view columnArrange.xml @ 1:6c6d26ff01ff draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/column_arrange_by_header commit b6e0b2de32ddb91085235397728623a35ad13f42
author bgruening
date Fri, 15 Feb 2019 07:45:03 -0500
parents f18f67056946
children
line wrap: on
line source

<tool id="bg_column_arrange_by_header" name="Column arrange" version="0.2">
    <description>by header name</description>
    <command interpreter="python">
    <![CDATA[
        column_arrange.py
          --columns
        #for token in $rep_param_columns:
            '$token.param_column'
        #end for
        --in '$param_input'
        --out '$output'
        $discard_remaining
    ]]>
    </command>
    <inputs>
        <param format="tabular" name="param_input" type="data" label="file to rearrange" />
        <repeat name ="rep_param_columns" min="1" title="Specify the first few columns by name">
            <param name="param_column" type="text" value="" label="column">
                <sanitizer>
                    <valid initial="string.printable">
                        <remove value="&apos;"/>
                    </valid>
                    <mapping initial="none">
                        <add source="&apos;" target="&apos;&quot;&apos;&quot;&apos;" />
                    </mapping>
                </sanitizer>
            </param>
        </repeat>
        <param name="discard_remaining" type="boolean" truevalue="--discard" falsevalue="" checked="false"
        label="Discard unspecified columns?"
        help="Columns not explicitly specified above for rearrangement can be appended after the last specified column in their original order (the default) or be discarded from the output." />
    </inputs>
    <outputs>
        <data format="tabular" name="output" />
    </outputs>
    <tests>
        <test>
            <param name="param_input" value="columnarrange_input1.tab"/>
            <repeat name="rep_param_columns">
                <param name="param_column" value="fname"/>
            </repeat>
            <repeat name="rep_param_columns">
                <param name="param_column" value="age"/>
            </repeat>
            <output name="output" file="columnarrange_result1.tab"/>
        </test>
        <test>
            <param name="param_input" value="columnarrange_input1.tab"/>
            <repeat name="rep_param_columns">
                <param name="param_column" value="fname"/>
            </repeat>
            <param name="discard_remaining" value="true" />
            <output name="output">
                <assert_contents>
                    <has_n_columns n="1" />
                    <has_line line="fname" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="param_input" value="columnarrange_input1.tab"/>
            <repeat name="rep_param_columns">
                <param name="param_column" value="fname"/>
            </repeat>
            <repeat name="rep_param_columns">
                <param name="param_column" value="age"/>
            </repeat>
            <param name="discard_remaining" value="true" />
            <output name="output">
                <assert_contents>
                    <has_n_columns n="2" />
                    <has_line line="fname&#009;age" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="param_input" value="columnarrange_input2.tab"/>
            <repeat name="rep_param_columns">
                <param name="param_column" value="first name"/>
            </repeat>
            <repeat name="rep_param_columns">
                <param name="param_column" value="nationality"/>
            </repeat>
            <output name="output" file="columnarrange_result2.tab"/>
        </test>
    </tests>
    <help>
**What it does**

With this tool you can specify - by name - the order of columns for tabular
data.
Columns not specified will remain ordered as before and be moved to the right
of the specified columns, as shown in the following example.

Input file::

    AHeader BHeader CHeader DHeader
    a       b       c       d
    a       b       c       d

Specifying **CHeader** and **BHeader**, as the columns that should be leftmost,
generates::

    CHeader BHeader AHeader DHeader
    c       b       a       d
    c       b       a       d

Alternatively, you can choose to retain *only* the specified columns in their
new arrangement and discard all other columns.
    </help>
    <citations>
        <citation type="bibtex">
            @ARTICLE{bgruening_galaxytools,
                Author = {Björn Grüning, Cameron Smith, Torsten Houwaart, Nicola Soranzo, Eric Rasche},
                keywords = {bioinformatics, ngs, galaxy, cheminformatics, rna},
                title = {{Galaxy Tools - A collection of bioinformatics and cheminformatics tools for the Galaxy environment}},
                url = {https://github.com/bgruening/galaxytools}
            }
        </citation>
    </citations>
</tool>