20
|
1 <tool id="filter_tabular" name="Filter Tabular" version="5.0.0">
|
|
2 <description></description>
|
|
3
|
|
4 <macros>
|
|
5 <import>macros.xml</import>
|
|
6 </macros>
|
|
7
|
|
8 <requirements>
|
|
9 </requirements>
|
|
10 <stdio>
|
|
11 <exit_code range="1:" />
|
|
12 </stdio>
|
|
13 <command><![CDATA[
|
|
14 python $__tool_directory__/filter_tabular.py
|
|
15 -i '$input'
|
|
16 -j '$filter_json'
|
|
17 -o '$output'
|
|
18 ]]></command>
|
|
19 <configfiles>
|
|
20 <configfile name="filter_json">
|
|
21 #import json
|
|
22 @LINEFILTERS@
|
|
23 #if $input_filters:
|
|
24 #echo $json.dumps($input_filters)
|
|
25 #end if
|
|
26 </configfile>
|
|
27 </configfiles>
|
|
28 <inputs>
|
|
29 <param name="input" type="data" format="tabular" label="Tabular Dataset to filter"/>
|
|
30 <expand macro="macro_line_filters" />
|
|
31 </inputs>
|
|
32 <outputs>
|
|
33 <data format="tabular" name="output" />
|
|
34 </outputs>
|
|
35 <tests>
|
|
36 <test>
|
|
37 <param name="input" ftype="tabular" value="pets.tsv"/>
|
|
38 <repeat name="linefilters">
|
|
39 <param name="filter_type" value="comment"/>
|
|
40 <param name="comment_char" value="35"/>
|
|
41 </repeat>
|
|
42 <repeat name="linefilters">
|
|
43 <param name="filter_type" value="append_line_num"/>
|
|
44 </repeat>
|
|
45 <repeat name="linefilters">
|
|
46 <param name="filter_type" value="select_columns"/>
|
|
47 <param name="columns" value="7,2,3,4,1"/>
|
|
48 </repeat>
|
|
49 <repeat name="linefilters">
|
|
50 <param name="filter_type" value="replace"/>
|
|
51 <param name="column" value="c4"/>
|
|
52 <param name="regex_pattern" value="(\d+)/(\d+)/(\d+)"/>
|
|
53 <param name="regex_replace" value="19\3-\2-\1"/>
|
|
54 </repeat>
|
|
55 <output name="output" file="filtered_people_results.tsv"/>
|
|
56 </test>
|
|
57 <test>
|
|
58 <param name="input" ftype="tabular" value="pets.tsv"/>
|
|
59 <repeat name="linefilters">
|
|
60 <param name="filter_type" value="comment"/>
|
|
61 <param name="comment_char" value="35"/>
|
|
62 </repeat>
|
|
63 <repeat name="linefilters">
|
|
64 <param name="filter_type" value="append_line_num"/>
|
|
65 </repeat>
|
|
66 <repeat name="linefilters">
|
|
67 <param name="filter_type" value="select_columns"/>
|
|
68 <param name="columns" value="c7,c5,c6"/>
|
|
69 </repeat>
|
|
70 <repeat name="linefilters">
|
|
71 <param name="filter_type" value="normalize"/>
|
|
72 <param name="columns" value="c2,c3"/>
|
|
73 <param name="separator" value=","/>
|
|
74 </repeat>
|
|
75 <output name="output" file="filtered_pets_results.tsv"/>
|
|
76 </test>
|
|
77
|
|
78 </tests>
|
|
79 <help><![CDATA[
|
|
80 ==============
|
|
81 Filter Tabular
|
|
82 ==============
|
|
83
|
|
84 Filter a tabular dataset by applying line filters as it is being read.
|
|
85 Multiple filters may be used with each filter using the result of the previous filter.
|
|
86
|
|
87 **Inputs**
|
|
88
|
|
89 A tabular dataset.
|
|
90
|
|
91
|
|
92 **Outputs**
|
|
93
|
|
94 A filtered tabular dataset.
|
|
95
|
|
96
|
|
97 @LINEFILTERS_HELP@
|
|
98
|
|
99 @LINEFILTERS_HELP_EXAMPLE@
|
|
100
|
|
101 ]]></help>
|
|
102 </tool>
|