comparison cut.xml @ 0:5b5330a8dfac draft default tip

"planemo upload for repository https://github.com/shenwei356/csvtk commit 3a97e1b79bf0c6cdd37d5c8fb497b85531a563ab"
author nml
date Tue, 19 May 2020 17:09:36 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:5b5330a8dfac
1 <tool id="csvtk_cut" name="csvtk-cut" version="@VERSION@+@GALAXY_VERSION@">
2 <description> and keep selected 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 ###################
11 ## Start Command ##
12 ###################
13
14 csvtk cut --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 ## To output ##
39 ###############
40 > cut
41
42 ]]></command>
43 <inputs>
44 <expand macro="singular_input" />
45 <expand macro="fields_input" />
46 <expand macro="ignore_case" />
47 <expand macro="global_parameters" />
48 </inputs>
49 <outputs>
50 <data format_source="in_1" name="cut" from_work_dir="cut" label="${in_1.name} cut out column(s) ${column_text.in_text}" />
51 </outputs>
52 <tests>
53 <test>
54 <param name="in_1" value="plot.csv" />
55 <conditional name="column_text">
56 <param name="select" value="column" />
57 <param name="in_text" value="2,3" />
58 </conditional>
59 <output name="cut" file="cut_1.csv" ftype="csv" />
60 </test>
61 <test>
62 <param name="in_1" value="plot.csv" />
63 <conditional name="column_text">
64 <param name="select" value="string" />
65 <param name="in_text" value="-2" />
66 </conditional>
67 <output name="cut" file="cut_2.csv" ftype="csv" />
68 </test>
69 </tests>
70 <help><![CDATA[
71
72 Csvtk - Cut Help
73 ----------------
74
75 Info
76 ####
77
78 Csvtk Cut cuts specified columns to create an output
79
80 Csvtk Cut can be used to keep columns with normal inputs such as the column name or number. It
81 can also be used to specify columns to remove with a "-" at the start. An example can be seen below.
82
83 .. class:: warningmark
84
85 Single quotes are not allowed in text inputs!
86
87 @HELP_INPUT_DATA@
88
89
90 Usage
91 #####
92
93 To run csvtk-cut, all you need is a valid (as defined above) CSV or TSV file
94
95 **Example cut to keep columns**
96
97 Input table:
98
99 +--------+--------+----------+
100 | Name | Colour | Food |
101 +========+========+==========+
102 | Eric | Blue | Apples |
103 +--------+--------+----------+
104 | Darian | Blue | Pancakes |
105 +--------+--------+----------+
106 | Daniel | Red | Apples |
107 +--------+--------+----------+
108 | Emily | Blue | Apples |
109 +--------+--------+----------+
110
111 Now if we wanted to cut out and keep columns 1 and 2, our column input string (-F -f) would be "1,2"
112 and would result in the following table:
113
114 +--------+--------+
115 | Name | Colour |
116 +========+========+
117 | Eric | Blue |
118 +--------+--------+
119 | Darian | Blue |
120 +--------+--------+
121 | Daniel | Red |
122 +--------+--------+
123 | Emily | Blue |
124 +--------+--------+
125
126 --------
127
128 **Example cut to remove column**
129
130 Similar input table as above:
131
132 +--------+--------+----------+-----------------+
133 | Name | Colour | Food | Unneeded Column |
134 +========+========+==========+=================+
135 | Eric | Blue | Apples | fadah |
136 +--------+--------+----------+-----------------+
137 | Darian | Blue | Pancakes | ewq3rfa |
138 +--------+--------+----------+-----------------+
139 | Daniel | Red | Apples | feda356t |
140 +--------+--------+----------+-----------------+
141 | Emily | Blue | Apples | a342qadef |
142 +--------+--------+----------+-----------------+
143
144 Now, we have a garbage last column and we want to keep everything else. We could input "1,2,3" to keep the first 3 columns,
145 OR if we set the input column name to "-4" or "-Unneeded Column" csvtk cut will remove the final column giving the following:
146
147 +--------+--------+----------+
148 | Name | Colour | Food |
149 +========+========+==========+
150 | Eric | Blue | Apples |
151 +--------+--------+----------+
152 | Darian | Blue | Pancakes |
153 +--------+--------+----------+
154 | Daniel | Red | Apples |
155 +--------+--------+----------+
156 | Emily | Blue | Apples |
157 +--------+--------+----------+
158
159 ----
160
161 @HELP_COLUMNS@
162
163
164 @HELP_END_STATEMENT@
165
166
167 ]]></help>
168 <expand macro="citations" />
169 </tool>