/
cutWrapper.xml
211 lines (172 loc) · 10 KB
/
cutWrapper.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<tool id="Cut1" name="Cut" version="1.0.2">
<description>columns from a table</description>
<command interpreter="perl">cutWrapper.pl "${input}" "${columnList}" "${delimiter}" "${out_file1}"</command>
<inputs>
<param name="columnList" type="text" value="c1,c2" label="Cut columns"/>
<param name="delimiter" type="select" label="Delimited by">
<option value="T">Tab</option>
<option value="Sp">Whitespace</option>
<option value="Dt">Dot</option>
<option value="C">Comma</option>
<option value="D">Dash</option>
<option value="U">Underscore</option>
<option value="P">Pipe</option>
</param>
<param format="txt" name="input" type="data" label="From"/>
</inputs>
<outputs>
<data format="tabular" name="out_file1" >
<actions>
<conditional name="delimiter">
<when value="T">
<conditional name="input">
<when datatype_isinstance="interval">
<action type="format" default="tabular">
<option type="from_param" name="columnList" column="0" offset="0"> <!-- chromCol is 1-->
<filter type="insert_column" column="0" value="interval"/>
<filter type="insert_column" ref="columnList" /> <!-- startCol -->
<filter type="insert_column" ref="columnList" /> <!-- endCol -->
<filter type="multiple_splitter" column="1" separator=","/>
<filter type="column_strip" column="1"/> <!-- get rid of all external whitespace -->
<filter type="string_function" column="1" name="lower" />
<filter type="param_value" column="1" value="^c\d{1,}$" compare="re_search" keep="True"/>
<filter type="column_strip" column="1" strip="c"/> <!-- get rid of c's -->
<filter type="boolean" column="1" cast="int" />
<filter type="multiple_splitter" column="2" separator=","/>
<filter type="column_strip" column="2"/> <!-- get rid of all external whitespace -->
<filter type="string_function" column="2" name="lower" />
<filter type="param_value" column="2" value="^c\d{1,}$" compare="re_search" keep="True"/>
<filter type="column_strip" column="2" strip="c"/> <!-- get rid of c's -->
<filter type="boolean" column="2" cast="int" />
<filter type="multiple_splitter" column="3" separator=","/>
<filter type="column_strip" column="3"/> <!-- get rid of all external whitespace -->
<filter type="string_function" column="3" name="lower" />
<filter type="param_value" column="3" value="^c\d{1,}$" compare="re_search" keep="True"/>
<filter type="column_strip" column="3" strip="c"/> <!-- get rid of c's -->
<filter type="boolean" column="3" cast="int" />
<filter type="metadata_value" ref="input" name="chromCol" column="1" />
<filter type="metadata_value" ref="input" name="startCol" column="2" />
<filter type="metadata_value" ref="input" name="endCol" column="3" />
</option>
</action>
<conditional name="out_file1">
<when datatype_isinstance="interval">
<action type="metadata" name="chromCol">
<option type="from_param" name="columnList" column="0" offset="0"> <!-- chromCol is 0-->
<filter type="multiple_splitter" column="0" separator=","/>
<filter type="column_strip" column="0"/> <!-- get rid of all external whitespace -->
<filter type="string_function" column="0" name="lower" />
<filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/>
<filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's -->
<filter type="insert_column" value="1" iterate="True" column="0"/>
<filter type="boolean" column="1" cast="int" />
<filter type="metadata_value" ref="input" name="chromCol" column="1" />
</option>
</action>
<action type="metadata" name="startCol">
<option type="from_param" name="columnList" column="0" offset="0"> <!-- startCol is 0-->
<filter type="multiple_splitter" column="0" separator=","/>
<filter type="column_strip" column="0"/> <!-- get rid of all external whitespace -->
<filter type="string_function" column="0" name="lower" />
<filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/>
<filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's -->
<filter type="insert_column" value="1" iterate="True" column="0"/>
<filter type="boolean" column="1" cast="int" />
<filter type="metadata_value" ref="input" name="startCol" column="1" />
</option>
</action>
<action type="metadata" name="endCol">
<option type="from_param" name="columnList" column="0" offset="0"> <!-- endCol is 0-->
<filter type="multiple_splitter" column="0" separator=","/>
<filter type="column_strip" column="0"/> <!-- get rid of all external whitespace -->
<filter type="string_function" column="0" name="lower" />
<filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/>
<filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's -->
<filter type="insert_column" value="1" iterate="True" column="0"/>
<filter type="boolean" column="1" cast="int" />
<filter type="metadata_value" ref="input" name="endCol" column="1" />
</option>
</action>
<action type="metadata" name="nameCol" default="0">
<option type="from_param" name="columnList" column="0" offset="0"> <!-- nameCol is 0-->
<filter type="multiple_splitter" column="0" separator=","/>
<filter type="column_strip" column="0"/> <!-- get rid of all external whitespace -->
<filter type="string_function" column="0" name="lower" />
<filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/>
<filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's -->
<filter type="insert_column" value="1" iterate="True" column="0"/>
<filter type="boolean" column="1" cast="int" />
<filter type="metadata_value" ref="input" name="nameCol" column="1" />
</option>
</action>
<action type="metadata" name="strandCol" default="0">
<option type="from_param" name="columnList" column="0" offset="0"> <!-- strandCol is 0-->
<filter type="multiple_splitter" column="0" separator=","/>
<filter type="column_strip" column="0"/> <!-- get rid of all external whitespace -->
<filter type="string_function" column="0" name="lower" />
<filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/>
<filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's -->
<filter type="insert_column" value="1" iterate="True" column="0"/>
<filter type="boolean" column="1" cast="int" />
<filter type="metadata_value" ref="input" name="strandCol" column="1" />
</option>
</action>
</when>
</conditional>
</when>
</conditional>
</when>
</conditional>
</actions>
</data>
</outputs>
<tests>
<test>
<param name="columnList" value="c1,c4,c2,c3"/>
<param name="delimiter" value="T"/>
<param name="input" value="1.bed"/>
<output name="out_file1" file="eq-cut.dat"/>
</test>
<test>
<param name="columnList" value="c1,c4,c2-c3" />
<param name="delimiter" value="T" />
<param name="input" value="1.bed" />
<output name="out_file1" file="eq-cut.dat" />
</test>
</tests>
<help>
.. class:: warningmark
**WARNING: This tool breaks column assignments.** To re-establish column assignments run the tools and click on the pencil icon in the latest history item.
.. class:: infomark
The output of this tool is always in tabular format (e.g., if your original delimiters are commas, they will be replaced with tabs). For example:
Cutting columns 1 and 3 from::
apple,is,good
windows,is,bad
will give::
apple good
windows bad
-----
**What it does**
This tool selects (cuts out) specified columns from the dataset.
- Columns are specified as **c1**, **c2**, and so on. Column count begins with **1**
- Columns can be specified in any order (e.g., **c2,c1,c6**)
- If you specify more columns than actually present - empty spaces will be filled with dots
-----
**Example**
Input dataset (six columns: c1, c2, c3, c4, c5, and c6)::
chr1 10 1000 gene1 0 +
chr2 100 1500 gene2 0 +
**cut** on columns "**c1,c4,c6**" will return::
chr1 gene1 +
chr2 gene2 +
**cut** on columns "**c6,c5,c4,c1**" will return::
+ 0 gene1 chr1
+ 0 gene2 chr2
**cut** on columns "**c1-c3**" will return::
chr1 10 1000
chr2 100 1500
**cut** on columns "**c8,c7,c4**" will return::
. . gene1
. . gene2
</help>
</tool>