comparison collapse.xml @ 0:7ff05a1ffdd7 draft default tip

"planemo upload for repository https://github.com/shenwei356/csvtk commit 3a97e1b79bf0c6cdd37d5c8fb497b85531a563ab"
author nml
date Tue, 19 May 2020 17:18:56 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:7ff05a1ffdd7
1 <tool id="csvtk_collapse" name="csvtk-collapse" version="@VERSION@+@GALAXY_VERSION@">
2 <description> one field with selected fields as keys</description>
3 <macros>
4 <import>macros.xml</import>
5 </macros>
6 <expand macro="requirements" />
7 <expand macro="version_cmd" />
8 <command detect_errors="exit_code"><![CDATA[
9
10 ###################
11 ## Start Command ##
12 ###################
13
14 csvtk collapse --num-cpus "\${GALAXY_SLOTS:-1}"
15
16 ## Add additional flags as specified ##
17 #######################################
18 $ignore_case
19 $global_param.illegal_rows
20 $global_param.empty_rows
21 $global_param.header
22 $global_param.lazy_quotes
23
24 ## Set Tabular input/output flag if input is tabular ##
25 #######################################################
26 #if $in_1.is_of_type("tabular"):
27 -t -T
28 #end if
29
30 ## Set Input ##
31 ###############
32 '$in_1'
33
34 ## Specify fields for collapse ##
35 #################################
36 -F -f '$column_text.in_text'
37
38 ## other ##
39 ###########
40 -v '$value_column.in_text'
41 -s '$separator'
42
43 ## To output ##
44 ###############
45 > collapsed
46
47 ]]></command>
48 <inputs>
49 <expand macro="singular_input" />
50 <expand macro="fields_input" />
51 <conditional name="value_column" >
52 <param type="select" name="select" label="Select value column to collapse based on" argument="-v">
53 <option value="string">Column Name</option>
54 <option value="column">Column Number</option>
55 </param>
56 <when value="column">
57 <param type="data_column" name="in_text"
58 data_ref="in_1"
59 multiple="false"
60 label="Input column number"
61 help="Select column to collapse on"
62 />
63 </when>
64 <when value="string">
65 <param type="text" name="in_text"
66 optional="false"
67 label="Input column name"
68 help="Specify column name or number (ex. 1 for first column) to collapse on">
69 <expand macro="text_sanitizer" />
70 </param>
71 </when>
72 </conditional>
73 <param name="separator" type="text" value="; " argument="-s"
74 optional="false"
75 label="Separator string"
76 help="Input string of characters that will separate collapsed columns. The ' character is not allowed">
77 <expand macro="text_sanitizer" />
78 </param>
79 <expand macro="ignore_case" />
80 <expand macro="global_parameters" />
81 </inputs>
82 <outputs>
83 <data format_source="in_1" name="collapse" from_work_dir="collapsed" label="${in_1.name} with ${value_column.in_text} collapsed by ${column_text.in_text}" />
84 </outputs>
85 <tests>
86 <test>
87 <param name="in_1" value="blood_type.tsv" />
88 <conditional name="column_text">
89 <param name="select" value="string" />
90 <param name="in_text" value="2" />
91 </conditional>
92 <conditional name="value_column">
93 <param name="select" value="string" />
94 <param name="in_text" value="1" />
95 </conditional>
96 <param name="separator" value="; " />
97 <output name="collapse" file="collapsed.tsv" ftype="tabular" />
98 </test>
99 <test>
100 <param name="in_1" value="illegal.csv" />
101 <conditional name="column_text">
102 <param name="select" value="string" />
103 <param name="in_text" value="4" />
104 </conditional>
105 <conditional name="value_column">
106 <param name="select" value="string" />
107 <param name="in_text" value="1" />
108 </conditional>
109 <param name="separator" value="; " />
110 <section name="global_param">
111 <param name="illegal_rows" value="true" />
112 </section>
113 <output name="collapse" file="illegal_collapse.csv" />
114 </test>
115 </tests>
116 <help><![CDATA[
117
118 Csvtk - Collapse Help
119 ---------------------
120
121 Info
122 ####
123
124 Csvtk collapse combines one field with selected fields as keys for what to combine
125
126 .. class:: warningmark
127
128 Single quotes are not allowed in text inputs!
129
130 @HELP_INPUT_DATA@
131
132
133 Usage
134 #####
135
136 To run csvtk-collapse, all you need is a valid (as defined above) CSV or TSV file with a column you want to use
137 to collapse on based on any number of key column(s).
138
139 **Example collapse with one key column**
140
141 Input table:
142
143 +--------+--------+----------+
144 | Name | Colour | Food |
145 +========+========+==========+
146 | Eric | Blue | Apples |
147 +--------+--------+----------+
148 | Darian | Blue | Pancakes |
149 +--------+--------+----------+
150 | Daniel | Red | Apples |
151 +--------+--------+----------+
152 | Emily | Blue | Apples |
153 +--------+--------+----------+
154
155 Now if you wanted to find out who has the same favourite colour, you would specify the key column as "Colour" (-F -f)
156 and the value column as "Name" (-v) to generate the following table:
157
158 +--------+---------------------+
159 | Colour | Name |
160 +========+=====================+
161 | Red | Daniel |
162 +--------+---------------------+
163 | Blue | Eric; Darian; Emily |
164 +--------+---------------------+
165
166 --------
167
168 **Example collapse with two key columns**
169
170 Same input table, now our key columns are "Colour" and "Food" which could be input as "2,3" (-F -f)
171 and the same value column which would generate the following table:
172
173 +--------+----------+-------------+
174 | Colour | Food | Name |
175 +========+==========+=============+
176 | Blue | Pancakes | Darian |
177 +--------+----------+-------------+
178 | Red | Apples | Daniel |
179 +--------+----------+-------------+
180 | Blue | Apples | Eric; Emily |
181 +--------+----------+-------------+
182
183 ----
184
185 @HELP_COLUMNS@
186
187
188 @HELP_END_STATEMENT@
189
190
191 ]]></help>
192 <expand macro="citations" />
193 </tool>