changeset 12:78e1cf88d133 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cutadapt commit 195c6112eff237b20a6744e82e2c4e7641f7c488
author iuc
date Thu, 24 May 2018 18:24:08 -0400
parents 8665bcc8b847
children f5fdf41c08b8
files cutadapt.xml macros.xml
diffstat 2 files changed, 140 insertions(+), 123 deletions(-) [+]
line wrap: on
line diff
--- a/cutadapt.xml	Mon Mar 05 11:02:48 2018 -0500
+++ b/cutadapt.xml	Thu May 24 18:24:08 2018 -0400
@@ -1,4 +1,4 @@
-<tool id="cutadapt" name="Cutadapt" version="1.16">
+<tool id="cutadapt" name="Cutadapt" version="1.16.1" profile="17.09">
     <description>Remove adapter sequences from Fastq/Fasta</description>
     <macros>
         <import>macros.xml</import>
@@ -13,107 +13,62 @@
 
         ## Link in the input and output files, so Cutadapt can tell their type
 
-        #set compressed="False"
+        #import re
         #set format = "fastq"
-
-        #if str($library.type) == 'paired':
+        #set read1 = "input_f"
+        #set read2 = "input_r"
+        #set paired = False
+        #set library_type = str($library.type)
+        #if $library_type == 'paired':
+        #set paired = True
+        #set read1 = re.sub('[^\w\-\s]', '_', str($library.input_1.element_identifier))
+        #set read2 = re.sub('[^\w\-\s]', '_', str($library.input_2.element_identifier))
+        #set input_1 = $library.input_1
+        #set input_2 = $library.input_2
+        #else if $library_type == 'paired_collection'
+        #set paired = True
+        #set input_1 = $library.input_1.forward
+        #set input_2 = $library.input_1.reverse
+        #set read1 = re.sub('[^\w\-\s]', '_', str($library.input_1.name))
+        #else
+        #set input_1 = $library.input_1
+        #set read1 = re.sub('[^\w\-\s]', '_', str($library.input_1.element_identifier))
+        #end if
 
-            #if $library.input_1.is_of_type("fastq.gz", "fastqsanger.gz"):
-                #set read1 = "input_f.fastq.gz"
-                #set compressed = "GZ"
-                #set out1 = "out1.gz"
-            #else if $library.input_1.is_of_type("fastq.bz2", "fastqsanger.bz2"):
-                #set read1 = "input_f.fastq.bz2"
-                #set compressed = "BZ2"
-                #set out1 = "out1.bz2"
-            #else if $library.input_1.is_of_type('fasta'):
+        #if $input_1.is_of_type("fastq.gz", "fastqsanger.gz"):
+            #set read1 = $read1 + ".fq.gz"
+            #set out1 = "out1.gz"
+        #else if $input_1.is_of_type("fastq.bz2", "fastqsanger.bz2"):
+            #set read1 = $read1 + ".fq.bz2"
+            #set out1 = "out1.bz2"
+        #else if $input_1.is_of_type('fasta'):
+            #set format = "fasta"
+            #set read1 = $read1 + ".fa"
+            #set out1 = "out1.fa"
+        #else:
+            #set read1 = $read1 + ".fq"
+            #set out1 = "out1.fq"
+        #end if
+        ln -f -s '${input_1}' '$read1' &&
+
+        #if $paired:
+            #if $input_2.is_of_type("fastq.gz", "fastqsanger.gz"):
+                #set read2 = $read2 + ".fq.gz"
+                #set out2 = "out2.gz"
+            #else if $input_2.is_of_type("fastq.bz2", "fastqsanger.bz2"):
+                #set read2 = $read2 + ".fq.bz2"
+                #set out2 = "out2.bz2"
+            #else if $input_2.is_of_type('fasta'):
                 #set format = "fasta"
-                #set read1 = "input_f.fasta"
-                #set out1 = "out1.fa"
+                #set read2 = $read2 + ".fa"
+                #set out2 = "out2.fa"
             #else:
-                #set read1 = "input_f.fastq"
-                #set out1 = "out1.fq"
-            #end if
-            ln -f -s '${library.input_1}' ${read1} &&
-
-            #if $library.input_2.is_of_type("fastq.gz", "fastqsanger.gz"):
-                #set read2 = "input_r.fastq.gz"
-                #set compressed = "GZ"
-                #set out2 = "out2.gz"
-            #else if $library.input_2.is_of_type("fastq.bz2", "fastqsanger.bz2"):
-                #set read2 = "input_r.fastq.bz2"
-                #set compressed = "BZ2"
-                #set out2 = "out2.bz2"
-            #else if $library.input_2.is_of_type('fasta'):
-                #set read2 = "input_r.fasta"
-                #set out2 = "out2.fa"
-                #set format = "fasta"
-            #else:
-                #set read2 = "input_r.fastq"
+                #set read2 = $read2 + ".fq"
                 #set out2 = "out2.fq"
             #end if
-            ln -f -s '${library.input_2}' ${read2} &&
-
-
-        #else if str($library.type) == 'paired_collection':
-
-            #if $library.input_1.forward.is_of_type("fastq.gz", "fastqsanger.gz"):
-                #set read1 = "input_f.fastq.gz"
-                #set compressed = "GZ"
-                #set out1 = "out1.gz"
-            #else if $library.input_1.forward.is_of_type("fastq.bz2", "fastqsanger.bz2"):
-                #set read1 = "input_f.fastq.bz2"
-                #set compressed = "BZ2"
-                #set out1 = "out1.bz2"
-            #else if $library.input_1.forward.is_of_type('fasta'):
-                #set format = "fasta"
-                #set read1 = "input_f.fasta"
-                #set out1 = "out1.fa"
-            #else:
-                #set read1 = "input_f.fastq"
-                #set out1 = "out1.fq"
-            #end if
-            ln -s '${library.input_1.forward}' ${read1} &&
-
-            #if $library.input_1.reverse.is_of_type("fastq.gz", "fastqsanger.gz"):
-                #set read2 = "input_r.fastq.gz"
-                #set compressed = "GZ"
-                #set out1 = "out2.gz"
-            #else if $library.input_1.reverse.is_of_type("fastq.bz2", "fastqsanger.bz2"):
-                #set read2 = "input_r.fastq.bz2"
-                #set compressed = "BZ2"
-                #set out2 = "out2.bz2"
-            #else if $library.input_1.reverse.is_of_type("fasta"):
-                #set format = "fasta"
-                #set read2 = "input_r.fasta"
-                #set out2 = "out2.fa"
-            #else:
-                #set read2 = "input_r.fastq"
-                #set out2 = "out2.fq"
-            #end if
-            ln -s '${library.input_1.reverse}' ${read2} &&
-
-        #else:
-            #if $library.input_1.is_of_type("fastq.gz", "fastqsanger.gz"):
-                #set read1 = "input_f.fastq.gz"
-                #set compressed = "GZ"
-                #set out1 = "out1.gz"
-            #else if $library.input_1.is_of_type("fastq.bz2", "fastqsanger.bz2"):
-                #set read1 = "input_f.fastq.bz2"
-                #set compressed = "BZ2"
-                #set out1 = "out1.bz2"
-            #else if $library.input_1.is_of_type('fasta'):
-                #set format = "fasta"
-                #set read1 = "input_f.fasta"
-                #set out1 = "out1.fa"
-            #else:
-                #set read1 = "input_f.fastq"
-                #set out1 = "out1.fq"
-            #end if
-            ln -f -s '${library.input_1}' ${read1} &&
+            ln -f -s '${input_2}' '$read2' &&
         #end if
 
-
         ## Run Cutadapt
 
         cutadapt
@@ -179,19 +134,15 @@
             --length-tag="$read_mod_options.length_tag"
         #end if
 
-        #if str( $library.type ) == "single":
-            '${read1}'
-        #else:
-            '${read1}'
+        '${read1}'
+        #if $paired:
             '${read2}'
         #end if
 
         #if $output_options.report:
             > report.txt
         #end if
-
     ]]></command>
-
     <inputs>
 
         <!-- Reads -->
@@ -217,6 +168,7 @@
                 <param name="input_1" format="fastqsanger,fastqsanger.gz,fastqsanger.bz2,fasta" type="data_collection" collection_type="paired" label="Paired Collection" help="Should be of datatype &quot;fastq.gz&quot; or &quot;fasta&quot;" />
                 <expand macro="paired_end_options" />
             </when>
+
         </conditional>
 
         <!-- Adapter Options -->
@@ -261,7 +213,7 @@
 
         <!-- Output Options -->
         <section name="output_options" title="Output Options">
-            <param name="report" type="boolean" value="False" label="Report" help="Cutadapt's per-adapter statistics."/>
+            <param name="report" type="boolean" value="False" label="Report" help="Cutadapt's per-adapter statistics. You can use this file with MultiQC."/>
             <param name="info_file" argument="--info-file" type="boolean" value="False" label="Info File" help="Write information about each read and its adapter matches to a file."/>
             <param name="rest_file" argument="--rest-file" type="boolean" value="False" label="Rest of Read" help="When the adapter matches in the middle of a read, write the rest (after the adapter) into a file."/>
             <param name="wildcard_file" argument="--wildcard-file" type="boolean" value="False" label="Wildcard File" help="When the adapter has wildcard bases ('N's) write adapter bases matching wildcard positions to file."/>
@@ -273,49 +225,59 @@
     </inputs>
 
     <outputs>
-        <data name="out1" format_source="input_1" metadata_source="input_1" from_work_dir="out1*" label="${tool.name} on ${on_string}: Read 1 Output"/>
-        <data name="out2" format_source="input_2" metadata_source="input_2" from_work_dir="out2*" label="${tool.name} on ${on_string}: Read 2 Output" >
+        <data name="out1" format="fasta" metadata_source="input_1" from_work_dir="out1*" label="${tool.name} on ${on_string}: Read 1 Output">
+            <expand macro="inherit_format_1" />
+        </data>
+        <data name="out2" format="fastqsanger" metadata_source="input_2" from_work_dir="out2*" label="${tool.name} on ${on_string}: Read 2 Output" >
             <filter>(library['type'] == 'paired' or library['type'] == 'paired_collection')</filter>
+            <expand macro="inherit_format_2" />
         </data>
 
         <data name="report" format="txt" from_work_dir="report.txt" label="${tool.name} on ${on_string}: Report">
             <filter>(output_options['report'] is True)</filter>
         </data>
 
-        <data  name="info_file" format_source="txt" metadata_source="input_1" label="${tool.name} on ${on_string}: Info File" >
+        <data  name="info_file" format="txt" metadata_source="input_1" label="${tool.name} on ${on_string}: Info File" >
             <filter>(output_options['info_file'] is True)</filter>
         </data>
 
-        <data name="rest_output" format_source="input_1" metadata_source="input_1" label="${tool.name} on ${on_string}: Rest of Reads (R1 only)" >
+        <data name="rest_output" format="fastqsanger" metadata_source="input_1" label="${tool.name} on ${on_string}: Rest of Reads (R1 only)" >
             <filter>(output_options['rest_file'] is True)</filter>
+            <expand macro="inherit_format_1" />
         </data>
 
-        <data name="wild_output" format_source="txt" metadata_source="input_1" label="${tool.name} on ${on_string}: Wildcard File" >
+        <data name="wild_output" format="txt" metadata_source="input_1" label="${tool.name} on ${on_string}: Wildcard File" >
             <filter>(output_options['wildcard_file'] is True)</filter>
         </data>
 
-        <data name="untrimmed_output" format_source="input_1" metadata_source="input_1" label="${tool.name} on ${on_string}: Untrimmed Read 1" >
+        <data name="untrimmed_output" format="fastqsanger" metadata_source="input_1" label="${tool.name} on ${on_string}: Untrimmed Read 1" >
             <filter>(output_options['untrimmed_file'] is True)</filter>
+            <expand macro="inherit_format_1" />
         </data>
-        <data name="untrimmed_paired_output" format_source="input_2" metadata_source="input_2" label="${tool.name} on ${on_string}: Untrimmed Read 2" >
+        <data name="untrimmed_paired_output" format="fastqsanger" metadata_source="input_2" label="${tool.name} on ${on_string}: Untrimmed Read 2" >
             <filter>(library['type'] == 'paired' or library['type'] == 'paired_collection')</filter>
             <filter>(output_options['untrimmed_file'] is True)</filter>
+            <expand macro="inherit_format_2" />
         </data>
 
-        <data name="too_short_output" format_source="input_1" metadata_source="input_1" label="${tool.name} on ${on_string}: Too Short Read 1" >
+        <data name="too_short_output" format="fastqsanger" metadata_source="input_1" label="${tool.name} on ${on_string}: Too Short Read 1" >
             <filter>(output_options['too_short_file'] is True)</filter>
+            <expand macro="inherit_format_1" />
         </data>
-        <data name="too_short_paired_output" format_source="input_2" metadata_source="input_2" label="${tool.name} on ${on_string}: Too Short Read 2" >
+        <data name="too_short_paired_output" format="fastqsanger" metadata_source="input_2" label="${tool.name} on ${on_string}: Too Short Read 2" >
             <filter>(library['type'] == 'paired' or library['type'] == 'paired_collection')</filter>
             <filter>(output_options['too_short_file'] is True)</filter>
+            <expand macro="inherit_format_2" />
         </data>
 
-        <data name="too_long_output" format_source="input_1" metadata_source="input_1" label="${tool.name} on ${on_string}: Too Long Read 1" >
+        <data name="too_long_output" format="fastqsanger" metadata_source="input_1" label="${tool.name} on ${on_string}: Too Long Read 1" >
             <filter>(output_options['too_long_file'] is True)</filter>
+            <expand macro="inherit_format_1" />
         </data>
-        <data name="too_long_paired_output" format_source="input_2" metadata_source="input_2" label="${tool.name} on ${on_string}: Too Long Read 2" >
+        <data name="too_long_paired_output" format="fastqsanger" metadata_source="input_2" label="${tool.name} on ${on_string}: Too Long Read 2" >
             <filter>(library['type'] == 'paired' or library['type'] == 'paired_collection')</filter>
             <filter>(output_options['too_long_file'] is True)</filter>
+            <expand macro="inherit_format_2" />
         </data>
     </outputs>
 
@@ -326,7 +288,7 @@
             <param name="input_1" ftype="fastq" value="cutadapt_small.fastq" />
             <param name="adapter_source_list" value="user"/>
             <param name="adapter" value="AGATCGGAAGAGC"/>
-            <output name="out1" file="cutadapt_small.out"/>
+            <output name="out1" file="cutadapt_small.out" ftype="fastq"/>
         </test>
         <!-- Ensure single end fastq.gz works -->
         <test>
@@ -334,7 +296,7 @@
             <param name="input_1" ftype="fastq.gz" value="bwa-mem-fastq1.fq.gz" />
             <param name="adapter_source_list" value="user"/>
             <param name="adapter" value="AGATCGGAAGAGC"/>
-            <output name="out1" decompress="True" file="cutadapt_out1.fq.gz"/>
+            <output name="out1" decompress="True" file="cutadapt_out1.fq.gz" ftype="fastq.gz"/>
         </test>
         <!-- Ensure paired end fastq.gz works -->
         <test>
@@ -345,8 +307,24 @@
             <param name="adapter" value="AGATCGGAAGAGC"/>
             <param name="adapter_source_list2" value="user"/>
             <param name="adapter2" value="AGATCGGAAGAGC"/>
-            <output name="out1" decompress="True" file="cutadapt_out1.fq.gz"/>
-            <output name="out2" decompress="True" file="cutadapt_out2.fq.gz"/>
+            <output name="out1" decompress="True" file="cutadapt_out1.fq.gz" ftype="fastq.gz"/>
+            <output name="out2" decompress="True" file="cutadapt_out2.fq.gz" ftype="fastq.gz"/>
+        </test>
+        <!-- Ensure paired collection works -->
+        <test>
+            <param name="type" value="paired_collection" />
+            <param name="input_1">
+                <collection type="paired">
+                    <element name="forward" ftype="fastq.gz" value="bwa-mem-fastq1.fq.gz" />
+                    <element name="reverse" ftype="fastq.gz" value="bwa-mem-fastq2.fq.gz" />
+                </collection>
+            </param>
+            <param name="adapter_source_list" value="user"/>
+            <param name="adapter" value="AGATCGGAAGAGC"/>
+            <param name="adapter_source_list2" value="user"/>
+            <param name="adapter2" value="AGATCGGAAGAGC"/>
+            <output name="out1" decompress="True" file="cutadapt_out1.fq.gz" ftype="fastq.gz"/>
+            <output name="out2" decompress="True" file="cutadapt_out2.fq.gz" ftype="fastq.gz"/>
         </test>
         <!-- Ensure built-in adapters work -->
         <test>
@@ -354,7 +332,7 @@
             <param name="input_1" ftype="fastq" value="cutadapt_small.fastq" />
             <param name="adapter_source_list" value="builtin"/>
             <param name="adapter" value="TGTAGGCC"/>
-            <output name="out1" file="cutadapt_builtin.out"/>
+            <output name="out1" file="cutadapt_builtin.out" ftype="fastq"/>
         </test>
         <!-- Ensure discard file output works -->
         <test>
@@ -365,7 +343,7 @@
             <param name="discard" value="True"/>
             <param name="read_modification" value="none"/>
             <param name="output_type" value="default"/>
-            <output name="out1" file="cutadapt_discard.out"/>
+            <output name="out1" file="cutadapt_discard.out" ftype="fastq"/>
         </test>
         <!-- Ensure rest file output works -->
         <test>
@@ -376,8 +354,8 @@
             <param name="read_modification" value="none"/>
             <param name="output_type" value="additional"/>
             <param name="rest_file" value="True"/>
-            <output name="out1" file="cutadapt_rest.out"/>
-            <output name="rest_output" file="cutadapt_rest2.out"/>
+            <output name="out1" file="cutadapt_rest.out" ftype="fasta"/>
+            <output name="rest_output" file="cutadapt_rest2.out" ftype="fasta"/>
         </test>
         <!-- Ensure nextseq-trim option works -->
         <test>
@@ -387,7 +365,7 @@
             <param name="adapter" value="AGATCGGAAGAGC"/>
             <param name="read_modification" value="modify"/>
             <param name="nextseq_trim" value="20" />
-            <output name="out1" decompress="True" file="cutadapt_nextseq_out.fq.gz"/>
+            <output name="out1" decompress="True" file="cutadapt_nextseq_out.fq.gz" ftype="fastq.gz"/>
         </test>
         <!-- Ensure Report and Info file output work -->
         <test>
@@ -397,13 +375,13 @@
             <param name="adapter" value="AGATCGGAAGAGC"/>
             <param name="report" value="True" />
             <param name="info_file" value="True" />
-            <output name="out1" value="cutadapt_small.out"/>
+            <output name="out1" value="cutadapt_small.out" ftype="fastq"/>
             <output name="report">
                 <assert_contents>
                     <has_text text="Summary"/>
                 </assert_contents>
             </output>
-            <output name="info_file" value="cutadapt_info_out.txt"/>
+            <output name="info_file" value="cutadapt_info_out.txt" ftype="txt"/>
         </test>
     </tests>
 
--- a/macros.xml	Mon Mar 05 11:02:48 2018 -0500
+++ b/macros.xml	Thu May 24 18:24:08 2018 -0400
@@ -261,4 +261,43 @@
 
         </xml>
 
+        <xml name="inherit_format_1">
+            <actions>
+                <conditional name="library.type">
+                    <when value="single">
+                        <action type="format">
+                            <option type="from_param" name="library.input_1" param_attribute="ext" />
+                        </action>
+                    </when>
+                    <when value="paired">
+                        <action type="format">
+                            <option type="from_param" name="library.input_1" param_attribute="ext" />
+                        </action>
+                    </when>
+                    <when value="paired_collection">
+                        <action type="format">
+                            <option type="from_param" name="library.input_1" param_attribute="forward.ext" />
+                        </action>
+                    </when>
+                </conditional>
+            </actions>
+        </xml>
+
+        <xml name="inherit_format_2">
+            <actions>
+                <conditional name="library.type">
+                    <when value="paired">
+                        <action type="format">
+                            <option type="from_param" name="library.input_2" param_attribute="ext" />
+                        </action>
+                    </when>
+                    <when value="paired_collection">
+                        <action type="format">
+                            <option type="from_param" name="library.input_1" param_attribute="reverse.ext" />
+                        </action>
+                    </when>
+                </conditional>
+            </actions>
+        </xml>
+
 </macros>
\ No newline at end of file