diff add_input_name_as_column.xml @ 0:3a1f8302302d

Imported from capsule None
author mvdbeek
date Tue, 13 Jan 2015 12:05:08 -0500
parents
children b31219f26a8f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/add_input_name_as_column.xml	Tue Jan 13 12:05:08 2015 -0500
@@ -0,0 +1,57 @@
+<tool id="addName" name="Add input name as column" version="0.1">
+  <description>to an existing tabular file</description>
+  <command interpreter="python">add_input_name_as_column.py 
+    --input "$input" 
+    --label "$input.name" 
+    --output "$output"
+    #if $header.contains_header=="yes":
+      --header "$header.colname"
+    #end if
+  </command>
+  <inputs>
+  <param format="tabular" name="input" type="data" label="to Dataset" help="Dataset missing? See TIP below" />
+  <conditional name="header">
+    <param name="contains_header" type="select" label="input contains a header line?" >
+      <option value="yes" selected="true">Yes</option>
+      <option value="no">No</option>
+    </param>
+    <when value="yes"> 
+      <param name="colname" type="text" value="sample" help="select a column header to be added in the first line">
+        <validator type="empty_field" message="please add a column header"/>
+      </param>
+    </when>
+    <when value="no"> 
+    </when>
+  </conditional>
+  </inputs>
+  <outputs>
+    <data name="output" format="tabular" />
+  </outputs>
+  <tests>
+    <test>
+      <param name="input" value="signature.tab" ftype="tabular" />
+      <param name="contains_header" value="yes" />
+      <param name="colname" value="sample" />
+      <output name="output" file="signature_with_header.tab" ftype="tabular"/>
+    </test>
+    <test>
+      <param name="input" value="signature.tab" ftype="tabular" />
+      <param name="contains_header" value="no" />
+      <output name="output" file="signature_without_header.tab" ftype="tabular"/>
+    </test>
+  </tests>
+  <help>
+
+.. class:: infomark
+
+**TIP:** If your data is not TAB delimited, use *Text Manipulation-&gt;Convert*
+
+-----
+
+**What it does**
+
+Adds a new column with the name of the input file as it appears in the history.
+Written by Marius van den Beek, m.vandenbeek at gmail . com
+  </help>
+</tool>
+