Mercurial > repos > nml > collapse_collections
annotate merge.xml @ 6:830961c48e42 draft
"planemo upload commit 9023eff03236d0c02dfa1c303f652cecb77cb09c"
author | nml |
---|---|
date | Thu, 13 Feb 2020 12:38:44 -0500 |
parents | 33151a38533a |
children | 90981f86000f |
rev | line source |
---|---|
6
830961c48e42
"planemo upload commit 9023eff03236d0c02dfa1c303f652cecb77cb09c"
nml
parents:
5
diff
changeset
|
1 <tool id="collapse_dataset" name="Collapse Collection" version="4.2"> |
4
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
2 <description>into single dataset in order of the collection</description> |
0
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
3 <command> |
1
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
4 <![CDATA[ |
2
4263967e8d40
planemo upload commit ee055b53af5f4a3420b35f3641d45c0559be37fc
nml
parents:
1
diff
changeset
|
5 |
4
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
6 ( |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
7 #if $one_header: |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
8 #if $filename.add_name: |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
9 awk '{if (NR==1) {print "Sample\t"$0}}' "$input_list[0]"; |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
10 #else: |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
11 awk '{if (NR==1) {print}}' "$input_list[0]"; |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
12 #end if |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
13 #end if |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
14 |
1
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
15 #for $f in $input_list# |
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
16 #if $filename.add_name: |
3
c0c988378838
planemo upload commit 6bde05f38465311441e89cfa070f03d3b6edad1b
nml
parents:
2
diff
changeset
|
17 #if str($filename.place_name) == "same_once": |
4
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
18 #if $one_header: |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
19 printf "$f.element_identifier\t"; tail -q -n +2 "$f"; |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
20 #else: |
6
830961c48e42
"planemo upload commit 9023eff03236d0c02dfa1c303f652cecb77cb09c"
nml
parents:
5
diff
changeset
|
21 printf "$f.element_identifier\t"; awk '{ print $0 } END { if (NR == 0 && NF == 0) { print "" } }' "$f"; |
4
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
22 #end if |
3
c0c988378838
planemo upload commit 6bde05f38465311441e89cfa070f03d3b6edad1b
nml
parents:
2
diff
changeset
|
23 #elif str($filename.place_name) == "same_multiple": |
4
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
24 #if $one_header: |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
25 awk '{if (NR!=1) {print "$f.element_identifier\t"$0}}' "$f"; |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
26 #else: |
6
830961c48e42
"planemo upload commit 9023eff03236d0c02dfa1c303f652cecb77cb09c"
nml
parents:
5
diff
changeset
|
27 awk '{print "$f.element_identifier\t"$0} END { if (NR == 0 && NF == 0) { print "$f.element_identifier\t" } }' "$f"; |
4
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
28 #end if |
3
c0c988378838
planemo upload commit 6bde05f38465311441e89cfa070f03d3b6edad1b
nml
parents:
2
diff
changeset
|
29 #elif str($filename.place_name) == "above": |
4
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
30 #if $one_header: |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
31 printf "$f.element_identifier\n"; tail -q -n +2 "$f"; |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
32 #else: |
3
c0c988378838
planemo upload commit 6bde05f38465311441e89cfa070f03d3b6edad1b
nml
parents:
2
diff
changeset
|
33 printf "$f.element_identifier\n"; cat "$f"; |
4
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
34 #end if |
1
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
35 #end if |
3
c0c988378838
planemo upload commit 6bde05f38465311441e89cfa070f03d3b6edad1b
nml
parents:
2
diff
changeset
|
36 #else: |
4
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
37 #if $one_header: |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
38 awk '{if (NR!=1) {print}}' "$f"; |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
39 #else: |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
40 cat "$f" ; |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
41 #end if |
1
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
42 #end if |
3
c0c988378838
planemo upload commit 6bde05f38465311441e89cfa070f03d3b6edad1b
nml
parents:
2
diff
changeset
|
43 |
1
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
44 #end for# |
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
45 ) |
0
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
46 > $output |
1
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
47 |
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
48 ]]> |
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
49 |
0
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
50 </command> |
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
51 <inputs> |
4
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
52 <param name="input_list" type="data" format="data" label="Collection of files to collapse into single dataset" help="" optional="false" multiple="true" /> |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
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."/> |
6
830961c48e42
"planemo upload commit 9023eff03236d0c02dfa1c303f652cecb77cb09c"
nml
parents:
5
diff
changeset
|
54 <conditional name="filename"> |
5
33151a38533a
"planemo upload commit 7b5d3aa437e73ebc4b950c6744055ae1c2196d0e"
nml
parents:
4
diff
changeset
|
55 <param name="add_name" type="boolean" display="checkboxes" label="Prepend File name"/> |
1
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
56 <when value="true"> |
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
57 <param name="place_name" type="select" label="Where to add dataset name"> |
3
c0c988378838
planemo upload commit 6bde05f38465311441e89cfa070f03d3b6edad1b
nml
parents:
2
diff
changeset
|
58 <option value="same_once">Same line and only once per dataset</option> |
c0c988378838
planemo upload commit 6bde05f38465311441e89cfa070f03d3b6edad1b
nml
parents:
2
diff
changeset
|
59 <option value="same_multiple">Same line and each line in dataset</option> |
1
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
60 <option value="above">Line Above</option> |
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
61 </param> |
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
62 </when> |
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
63 <when value='false'> |
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
64 </when> |
a78a70d4806c
planemo upload commit b8a959738e856ac80cb2d58423f455337cdd4853
nml
parents:
0
diff
changeset
|
65 </conditional> |
0
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
66 </inputs> |
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
67 <outputs> |
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
68 <data name="output" format_source="input_list" ></data> |
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
69 </outputs> |
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
70 <tests> |
3
c0c988378838
planemo upload commit 6bde05f38465311441e89cfa070f03d3b6edad1b
nml
parents:
2
diff
changeset
|
71 <test> |
4
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
72 <param name="input_list" value="input1,input2"/> |
3
c0c988378838
planemo upload commit 6bde05f38465311441e89cfa070f03d3b6edad1b
nml
parents:
2
diff
changeset
|
73 <output name="output" file="answer.txt"/> |
c0c988378838
planemo upload commit 6bde05f38465311441e89cfa070f03d3b6edad1b
nml
parents:
2
diff
changeset
|
74 </test> |
4
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
75 <test> |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
76 <param name="input_list" value="strain1.tsv,strain2.tsv"/> |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
77 <param name="one_header" value="True"/> |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
78 <param name="add_name" value="True"/> |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
79 <param name="place_name" value="same_multiple"/> |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
80 <output name="output" file="answer2.tsv"/> |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
81 </test> |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
82 <test> |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
83 <param name="input_list" value="strain1.tsv,strain2.tsv"/> |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
84 <param name="one_header" value="True"/> |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
85 <output name="output" file="answer3.tsv"/> |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
86 </test> |
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
87 |
0
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
88 </tests> |
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
89 <help> |
4
25136a2b0cfe
planemo upload commit 0340e76ceab90331dab96f4a6b8a9b7df5b8c1c2
nml
parents:
3
diff
changeset
|
90 Combines a list collection into a single file dataset with option to include dataset names or merge common header line. |
0
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
91 </help> |
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
92 <citations> |
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
93 </citations> |
49bd84e136c7
planemo upload commit f3c3ccefd8615c32713e0b0e8d231ce5151b2714-dirty
nml
parents:
diff
changeset
|
94 </tool> |