comparison gather.xml @ 0:6acd7c0ad672 draft default tip

"planemo upload for repository https://github.com/shenwei356/csvtk commit 3a97e1b79bf0c6cdd37d5c8fb497b85531a563ab"
author nml
date Tue, 19 May 2020 17:21:15 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:6acd7c0ad672
1 <tool id="csvtk_gather" name="csvtk-gather" version="@VERSION@+@GALAXY_VERSION@">
2 <description> column(s) into key-value pairs</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 csvtk gather --num-cpus "\${GALAXY_SLOTS:-1}"
14
15 ## Add additional flags as specified ##
16 #######################################
17 $global_param.illegal_rows
18 $global_param.empty_rows
19 $global_param.header
20 $global_param.lazy_quotes
21
22 ## Set Tabular input/output flag if first input is tabular ##
23 #############################################################
24 #if $in_1.is_of_type("tabular"):
25 -t -T
26 #end if
27
28 ## Set input files ##
29 #####################
30 $in_1
31
32 ## Specify fields to use ##
33 ###########################
34 -F -f '$column_text.in_text'
35
36 ## Specific inputs ##
37 #####################
38 -k '$key_string'
39 -v '$value_string'
40
41 ## Keep only Key/value columns ##
42 #################################
43 #if $only_input_columns == 'Yes'
44 | csvtk cut -F -f '$key_string','$value_string'
45
46 #if $in_1.is_of_type("tabular"):
47 -t -T
48 #end if
49 #end if
50
51 ## To output ##
52 ###############
53 > gathered
54
55 ]]></command>
56 <inputs>
57 <expand macro="singular_input"/>
58 <expand macro="fields_input"/>
59 <param name="key_string" type="text"
60 optional="false"
61 argument="-k"
62 label="Name of Key Column"
63 help="Set name of key column that gathered field will output to">
64 <expand macro="text_sanitizer" />
65 </param>
66 <param name="value_string" type="text"
67 optional="false"
68 argument="-v"
69 label="Name of Value Column">
70 <expand macro="text_sanitizer" />
71 </param>
72 <param name="only_input_columns" type="boolean"
73 truevalue="Yes"
74 falsevalue="No"
75 label="Keep only Key and Value column(s) generated"
76 help="Removes all columns but the input labeled key and value columns"
77 />
78 <expand macro="global_parameters" />
79 </inputs>
80 <outputs>
81 <data format_source="in_1" from_work_dir="gathered" name="gathered" label="${in_1.name} gathered on column(s) ${column_text.in_text}" />
82 </outputs>
83 <tests>
84 <test>
85 <param name="in_1" value="csv.csv" />
86 <param name="key_string" value="1" />
87 <param name="value_string" value="2" />
88 <conditional name="column_text">
89 <param name="select" value="string" />
90 <param name="in_text" value="1" />
91 </conditional>
92 <output name="gathered" file="gathered.csv" ftype="csv" />
93 </test>
94 </tests>
95 <help><![CDATA[
96
97 Csvtk - Gather Help
98 -------------------
99
100 Info
101 ####
102
103 Csvtk gather gathers columns into key-value pairs
104
105 .. class:: warningmark
106
107 Single quotes are not allowed in text inputs!
108
109 @HELP_INPUT_DATA@
110
111
112 Usage
113 #####
114
115 **Ex. Gather with column 1:**
116
117 Suppose we had the following table:
118
119 +---------+------------+-----------+
120 | Name | Blood Type | Frequency |
121 +=========+============+===========+
122 | Bob | A | 4 |
123 +---------+------------+-----------+
124 | Jacob | B | 5 |
125 +---------+------------+-----------+
126 | Matthew | O | 12 |
127 +---------+------------+-----------+
128 | Daniel | AB | 1 |
129 +---------+------------+-----------+
130
131 If we did a gather on column 1 creating a key column called "Key" and a value column called "Output"
132 we would get the following result.
133
134 +------------+-----------+------+---------+
135 | Blood Type | Frequency | Key | Output |
136 +============+===========+======+=========+
137 | A | 4 | Name | Bob |
138 +------------+-----------+------+---------+
139 | B | 4 | Name | Jacob |
140 +------------+-----------+------+---------+
141 | O | 12 | Name | Matthew |
142 +------------+-----------+------+---------+
143 | AB | 1 | Name | Daniel |
144 +------------+-----------+------+---------+
145
146 ----
147
148 **Ex. Gather with 2 columns:**
149
150 Same starting table
151
152 +---------+------------+-----------+
153 | Name | Blood Type | Frequency |
154 +=========+============+===========+
155 | Bob | A | 4 |
156 +---------+------------+-----------+
157 | Jacob | B | 5 |
158 +---------+------------+-----------+
159 | Matthew | O | 12 |
160 +---------+------------+-----------+
161 | Daniel | AB | 1 |
162 +---------+------------+-----------+
163
164 Now, if we specify the input columns as "1,2" to get columns 1 and 2 targeted as the key columns (called key),
165 we get the following output:
166
167 +-----------+------------+---------+
168 | Frequency | Key | Output |
169 +===========+============+=========+
170 | 4 | Name | Bob |
171 +-----------+------------+---------+
172 | 4 | Blood Type | A |
173 +-----------+------------+---------+
174 | 4 | Name | Jacob |
175 +-----------+------------+---------+
176 | 4 | Blood Type | B |
177 +-----------+------------+---------+
178 | 12 | Name | Matthew |
179 +-----------+------------+---------+
180 | 12 | Blood Type | O |
181 +-----------+------------+---------+
182 | 1 | Name | Daniel |
183 +-----------+------------+---------+
184 | 1 | Blood Type | AB |
185 +-----------+------------+---------+
186
187 ----
188
189 @HELP_COLUMNS@
190
191
192 @HELP_END_STATEMENT@
193
194
195 ]]></help>
196 <expand macro="citations" />
197 </tool>