view merge.groups.xml @ 9:ddd068a49efe draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/mothur commit dfdd4c590370ecb3a9806314d43eb5668e36a01a"
author iuc
date Fri, 22 Jan 2021 00:16:25 +0000
parents 0efffd5559c6
children 2624af4d11ac
line wrap: on
line source

<tool profile="16.07" id="mothur_merge_groups" name="Merge.groups" version="@WRAPPER_VERSION@.0">
    <description>Merge groups in a shared file</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 '$otu' otu.dat &&
ln -s '$group' group.dat &&
ln -s '$fasta' fasta.dat &&
#if $design.source == "hist":
    ln -s '$design.design_dataset' design_dataset.dat &&
#else:
    ln -s '$generated_design' generated_design.dat &&
#end if

echo 'merge.groups(
    #if $design.source == "hist":
        design=design_dataset.dat
    #else:
        design=generated_design.dat
    #end if
    #if $otu:
        ,shared=otu.dat
    #end if
    #if $group:
        #if $group.is_of_type("mothur.groups"):
            ,group=group.dat
        #elif $group.is_of_type("mothur.count_table"):
            ,count=group.dat
        #end if
    #end if
    #if $fasta:
        ,fasta=fasta.dat
    #end if
    #if $groups:
        ,groups=${ str($groups).replace(",","-") }
    #end if
    #if $label:
        ,label=${ str($label).replace(",","-") }
    #end if
    ,method=$method
)'
| sed 's/ //g'  ## mothur trips over whitespace
| mothur
| tee mothur.out.log
    ]]></command>
    <configfiles>
        <configfile name="generated_design"><![CDATA[
            #if $design.source == 'build':
                #for $grouping in $design.groupings:
                    #set grp_str = $grouping.groups.__str__
                    #if grp_str != None and len(grp_str) > 0:
                        #for $grp in grp_str.split(','):
                            $grp	$grouping.name
                        #end for
                    #end if
                #end for
            #end if
        ]]></configfile>
    </configfiles>
    <inputs>
        <param name="otu" type="data" format="mothur.shared" optional="true" label="shared - OTU Shared Dataset"/>
        <param name="label" type="select" label="label - Pick OTU Labels to include" optional="true" multiple="true">
            <expand macro="labeloptions"/>
        </param>
        <param name="group" type="data" format="mothur.groups,mothur.count_table" optional="true" label="group or count - Group Dataset or Count Table"/>
        <param name="fasta" type="data" format="fasta,mothur.align" optional="true" label="Fasta file" help="only valid if you supplied a count file"/>
        <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="method" type="select" label="Merging method">
            <option value="sum" selected="true"> Sum </option>
            <option value="average"> Average </option>
            <option value="median"> Median </option>
        </param>
        <conditional name="design">
            <param name="source" type="select" label="Grouping Design from" help="">
                <option value="hist">Your History</option>
                <option value="build">Build a grouping design</option>
            </param>
            <when value="hist">
                <param name="design_dataset" type="data" format="tabular" label="design - assign groups to new grouping" help="design has 2 columns: group(col 1) and grouping(col 2) (separated by a TAB character)"/>
            </when>
            <when value="build">
                <repeat name="groupings" title="Grouping">
                    <param name="name" type="text" label="Name for a new combined grouping"/>
                    <param name="groups" type="select" multiple="true" label="Select groups for to include in this grouping">
                        <options>
                            <filter type="data_meta" ref="otu" key="groups"/>
                        </options>
                    </param>
                </repeat>
            </when>
        </conditional>
        <expand macro="param-savelog"/>
    </inputs>
    <outputs>
        <expand macro="logfile-output"/>
        <data name="merged_shared" format="mothur.shared" from_work_dir="otu*.merge.*" label="${tool.name} on ${on_string}: merge.shared">
            <filter>otu</filter>
        </data>
        <data name="merged_group" format="mothur.groups" from_work_dir="group*.merge.*" label="${tool.name} on ${on_string}: merge.groups">
            <filter>group</filter>
        </data>
    </outputs>
    <tests>
        <test><!-- test with shared file -->
            <param name="otu" value="amazon.an.shared" ftype="mothur.shared"/>
            <param name="source" value="hist"/>
            <param name="design_dataset" value="toymothur.design2"/>
            <output name="merged_shared" md5="60f9e715c948911a61986bf1d1db7747" ftype="mothur.shared"/>
            <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
        <test><!-- test with shared file and label and group select -->
            <param name="otu" value="amazon.an.shared" ftype="mothur.shared"/>
            <param name="label" value="0.05,0.22,0.38"/>
            <param name="groups" value="forest,pasture"/>
            <param name="source" value="hist"/>
            <param name="design_dataset" value="toymothur.design2"/>
            <output name="merged_shared" md5="11818d535bf88938dc063afca3f95b23" ftype="mothur.shared"/>
            <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
        <test><!-- test with group file -->
            <param name="group" value="amazon.groups" ftype="mothur.groups"/>
            <param name="source" value="hist"/>
            <param name="design_dataset" value="toymothur.design2"/>
            <output name="merged_group" md5="023ebd0668522e9531da5b061e6e9137" ftype="mothur.groups"/>
            <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
        <test><!-- test with count table and fasta file -->
            <param name="group" value="amazon_withgroups.count_table" ftype="mothur.count_table"/>
            <param name="fasta" value="amazon.fasta" ftype="fasta"/>
            <param name="method" value="median"/>
            <param name="source" value="hist"/>
            <param name="design_dataset" value="toymothur.design2"/>
            <output name="merged_group" ftype="mothur.groups">
                <assert_contents>
                    <has_text text="U68589"/>
                    <has_text text="tardis"/>
                    <has_text text="dalek"/>
                </assert_contents>
            </output>
            <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
        <test><!-- test with design creation -->
            <param name="otu" value="amazon.an.shared" ftype="mothur.shared"/>
            <param name="source" value="build"/>
            <repeat name="groupings">
                <param name="name" value="tardis"/>
                <param name="groups" value="forest"/>
            </repeat>
            <repeat name="groupings">
                <param name="name" value="dalek"/>
                <param name="groups" value="pasture"/>
            </repeat>
            <output name="merged_shared" md5="60f9e715c948911a61986bf1d1db7747" ftype="mothur.shared"/>
            <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
    </tests>
    <help><![CDATA[

@MOTHUR_OVERVIEW@

**Command Documentation**

The merge.groups_ command reads a shared_ file and a design file and merges the groups in the shared file that are in the same grouping in the design file.

A design file partitions a list of names into groups.  It is a tab-delimited file with 2 columns: name and group, e.g. :
                                ======= =======
                                duck    bird
                                cow     mammal
                                pig     mammal
                                goose   bird
                                cobra   reptile
                                ======= =======

The Make_Design tool can construct a design file from a Mothur dataset that contains group names.

.. _shared: https://www.mothur.org/wiki/Shared_file
.. _merge.groups: https://www.mothur.org/wiki/Merge.groups

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