view make.group.xml @ 6:182b471ed56b draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/mothur commit debdcdbb89f9bf3e2c3eed05cb078eddb27d4684"
author iuc
date Mon, 02 Dec 2019 06:12:05 -0500
parents 63a75db03ecc
children
line wrap: on
line source

<tool profile="16.07" id="mothur_make_group" name="Make.group" version="@WRAPPER_VERSION@.0">
    <description>Make a group file</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="stdio"/>
    <expand macro="version_command"/>
    <command><![CDATA[
@SHELL_OPTIONS@

#import re

#set fastas = ''
#set groups = ''
#set count = 0

#if $method.how == 'collection':
    #for $i in $method.fasta_collection:
        #set $identifier=re.sub('[^\w_]', '_', str($i.element_identifier))
        ln -s '$i' 'fasta_${identifier}.dat' &&
        #set fastas+='fasta_'+$identifier+'.dat-'
        #set groups+=$identifier+'-'
    #end for
#else
    #for $i in $method.inputs:
        ln -s '$i.fasta' fasta_${count}.dat &&
        #set fastas+='fasta_'+str($count)+'.dat-'
        #set groups+=str($i.group)+'-'
        #set count+=1
    #end for
#end if

echo 'make.group(
    fasta=${ str($fastas).rstrip('-') },
    groups=${ str($groups).rstrip('-') }
)'
| sed 's/ //g'  ## mothur trips over whitespace
| mothur
| tee mothur.out.log
    ]]></command>
    <inputs>
        <conditional name="method">
            <param name="how" type="select" label="Method to create group file">
                <option value="collection"> Automatically from collection </option>
                <option value="manually"> Manually specify fasta files and group names</option>
            </param>
            <when value="collection">
                <param name="fasta_collection" type="data_collection" collection_type="list" format="fasta" label="Collection with fasta files to group"
                    help="group names will be derived from the dataset names of the collection elements, please make sure these are meaningful names"/>
            </when>
            <when value="manually">
                <repeat name="inputs" title="Additional">
                    <param name="fasta" type="data" format="fasta" label="fasta - Fasta to group"/>
                    <param name="group" type="text" label="group - Group name"/>
                </repeat>
            </when>
        </conditional>
        <expand macro="param-savelog"/>
    </inputs>
    <outputs>
        <expand macro="logfile-output"/>
        <data name="output" format="mothur.groups" from_work_dir="*groups" label="${tool.name} on ${on_string}: group"/>
    </outputs>
    <tests>
        <test> <!-- test manual groups creation -->
            <param name="how" value="manually"/>
            <repeat name="inputs">
                <param name="fasta" value="Mock_S280_L001_R1_001_small.trim.contigs.good.align_head"/>
                <param name="group" value="testgroup"/>
            </repeat>
            <repeat name="inputs">
                <param name="fasta" value="Mock_S280_L001_R1_001_small.trim.contigs.good.align_head"/>
                <param name="group" value="testgroup2"/>
            </repeat>
            <output name="output" file="Mock_S280_L001_R1_001_small.trim.contigs.good.Mock_S280_L001_R1_001_small.trim.contigs.good.groups"/>
            <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
        <test> <!-- test auto-creation from collection -->
            <param name="how" value="collection"/>
            <param name="fasta_collection">
               <collection type="list">
                   <element name="testgroup" ftype="fasta" value="Mock_S280_L001_R1_001_small.trim.contigs.good.align_head" />
                   <element name="testgroup2" ftype="fasta" value="Mock_S280_L001_R1_001_small.trim.contigs.good.align_head" />
              </collection>
           </param>
           <output name="output" file="Mock_S280_L001_R1_001_small.trim.contigs.good.Mock_S280_L001_R1_001_small.trim.contigs.good.groups"/>
           <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
        <test> <!-- test with spaces or hyphens in element identifier -->
            <param name="how" value="collection"/>
            <param name="fasta_collection">
               <collection type="list">
                   <element name="test group" ftype="fasta" value="Mock_S280_L001_R1_001_small.trim.contigs.good.align_head" />
                   <element name="test-group2" ftype="fasta" value="Mock_S280_L001_R1_001_small.trim.contigs.good.align_head" />
              </collection>
           </param>
           <output name="output" file="make_group_collection.groups"/>
           <param name="savelog" value="true"/>
            <expand macro="logfile-test"/>
        </test>
    </tests>
    <help><![CDATA[

@MOTHUR_OVERVIEW@

**Command Documentation**

The make.group_ command reads a fasta file or series of fasta files and creates a group_ file.

.. _group: https://www.mothur.org/wiki/Group_file
.. _make.group: https://www.mothur.org/wiki/Make.group

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