comparison split.xml @ 0:92509cf500a4 draft default tip

"planemo upload for repository https://github.com/shenwei356/csvtk commit 3a97e1b79bf0c6cdd37d5c8fb497b85531a563ab"
author nml
date Tue, 19 May 2020 17:18:02 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:92509cf500a4
1 <tool id="csvtk_split" name="csvtk-split" version="@VERSION@+@GALAXY_VERSION@">
2 <description>table into multiple files</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 ## Create directory and set input name ##
11 #########################################
12 mkdir -p ./output &&
13
14 #set input_name = str($in_1.name)
15 ln -s '$in_1' $input_name &&
16
17 ###################
18 ## Start Command ##
19 ###################
20
21 csvtk split -o ./output --num-cpus "\${GALAXY_SLOTS:-1}"
22
23 ## Add additional flags as specified ##
24 #######################################
25 $ignore_case
26 $global_param.illegal_rows
27 $global_param.empty_rows
28 $global_param.header
29 $global_param.lazy_quotes
30
31 ## Set Tabular input/output flag if input is tabular ##
32 #######################################################
33 #if $in_1.is_of_type("tabular"):
34 -t -T
35 #end if
36
37 ## Set Input ##
38 ###############
39 '$input_name'
40
41 ## Specify fields for splitting ##
42 ##################################
43 -F -f '$column_text.in_text'
44
45 ]]></command>
46 <inputs>
47 <expand macro="singular_input" />
48 <expand macro="fields_input" />
49 <expand macro="ignore_case" />
50 <expand macro="global_parameters" />
51 </inputs>
52 <outputs>
53 <collection name="list_split" type="list" label="${in_1.name} split on column ${column_text.in_text}">
54 <discover_datasets pattern="__designation_and_ext__" directory="output" visible="false" format="csv,tabular"/>
55 </collection>
56 </outputs>
57 <tests>
58 <test>
59 <param name="in_1" value="csv.csv" />
60 <conditional name="column_text">
61 <param name="select" value="string" />
62 <param name="in_text" value="1" />
63 </conditional>
64 <param name="ignore_case" value="true" />
65 <output_collection name="list_split" type="list">
66 <element name="csv-bob" file="csv-bob.csv" ftype="csv" />
67 <element name="csv-darian" file="csv-darian.csv" ftype="csv" />
68 <element name="csv-jack" file="csv-jack.csv" ftype="csv" />
69 </output_collection>
70 </test>
71 </tests>
72 <help><![CDATA[
73
74 Csvtk - Split Help
75 ------------------
76
77 Info
78 ####
79 Split input csv/tsv files into multiple csv/tsv files based on a column number(s) or name(s).
80
81 This tool will generate as many output files as there are unique data points in the selected column(s).
82
83 Examples below.
84
85 .. class:: warningmark
86
87 Single quotes are not allowed in text inputs!
88
89 @HELP_INPUT_DATA@
90
91
92 Usage
93 #####
94 Here we will demonstrate what the tool does when 1 column is selected or when 2+ columns are selected.
95
96 **Ex. Split input based on column 1:**
97
98 ::
99
100 Suppose we have the following input table that we want to split on column 2, the 'Colour' column:
101
102 +--------+--------+----------+
103 | Name | Colour | Food |
104 +========+========+==========+
105 | Eric | Blue | Apples |
106 +--------+--------+----------+
107 | Darian | Blue | Pancakes |
108 +--------+--------+----------+
109 | Daniel | Red | Apples |
110 +--------+--------+----------+
111 | Frank | Blue | Apples |
112 +--------+--------+----------+
113
114 --------------------------------------------------------------------------------
115
116 Splitting would yield the following 2 tables:
117
118 +--------+--------+----------+
119 | Name | Colour | Food |
120 +========+========+==========+ +--------+--------+----------+
121 | Eric | Blue | Apples | | Name | Colour | Food |
122 +--------+--------+----------+ + +========+========+==========+
123 | Darian | Blue | Pancakes | | Daniel | Red | Apples |
124 +--------+--------+----------+ +--------+--------+----------+
125 | Frank | Blue | Apples |
126 +--------+--------+----------+
127
128 ---------------------------------------------------------------------------------
129
130 ----
131
132 **Ex. Split on 2 columns:**
133
134 ::
135
136 Suppose keep the same input but instead split on both the 'Colour' and 'Food' columns:
137
138 +--------+--------+----------+
139 | Name | Colour | Food |
140 +========+========+==========+
141 | Eric | Blue | Apples |
142 +--------+--------+----------+
143 | Darian | Blue | Pancakes |
144 +--------+--------+----------+
145 | Daniel | Red | Apples |
146 +--------+--------+----------+
147 | Frank | Blue | Apples |
148 +--------+--------+----------+
149
150 --------------------------------------------------------------------------------------------------------
151
152 This split would yield the following three output files:
153
154 +--------+--------+----------+
155 | Name | Colour | Food | +--------+--------+----------+ +--------+--------+----------+
156 +========+========+==========+ | Name | Colour | Food | | Name | Colour | Food |
157 | Eric | Blue | Apples | + +========+========+==========+ + +========+========+==========+
158 +--------+--------+----------+ | Darian | Blue | Pancakes | | Daniel | Red | Apples |
159 | Frank | Blue | Apples | +--------+--------+----------+ +--------+--------+----------+
160 +--------+--------+----------+
161
162 Here, the value in the cell has to match for both columns for them to be output together. Frank and Eric
163 like apples and the colour blue so they get put together. And even though Darian likes the colour blue, he
164 prefers pancakes and thus gets his own output file.
165
166 ----
167
168 @HELP_END_STATEMENT@
169
170
171 ]]></help>
172 <expand macro="citations" />
173 </tool>