Mercurial > repos > nml > csvtk_uniq
comparison uniq.xml @ 0:07d1c048ec1b draft default tip
"planemo upload for repository https://github.com/shenwei356/csvtk commit 3a97e1b79bf0c6cdd37d5c8fb497b85531a563ab"
author | nml |
---|---|
date | Tue, 19 May 2020 17:16:58 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:07d1c048ec1b |
---|---|
1 <tool id="csvtk_uniq" name="csvtk-unique" version="@VERSION@+@GALAXY_VERSION@"> | |
2 <description> first values in column(s)</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 uniq --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 unique ## | |
35 ############################### | |
36 -F -f '$column_text.in_text' | |
37 | |
38 ## If Only Wanted input columns ## | |
39 ################################## | |
40 #if $only_input_columns == 'Yes' | |
41 | csvtk cut -F -f '$column_text.in_text' | |
42 | |
43 #if $in_1.is_of_type("tabular"): | |
44 -t -T | |
45 #end if | |
46 #end if | |
47 | |
48 ## To output ## | |
49 ############### | |
50 > uniq | |
51 | |
52 ]]></command> | |
53 <inputs> | |
54 <expand macro="singular_input" /> | |
55 <expand macro="fields_input" /> | |
56 <expand macro="ignore_case" /> | |
57 <param name="only_input_columns" type="boolean" | |
58 truevalue="Yes" | |
59 falsevalue="No" | |
60 label="Keep only input column(s)" | |
61 help="All columns not specified as part of the input will be removed" | |
62 /> | |
63 <expand macro="global_parameters" /> | |
64 </inputs> | |
65 <outputs> | |
66 <data format_source="in_1" name="uniq" from_work_dir="uniq" label="${in_1.name} unique values in column(s) ${column_text.in_text}" /> | |
67 </outputs> | |
68 <tests> | |
69 <test> | |
70 <param name="in_1" value="blood_type.tsv" /> | |
71 <conditional name="column_text"> | |
72 <param name="select" value="string" /> | |
73 <param name="in_text" value="2,3" /> | |
74 </conditional> | |
75 <output name="uniq" file="uniq.tsv" ftype="tabular" /> | |
76 </test> | |
77 </tests> | |
78 <help><![CDATA[ | |
79 | |
80 Csvtk - Unique Help | |
81 ------------------- | |
82 | |
83 Info | |
84 #### | |
85 | |
86 Csvtk unique pulls the first unique values from the column(s) specified to create | |
87 | |
88 .. class:: warningmark | |
89 | |
90 Single quotes are not allowed in text inputs! | |
91 | |
92 @HELP_INPUT_DATA@ | |
93 | |
94 | |
95 Usage | |
96 ##### | |
97 | |
98 To run csvtk-uniq, all you need is a valid (as defined above) CSV or TSV and the column(s) that you want the to find unique values in. | |
99 | |
100 **Ex. Unique on one column:** | |
101 | |
102 Suppose you had a table as such | |
103 | |
104 +--------+--------+----------+ | |
105 | Name | Colour | Food | | |
106 +========+========+==========+ | |
107 | Eric | Blue | Apples | | |
108 +--------+--------+----------+ | |
109 | Darian | Blue | Pancakes | | |
110 +--------+--------+----------+ | |
111 | Daniel | Red | Apples | | |
112 +--------+--------+----------+ | |
113 | Frank | Blue | Apples | | |
114 +--------+--------+----------+ | |
115 | |
116 If you ran csvtk-unique on the Colour column, you would end up with the following table: | |
117 | |
118 +--------+--------+----------+ | |
119 | Name | Colour | Food | | |
120 +========+========+==========+ | |
121 | Eric | Blue | Apples | | |
122 +--------+--------+----------+ | |
123 | Daniel | Red | Apples | | |
124 +--------+--------+----------+ | |
125 | |
126 As only the first instance of the value in the column is kept. | |
127 | |
128 ---- | |
129 | |
130 **Ex. Unique on more than one column:** | |
131 | |
132 Same input table | |
133 | |
134 +--------+--------+----------+ | |
135 | Name | Colour | Food | | |
136 +========+========+==========+ | |
137 | Eric | Blue | Apples | | |
138 +--------+--------+----------+ | |
139 | Darian | Blue | Pancakes | | |
140 +--------+--------+----------+ | |
141 | Daniel | Red | Apples | | |
142 +--------+--------+----------+ | |
143 | Frank | Blue | Apples | | |
144 +--------+--------+----------+ | |
145 | |
146 Now if you ran csvtk-unique on the Colour and Food column, you would end up with the following table: | |
147 | |
148 +--------+--------+----------+ | |
149 | Name | Colour | Food | | |
150 +========+========+==========+ | |
151 | Eric | Blue | Apples | | |
152 +--------+--------+----------+ | |
153 | Darian | Blue | Pancakes | | |
154 +--------+--------+----------+ | |
155 | Daniel | Red | Apples | | |
156 +--------+--------+----------+ | |
157 | |
158 Only the last row was not kept as there was already a unique pair found of "Blue" and "Apples". | |
159 | |
160 **Note:** If you want to only have the unique values of the columns and get rid of the additional columns, run a "cut program" to cut out the wanted columns | |
161 and then csvtk unique to only get the wanted values. | |
162 | |
163 ---- | |
164 | |
165 @HELP_COLUMNS@ | |
166 | |
167 | |
168 @HELP_END_STATEMENT@ | |
169 | |
170 | |
171 ]]></help> | |
172 <expand macro="citations" /> | |
173 </tool> |