Mercurial > repos > mvdbeek > add_input_name_as_column
annotate add_input_name_as_column.xml @ 4:b31219f26a8f
Change $input.name to $input.element_ideentifier. This allows
keeping the input datatset collections identifier (= history name).
| author | mvdbeek |
|---|---|
| date | Fri, 20 Mar 2015 14:51:56 +0100 |
| parents | 3a1f8302302d |
| children | 06061aa49527 |
| rev | line source |
|---|---|
|
4
b31219f26a8f
Change $input.name to $input.element_ideentifier. This allows
mvdbeek
parents:
0
diff
changeset
|
1 <tool id="addName" name="Add input name as column" version="0.1.1"> |
| 0 | 2 <description>to an existing tabular file</description> |
| 3 <command interpreter="python">add_input_name_as_column.py | |
| 4 --input "$input" | |
|
4
b31219f26a8f
Change $input.name to $input.element_ideentifier. This allows
mvdbeek
parents:
0
diff
changeset
|
5 --label "$input.element_identifier" |
| 0 | 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 |
