diff get.oturep.xml @ 1:17b63c3cc04d draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/mothur commit ea40e3d84e7850eb4226d6c85f709dcad18d4ba9
author iuc
date Thu, 18 May 2017 18:09:47 -0400
parents d568050a95be
children 899ef1660676
line wrap: on
line diff
--- a/get.oturep.xml	Fri Jun 24 16:33:26 2016 -0400
+++ b/get.oturep.xml	Thu May 18 18:09:47 2017 -0400
@@ -4,85 +4,118 @@
         <import>macros.xml</import>
     </macros>
     <expand macro="requirements"/>
+    <expand macro="stdio"/>
     <expand macro="version_command"/>
-    <command detect_errors="aggressive"><![CDATA[
+    <command><![CDATA[
+        @SHELL_OPTIONS@
+
         ## create symlinks to input datasets
         ln -s "$otu" otu.dat &&
-        ln -s "$fasta" fasta.dat &&
-        ln -s "$input.dist" input.dist.dat &&
-        ln -s "$input.name" input.name.dat &&
-        ln -s "$count" count.dat &&
-        #if $pick.type == "yes":
-            ln -s "$pick.group" pick.group.dat &&
+        #if $method_condition.method_switch == "distance":
+            ln -s "$method_condition.matrix_condition.dist" dist.dat &&
+            ln -s "$method_condition.matrix_condition.nameOrCount" nameOrCount.dat &&
+            ln -s "$method_condition.fasta" fasta.dat &&
+            #if $method_condition.pick.type == "yes":
+                ln -s "$method_condition.pick.group" group.dat &&
+            #end if
+        #elif $method_condition.method_switch == "abundance":
+            ln -s "$method_condition.nameOrCount" nameOrCount.dat &&
         #end if
 
         echo 'get.oturep(
             list=otu.dat,
-            #if $fasta:
-                fasta=fasta.dat,
-            #end if
-            #if $input.source == "column":
-                column=input.dist.dat,
-                name=input.name.dat,
-            #elif $input.source == "phylip":
-                phylip=input.dist.dat,
-                #if $input.name:
-                    name=input.name.dat,
-                #end if
+            #if $sorted:
+                sorted=$sorted,
             #end if
             #if $label:
                 label=${ str($label).replace(",","-") },
             #end if
-            #if $pick.type == "yes":
-                #if $pick.group:
-                    group=pick.group.dat,
+            #if $method_condition.method_switch == "distance":
+                method=distance,
+                #if $method_condition.matrix_condition.matrix_format == "column":
+                    column=dist.dat,
+                    #if $method_condition.matrix_condition.nameOrCount.is_of_type("mothur.names"):
+                        name=nameOrCount.dat,
+                    #elif $method_condition.matrix_condition.nameOrCount.is_of_type("mothur.count_table"):
+                        count=nameOrCount.dat,
+                    #end if
+                #elif $method_condition.matrix_condition.matrix_format == "phylip":
+                    phylip=dist.dat,
+                    #if $method_condition.matrix_condition.nameOrCount:
+                        #if $method_condition.matrix_condition.nameOrCount.is_of_type("mothur.names"):
+                            name=nameOrCount.dat,
+                        #elif $method_condition.matrix_condition.nameOrCount.is_of_type("mothur.count_table"):
+                            count=nameOrCount.dat,
+                        #end if
+                    #end if
                 #end if
-                #if $pick.groups:
-                    groups=${ str($pick.groups).replace(",","-") },
+                #if $method_condition.fasta:
+                    fasta=fasta.dat,
+                #end if
+                #if $method_condition.pick.type == "yes":
+                    #if $method_condition.pick.group:
+                        group=group.dat,
+                    #end if
+                    #if $method_condition.pick.groups:
+                        groups=${ str($method_condition.pick.groups).replace(",","-") },
+                    #end if
+                #end if
+                large=$method_condition.large
+            #elif $method_condition.method_switch == "abundance":
+                method=abundance,
+                #if $method_condition.nameOrCount.is_of_type("mothur.names"):
+                    name=nameOrCount.dat
+                #elif $method_condition.nameOrCount.is_of_type("mothur.count_table"):
+                    count=nameOrCount.dat
                 #end if
             #end if
-            #if $sorted:
-                sorted=$sorted,
-            #end if
-            #if $count and not $input.name:
-                count=count.dat,
-            #end if
-            method=$method,
-            large=$large
         )'
         | sed 's/ //g'  ## mothur trips over whitespace
         | mothur
+        | tee mothur.out.log
     ]]></command>
     <inputs>
         <param name="otu" type="data" format="mothur.list" label="list - OTU List"/>
-        <conditional name="input">
-            <param name="source" type="select" label="Distance Matrix Format">
-                <option value="column">Pairwise Column Distance Matrix</option>
-                <option value="phylip">Phylip Distance Matrix</option>
+        <conditional name="method_condition">
+            <param name="method_switch" type="select" label="Method to use for the selection of the representative sequences" help="The distance method finds the sequence with the smallest maximum distance to other sequences. The abundance method chooses the most abundant sequence in the OTU as the representative.">
+                <option value="distance" selected="true">distance</option>
+                <option value="abundance">abundance</option>
             </param>
-            <when value="column">
-                <param name="dist" type="data" format="mothur.pair.dist" label="column - Distance Matrix"/>
-                <param name="name" type="data" format="mothur.names" label="name - Sequences Name reference"/>
-            </when>
-            <when value="phylip">
-                <param name="dist" type="data" format="mothur.lower.dist,mothur.square.dist" label="phylip - Distance Matrix"/>
-                <param name="name" type="data" format="mothur.names" optional="true" label="name - Names"/>
+            <when value="distance">
+                <conditional name="matrix_condition">
+                    <param name="matrix_format" type="select" label="Select a Distance Matrix Format" help="">
+                        <option value="column">Pairwise Column Distance Matrix</option>
+                        <option value="phylip">Phylip Distance Matrix</option>
+                    </param>
+                    <when value="column">
+                        <param name="dist" type="data" format="mothur.pair.dist" label="column - Distance Matrix"/>
+                        <param name="nameOrCount" type="data" format="mothur.names,mothur.count_table" label="name file or count table - Sequences Name reference"/>
+                    </when>
+                    <when value="phylip">
+                        <param name="dist" type="data" format="mothur.dist,mothur.lower.dist,mothur.square.dist" label="phylip - Distance Matrix"/>
+                        <param name="nameOrCount" type="data" format="mothur.names,mothur.count_table" optional="true" label="name file or count table - Sequences Name reference"/>
+                    </when>
+                </conditional>
+                <param name="fasta" type="data" format="fasta" optional="true" label="fasta - Fasta"/>
+                <conditional name="pick">
+                    <param name="type" type="select" label="Parse a group file into abundant and rare groups?" help="">
+                        <option value="no" selected="true">No</option>
+                        <option value="yes">Yes</option>
+                    </param>
+                    <when value="no"/>
+                    <when value="yes">
+                        <param name="group" type="data" format="mothur.groups" label="group - Group file for the OTU List"/>
+                        <param name="groups" type="select"  multiple="true" label="groups - Group Selection (all used if none are selected)">
+                            <options>
+                                <filter type="data_meta" ref="group" key="groups"/>
+                            </options>
+                        </param>
+                    </when>
+                </conditional>
+                <param name="large" type="boolean" checked="false" truevalue="true" falsevalue="false" label="large - Distance Matrix is very Large" help="Set this parameter to Yes if your distance matric might not fit in RAM"/>
             </when>
-        </conditional>
-        <param name="fasta" type="data" format="fasta" optional="true" label="fasta - Fasta"/>
-        <conditional name="pick">
-            <param name="type" type="select" label="Parse a group file into abundant and rare groups?" help="">
-                <option value="no" selected="true">No</option>
-                <option value="yes">Yes</option>
-            </param>
-            <when value="no"/>
-            <when value="yes">
-                <param name="group" type="data" format="mothur.groups" label="group - Group file for the OTU List"/>
-                <param name="groups" type="select"  multiple="true" label="groups - Group Selection (all used if none are selected)">
-                    <options>
-                        <filter type="data_meta" ref="group" key="groups"/>
-                    </options>
-                </param>
+            <when value="abundance">
+                <param name="nameOrCount" type="data" format="mothur.names,mothur.count_table" label="name file or count table - Sequences Name reference"/>
             </when>
         </conditional>
         <param name="label" type="select" multiple="true" label="label - OTU Labels">
@@ -95,53 +128,56 @@
             <option value="size">Bin Size</option>
             <option value="group">Group</option>
         </param>
-        <param name="large" type="boolean" checked="false" truevalue="true" falsevalue="false" label="large - Distance Matrix is very Large"/>
-        <param name="count" type="data" format="mothur.count_table" optional="true" label="count - a count table" help="Cannot supply both a names and count table. Will be ignored if you also supplied a name file. Generated by count.seqs"/>
-        <param name="method" type="select" label="method - select the method of selecting the representative sequence" help="the distance method finds the sequence with the smallest maximum distance to other sequences. The abundance method chooses the abundant sequence in the OTU as the representative. Default=distance">
-            <option value="distance" selected="true">distance</option>
-            <option value="abundance">abundance</option>
-        </param>
     </inputs>
     <outputs>
         <expand macro="logfile-output"/>
         <collection name="names_out" type="list" label="${tool.name} on ${on_string}: rep.names">
-            <filter>input['name'] or not count</filter>
+            <filter>method_condition['nameOrCount'].ext == "mothur.names"</filter>
+            <filter>method_condition['matrix_condition']['nameOrCount'].ext == "mothur.names"</filter>
             <discover_datasets pattern=".*?\.(?P&lt;designation&gt;.*)\.rep\.names" format="mothur.names"/>
         </collection>
         <collection name="fasta_out" type="list" label="${tool.name} on ${on_string}: rep.fasta">
-            <filter>fasta</filter>
+            <filter>method_condition['method_switch'] == "distance"</filter>
+            <filter>method_condition['fasta']</filter>
             <discover_datasets pattern=".*?\.(?P&lt;designation&gt;.*)\.rep\.fasta" format="fasta"/>
         </collection>
         <collection name="count_out" type="list" label="${tool.name} on ${on_string}: rep.count_table">
-            <filter>count and not input['name']</filter>
+            <filter>method_condition['nameOrCount'].ext == "mothur.count_table"</filter>
+            <filter>method_condition['matrix_condition']['nameOrCount'].ext == "mothur.count_table"</filter>
             <discover_datasets pattern=".*?\.(?P&lt;designation&gt;.*)\.rep\.count_table" format="mothur.count_table"/>
         </collection>
     </outputs>
     <tests>
-        <test><!-- test with phylip -->
+        <!-- test with distance / phylip -->
+        <test>
             <param name="otu" value="amazon.an.list" ftype="mothur.list"/>
-            <param name="source" value="phylip"/>
+            <param name="method_switch" value="distance"/>
+            <param name="matrix_format" value="phylip"/>
             <param name="dist" value="98_sq_phylip_amazon.dist" ftype="mothur.square.dist"/>
-            <param name="name" value="amazon1.names" ftype="mothur.names"/>
+            <param name="nameOrCount" value="amazon1.names" ftype="mothur.names"/>
             <output_collection name="names_out" count="36">
                 <element name="0.27" md5="39ff2858909d49633871d5a625585de5" ftype="mothur.names"/>
             </output_collection>
             <expand macro="logfile-test"/>
         </test>
-        <test><!-- test with column and label select -->
+        <!-- test with distance / column / label select -->
+        <test>
             <param name="otu" value="amazon.an.list" ftype="mothur.list"/>
-            <param name="source" value="column"/>
+            <param name="method_switch" value="distance"/>
+            <param name="matrix_format" value="column"/>
             <param name="dist" value="amazon.pair.dist" ftype="mothur.pair.dist"/>
-            <param name="name" value="amazon1.names" ftype="mothur.names"/>
+            <param name="nameOrCount" value="amazon1.names" ftype="mothur.names"/>
             <param name="label" value="unique,0.05,0.27,0.45"/>
             <output_collection name="names_out" count="4">
                 <element name="0.27" md5="be6dccdd3d4619c3ac465246c826209a" ftype="mothur.names"/>
             </output_collection>
             <expand macro="logfile-test"/>
         </test>
-        <test><!-- test with fasta and sorting-->
+        <!-- test with distance / fasta / sorting -->
+        <test>
             <param name="otu" value="amazon.an.list" ftype="mothur.list"/>
-            <param name="source" value="phylip"/>
+            <param name="method_switch" value="distance"/>
+            <param name="matrix_format" value="phylip"/>
             <param name="dist" value="98_sq_phylip_amazon.dist" ftype="mothur.square.dist"/>
             <param name="fasta" value="amazon.fasta" ftype="fasta"/>
             <param name="label" value="0.05,0.27"/>
@@ -154,32 +190,52 @@
             </output_collection>
             <expand macro="logfile-test"/>
         </test>
-        <test><!-- test with group file -->
+        <!-- test with distance / group file -->
+        <test>
             <param name="otu" value="amazon.an.list" ftype="mothur.list"/>
-            <param name="source" value="column"/>
+            <param name="method_switch" value="distance"/>
+            <param name="matrix_format" value="column"/>
             <param name="dist" value="amazon.pair.dist" ftype="mothur.pair.dist"/>
-            <param name="name" value="amazon1.names" ftype="mothur.names"/>
+            <param name="nameOrCount" value="amazon1.names" ftype="mothur.names"/>
             <param name="label" value="unique,0.05,0.27,0.45"/>
             <param name="type" value="yes"/>
             <param name="group" value="amazon.groups" ftype="mothur.groups"/>
             <param name="groups" value="forest,pasture"/>
-            <param name="count" value="amazon1.count_table" ftype="mothur.count_table"/> <!-- should be ignored as we also supplied name file -->
             <output_collection name="names_out" count="8">
                 <element name="0.27.pasture" md5="34f87d93fd9ebbefed9754f627f502fd" ftype="mothur.names"/>
             </output_collection>
             <expand macro="logfile-test"/>
         </test>
-        <test><!-- test with count table -->
+        <!-- test with distance / count table -->
+        <test>
             <param name="otu" value="amazon.an.list" ftype="mothur.list"/>
-            <param name="source" value="phylip"/>
+            <param name="method_switch" value="distance"/>
+            <param name="matrix_format" value="phylip"/>
             <param name="dist" value="98_sq_phylip_amazon.dist" ftype="mothur.square.dist"/>
             <param name="label" value="unique,0.05,0.27"/>
-            <param name="count" value="amazon1.count_table" ftype="mothur.count_table"/>
+            <param name="nameOrCount" value="amazon1.count_table" ftype="mothur.count_table"/>
             <output_collection name="count_out" count="3">
                 <element name="0.27" md5="6b1afd712825af4bf8cb4ab8304df903" ftype="mothur.count_table"/>
             </output_collection>
             <expand macro="logfile-test"/>
         </test>
+        <!-- test with abundance / count / label -->
+        <!-- It seems that the content of the result file can vary from one execution to another with the same parameters -->
+        <test>
+            <param name="otu" value="amazon.an.list" ftype="mothur.list"/>
+            <param name="method_switch" value="abundance"/>
+            <param name="nameOrCount" value="amazon1.count_table" ftype="mothur.count_table"/>
+            <param name="label" value="0.27,unique"/>
+            <param name="sorted" value="name"/>
+            <output_collection name="count_out" count="2">
+                <element name="0.27" ftype="mothur.count_table">
+                    <assert_contents>
+                        <has_text_matching expression="U68\w+\t36" />
+                    </assert_contents>
+                </element>
+            </output_collection>
+            <expand macro="logfile-test"/>
+        </test>
     </tests>
     <help>
 <![CDATA[
@@ -187,11 +243,11 @@
 @MOTHUR_OVERVIEW@
 
 
-**Command Documenation**
+**Command Documentation**
 
 The get.oturep_ command generates a fasta-formatted sequence file containing only a representative sequence for each OTU.  The opposite of the bin.seqs command.
 
-.. _get.oturep: http://www.mothur.org/wiki/Get.oturep
+.. _get.oturep: https://www.mothur.org/wiki/Get.oturep
 
 v1.23.0: Updated to Mothur 1.33, added count and method parameter
 ]]>