view filter_tabular.xml @ 10:9cc411a62277 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 67db58361546009a77b2cbd140967fbc634d425b"
author iuc
date Thu, 24 Sep 2020 11:27:38 +0000
parents 69b08fc9557c
children 6544e4b87a4f
line wrap: on
line source

<tool id="filter_tabular" name="Filter Tabular" version="3.1.0">
    <description></description>

    <macros>
         <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <command detect_errors="exit_code"><![CDATA[
        python '$__tool_directory__/filter_tabular.py'
        -i '$input'
        -j '$filter_json'
        -o '$output'
    ]]></command>
    <configfiles>
        <configfile name="filter_json">
#import json
@LINEFILTERS@
#if $input_filters:
#echo $json.dumps($input_filters)
#end if
        </configfile>
    </configfiles>
    <inputs>
        <param name="input" type="data" format="tabular" label="Tabular Dataset to filter"/>
        <expand macro="macro_line_filters" />
    </inputs>
    <outputs>
        <data format="tabular" name="output" />
    </outputs>
    <tests>
        <test>
            <param name="input" ftype="tabular" value="pets.tsv"/>
            <repeat name="linefilters">
                <conditional name="filter">
                    <param name="filter_type" value="regex"/>
                    <param name="regex_pattern" value="^\d+"/>
                    <param name="regex_action" value="include_find"/>
                </conditional>
            </repeat>
            <repeat name="linefilters">
                <conditional name="filter">
                    <param name="filter_type" value="append_line_num"/>
                </conditional>
            </repeat>
            <repeat name="linefilters">
                <conditional name="filter">
                    <param name="filter_type" value="select_columns"/>
                    <param name="columns" value="7,2,3,4,1"/>
                </conditional>
            </repeat>
            <repeat name="linefilters">
                <conditional name="filter">
                    <param name="filter_type" value="replace"/>
                    <param name="column" value="c4"/>
                    <param name="regex_pattern" value="(\d+)/(\d+)/(\d+)"/>
                    <param name="regex_replace" value="19\3-\2-\1"/>
                </conditional>
            </repeat>
            <output name="output" file="filtered_people_results.tsv"/>
        </test>
        <test>
            <param name="input" ftype="tabular" value="pets.tsv"/>
            <repeat name="linefilters">
                <conditional name="filter">
                    <param name="filter_type" value="comment"/>
                    <param name="comment_char" value="35"/>
                </conditional>
            </repeat>
            <repeat name="linefilters">
                <conditional name="filter">
                    <param name="filter_type" value="regex"/>
                    <param name="regex_pattern" value="^\d+"/>
                    <param name="regex_action" value="include_find"/>
                </conditional>
            </repeat>
            <repeat name="linefilters">
                <conditional name="filter">
                    <param name="filter_type" value="append_line_num"/>
                </conditional>
            </repeat>
            <repeat name="linefilters">
                <conditional name="filter">
                    <param name="filter_type" value="select_columns"/>
                    <param name="columns" value="c7,c5,c6"/>
                </conditional>
            </repeat>
            <repeat name="linefilters">
                <conditional name="filter">
                    <param name="filter_type" value="normalize"/>
                    <param name="columns" value="c2,c3"/>
                    <param name="separator" value=","/>
                </conditional>
            </repeat>
            <repeat name="linefilters">
                <conditional name="filter">
                    <param name="filter_type" value="regex"/>
                    <param name="regex_pattern" value="^\d+\t\t"/>
                    <param name="regex_action" value="exclude_match"/>
                </conditional>
            </repeat>
            <output name="output" file="filtered_pets_results.tsv"/>
        </test>

        <test>
            <param name="input" ftype="tabular" value="customers.tsv"/>
            <repeat name="linefilters">
                <conditional name="filter">
                    <param name="filter_type" value="regex"/>
                    <param name="regex_pattern" value="^\d+"/>
                    <param name="regex_action" value="include_find"/>
                </conditional>
            </repeat>
            <repeat name="linefilters">
                <conditional name="filter">
                    <param name="filter_type" value="replace"/>
                    <param name="column" value="c4"/>
                    <param name="regex_pattern" value=".*@(.*)"/>
                    <param name="regex_replace" value="\1"/>
                    <param name="add" value="after"/>
                </conditional>
            </repeat>
            <repeat name="linefilters">
                <conditional name="filter">
                    <param name="filter_type" value="replace"/>
                    <param name="column" value="c4"/>
                    <param name="regex_pattern" value=".*(com|org|net)$"/>
                    <param name="regex_replace" value="\1"/>
                    <param name="add" value="append"/>
                </conditional>
            </repeat>
            <output name="output" file="filtered_customers_results.tsv"/>
        </test>
    </tests>
    <help><![CDATA[
==============
Filter Tabular
==============

  Filter a tabular dataset by applying line filters as it is being read.
  Multiple filters may be used with each filter using the result of the previous filter.  

**Inputs**

  A tabular dataset.


**Outputs**

  A filtered tabular dataset.


@LINEFILTERS_HELP@

@LINEFILTERS_HELP_EXAMPLE@

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