diff filter_tabular.xml @ 20:ab27c4bd14b9 draft

Uploaded
author jjohnson
date Fri, 14 Jul 2017 11:39:27 -0400
parents
children 357fe86f245d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter_tabular.xml	Fri Jul 14 11:39:27 2017 -0400
@@ -0,0 +1,102 @@
+<tool id="filter_tabular" name="Filter Tabular" version="5.0.0">
+    <description></description>
+
+    <macros>
+         <import>macros.xml</import>
+    </macros>
+
+    <requirements>
+    </requirements>
+    <stdio>
+        <exit_code range="1:" />
+    </stdio>
+    <command><![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">
+                <param name="filter_type" value="comment"/>
+                <param name="comment_char" value="35"/>
+            </repeat>
+            <repeat name="linefilters">
+                <param name="filter_type" value="append_line_num"/>
+            </repeat>
+            <repeat name="linefilters">
+                <param name="filter_type" value="select_columns"/>
+                <param name="columns" value="7,2,3,4,1"/>
+            </repeat>
+            <repeat name="linefilters">
+                <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"/>
+            </repeat>
+            <output name="output" file="filtered_people_results.tsv"/>
+        </test>
+        <test>
+            <param name="input" ftype="tabular" value="pets.tsv"/>
+            <repeat name="linefilters">
+                <param name="filter_type" value="comment"/>
+                <param name="comment_char" value="35"/>
+            </repeat>
+            <repeat name="linefilters">
+                <param name="filter_type" value="append_line_num"/>
+            </repeat>
+            <repeat name="linefilters">
+                <param name="filter_type" value="select_columns"/>
+                <param name="columns" value="c7,c5,c6"/>
+            </repeat>
+            <repeat name="linefilters">
+                <param name="filter_type" value="normalize"/>
+                <param name="columns" value="c2,c3"/>
+                <param name="separator" value=","/>
+            </repeat>
+            <output name="output" file="filtered_pets_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>
+</tool>