view presto_parseheaders.xml @ 2:1ed5b0772f98 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/presto commit 19e832988729a92be5426131fc6114e1f7237982"
author iuc
date Fri, 02 Jul 2021 15:30:39 +0000
parents 55e95d8104f2
children 4049467b8bb8
line wrap: on
line source

<tool id="presto_parseheaders" name="pRESTO ParseHeaders" version="@TOOL_VERSION@">
    <description>Manage annotations in FASTQ headers.</description>
    
    <macros>
        <import>presto_macros.xml</import>
    </macros>
    
    <expand macro="requirements"/>
    
    <version_command>ParseHeaders.py --version</version_command>
    <command detect_errors="exit_code"><![CDATA[
        ln -s '$fastq_in' in.fastq &&
        ParseHeaders.py $cc.command
          -s in.fastq
          
          #if $varExists('cc.f')
            -f $cc.f
          #end if
          #if $varExists('cc.u')
            -u $cc.u
          #end if
          #if $varExists('cc.act')
            --act $cc.act
          #end if
          #if $varExists('cc.k')
            -k $cc.k
          #end if

          --outdir=.
          --outname=tmp &&
        mv ./tmp_*header* '$output'
    ]]></command>

    <inputs>
        <param name="fastq_in" type="data" format="fastq" label="Input FASTQ file"/>

        <conditional name="cc">
            <param name="command" type="select" label="Command">
                <option value="add">Add field/value pairs to header annotations (add)</option>
                <option value="collapse">Collapse header annotations with multiple entries (collapse)</option>
                <option value="copy">Copy header annotation fields (copy)</option>
                <option value="delete">Delete fields from header annotations (delete)</option>
                <option value="expand">Expand annotation fields with multiple values (expand)</option>
                <option value="rename">Rename header annotation fields (rename)</option>
                <option value="table">Write sequence headers to a table (table)</option>
            </param>
            <when value="add">
                <param argument="-f" type="text" value="" label="Field(s)" help="Space-separated list of field names to add.">
                    <expand macro="text-regex-validator"/>
                </param>
                <param argument="-u" type="text" value="" label="Value(s)" help="Space-separated list of values, one per field.">
                    <expand macro="text-regex-validator"/>
                </param>
            </when>
            <when value="collapse">
                <param argument="-f" type="text" value="" label="Field(s)" help="Space-separated list of field names to collapse values within.">
                    <expand macro="text-regex-validator"/>
                </param>
                <param argument="--act" type="text" value="" label="Action(s)" help="Space-separated list of actions, one per field [min,max,sum,first,last,set,cat].">
                    <expand macro="text-regex-validator"/>
                </param>
            </when>
            <when value="copy">
                <param argument="-f" type="text" value="" label="Source Field(s)" help="Space-separated list of field names to copy.">
                    <expand macro="text-regex-validator"/>
                </param>
                <param argument="-k" type="text" value="" label="Target Field(s)" help="Space-separated list of target field names, one per source field.">
                    <expand macro="text-regex-validator"/>
                </param>
                <param argument="--act" type="text" value="" label="Action(s)" help="Space-separated list of actions, one per target field [min,max,sum,first,last,set,cat].">
                    <expand macro="text-regex-validator"/>
                </param>
            </when>
            <when value="delete">
                <param argument="-f" type="text" value="" label="Field(s)" help="Space-separated list of field names to delete.">
                    <expand macro="text-regex-validator"/>
                </param>
            </when>
            <when value="expand">
                <param argument="-f" type="text" value="" label="Field(s)" help="Space-separated list of field names to expand.">
                    <expand macro="text-regex-validator"/>
                </param>
            </when>
            <when value="rename">
                <param argument="-f" type="text" value="" label="Source Field(s)" help="Space-separated list of field names to rename.">
                    <expand macro="text-regex-validator"/>
                </param>
                <param argument="-k" type="text" value="" label="Target Field(s)" help="Space-separated list of new field names.">
                    <expand macro="text-regex-validator"/>
                </param>
                <param argument="--act" type="text" value="" label="Action(s)" help="Space-separated list of actions, one per new field [min,max,sum,first,last,set,cat].">
                    <expand macro="text-regex-validator"/>
                </param>
            </when>
            <when value="table">
                <param argument="-f" type="text" value="" label="Field(s)" help="Space-separated list of field names to report on.">
                    <expand macro="text-regex-validator"/>
                </param>
            </when>
        </conditional>
    </inputs>

    <outputs>
        <data name="output" format="fastq">
            <change_format>
                <when input="command" value="table" format="tsv"/>
            </change_format>
        </data>
    </outputs>
    
    <tests>
        <test>
            <param  name="command" value="add"/>
            <param  name="fastq_in" value="presto_parseheaders_test_in.fastq"/>
            <param  name="f" value="FOO BAR"/>
            <param  name="u" value="hello world"/>
            <output name="output" file="presto_parseheaders_test_add_out.fastq" sort="true"/>
        </test>
        
        <test>
            <param  name="command" value="collapse"/>
            <param  name="fastq_in" value="presto_parseheaders_test_in.fastq"/>
            <param  name="f" value="CONSCOUNT"/>
            <param  name="act" value="sum"/>
            <output name="output" file="presto_parseheaders_test_collapse_out.fastq" sort="true"/>
        </test>

        <test>
            <param  name="command"  value="copy"/>
            <param  name="fastq_in" value="presto_parseheaders_test_in.fastq"/>
            <param  name="f" value="PRCONS"/>
            <param  name="k" value="PRIMER"/>
            <param  name="act" value="set"/>
            <output name="output" file="presto_parseheaders_test_copy_out.fastq" sort="true"/>
        </test>

        <test>
            <param  name="command" value="delete"/>
            <param  name="fastq_in" value="presto_parseheaders_test_in.fastq"/>
            <param  name="f" value="CONSCOUNT SEQORIENT"/>
            <output name="output" file="presto_parseheaders_test_delete_out.fastq" sort="true"/>
        </test>

        <test>
            <param  name="command" value="expand"/>
            <param  name="fastq_in" value="presto_parseheaders_test_in.fastq"/>
            <param  name="f" value="CONSCOUNT"/>
            <output name="output" file="presto_parseheaders_test_expand_out.fastq" sort="true"/>
        </test>
        
        <test>
            <param  name="command" value="rename"/>
            <param  name="fastq_in" value="presto_parseheaders_test_in.fastq"/>
            <param  name="f" value="PRCONS"/>
            <param  name="k" value="PRIMER"/>
            <param  name="act" value="set"/>
            <output name="output" file="presto_parseheaders_test_rename_out.fastq" sort="true"/>
        </test>

        <test>
            <param  name="command" value="table"/>
            <param  name="fastq_in" value="presto_parseheaders_test_in.fastq"/>
            <param  name="f" value="PRCONS PRIMER"/>
            <output name="output" file="presto_parseheaders_test_table_out.tsv" sort="true"/>
        </test>
    </tests>
    
    <help><![CDATA[
Adds, removes, renames and otherwise transforms annotations in FASTQ headers.

See the `pRESTO online help <@PRESTO_BASE_URL@/en/stable>`_ for more information.

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