diff easyjoin.xml @ 4:56e80527c482 draft

Uploaded
author bgruening
date Wed, 07 Jan 2015 11:10:52 -0500
parents 7068d1548234
children 8928e6d1e7ba
line wrap: on
line diff
--- a/easyjoin.xml	Sun Oct 06 08:22:36 2013 -0400
+++ b/easyjoin.xml	Wed Jan 07 11:10:52 2015 -0500
@@ -1,41 +1,51 @@
-<tool id="tp_easyjoin_tool" name="Join" version="0.1.1">
-    <requirements>
-        <requirement type="package" version="8.21">gnu_coreutils</requirement>
-    </requirements>
+<tool id="tp_easyjoin_tool" name="Join" version="@BASE_VERSION@.0">
     <description>two files</description>
-    <command interpreter="perl">easyjoin $jointype
-        -t '	'
-        $header
-        -e '$empty_string_filler'
-        -o auto
-        $ignore_case
-        -1 '$column1'
-        -2 '$column2'
-        "$input1" "$input2"
-        &gt; '$output'
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements">
+        <requirement type="set_environment">TP_SCRIPT_PATH</requirement>
+    </expand>
+    <version_command>join --version | head -n 1</version_command>
+    <command>
+<![CDATA[
+        cp \$TP_SCRIPT_PATH/sort-header ./ &&
+        chmod +x sort-header &&
+        perl \$TP_SCRIPT_PATH/easyjoin
+            $jointype
+            -t '	'
+            $header
+            -e '$empty_string_filler'
+            -o auto
+            $ignore_case
+            -1 '$column1'
+            -2 '$column2'
+            "$infile1"
+            "$infile2"
+            > '$output'
+]]>
     </command>
+    <inputs>
+        <param name="infile1" format="tabular" type="data" label="1st file" />
+        <param name="column1" label="Column to use from 1st file" type="data_column" data_ref="infile1" accept_default="true" />
 
-    <inputs>
-        <param format="txt" name="input1" type="data" label="1st file" />
-        <param name="column1" label="Column to use from 1st file" type="data_column" data_ref="input1" accept_default="true" />
-
-        <param format="txt" name="input2" type="data" label="2nd File" />
-        <param name="column2" label="Column to use from 2nd file" type="data_column" data_ref="input2" accept_default="true" />
+        <param name="infile2" format="txt" type="data" label="2nd File" />
+        <param name="column2" label="Column to use from 2nd file" type="data_column" data_ref="infile2" accept_default="true" />
 
         <param name="jointype" type="select" label="Output lines appearing in">
-            <option value=" ">BOTH 1st &amp; 2nd file.</option>
-            <option value="-v 1">1st but not in 2nd file. [-v 1]</option>
-            <option value="-v 2">2nd but not in 1st file. [-v 2]</option>
-            <option value="-a 1">both 1st &amp; 2nd file, plus unpairable lines from 1st file. [-a 1]</option>
-            <option value="-a 2">both 1st &amp; 2nd file, plus unpairable lines from 2st file. [-a 2]</option>
-            <option value="-a 1 -a 2">All Lines [-a 1 -a 2]</option>
+            <option value=" " selected="True">Both 1st &amp; 2nd file.</option>
+            <option value="-v 1">1st but not in 2nd file. (-v 1)</option>
+            <option value="-v 2">2nd but not in 1st file. (-v 2)</option>
+            <option value="-a 1">Both 1st &amp; 2nd file, plus unpairable lines from 1st file. (-a 1)</option>
+            <option value="-a 2">Both 1st &amp; 2nd file, plus unpairable lines from 2st file. (-a 2)</option>
+            <option value="-a 1 -a 2">All lines [-a 1 -a 2]</option>
             <option value="-v 1 -v 2">All unpairable lines [-v 1 -v 2]</option>
         </param>
 
-        <param name="header" type="boolean" checked="false" truevalue="--header" falsevalue="" label="First line is a header line" help="Use if first line contains column headers. It will not be sorted." />
-
-        <param name="ignore_case" type="boolean" checked="false" truevalue="-i" falsevalue="" label="Ignore case" help="Sort and Join key column values regardless of upper/lower case letters." />
-
+        <param name="header" type="boolean" checked="false" truevalue="--header" falsevalue=""
+            label="First line is a header line" help="Use if first line contains column headers. It will not be sorted." />
+        <param name="ignore_case" type="boolean" checked="false" truevalue="-i" falsevalue=""
+            label="Ignore case" help="Sort and Join key column values regardless of upper/lower case letters." />
         <param name="empty_string_filler" type="text" size="20" value="0" label="Value to put in unpaired (empty) fields">
             <sanitizer>
                 <valid initial="string.printable">
@@ -43,13 +53,23 @@
                 </valid>
             </sanitizer>
         </param>
-
-  </inputs>
-  <outputs>
-    <data name="output" format="input" metadata_source="input1"/>
-  </outputs>
-
-<help>
+    </inputs>
+    <outputs>
+        <data name="output" format="input" metadata_source="infile1"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="infile1" value="easyjoin1.tabular" />
+            <param name="column1" value="1" />
+            <param name="infile2" value="easyjoin2.tabular" />
+            <param name="column2" value="1" />
+            <param name="header" value="True" />
+            <param name="jointype" value="-a 1 -a 2" />
+            <output name="output" file="easyjoin_result1.tabular" />
+        </test>
+    </tests>
+    <help>
+<![CDATA[
 **What it does**
 
 This tool joins two tabular files based on a common key column.
@@ -83,13 +103,13 @@
     Melon	green	.
     Orange	orange	7
 
-# Input files need not be sorted.
-# The header line (**Fruit  Color  Price**) was joined and kept as first line.
-# Missing values ( Avocado's color, missing from the first file ) are replaced with a period character.
+.. class:: infomark
 
------
+ * Input files need not be sorted.
+ * The header line (**Fruit  Color  Price**) was joined and kept as first line.
+ * Missing values ( Avocado's color, missing from the first file ) are replaced with a period character.
 
-*easyjoin* was written by A. Gordon
-
-</help>
+@REFERENCES@
+]]>
+    </help>
 </tool>