Mercurial > repos > jjohnson > query_tabular
comparison query_tabular.xml @ 21:357fe86f245d draft
Uploaded
author | jjohnson |
---|---|
date | Fri, 14 Jul 2017 17:34:22 -0400 |
parents | ab27c4bd14b9 |
children | bed5018e7ae3 |
comparison
equal
deleted
inserted
replaced
20:ab27c4bd14b9 | 21:357fe86f245d |
---|---|
1 <tool id="query_tabular" name="Query Tabular" version="5.0.0"> | 1 <tool id="query_tabular" name="Query Tabular" version="1.0.0"> |
2 <description>using sqlite sql</description> | 2 <description>using sqlite sql</description> |
3 | 3 |
4 <macros> | 4 <macros> |
5 <import>macros.xml</import> | 5 <import>macros.xml</import> |
6 </macros> | 6 </macros> |
7 | 7 |
8 <requirements> | 8 <requirements> |
9 </requirements> | 9 </requirements> |
10 <stdio> | 10 |
11 <exit_code range="1:" /> | 11 <command detect_errors="exit_code"><![CDATA[ |
12 </stdio> | 12 cat '$query_file' && |
13 <command><![CDATA[ | |
14 cat $query_file && | |
15 #if $add_to_database.withdb: | 13 #if $add_to_database.withdb: |
16 #if $save_db: | 14 #if $save_db: |
17 cp "$add_to_database.withdb" "$sqlitedb" && | 15 cp '$add_to_database.withdb' '$sqlitedb' && |
18 #else: | 16 #else: |
19 cp "$add_to_database.withdb" "$workdb" && | 17 cp '$add_to_database.withdb' '$workdb' && |
20 #end if | 18 #end if |
21 #end if | 19 #end if |
22 python $__tool_directory__/query_tabular.py | 20 python '$__tool_directory__/query_tabular.py' |
23 #if $save_db | 21 #if $save_db |
24 -s "$sqlitedb" | 22 -s '$sqlitedb' |
25 #else | 23 #else |
26 -s $workdb | 24 -s '$workdb' |
27 #end if | 25 #end if |
28 -j $table_json | 26 -j '$table_json' |
29 #if $sqlquery: | 27 #if $sqlquery: |
30 -Q "$query_file" | 28 -Q '$query_file' |
31 $no_header | 29 $no_header |
32 -o $output | 30 -o '$output' |
33 #end if | 31 #end if |
34 ]]></command> | 32 ]]></command> |
35 <configfiles> | 33 <configfiles> |
36 <configfile name="query_file"> | 34 <configfile name="query_file"> |
37 $sqlquery | 35 $sqlquery |
143 <data format="tabular" name="output" label="query results on ${on_string}"> | 141 <data format="tabular" name="output" label="query results on ${on_string}"> |
144 <filter>not save_db or (sqlquery and len(sqlquery.strip()) > 0)</filter> | 142 <filter>not save_db or (sqlquery and len(sqlquery.strip()) > 0)</filter> |
145 </data> | 143 </data> |
146 </outputs> | 144 </outputs> |
147 <tests> | 145 <tests> |
148 | |
149 <test> | 146 <test> |
150 <repeat name="tables"> | 147 <repeat name="tables"> |
151 <param name="table" ftype="tabular" value="customers.tsv"/> | 148 <param name="table" ftype="tabular" value="customers.tsv"/> |
152 <param name="table_name" value="customers"/> | 149 <section name="input_opts"> |
153 <param name="col_names" value="CustomerID,FirstName,LastName,Email,DOB,Phone"/> | 150 <repeat name="linefilters"> |
151 <conditional name="filter"> | |
152 <param name="filter_type" value="comment"/> | |
153 <param name="comment_char" value="35"/> | |
154 </conditional> | |
155 </repeat> | |
156 </section> | |
157 <section name="tbl_opts"> | |
158 <param name="table_name" value="customers"/> | |
159 <param name="col_names" value="CustomerID,FirstName,LastName,Email,DOB,Phone"/> | |
160 </section> | |
154 </repeat> | 161 </repeat> |
155 <repeat name="tables"> | 162 <repeat name="tables"> |
156 <param name="table" ftype="tabular" value="sales.tsv"/> | 163 <param name="table" ftype="tabular" value="sales.tsv"/> |
157 <param name="table_name" value="sales"/> | 164 <section name="input_opts"> |
158 <param name="col_names" value="CustomerID,Date,SaleAmount"/> | 165 <repeat name="linefilters"> |
166 <conditional name="filter"> | |
167 <param name="filter_type" value="comment"/> | |
168 <param name="comment_char" value="35"/> | |
169 </conditional> | |
170 </repeat> | |
171 </section> | |
172 <section name="tbl_opts"> | |
173 <param name="table_name" value="sales"/> | |
174 <param name="col_names" value="CustomerID,Date,SaleAmount"/> | |
175 </section> | |
159 </repeat> | 176 </repeat> |
160 <param name="sqlquery" value="SELECT FirstName,LastName,sum(SaleAmount) as "TotalSales" FROM customers join sales on customers.CustomerID = sales.CustomerID GROUP BY customers.CustomerID ORDER BY TotalSales DESC"/> | 177 <param name="sqlquery" value="SELECT FirstName,LastName,sum(SaleAmount) as "TotalSales" FROM customers join sales on customers.CustomerID = sales.CustomerID GROUP BY customers.CustomerID ORDER BY TotalSales DESC"/> |
161 <output name="output" file="sales_results.tsv"/> | 178 <output name="output" file="sales_results.tsv"/> |
162 </test> | 179 </test> |
163 | 180 |
164 <test> | 181 <test> |
165 <repeat name="tables"> | 182 <repeat name="tables"> |
166 <param name="table" ftype="tabular" value="customers.tsv"/> | 183 <param name="table" ftype="tabular" value="customers.tsv"/> |
167 <param name="col_names" value=",FirstName,LastName,,DOB,"/> | 184 <section name="input_opts"> |
185 <repeat name="linefilters"> | |
186 <conditional name="filter"> | |
187 <param name="filter_type" value="comment"/> | |
188 <param name="comment_char" value="35"/> | |
189 </conditional> | |
190 </repeat> | |
191 </section> | |
192 <section name="tbl_opts"> | |
193 <param name="col_names" value=",FirstName,LastName,,DOB,"/> | |
194 </section> | |
168 </repeat> | 195 </repeat> |
169 <repeat name="tables"> | 196 <repeat name="tables"> |
170 <param name="table" ftype="tabular" value="sales.tsv"/> | 197 <param name="table" ftype="tabular" value="sales.tsv"/> |
198 <section name="input_opts"> | |
199 <repeat name="linefilters"> | |
200 <conditional name="filter"> | |
201 <param name="filter_type" value="skip"/> | |
202 <param name="skip_lines" value="1"/> | |
203 </conditional> | |
204 </repeat> | |
205 </section> | |
171 </repeat> | 206 </repeat> |
172 <param name="sqlquery" value="SELECT FirstName,LastName,sum(t2.c3) as "TotalSales" FROM t1 join t2 on t1.c1 = t2.c1 GROUP BY t1.c1 ORDER BY TotalSales DESC;"/> | 207 <param name="sqlquery" value="SELECT FirstName,LastName,sum(t2.c3) as "TotalSales" FROM t1 join t2 on t1.c1 = t2.c1 GROUP BY t1.c1 ORDER BY TotalSales DESC;"/> |
173 <output name="output" file="sales_results.tsv"/> | 208 <output name="output" file="sales_results.tsv"/> |
174 </test> | 209 </test> |
175 | 210 |
176 <test> | 211 <test> |
177 <repeat name="tables"> | 212 <repeat name="tables"> |
178 <param name="table" ftype="tabular" value="customers.tsv"/> | 213 <param name="table" ftype="tabular" value="customers.tsv"/> |
179 <param name="col_names" value=",FirstName,LastName,,BirthDate,"/> | 214 <section name="input_opts"> |
215 <repeat name="linefilters"> | |
216 <conditional name="filter"> | |
217 <param name="filter_type" value="skip"/> | |
218 <param name="skip_lines" value="1"/> | |
219 </conditional> | |
220 </repeat> | |
221 </section> | |
222 <section name="tbl_opts"> | |
223 <param name="col_names" value=",FirstName,LastName,,BirthDate,"/> | |
224 </section> | |
180 </repeat> | 225 </repeat> |
181 <param name="sqlquery" value="select FirstName,LastName,re_sub('^\d{2}(\d{2})-(\d\d)-(\d\d)','\3/\2/\1',BirthDate) as "DOB" from t1 WHERE re_search('[hp]er',c4)"/> | 226 <param name="sqlquery" value="select FirstName,LastName,re_sub('^\d{2}(\d{2})-(\d\d)-(\d\d)','\3/\2/\1',BirthDate) as "DOB" from t1 WHERE re_search('[hp]er',c4)"/> |
182 <output name="output" file="regex_results.tsv"/> | 227 <output name="output" file="regex_results.tsv"/> |
183 </test> | 228 </test> |
184 | 229 |
185 <test> | 230 <test> |
186 <repeat name="tables"> | 231 <repeat name="tables"> |
187 <param name="table" ftype="tabular" value="IEDB.tsv"/> | 232 <param name="table" ftype="tabular" value="IEDB.tsv"/> |
188 <param name="table_name" value="iedb"/> | 233 <section name="input_opts"> |
189 <param name="col_names" value="ID,allele,seq_num,start,end,length,peptide,method,percentile_rank,ann_ic50,ann_rank,smm_ic50,smm_rank,comblib_sidney2008_score,comblib_sidney2008_rank,netmhcpan_ic50,netmhcpan_rank"/> | 234 <repeat name="linefilters"> |
235 <conditional name="filter"> | |
236 <param name="filter_type" value="comment"/> | |
237 <param name="comment_char" value="35"/> | |
238 </conditional> | |
239 </repeat> | |
240 </section> | |
241 <section name="tbl_opts"> | |
242 <param name="table_name" value="iedb"/> | |
243 <param name="col_names" value="ID,allele,seq_num,start,end,length,peptide,method,percentile_rank,ann_ic50,ann_rank,smm_ic50,smm_rank,comblib_sidney2008_score,comblib_sidney2008_rank,netmhcpan_ic50,netmhcpan_rank"/> | |
244 </section> | |
190 </repeat> | 245 </repeat> |
191 <repeat name="tables"> | 246 <repeat name="tables"> |
192 <param name="table" ftype="tabular" value="netMHC_summary.tsv"/> | 247 <param name="table" ftype="tabular" value="netMHC_summary.tsv"/> |
193 <param name="table_name" value="mhc_summary"/> | 248 <section name="input_opts"> |
194 <param name="col_names" value="pos,peptide,logscore,affinity,Bind_Level,Protein,Allele"/> | 249 <repeat name="linefilters"> |
195 </repeat> | 250 <conditional name="filter"> |
196 <param name="sqlquery" value="select iedb.ID,iedb.peptide,iedb.start,iedb.end,iedb.percentile_rank,mhc_summary.logscore,mhc_summary.affinity,mhc_summary.Bind_Level from iedb left outer join mhc_summary on iedb.peptide = mhc_summary.peptide order by affinity,Bind_Level"/> | 251 <param name="filter_type" value="skip"/> |
252 <param name="skip_lines" value="1"/> | |
253 </conditional> | |
254 </repeat> | |
255 </section> | |
256 <section name="tbl_opts"> | |
257 <param name="table_name" value="mhc_summary"/> | |
258 <param name="col_names" value="pos,peptide,logscore,affinity,Bind_Level,Protein,Allele"/> | |
259 </section> | |
260 </repeat> | |
261 <param name="sqlquery" value="select iedb.ID,iedb.peptide,iedb.start,iedb.end,iedb.percentile_rank,mhc_summary.logscore,mhc_summary.affinity,mhc_summary.Bind_Level from iedb left outer join mhc_summary on iedb.peptide = mhc_summary.peptide order by affinity,Bind_Level,percentile_rank"/> | |
197 <output name="output" file="query_results.tsv"/> | 262 <output name="output" file="query_results.tsv"/> |
198 </test> | 263 </test> |
199 | 264 |
200 <test> | 265 <test> |
266 <section name="add_to_database"> | |
267 <param name="withdb" ftype="sqlite" value="testdb.sqlite"/> | |
268 </section> | |
201 <repeat name="tables"> | 269 <repeat name="tables"> |
202 <param name="table" ftype="tabular" value="pets.tsv"/> | 270 <param name="table" ftype="tabular" value="pets.tsv"/> |
203 <repeat name="linefilters"> | 271 <section name="input_opts"> |
204 <param name="filter_type" value="comment"/> | 272 <repeat name="linefilters"> |
205 <param name="comment_char" value="35"/> | 273 <conditional name="filter"> |
206 </repeat> | 274 <param name="filter_type" value="regex"/> |
207 <repeat name="linefilters"> | 275 <param name="regex_pattern" value="^\d+"/> |
208 <param name="filter_type" value="append_line_num"/> | 276 <param name="regex_action" value="include_find"/> |
209 </repeat> | 277 </conditional> |
210 <repeat name="linefilters"> | 278 </repeat> |
211 <param name="filter_type" value="select_columns"/> | 279 <repeat name="linefilters"> |
212 <param name="columns" value="7,2,3,4,1"/> | 280 <conditional name="filter"> |
213 </repeat> | 281 <param name="filter_type" value="comment"/> |
214 <repeat name="linefilters"> | 282 <param name="comment_char" value="35"/> |
215 <param name="filter_type" value="replace"/> | 283 </conditional> |
216 <param name="column" value="c4"/> | 284 </repeat> |
217 <param name="regex_pattern" value="(\d+)/(\d+)/(\d+)"/> | 285 <repeat name="linefilters"> |
218 <param name="regex_replace" value="19\3-\2-\1"/> | 286 <conditional name="filter"> |
219 </repeat> | 287 <param name="filter_type" value="append_line_num"/> |
220 <param name="table_name" value="people"/> | 288 </conditional> |
221 <param name="col_names" value="id,first,last,dob,pets"/> | 289 </repeat> |
222 | 290 <repeat name="linefilters"> |
223 </repeat> | 291 <conditional name="filter"> |
292 <param name="filter_type" value="select_columns"/> | |
293 <param name="columns" value="7,2,3,4,1"/> | |
294 </conditional> | |
295 </repeat> | |
296 <repeat name="linefilters"> | |
297 <conditional name="filter"> | |
298 <param name="filter_type" value="replace"/> | |
299 <param name="column" value="c4"/> | |
300 <param name="regex_pattern" value="(\d+)/(\d+)/(\d+)"/> | |
301 <param name="regex_replace" value="19\3-\2-\1"/> | |
302 </conditional> | |
303 </repeat> | |
304 </section> | |
305 <section name="tbl_opts"> | |
306 <param name="table_name" value="people"/> | |
307 <param name="col_names" value="id,first,last,dob,pets"/> | |
308 </section> | |
309 </repeat> | |
310 <param name="sqlquery" value="SELECT people.id,first,last,pets,quote FROM people JOIN contacts ON people.first = contacts.first_name"/> | |
311 <output name="output" file="add_to_db_results.tsv"/> | |
312 </test> | |
313 | |
314 <test> | |
224 <repeat name="tables"> | 315 <repeat name="tables"> |
225 <param name="table" ftype="tabular" value="pets.tsv"/> | 316 <param name="table" ftype="tabular" value="pets.tsv"/> |
226 <repeat name="linefilters"> | 317 <section name="input_opts"> |
227 <param name="filter_type" value="comment"/> | 318 <repeat name="linefilters"> |
228 <param name="comment_char" value="35"/> | 319 <conditional name="filter"> |
229 </repeat> | 320 <param name="filter_type" value="regex"/> |
230 <repeat name="linefilters"> | 321 <param name="regex_pattern" value="^\d+"/> |
231 <param name="filter_type" value="append_line_num"/> | 322 <param name="regex_action" value="include_find"/> |
232 </repeat> | 323 </conditional> |
233 <repeat name="linefilters"> | 324 </repeat> |
234 <param name="filter_type" value="select_columns"/> | 325 <repeat name="linefilters"> |
235 <param name="columns" value="c7,c5,c6"/> | 326 <conditional name="filter"> |
236 </repeat> | 327 <param name="filter_type" value="comment"/> |
237 <repeat name="linefilters"> | 328 <param name="comment_char" value="35"/> |
238 <param name="filter_type" value="normalize"/> | 329 </conditional> |
239 <param name="columns" value="c2,c3"/> | 330 </repeat> |
240 <param name="separator" value=","/> | 331 <repeat name="linefilters"> |
241 </repeat> | 332 <conditional name="filter"> |
242 <param name="table_name" value="pet"/> | 333 <param name="filter_type" value="append_line_num"/> |
243 <param name="col_names" value="id,name,animal"/> | 334 </conditional> |
335 </repeat> | |
336 <repeat name="linefilters"> | |
337 <conditional name="filter"> | |
338 <param name="filter_type" value="select_columns"/> | |
339 <param name="columns" value="7,2,3,4,1"/> | |
340 </conditional> | |
341 </repeat> | |
342 <repeat name="linefilters"> | |
343 <conditional name="filter"> | |
344 <param name="filter_type" value="replace"/> | |
345 <param name="column" value="c4"/> | |
346 <param name="regex_pattern" value="(\d+)/(\d+)/(\d+)"/> | |
347 <param name="regex_replace" value="19\3-\2-\1"/> | |
348 </conditional> | |
349 </repeat> | |
350 </section> | |
351 <section name="tbl_opts"> | |
352 <param name="table_name" value="people"/> | |
353 <param name="col_names" value="id,first,last,dob,pets"/> | |
354 </section> | |
355 </repeat> | |
356 <repeat name="tables"> | |
357 <param name="table" ftype="tabular" value="pets.tsv"/> | |
358 <section name="input_opts"> | |
359 <repeat name="linefilters"> | |
360 <conditional name="filter"> | |
361 <param name="filter_type" value="regex"/> | |
362 <param name="regex_pattern" value="^\d+"/> | |
363 <param name="regex_action" value="include_find"/> | |
364 </conditional> | |
365 </repeat> | |
366 <repeat name="linefilters"> | |
367 <conditional name="filter"> | |
368 <param name="filter_type" value="append_line_num"/> | |
369 </conditional> | |
370 </repeat> | |
371 <repeat name="linefilters"> | |
372 <conditional name="filter"> | |
373 <param name="filter_type" value="select_columns"/> | |
374 <param name="columns" value="c7,c5,c6"/> | |
375 </conditional> | |
376 </repeat> | |
377 <repeat name="linefilters"> | |
378 <conditional name="filter"> | |
379 <param name="filter_type" value="normalize"/> | |
380 <param name="columns" value="c2,c3"/> | |
381 <param name="separator" value=","/> | |
382 </conditional> | |
383 </repeat> | |
384 </section> | |
385 <section name="tbl_opts"> | |
386 <param name="table_name" value="pet"/> | |
387 <param name="col_names" value="id,name,animal"/> | |
388 </section> | |
244 </repeat> | 389 </repeat> |
245 <param name="sqlquery" value="SELECT people.id,first,last,dob,name,animal,pets FROM people JOIN pet ON people.id = pet.id WHERE animal = 'cat'"/> | 390 <param name="sqlquery" value="SELECT people.id,first,last,dob,name,animal,pets FROM people JOIN pet ON people.id = pet.id WHERE animal = 'cat'"/> |
246 <output name="output" file="pet_normalized_query_results.tsv"/> | 391 <output name="output" file="pet_normalized_query_results.tsv"/> |
247 </test> | 392 </test> |
248 | 393 |