Mercurial > repos > mvdbeek > add_input_name_as_column
comparison add_input_name_as_column.xml @ 0:bfebefdd5ba4
Initial Commit.
author | mvdbeek |
---|---|
date | Mon, 29 Dec 2014 21:26:29 +0100 |
parents | |
children | 07d2cbf43b51 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:bfebefdd5ba4 |
---|---|
1 <tool id="addName" name="Add input name as column" version="0.1"> | |
2 <description>to an existing tabular file</description> | |
3 <command interpreter="python">add_input_name_as_column.py | |
4 --input "$input" | |
5 --label "$input.name" | |
6 --output "$output" | |
7 #if $header.contains_header=="yes": | |
8 --header "$header.colname" | |
9 #end if | |
10 </command> | |
11 <inputs> | |
12 <param format="tabular" name="input" type="data" label="to Dataset" help="Dataset missing? See TIP below" /> | |
13 <conditional name="header"> | |
14 <param name="contains_header" type="select" label="input contains a header line?" > | |
15 <option value="yes" selected="true">Yes</option> | |
16 <option value="no">No</option> | |
17 </param> | |
18 <when value="yes"> | |
19 <param name="colname" type="text" value="sample" help="select a column header to be added in the first line"> | |
20 <validator type="empty_field" message="please add a column header"/> | |
21 </param> | |
22 </when> | |
23 <when value="no"> | |
24 </when> | |
25 </conditional> | |
26 </inputs> | |
27 <outputs> | |
28 <data name="output" format="tabular" /> | |
29 </outputs> | |
30 <tests> | |
31 <test> | |
32 <param name="input" value="signature.tab" ftype="tabular" /> | |
33 <param name="contains_header" value="yes" /> | |
34 <param name="colname" value="sample" /> | |
35 <output name="output" file="signature_with_header.tab" ftype="tabular"/> | |
36 </test> | |
37 <test> | |
38 <param name="input" value="signature.tab" ftype="tabular" /> | |
39 <param name="contains_header" value="no" /> | |
40 <output name="output" file="signature_without_header.tab" ftype="tabular"/> | |
41 </test> | |
42 </tests> | |
43 <help> | |
44 | |
45 .. class:: infomark | |
46 | |
47 **TIP:** If your data is not TAB delimited, use *Text Manipulation->Convert* | |
48 | |
49 ----- | |
50 | |
51 **What it does** | |
52 | |
53 Adds a new column with the name of the input file as it appears in the history. | |
54 Written by Marius van den Beek, m.vandenbeek at gmail . com | |
55 </help> | |
56 </tool> | |
57 |