view sub.sample.xml @ 3:430ca7be3073 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/mothur commit 283d5933cd945b7815b3da2ce45baa60d73e9746
author iuc
date Fri, 06 Apr 2018 04:31:51 -0400
parents 46d13e8c60ba
children 2986f7b01e74
line wrap: on
line source

<tool profile="16.07" id="mothur_sub_sample" name="Sub.sample" version="@WRAPPER_VERSION@.0">
    <description>Create a sub sample</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="stdio"/>
    <expand macro="version_command"/>
    <command><![CDATA[
@SHELL_OPTIONS@

## create symlinks to input datasets
ln -s '$input.otu' input_otu.dat &&
ln -s '$count' count.dat &&
ln -s '$taxonomy' taxonomy.dat &&
#if $input.format == "fasta":
    ln -s '$input.name_in' input_name_in.dat &&
#end if
#if ($input.format == "fasta" or $input.format == "list") and $input.use_group.to_filter == "yes":
    ln -s '$input.use_group.group_in' input_use_group_group_in.dat &&
#end if

echo 'sub.sample(
    #if $input.format == "fasta":
        fasta=input_otu.dat
        #if $input.name_in:
            ,name=input_name_in.dat
        #end if
    #else
        #if $input.format == "list":
            list=input_otu.dat
        #elif $input.format == "sabund":
            sabund=input_otu.dat
        #elif $input.format == "rabund":
            rabund=input_otu.dat
        #elif $input.format == "shared":
            shared=input_otu.dat
            #if $input.groups:
                ,groups=${ str($input.groups).replace(",","-") }
            #end if
        #end if
        #if $input.label:
            ,label=${ str($input.label).replace(",","-") }
        #end if
    #end if
    #if $input.format == "fasta" or $input.format == "list":
        #if $input.use_group.to_filter == "yes":
            ,group=input_use_group_group_in.dat
            #if $input.use_group.groups:
                ,groups=${ str($input.use_group.groups).replace(",","-") }
            #end if
            ,persample=$input.use_group.persample
        #end if
    #end if
    #if $count:
        ,count=count.dat
    #end if
    #if $taxonomy:
        ,taxonomy=taxonomy.dat
    #end if
    #if $size:
        ,size=$size
    #end if
)'
| sed 's/ //g'  ## mothur trips over whitespace
| mothur
| tee mothur.out.log
    ]]></command>
    <inputs>
        <conditional name="input">
            <param name="format" type="select" label="Select type of data to sub sample">
                <option value="fasta">FASTA</option>
                <option value="list">OTU List</option>
                <option value="shared">OTU Shared</option>
                <option value="sabund">OTU Shared Abundance (sabund)</option>
                <option value="rabund">OTU Relative Abundance (rabund)</option>
            </param>
            <when value="fasta">
                <param name="otu" type="data" format="fasta" label="fasta - "/>
                <param name="name_in" type="data" format="mothur.names" optional="true" label="name - Group Names from your history"/>
                <conditional name="use_group">
                    <param name="to_filter" type="select" label="Use groups?">
                        <option value="no">No</option>
                        <option value="yes">Yes</option>
                    </param>
                    <when value="no"/>
                    <when value="yes">
                        <param name="group_in" type="data" format="mothur.groups" label="group - Groups"/>
                        <param name="groups" type="select" optional="true" label="groups - Pick groups to include" multiple="true">
                            <options>
                                <filter type="data_meta" ref="group_in" key="groups"/>
                            </options>
                        </param>
                        <param name="persample" type="boolean" truevalue="true" falsevalue="false" checked="false" label="persample - select subsample of the same size from each of the groups"/>
                    </when>
                </conditional>
            </when>
            <when value="list">
                <param name="otu" type="data" format="mothur.list" label="list - OTU List"/>
                <conditional name="use_group">
                    <param name="to_filter" type="select" label="Use groups">
                        <option value="no">No</option>
                        <option value="yes">Yes</option>
                    </param>
                    <when value="no"/>
                    <when value="yes">
                        <param name="group_in" type="data" format="mothur.groups" label="group - Groups"/>
                        <param name="groups" type="select" optional="true" label="groups - Pick groups to include" multiple="true">
                            <options>
                                <filter type="data_meta" ref="group_in" key="groups"/>
                            </options>
                        </param>
                        <param name="persample" type="boolean" truevalue="true" falsevalue="false" checked="false" label="persample - select subsample of the same size from each of the groups"/>
                    </when>
                </conditional>
                <param name="label" type="select" label="label - OTU Labels" optional="true" multiple="true">
                    <expand macro="labeloptions"/>
                </param>
            </when>
            <when value="shared">
                <param name="otu" type="data" format="mothur.shared" label="shared - OTU Shared"/>
                <param name="groups" type="select" optional="true" label="groups - Pick groups to include" multiple="true">
                    <options>
                        <filter type="data_meta" ref="otu" key="groups"/>
                    </options>
                </param>
                <param name="label" type="select" label="label - OTU Labels" optional="true" multiple="true">
                    <expand macro="labeloptions"/>
                </param>
            </when>
            <when value="sabund">
                <param name="otu" type="data" format="mothur.sabund" label="sabund - OTU Species Abundance"/>
                <param name="label" type="select" label="label - OTU Labels" optional="true" multiple="true">
                    <expand macro="labeloptions"/>
                </param>
            </when>
            <when value="rabund">
                <param name="otu" type="data" format="mothur.rabund" label="rabund - OTU Relative Abundance"/>
                <param name="label" type="select" label="label - OTU Labels" optional="true" multiple="true">
                    <expand macro="labeloptions"/>
                </param>
            </when>
        </conditional>
        <param name="size" type="integer" value="" min="1" optional="true" label="size - If set, the number of samples to pick"/>
        <param name="count" type="data" format="mothur.count_table" optional="true" label="count - a count_table" help="generated by count.seqs"/>
        <param name="taxonomy" type="data" format="mothur.seq.taxonomy,mothur.ref.taxonomy" optional="true" label="taxonomy - allows a taxonomy file"/>
        <expand macro="param-savelog"/>
    </inputs>
    <outputs>
        <expand macro="logfile-output"/>
        <data name="fasta_out" format_source="otu" from_work_dir="input_otu*.subsample.*" label="${tool.name} on ${on_string}: subsample.fasta">
            <filter>input['format'] == 'fasta'</filter>
        </data>
        <data name="taxonomy_out" format_source="taxonomy" from_work_dir="taxonomy.subsample.dat" label="${tool.name} on ${on_string}: subsample.taxonomy">
            <filter>taxonomy</filter>
        </data>
        <collection name="list_out" type="list" label="${tool.name} on ${on_string}: subsample.list">
            <filter>input['format'] == 'list'</filter>
            <discover_datasets pattern=".*?\.(?P&lt;designation&gt;.*)\.subsample\.dat" format="mothur.list"/>
        </collection>
        <collection name="shared_out" type="list" label="${tool.name} on ${on_string}: subsample.shared">
            <filter>input['format'] == 'shared'</filter>
            <discover_datasets pattern=".*?\.(?P&lt;designation&gt;.*)\.subsample\.dat" format="mothur.shared"/>
        </collection>
        <data name="sabund_out" format="mothur.sabund" from_work_dir="input_otu*.subsample.*" label="${tool.name} on ${on_string}: subsample.sabund">
            <filter>input['format'] == 'sabund'</filter>
        </data>
        <data name="rabund_out" format="mothur.rabund" from_work_dir="input_otu*.subsample.*" label="${tool.name} on ${on_string}: subsample.rabund">
            <filter>input['format'] == 'rabund'</filter>
        </data>
        <data name="names_out" format="mothur.names" from_work_dir="input_name_in*.subsample.*" label="${tool.name} on ${on_string}: subsample.names">
            <filter>input['format'] == 'fasta' and input['name_in']</filter>
        </data>
        <data name="group_out" format="mothur.groups" from_work_dir="input_use_group_group_in*.subsample.*" label="${tool.name} on ${on_string}: subsample.groups">
            <filter>(input['format'] == 'fasta' or input['format'] == 'list') and input['use_group']['to_filter'] == 'yes'</filter>
        </data>
    </outputs>
    <tests>
        <test><!-- test with list -->
            <param name="format" value="list"/>
            <param name="otu" value="amazon.an.list" ftype="mothur.list"/>
            <output_collection name="list_out" count="36">
                <element name="0.20" ftype="mothur.list">
                    <assert_contents>
                       <has_text text="label"/>
                       <has_text text="numOtus"/>
                   </assert_contents>
                </element>
            </output_collection>
            <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
        <test><!-- test with list and group file and label select-->
            <param name="format" value="list"/>
            <param name="otu" value="amazon.an.list" ftype="mothur.list"/>
            <param name="to_filter" value="yes"/>
            <param name="group_in" value="amazon.groups" ftype="mothur.groups"/>
            <param name="groups" value="forest,pasture"/>
            <param name="label" value="0.20,0.45,0.55"/>
            <output_collection name="list_out" count="3">
                <element name="0.20" ftype="mothur.list">
                    <assert_contents>
                        <has_text text="label"/>
                        <has_text text="numOtus"/>
                   </assert_contents>
                </element>
            </output_collection>
            <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
        <test><!-- test with fasta and taxonomy -->
            <param name="format" value="fasta"/>
            <param name="otu" value="amazon.fasta" ftype="fasta"/>
            <param name="taxonomy" value="amazon.wang.wang.taxonomy" ftype="mothur.seq.taxonomy"/>
            <output name="fasta_out" ftype="fasta">
                <assert_contents>
                    <has_text text=">U"/>
                </assert_contents>
            </output>
            <output name="taxonomy_out" ftype="mothur.seq.taxonomy">
                <assert_contents>
                    <has_line_matching expression="^U[0-9]+\tBacteria.*$"/>
                </assert_contents>
            </output>
            <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
        <test><!-- test with fasta and group file and name file -->
            <param name="format" value="fasta"/>
            <param name="otu" value="amazon.fasta" ftype="fasta"/>
            <param name="to_filter" value="yes"/>
            <param name="group_in" value="amazon.groups" ftype="mothur.groups"/>
            <param name="groups" value="forest,pasture"/>
            <param name="name_in" value="amazon1.names" ftype="mothur.names"/>
            <output name="fasta_out" ftype="fasta">
                <assert_contents>
                    <has_text_matching expression=">U[0-9]+"/>
                </assert_contents>
            </output>
            <output name="group_out" ftype="mothur.groups">
                <assert_contents>
                    <has_line_matching expression="^U[0-9]+\t(forest|pasture)$"/>
                </assert_contents>
            </output>
            <output name="names_out" ftype="mothur.names">
                <assert_contents>
                    <has_line_matching expression="^U[0-9]+\tU[0-9]+$"/>
                </assert_contents>
            </output>
            <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
        <test><!-- test with shared -->
            <param name="format" value="shared"/>
            <param name="otu" value="amazon.an.shared" ftype="mothur.shared"/>
            <param name="label" value="unique,0.20"/>
            <param name="groups" value="forest"/>
            <output_collection name="shared_out" count="2">
                <element name="0.20" ftype="mothur.shared">
                    <assert_contents>
                        <has_text text="label"/>
                        <has_text text="numOtus"/>
                        <has_text text="forest"/>
                        <not_has_text text="pasture"/>
                    </assert_contents>
                </element>
            </output_collection>
            <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
        <test><!-- test with rabund -->
            <param name="format" value="rabund"/>
            <param name="otu" value="amazon.an.rabund" ftype="mothur.rabund"/>
            <output name="rabund_out" ftype="mothur.rabund">
                <assert_contents>
                    <has_text text="unique"/>
                    <has_text text="0.55"/>
                </assert_contents>
            </output>
            <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
        <test><!-- test with sabund -->
            <param name="format" value="sabund"/>
            <param name="otu" value="amazon.an.sabund" ftype="mothur.sabund"/>
            <output name="sabund_out" ftype="mothur.sabund">
                <assert_contents>
                    <has_text text="unique"/>
                    <has_text text="0.55"/>
                </assert_contents>
            </output>
            <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
    </tests>
    <help><![CDATA[

@MOTHUR_OVERVIEW@

**Command Documentation**

The sub.sample_ command can be used as a way to normalize your data, or to create a smaller set from your original set. It takes as an input the following file types: fasta, list_, shared_, rabund_ and sabund_ to generate a new file that contains a sampling of your original file.

.. _list: https://www.mothur.org/wiki/List_file
.. _shared: https://www.mothur.org/wiki/Shared_file
.. _rabund: https://www.mothur.org/wiki/Rabund_file
.. _sabund: https://www.mothur.org/wiki/Sabund_file
.. _sub.sample: https://www.mothur.org/wiki/Sub.sample

    ]]></help>
    <expand macro="citations"/>
</tool>