comparison query_tabular.xml @ 15:cf4397560712 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit dd35055c76d86fe98985b5825c1751efb8208242
author iuc
date Thu, 27 Jun 2024 17:23:34 +0000
parents 3a6b78c39dca
children
comparison
equal deleted inserted replaced
14:3a6b78c39dca 15:cf4397560712
1 <tool id="query_tabular" name="Query Tabular" version="3.3.1"> 1 <tool id="query_tabular" name="Query Tabular" version="3.3.2">
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>
35 #import json 35 #import json
36 #set $jtbldef = dict() 36 #set $jtbldef = dict()
37 #set $jtbls = [] 37 #set $jtbls = []
38 #set $jtbldef['tables'] = $jtbls 38 #set $jtbldef['tables'] = $jtbls
39 #for $i,$tbl in enumerate($tables): 39 #for $i,$tbl in enumerate($tables):
40 #set $table = $tbl.table
40 #set $jtbl = dict() 41 #set $jtbl = dict()
41 #set $jtbl['file_path'] = str($tbl.table) 42 #set $jtbl['file_path'] = str($tbl.table)
42 #if $tbl.tbl_opts.table_name: 43 #if $tbl.tbl_opts.table_name:
43 #set $tname = str($tbl.tbl_opts.table_name) 44 #set $tname = str($tbl.tbl_opts.table_name)
44 #else 45 #else
135 <param name="col_names" type="text" value="" optional="true" label="Specify Column Names (comma-separated list)"> 136 <param name="col_names" type="text" value="" optional="true" label="Specify Column Names (comma-separated list)">
136 <help>By default, table columns will be named: c1,c2,c3,...,cn (column names for a table must be unique) 137 <help>By default, table columns will be named: c1,c2,c3,...,cn (column names for a table must be unique)
137 You can override the default names by entering a comma -separated list of names, e.g. ',name1,,,name2' would rename the second and fifth columns. 138 You can override the default names by entering a comma -separated list of names, e.g. ',name1,,,name2' would rename the second and fifth columns.
138 </help> 139 </help>
139 <sanitizer sanitize="False"/> 140 <sanitizer sanitize="False"/>
140 <validator type="regex" message="A List of names separated by commas: Column names should start with a letter and may contain additional letters, digits, and underscores. Otherwise, the name must be eclosed in: double quotes, back quotes, or square brackets.">^([A-Za-z]\w*|"\S+[^,"]*"|`\S+[^,`]*`|[[]\S+[^,"]*[]])?(,([A-Za-z]\w*|"\S+.*"|`\S+[^,`]*`|[[]\S+[^,"]*[]])?)*$</validator> 141 <validator type="regex" message="A List of names separated by commas: Column names should start with a letter and may contain additional letters, digits, and underscores. Otherwise, the name must be eclosed in: double quotes, back quotes, or square brackets.">^([A-Za-z]\w*|"\S+[^,"]*"|`\S+[^,`]*`|\[\S+[^,"]*\])?(,([A-Za-z]\w*|"\S+[^,"]*"|`\S+[^,`]*`|\[\S+[^,"]*\])?)*$</validator>
141 </param> 142 </param>
142 <param name="load_named_columns" type="boolean" truevalue="load_named_columns" falsevalue="" checked="false" label="Only load the columns you have named into database"/> 143 <param name="load_named_columns" type="boolean" truevalue="load_named_columns" falsevalue="" checked="false" label="Only load the columns you have named into database"/>
143 <param name="pkey_autoincr" type="text" value="" optional="true" label="Add an auto increment primary key column with this name" 144 <param name="pkey_autoincr" type="text" value="" optional="true" label="Add an auto increment primary key column with this name"
144 help="Only creates this additional column when a name is entered. (This can not be the same name as any of the other columns in this table.)"> 145 help="Only creates this additional column when a name is entered. (This can not be the same name as any of the other columns in this table.)">
145 <validator type="regex" message="Column name">^([A-Za-z]\w*)?$</validator> 146 <validator type="regex" message="Column name">^([A-Za-z]\w*)?$</validator>
146 </param> 147 </param>
147 <repeat name="indexes" title="Table Index"> 148 <repeat name="indexes" title="Table Index">
148 <param name="unique" type="boolean" truevalue="yes" falsevalue="no" checked="False" label="This is a unique index"/> 149 <param name="unique" type="boolean" truevalue="yes" falsevalue="no" checked="False" label="This is a unique index"/>
149 <param name="index_columns" type="text" value="" label="Index on Columns"> 150 <param name="index_columns" type="text" value="" label="Index on Columns">
150 <help>Create an index on the column names: e.g. for default column names: c1 or c2,c4 ( use the names you gave for columns)</help> 151 <help>Create an index on the column names: e.g. for default column names: c1 or c2,c4 ( use the names you gave for columns)</help>
151 <validator type="regex" message="Column name, separated by commes if more than one">^([A-Za-z]\w*|"\S+[^,"]*"|`\S+[^,`]*`|[[]\S+[^,"]*[]])(,([A-Za-z]\w*|"\S+.*"|`\S+[^,`]*`|[[]\S+[^,"]*[]])?)*$</validator> 152 <validator type="regex" message="Column name, separated by commes if more than one">^([A-Za-z]\w*|"\S+[^,"]*"|`\S+[^,`]*`|\[\S+[^,"]*\])(,([A-Za-z]\w*|"\S+[^,"]"|`\S+[^,`]*`|\[\S+[^,"]*\])?)*$</validator>
152 <sanitizer sanitize="False"/> 153 <sanitizer sanitize="False"/>
153 </param> 154 </param>
154 </repeat> 155 </repeat>
155 </section> 156 </section>
156 </repeat> 157 </repeat>
190 <filter>len(addqueries['queries']) > 2</filter> 191 <filter>len(addqueries['queries']) > 2</filter>
191 </data> 192 </data>
192 </outputs> 193 </outputs>
193 <tests> 194 <tests>
194 <!-- Test 1 --> 195 <!-- Test 1 -->
195 <test> 196 <test expect_num_outputs="1">
196 <repeat name="tables"> 197 <repeat name="tables">
197 <param name="table" ftype="tabular" value="customers.tsv"/> 198 <param name="table" ftype="tabular" value="customers.tsv"/>
198 <section name="input_opts"> 199 <section name="input_opts">
199 <repeat name="linefilters"> 200 <repeat name="linefilters">
200 <conditional name="filter"> 201 <conditional name="filter">
226 <param name="sqlquery" value="SELECT FirstName,LastName,sum(SaleAmount) as &quot;TotalSales&quot; FROM customers join sales on customers.CustomerID = sales.CustomerID GROUP BY customers.CustomerID ORDER BY TotalSales DESC"/> 227 <param name="sqlquery" value="SELECT FirstName,LastName,sum(SaleAmount) as &quot;TotalSales&quot; FROM customers join sales on customers.CustomerID = sales.CustomerID GROUP BY customers.CustomerID ORDER BY TotalSales DESC"/>
227 <output name="output" file="sales_results.tsv"/> 228 <output name="output" file="sales_results.tsv"/>
228 </test> 229 </test>
229 230
230 <!-- Test 2 --> 231 <!-- Test 2 -->
231 <test> 232 <test expect_num_outputs="1">
232 <repeat name="tables"> 233 <repeat name="tables">
233 <param name="table" ftype="tabular" value="customers.tsv"/> 234 <param name="table" ftype="tabular" value="customers.tsv"/>
234 <section name="input_opts"> 235 <section name="input_opts">
235 <repeat name="linefilters"> 236 <repeat name="linefilters">
236 <conditional name="filter"> 237 <conditional name="filter">
257 <param name="sqlquery" value="SELECT FirstName,LastName,sum(t2.c3) as &quot;TotalSales&quot; FROM t1 join t2 on t1.c1 = t2.c1 GROUP BY t1.c1 ORDER BY TotalSales DESC;"/> 258 <param name="sqlquery" value="SELECT FirstName,LastName,sum(t2.c3) as &quot;TotalSales&quot; FROM t1 join t2 on t1.c1 = t2.c1 GROUP BY t1.c1 ORDER BY TotalSales DESC;"/>
258 <output name="output" file="sales_results.tsv"/> 259 <output name="output" file="sales_results.tsv"/>
259 </test> 260 </test>
260 261
261 <!-- Test 3 --> 262 <!-- Test 3 -->
262 <test> 263 <test expect_num_outputs="1">
263 <repeat name="tables"> 264 <repeat name="tables">
264 <param name="table" ftype="tabular" value="customers.tsv"/> 265 <param name="table" ftype="tabular" value="customers.tsv"/>
265 <section name="input_opts"> 266 <section name="input_opts">
266 <repeat name="linefilters"> 267 <repeat name="linefilters">
267 <conditional name="filter"> 268 <conditional name="filter">
277 <param name="sqlquery" value="select FirstName,LastName,re_sub('^\d{2}(\d{2})-(\d\d)-(\d\d)','\3/\2/\1',BirthDate) as &quot;DOB&quot; from t1 WHERE re_search('[hp]er',c4)"/> 278 <param name="sqlquery" value="select FirstName,LastName,re_sub('^\d{2}(\d{2})-(\d\d)-(\d\d)','\3/\2/\1',BirthDate) as &quot;DOB&quot; from t1 WHERE re_search('[hp]er',c4)"/>
278 <output name="output" file="regex_results.tsv"/> 279 <output name="output" file="regex_results.tsv"/>
279 </test> 280 </test>
280 281
281 <!-- Test 4 --> 282 <!-- Test 4 -->
282 <test> 283 <test expect_num_outputs="1">
283 <repeat name="tables"> 284 <repeat name="tables">
284 <param name="table" ftype="tabular" value="IEDB.tsv"/> 285 <param name="table" ftype="tabular" value="IEDB.tsv"/>
285 <section name="input_opts"> 286 <section name="input_opts">
286 <repeat name="linefilters"> 287 <repeat name="linefilters">
287 <conditional name="filter"> 288 <conditional name="filter">
313 <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"/> 314 <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"/>
314 <output name="output" file="query_results.tsv"/> 315 <output name="output" file="query_results.tsv"/>
315 </test> 316 </test>
316 317
317 <!-- Test 5 --> 318 <!-- Test 5 -->
318 <test> 319 <test expect_num_outputs="1">
319 <section name="add_to_database"> 320 <section name="add_to_database">
320 <param name="withdb" ftype="sqlite" value="testdb.sqlite"/> 321 <param name="withdb" ftype="sqlite" value="testdb.sqlite"/>
321 </section> 322 </section>
322 <repeat name="tables"> 323 <repeat name="tables">
323 <param name="table" ftype="tabular" value="pets.tsv"/> 324 <param name="table" ftype="tabular" value="pets.tsv"/>
363 <param name="sqlquery" value="SELECT people.id,first,last,pets,quote FROM people JOIN contacts ON people.first = contacts.first_name"/> 364 <param name="sqlquery" value="SELECT people.id,first,last,pets,quote FROM people JOIN contacts ON people.first = contacts.first_name"/>
364 <output name="output" file="add_to_db_results.tsv"/> 365 <output name="output" file="add_to_db_results.tsv"/>
365 </test> 366 </test>
366 367
367 <!-- Test 6 --> 368 <!-- Test 6 -->
368 <test> 369 <test expect_num_outputs="1">
369 <repeat name="tables"> 370 <repeat name="tables">
370 <param name="table" ftype="tabular" value="pets.tsv"/> 371 <param name="table" ftype="tabular" value="pets.tsv"/>
371 <section name="input_opts"> 372 <section name="input_opts">
372 <repeat name="linefilters"> 373 <repeat name="linefilters">
373 <conditional name="filter"> 374 <conditional name="filter">
444 <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'"/> 445 <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'"/>
445 <output name="output" file="pet_normalized_query_results.tsv"/> 446 <output name="output" file="pet_normalized_query_results.tsv"/>
446 </test> 447 </test>
447 448
448 <!-- Test 7 --> 449 <!-- Test 7 -->
449 <test> 450 <test expect_num_outputs="1">
450 <repeat name="tables"> 451 <repeat name="tables">
451 <param name="table" ftype="tabular" value="psm_report.tsv"/> 452 <param name="table" ftype="tabular" value="psm_report.tsv"/>
452 <section name="input_opts"> 453 <section name="input_opts">
453 <repeat name="linefilters"> 454 <repeat name="linefilters">
454 <conditional name="filter"> 455 <conditional name="filter">
470 </conditional> 471 </conditional>
471 <output name="output" file="psm_report_out1.tsv" compare="re_match"/> 472 <output name="output" file="psm_report_out1.tsv" compare="re_match"/>
472 </test> 473 </test>
473 474
474 <!-- Test 8 column_names_from_first_line --> 475 <!-- Test 8 column_names_from_first_line -->
475 <test> 476 <test expect_num_outputs="1">
476 <repeat name="tables"> 477 <repeat name="tables">
477 <param name="table" ftype="tabular" value="psm_report.tsv"/> 478 <param name="table" ftype="tabular" value="psm_report.tsv"/>
478 <section name="input_opts"> 479 <section name="input_opts">
479 <repeat name="linefilters"> 480 <repeat name="linefilters">
480 <conditional name="filter"> 481 <conditional name="filter">
496 </conditional> 497 </conditional>
497 <output name="output" file="psm_report_out2.tsv" compare="re_match"/> 498 <output name="output" file="psm_report_out2.tsv" compare="re_match"/>
498 </test> 499 </test>
499 500
500 <!-- Test 9 modify database --> 501 <!-- Test 9 modify database -->
501 <test> 502 <test expect_num_outputs="2">
502 <repeat name="tables"> 503 <repeat name="tables">
503 <param name="table" ftype="tabular" value="psm_report.tsv"/> 504 <param name="table" ftype="tabular" value="psm_report.tsv"/>
504 <section name="input_opts"> 505 <section name="input_opts">
505 <repeat name="linefilters"> 506 <repeat name="linefilters">
506 <conditional name="filter"> 507 <conditional name="filter">
537 <output name="output" file="psm_dbmod_output.tsv" compare="re_match"/> 538 <output name="output" file="psm_dbmod_output.tsv" compare="re_match"/>
538 <output name="output1" file="psm_dbmod_output1.tsv" compare="re_match"/> 539 <output name="output1" file="psm_dbmod_output1.tsv" compare="re_match"/>
539 </test> 540 </test>
540 541
541 <!-- Test 10 column_names_from_first_line --> 542 <!-- Test 10 column_names_from_first_line -->
542 <test> 543 <test expect_num_outputs="1">
543 <repeat name="tables"> 544 <repeat name="tables">
544 <param name="table" ftype="tabular" value="netMHC_summary.tsv"/> 545 <param name="table" ftype="tabular" value="netMHC_summary.tsv"/>
545 <section name="input_opts"> 546 <section name="input_opts">
546 <repeat name="linefilters"> 547 <repeat name="linefilters">
547 <conditional name="filter"> 548 <conditional name="filter">
563 </conditional> 564 </conditional>
564 <output name="output" file="netMHC_summary_out1.tsv" ftype="tabular"/> 565 <output name="output" file="netMHC_summary_out1.tsv" ftype="tabular"/>
565 </test> 566 </test>
566 567
567 <!-- Test 11 --> 568 <!-- Test 11 -->
568 <test> 569 <test expect_num_outputs="1">
569 <repeat name="tables"> 570 <repeat name="tables">
570 <param name="table" ftype="tabular" value="netMHC_summary.tsv"/> 571 <param name="table" ftype="tabular" value="netMHC_summary.tsv"/>
571 <section name="input_opts"> 572 <section name="input_opts">
572 <repeat name="linefilters"> 573 <repeat name="linefilters">
573 <conditional name="filter"> 574 <conditional name="filter">
590 </conditional> 591 </conditional>
591 <output name="output" file="netMHC_summary_out2.tsv" ftype="tabular"/> 592 <output name="output" file="netMHC_summary_out2.tsv" ftype="tabular"/>
592 </test> 593 </test>
593 594
594 <!-- Test 12 math functions --> 595 <!-- Test 12 math functions -->
595 <test> 596 <test expect_num_outputs="1">
596 <repeat name="tables"> 597 <repeat name="tables">
597 <param name="table" ftype="tabular" value="math_input.tsv"/> 598 <param name="table" ftype="tabular" value="math_input.tsv"/>
598 </repeat> 599 </repeat>
599 <param name="sqlquery" value="SELECT c1, c2, trunc(c2), floor(c2), ceil(c2), abs(c1), fabs(c2), mod(c1,2), fmod(c2, 1.5), sqrt(c1), sqrt(c2), degrees(c1), radians(c1), log(c1), log10(c1), pow(c1,2), exp(c2), exp(c1), cos(c1), sin(c1), tan(c1), cosh(c1), sinh(c1), tanh(c1), acos(c1), asin(c1),acosh(c1), asinh(c1) FROM t1"/> 600 <param name="sqlquery" value="SELECT c1, c2, trunc(c2), floor(c2), ceil(c2), abs(c1), fabs(c2), mod(c1,2), fmod(c2, 1.5), sqrt(c1), sqrt(c2), degrees(c1), radians(c1), log(c1), log10(c1), pow(c1,2), exp(c2), exp(c1), cos(c1), sin(c1), tan(c1), cosh(c1), sinh(c1), tanh(c1), acos(c1), asin(c1),acosh(c1), asinh(c1) FROM t1"/>
600 <output name="output"> 601 <output name="output">