comparison separate.xml @ 0:1be50033b476 draft default tip

"planemo upload for repository https://github.com/shenwei356/csvtk commit 3a97e1b79bf0c6cdd37d5c8fb497b85531a563ab"
author nml
date Tue, 19 May 2020 17:24:41 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1be50033b476
1 <tool id="csvtk_separate" name="csvtk-separate" version="@VERSION@+@GALAXY_VERSION@">
2 <description> column into multiple columns</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 #set column_number = $column_names.count(',') + 1
11
12 ###################
13 ## Start Command ##
14 ###################
15 csvtk separate --num-cpus "\${GALAXY_SLOTS:-1}"
16
17 ## Add additional flags as specified ##
18 #######################################
19 $ignore_case
20 $global_param.illegal_rows
21 $global_param.empty_rows
22 $global_param.header
23 $global_param.lazy_quotes
24
25 ## Set Tabular input/output flag if first input is tabular ##
26 #############################################################
27 #if $in_1.is_of_type("tabular"):
28 -t -T
29 #end if
30
31 ## Set input files ##
32 #####################
33 $in_1
34
35 ## Specify field to use ##
36 ##########################
37 -f '$column_text.in_text'
38
39 ## Specific inputs ##
40 #####################
41 -n '$column_names'
42 -N '$column_number'
43
44 #if $how_separate.how == 'sep'
45 -s '$how_separate.separator'
46 #else
47 -r '($how_separate.separator)'
48 #end if
49
50 --na '$fill_na'
51 $extra_data
52 $remove
53
54 ## To output ##
55 ###############
56 > separated
57
58 ]]></command>
59 <inputs>
60 <expand macro="singular_input"/>
61 <expand macro="singular_fields_input"/>
62 <conditional name="how_separate">
63 <param name="how" type="select" label="Separate input column by:">
64 <option value="sep">Separator String</option>
65 <option value="regex">Regexp</option>
66 </param>
67 <when value="sep">
68 <param name="separator" type="text" value="; " argument="-s"
69 label="Separator string"
70 help="Specify what string separates the data in the column">
71 <expand macro="text_sanitizer" />
72 </param>
73 </when>
74 <when value="regex">
75 <param name="separator" type="text" value=".+" argument="-r"
76 label="Set regex search pattern"
77 help="Use regex to match input column information. Example: ^(.+)$ will match all characters.
78 Regex help can be found below. The ' character is invalid">
79 <expand macro="text_sanitizer" />
80 </param>
81 </when>
82 </conditional>
83 <param name="column_names" type="text" value="new1,new2" argument="-n"
84 label="Specify new column name(s)"
85 help="More than one column can be made by separating the names by a comma (,). Ex. 'Genus,Species' would create two columns.">
86 <expand macro="text_sanitizer" />
87 </param>
88 <param name="extra_data" type="select" label="Handle extra data by:"
89 help="Extra data is data that does not fit into the new columns made. An example can be found below">
90 <option value="--drop">Dropping it</option>
91 <option value="--merge">Merging it</option>
92 </param>
93 <param name="fill_na" type="text" value="NA" argument="--na"
94 label="Character string to fill empty columns">
95 <expand macro="text_sanitizer" />
96 </param>
97 <param name="remove" type="boolean" checked="true" argument="-R"
98 truevalue="-R"
99 falsevalue=""
100 label="Remove input column"
101 />
102 <expand macro="ignore_case" />
103 <expand macro="global_parameters" />
104 </inputs>
105 <outputs>
106 <data format_source="in_1" from_work_dir="separated" name="separated" label="${in_1.name} column ${column_text.in_text} separated by ${how_separate.separator}" />
107 </outputs>
108 <tests>
109 <test>
110 <param name="in_1" value="collapsed.tsv" />
111 <conditional name="column_text">
112 <param name="select" value="string" />
113 <param name="in_text" value="2" />
114 </conditional>
115 <conditional name="how_separate">
116 <param name="how" value="sep" />
117 <param name="separator" value="; " />
118 </conditional>
119 <param name="column_names" value="1,2" />
120 <param name="fill_na" value="NA" />
121 <param name="extra_data" value="--drop" />
122 <param name="remove" value="true" />
123 <output name="separated" file="separated_1.tsv" ftype="tabular" />
124 </test>
125 <test>
126 <param name="in_1" value="collapsed.tsv" />
127 <conditional name="column_text">
128 <param name="select" value="string" />
129 <param name="in_text" value="2" />
130 </conditional>
131 <conditional name="how_separate">
132 <param name="how" value="sep" />
133 <param name="separator" value="; " />
134 </conditional>
135 <param name="column_names" value="1,2" />
136 <param name="fill_na" value="N/A" />
137 <param name="extra_data" value="--merge" />
138 <param name="remove" value="false" />
139 <output name="separated" file="separated_2.tsv" ftype="tabular" />
140 </test>
141 </tests>
142 <help><![CDATA[
143
144 Csvtk - Separate Help
145 ---------------------
146
147 Info
148 ####
149
150 Csvtk-separate separates columns into new columns based on either an input string or a regex expression.
151
152 The regex input for this tool is structured such that your regular expression **does not** need to start with with quotes or brackets. You can
153 start your expression with a `^` or just go straight into it
154
155 For example:
156
157 ::
158
159 Using `.+` as an input would be used in the code as '(.+)'
160
161 Using ^(.+)$ as an input would yield an input in the code as '(^(.+)$)'
162
163 .. class:: warningmark
164
165 Single quotes are not allowed in text inputs!
166
167 ----
168
169
170 @HELP_INPUT_DATA@
171
172
173 Usage
174 #####
175
176 **Ex. Separate with Dropping Data**
177
178 Suppose we had the following table and wanted to separate the scientific name column to create two new columns called genus and species:
179
180 +------------+------------------------------+
181 | Name | Scientific Name |
182 +============+==============================+
183 | Red Fox | Vulpes vulpes |
184 +------------+------------------------------+
185 | Salmonella | Salmonella enterica enterica |
186 +------------+------------------------------+
187
188 First, we set our separator to string and use just a space (' ') as the separator as the names are separated by spaces.
189
190 Then, we have to set the new column names which can be done by setting the column names to 'Genus,Species' (make sure that the names are
191 separated by a comma).
192
193 Finally, we have to decide if we want to drop the input column and if we want to merge the additional data or drop it.
194
195 First table will show dropping of additional data (the second enterica is additional as it cannot fit in its own column)
196
197 +------------+------------+----------+
198 | Name | Genus | Species |
199 +============+============+==========+
200 | Red Fox | Vulpes | vulpes |
201 +------------+------------+----------+
202 | Salmonella | Salmonella | enterica |
203 +------------+------------+----------+
204
205 |
206
207 Here is what it would look like if we merged data instead:
208
209 +------------+------------+-------------------+
210 | Name | Genus | Species |
211 +============+============+===================+
212 | Red Fox | Vulpes | vulpes |
213 +------------+------------+-------------------+
214 | Salmonella | Salmonella | enterica enterica |
215 +------------+------------+-------------------+
216
217 ----
218
219
220 @HELP_COLUMNS@
221
222
223 @HELP_END_STATEMENT@
224
225
226 ]]></help>
227 <expand macro="citations" />
228 </tool>