comparison awklike-mutate.xml @ 0:8e1a86b7fbc4 draft default tip

"planemo upload for repository https://github.com/shenwei356/csvtk commit 3a97e1b79bf0c6cdd37d5c8fb497b85531a563ab"
author nml
date Tue, 19 May 2020 17:15:08 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:8e1a86b7fbc4
1 <tool id="csvtk_awklike_mutate" name="csvtk-advanced-mutate" version="@VERSION@+@GALAXY_VERSION@">
2 <description> new column by awk-like artithmetic/string expressions</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 mutate2 --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 ## Specific inputs ##
33 #####################
34 -e '$in_text'
35 -n '$column_name'
36 -L '$additional.digit_number'
37 $additional.digit_strings
38
39 ## To output ##
40 ###############
41 > mutated
42
43 ]]></command>
44 <inputs>
45 <expand macro="singular_input"/>
46 <param name="in_text" type="text" argument="-e" label="Awk-like artithmetic/string expression" >
47 <help>
48 <![CDATA[
49 Examples:
50 - '$age>12'
51 - '$1 > $3'
52 - '$name=="abc"'
53 - '$1 % 2 == 0'
54 More info is available in the help section below. The ' character is invalid and will be replaced, thus you must
55 surround strings with double quotes ("string") instead.
56 ]]>
57 </help>
58 <expand macro="text_sanitizer" />
59 </param>
60 <param name="column_name" type="text" argument="-n" value="New_Column"
61 label="New column name"
62 help="Specify what the new column should be called">
63 <expand macro="text_sanitizer" />
64 </param>
65 <section name="additional" title="Additional Parameters" expanded="true">
66 <param name="digit_number" type="integer" value="2" argument="-L"
67 label="Number of digits after the decimal to keep"
68 help="Keep input integer number of decimal places"
69 />
70 <param name="digit_strings" type="boolean" checked="false" argument="-s"
71 truevalue="-s"
72 falsevalue=""
73 label="Input digits as strings"
74 help="Treat digits as string to avoid converting big digits into scientific notation. No longer supports mathematical operations if set to yes"
75 />
76 </section>
77 <expand macro="global_parameters" />
78 </inputs>
79 <outputs>
80 <data format_source="in_1" from_work_dir="mutated" name="mutated" label="${in_1.name} mutated by ${in_text}" />
81 </outputs>
82 <tests>
83 <test>
84 <param name="in_1" value="awk_mutate_input.csv" />
85 <param name="in_text" value="$2*$3" />
86 <param name="column_name" value="CFU/ml" />
87 <section name="additional">
88 <param name="digit_number" value="0" />
89 </section>
90 <output name="mutated" file="awk_mutate_output.csv" ftype="csv" />
91 </test>
92 </tests>
93 <help><![CDATA[
94
95 Csvtk - Mutate2 Help
96 --------------------
97
98 Info
99 ####
100
101 Csvtk advanced mutate (also called mutate2) outputs a column that evaluates the input expression. Please see the
102 `documentation <https://github.com/Knetic/govaluate/blob/master/MANUAL.md>`_ for further details and examples on how to write expressions.
103
104 Also checkout the tools `website <https://bioinf.shenwei.me/csvtk/usage/#mutate2>`_ for additional ideas on how to structure expressions!
105
106 .. class:: warningmark
107
108 Single quotes are not allowed in text inputs!
109
110 .. class:: note
111
112 If your wanted column header has a space in it, use the column number. Example: Use $1 if column #1 is called "Colony Counts"
113
114 Supported operators and types:
115
116 - Modifiers: + - / * & | ^ ** % >> <<
117 - Comparators: > >= < <= == != =~ !~
118 - Logical ops: || &&
119 - Numeric constants, as 64-bit floating point (12345.678)
120 - String constants (double quotes only: "foobar")
121 - Date constants (double quotes)
122 - Boolean constants: true false
123 - Parenthesis to control order of evaluation ( )
124 - Arrays (anything separated by , within parenthesis: (1, 2, "foo"))
125 - Prefixes: ! - ~
126 - Ternary conditional: ? :
127 - Null coalescence: ??
128
129 ----
130
131 @HELP_INPUT_DATA@
132
133
134 Usage
135 #####
136
137 Some quick and simple examples:
138
139 **Ex. Mutate2 with Numbers:**
140
141 Suppose we had the following table:
142
143 +---------------+------------+----------+
144 | Culture Label | Cell Count | Dilution |
145 +===============+============+==========+
146 | ECo-1 | 2523 | 1000 |
147 +---------------+------------+----------+
148 | LPn-1 | 100 | 1000000 |
149 +---------------+------------+----------+
150 | LPn-2 | 4 | 1000 |
151 +---------------+------------+----------+
152
153 If we wanted to evaluate the CFU/ml of these samples (supposing a 1ml volume plated) with this tool,
154 we could create give our new column a name like "CFU/ml" and then use the expression "$2*$3" to get:
155
156 +---------------+------------+----------+-----------+
157 | Culture Label | Cell Count | Dilution | CFU/ml |
158 +===============+============+==========+===========+
159 | ECo-1 | 2523 | 1000 | 2523000 |
160 +---------------+------------+----------+-----------+
161 | LPn-1 | 100 | 1000000 | 100000000 |
162 +---------------+------------+----------+-----------+
163 | LPn-2 | 4 | 1000 | 4000 |
164 +---------------+------------+----------+-----------+
165
166 Note how $2 was used to get column 2 due to it containing a space in its name
167
168 ----
169
170 @HELP_COLUMNS@
171
172
173 @HELP_END_STATEMENT@
174
175
176 ]]></help>
177 <expand macro="citations" />
178 </tool>