Mercurial > repos > nml > collapse_collections
comparison merge.xml @ 4:25136a2b0cfe draft
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
author | nml |
---|---|
date | Fri, 10 Mar 2017 16:12:32 -0500 |
parents | c0c988378838 |
children | 33151a38533a |
comparison
equal
deleted
inserted
replaced
3:c0c988378838 | 4:25136a2b0cfe |
---|---|
1 <tool id="collapse_dataset" name="Collapse Collection" version="3.0"> | 1 <tool id="collapse_dataset" name="Collapse Collection" version="4.0"> |
2 <description>Collapse collection into single dataset in order of the collection</description> | 2 <description>into single dataset in order of the collection</description> |
3 <command> | 3 <command> |
4 <![CDATA[ | 4 <![CDATA[ |
5 | 5 |
6 ( | 6 ( |
7 #if $one_header: | |
8 #if $filename.add_name: | |
9 awk '{if (NR==1) {print "Sample\t"$0}}' "$input_list[0]"; | |
10 #else: | |
11 awk '{if (NR==1) {print}}' "$input_list[0]"; | |
12 #end if | |
13 #end if | |
14 | |
7 #for $f in $input_list# | 15 #for $f in $input_list# |
8 #if $filename.add_name: | 16 #if $filename.add_name: |
9 #if str($filename.place_name) == "same_once": | 17 #if str($filename.place_name) == "same_once": |
18 #if $one_header: | |
19 printf "$f.element_identifier\t"; tail -q -n +2 "$f"; | |
20 #else: | |
10 printf "$f.element_identifier\t"; cat "$f"; | 21 printf "$f.element_identifier\t"; cat "$f"; |
22 #end if | |
11 #elif str($filename.place_name) == "same_multiple": | 23 #elif str($filename.place_name) == "same_multiple": |
24 #if $one_header: | |
25 awk '{if (NR!=1) {print "$f.element_identifier\t"$0}}' "$f"; | |
26 #else: | |
12 awk '{print "$f.element_identifier\t"$0}' "$f"; | 27 awk '{print "$f.element_identifier\t"$0}' "$f"; |
28 #end if | |
13 #elif str($filename.place_name) == "above": | 29 #elif str($filename.place_name) == "above": |
30 #if $one_header: | |
31 printf "$f.element_identifier\n"; tail -q -n +2 "$f"; | |
32 #else: | |
14 printf "$f.element_identifier\n"; cat "$f"; | 33 printf "$f.element_identifier\n"; cat "$f"; |
34 #end if | |
15 #end if | 35 #end if |
16 #else: | 36 #else: |
17 cat "$f" ; | 37 #if $one_header: |
38 awk '{if (NR!=1) {print}}' "$f"; | |
39 #else: | |
40 cat "$f" ; | |
41 #end if | |
18 #end if | 42 #end if |
19 | 43 |
20 #end for# | 44 #end for# |
21 ) | 45 ) |
22 > $output | 46 > $output |
23 | 47 |
24 ]]> | 48 ]]> |
25 | 49 |
26 </command> | 50 </command> |
27 <inputs> | 51 <inputs> |
28 <param name="input_list" type="data" format="data" label="Collection of files to collapse into single dataset" help="" optional="false" multiple="true" /> | 52 <param name="input_list" type="data" format="data" label="Collection of files to collapse into single dataset" help="" optional="false" multiple="true" /> |
53 <param name="one_header" type="boolean" display="checkboxes" label="Keep one header line" help="Combine first line of each file as the header for the final dataset. Useful when same header line is found in all files."/> | |
29 <conditional name="filename"> | 54 <conditional name="filename"> |
55 | |
30 <param name="add_name" type="boolean" display="checkboxes" label="Append File name"/> | 56 <param name="add_name" type="boolean" display="checkboxes" label="Append File name"/> |
31 <when value="true"> | 57 <when value="true"> |
32 <param name="place_name" type="select" label="Where to add dataset name"> | 58 <param name="place_name" type="select" label="Where to add dataset name"> |
33 <option value="same_once">Same line and only once per dataset</option> | 59 <option value="same_once">Same line and only once per dataset</option> |
34 <option value="same_multiple">Same line and each line in dataset</option> | 60 <option value="same_multiple">Same line and each line in dataset</option> |
42 <outputs> | 68 <outputs> |
43 <data name="output" format_source="input_list" ></data> | 69 <data name="output" format_source="input_list" ></data> |
44 </outputs> | 70 </outputs> |
45 <tests> | 71 <tests> |
46 <test> | 72 <test> |
47 <param name="input_list"> | 73 <param name="input_list" value="input1,input2"/> |
48 <collection type="list"> | |
49 <element name="input1" value="input1" /> | |
50 <element name="input2" value="input2" /> | |
51 </collection> | |
52 </param> | |
53 <output name="output" file="answer.txt"/> | 74 <output name="output" file="answer.txt"/> |
54 </test> | 75 </test> |
76 <test> | |
77 <param name="input_list" value="strain1.tsv,strain2.tsv"/> | |
78 <param name="one_header" value="True"/> | |
79 <param name="add_name" value="True"/> | |
80 <param name="place_name" value="same_multiple"/> | |
81 <output name="output" file="answer2.tsv"/> | |
82 </test> | |
83 <test> | |
84 <param name="input_list" value="strain1.tsv,strain2.tsv"/> | |
85 <param name="one_header" value="True"/> | |
86 <output name="output" file="answer3.tsv"/> | |
87 </test> | |
88 | |
55 </tests> | 89 </tests> |
56 <help> | 90 <help> |
57 Combines a list collection into a single file dataset with option to include dataset names. | 91 Combines a list collection into a single file dataset with option to include dataset names or merge common header line. |
58 </help> | 92 </help> |
59 <citations> | 93 <citations> |
60 </citations> | 94 </citations> |
61 </tool> | 95 </tool> |