diff stacks_cstacks.xml @ 8:759ba5c7faca draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/stacks commit dc23703c260d004a28fe24a2a7c00cb4371bc32e
author iuc
date Thu, 27 Apr 2017 04:18:23 -0400
parents a62f7e799494
children be3df81c0353
line wrap: on
line diff
--- a/stacks_cstacks.xml	Fri Apr 07 11:48:00 2017 -0400
+++ b/stacks_cstacks.xml	Thu Apr 27 04:18:23 2017 -0400
@@ -13,28 +13,33 @@
         &&
 
         #set $samples = ""
-        #for $input_file in $input_col:
+        #for $input_file in $input_col
             #set $filename = str($input_file.element_identifier)
-            #if not filename.endswith('.tsv'):
+            #if not filename.endswith('.tsv')
                 #set $filename = $filename + ".tsv"
             #end if
-            #if not re.search('catalog\.[a-z]+(\.tsv)?$', $filename):
-                ln -s "${input_file}" "stacks_inputs/$filename" &&
+            #if not re.search('catalog\.[a-z]+(\.tsv)?$', $filename)
+                ln -s '${input_file}' 'stacks_inputs/$filename' &&
 
-                #if $filename.endswith('.tags.tsv'):
-                    #set samples += " -s \"stacks_inputs/" + $filename[:-9] + "\""
+                #if $filename.endswith('.tags.tsv')
+                    #set samples += " -s 'stacks_inputs/" + $filename[:-9] + "'"
                 #end if
             #end if
         #end for
 
         cstacks
 
+            ## Batch description
+            -b 1
+
             -p \${GALAXY_SLOTS:-1}
 
-            $samples
-
-            ## Batch description
-            -b 1
+            #if $popmap
+                -P stacks_inputs -M '$popmap'
+            #else
+                $samples
+                -o stacks_outputs
+            #end if
 
             $g
 
@@ -42,20 +47,29 @@
 
             $include_multiple
 
-            #if $gapped.use_gapped:
+            #if $gapped.use_gapped == "yes"
                 --gapped
                 --max_gaps $gapped.max_gaps
                 --min_aln_len $gapped.min_aln_len
             #end if
 
-            -o stacks_outputs
+            2>&1 | tee cstacks.log
 
-             > cstacks.log 2>&1
+            #if $popmap
+                ## When using a popmap, stacks write to the input dir
+                && mv stacks_inputs/batch_1.catalog.*.tsv stacks_outputs/
+            #end if
+
+            &&
+
+            stacks_summary.py --stacks-prog cstacks --res-dir stacks_outputs --logfile cstacks.log --summary stacks_outputs/summary.html
     ]]></command>
 
     <inputs>
         <param name="input_col" format="tabular,txt" type="data_collection" collection_type="list" label="Output from previous Stacks pipeline steps (e.g. denovo_map, refmap, ustacks or pstacks)" />
 
+        <param name="popmap" type="data" format="tabular,txt" label="Population map" help="If set, the catalog will be built from samples listed in this file" optional="true" argument="-M" />
+
         <param name="g" argument="-g" type="boolean" checked="false" truevalue="-g" falsevalue="" label="Base catalog matching on genomic location, not sequence identity" />
 
         <param name="n" argument="-n" type="integer" value="1" label="Number of mismatches allowed between sample tags when building the catalog"/>
@@ -63,9 +77,12 @@
         <param name="include_multiple" argument="-m" type="boolean" checked="false" truevalue="-m" falsevalue="" label="Include tags in the catalog that match to more than one entry" />
 
         <conditional name="gapped">
-            <param name="use_gapped" argument="--gapped" type="boolean" checked="false" label="Perform gapped alignments between stacks" />
-            <when value="false"></when>
-            <when value="true">
+            <param name="use_gapped" argument="--gapped" type="select" label="Perform gapped alignments between stacks">
+                <option value="no" selected="true">No</option>
+                <option value="yes">Yes</option>
+            </param>
+            <when value="no"/>
+            <when value="yes">
                 <param name="max_gaps" argument="--max_gaps" type="integer" value="2" label="Number of gaps allowed between stacks before merging"/>
                 <param name="min_aln_len" argument="--min_aln_len" type="float" value="0.8" min="0.0" max="1.0" label="Minimum length of aligned sequence in a gapped alignment"/>
             </when>
@@ -75,6 +92,8 @@
     <outputs>
         <data format="txt" name="output_log" label="cstacks.log with ${tool.name} on ${on_string}" from_work_dir="cstacks.log" />
 
+        <data format="html" name="output_summary" label="Summary from ${tool.name} on ${on_string}" from_work_dir="stacks_outputs/summary.html" />
+
         <data format="tabular" name="catalogtags" label="Catalog assembled loci (tags) with ${tool.name} on ${on_string}" from_work_dir="stacks_outputs/batch_1.catalog.tags.tsv" />
         <data format="tabular" name="catalogsnps" label="Catalog model calls (snps) with ${tool.name} on ${on_string}" from_work_dir="stacks_outputs/batch_1.catalog.snps.tsv" />
         <data format="tabular" name="catalogalleles" label="Catalog haplotypes (alleles) with ${tool.name} on ${on_string}" from_work_dir="stacks_outputs/batch_1.catalog.alleles.tsv" />
@@ -103,6 +122,11 @@
                     <has_text text="done." />
                 </assert_contents>
             </output>
+            <output name="output_summary">
+                <assert_contents>
+                    <has_text text="Stacks Statistics" />
+                </assert_contents>
+            </output>
 
             <!-- catalog -->
             <output name="catalogtags">
@@ -138,13 +162,66 @@
                     <element name="PopA_02.tags.tsv" ftype="tabular" value="genotypes/PopA_02.tags.tsv" />
                </collection>
             </param>
-            <param name="gapped|use_gapped" value="true" />
+            <param name="gapped|use_gapped" value="yes" />
 
             <output name="output_log">
                 <assert_contents>
                     <has_text text="done." />
                 </assert_contents>
             </output>
+            <output name="output_summary">
+                <assert_contents>
+                    <has_text text="Stacks Statistics" />
+                </assert_contents>
+            </output>
+
+            <!-- catalog -->
+            <output name="catalogtags">
+                <assert_contents>
+                    <has_text text="catalog generated on" />
+                </assert_contents>
+            </output>
+            <output name="catalogsnps">
+                <assert_contents>
+                    <has_text text="catalog generated on" />
+                </assert_contents>
+            </output>
+            <output name="catalogalleles">
+                <assert_contents>
+                    <has_text text="catalog generated on" />
+                </assert_contents>
+            </output>
+        </test>
+
+        <test>
+            <param name="input_col">
+                <collection type="list">
+                    <element name="batch_1.catalog.alleles.tsv" ftype="tabular" value="genotypes/batch_1.catalog.alleles.tsv" />
+                    <element name="batch_1.catalog.snps.tsv" ftype="tabular" value="genotypes/batch_1.catalog.snps.tsv" />
+                    <element name="batch_1.catalog.tags.tsv" ftype="tabular" value="genotypes/batch_1.catalog.tags.tsv" />
+                    <element name="PopA_01.alleles.tsv" ftype="tabular" value="genotypes/PopA_01.alleles.tsv" />
+                    <element name="PopA_01.matches.tsv" ftype="tabular" value="genotypes/PopA_01.matches.tsv" />
+                    <element name="PopA_01.snps.tsv" ftype="tabular" value="genotypes/PopA_01.snps.tsv" />
+                    <element name="PopA_01.tags.tsv" ftype="tabular" value="genotypes/PopA_01.tags.tsv" />
+                    <element name="PopA_02.alleles.tsv" ftype="tabular" value="genotypes/PopA_02.alleles.tsv" />
+                    <element name="PopA_02.matches.tsv" ftype="tabular" value="genotypes/PopA_02.matches.tsv" />
+                    <element name="PopA_02.snps.tsv" ftype="tabular" value="genotypes/PopA_02.snps.tsv" />
+                    <element name="PopA_02.tags.tsv" ftype="tabular" value="genotypes/PopA_02.tags.tsv" />
+               </collection>
+            </param>
+
+            <param name="popmap" ftype="tabular" value="denovo_map/popmap_cstacks.tsv" />
+
+            <output name="output_log">
+                <assert_contents>
+                    <has_text text="done." />
+                </assert_contents>
+            </output>
+            <output name="output_summary">
+                <assert_contents>
+                    <has_text text="Stacks Statistics" />
+                </assert_contents>
+            </output>
 
             <!-- catalog -->
             <output name="catalogtags">