comparison query_tabular.xml @ 1:8a33b442ecd9 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit 81f69ad5f39223059c40501e55ac777d3feca845
author iuc
date Fri, 18 Aug 2017 16:48:09 -0400
parents 3708ff0198b7
children 973f03d82c86
comparison
equal deleted inserted replaced
0:3708ff0198b7 1:8a33b442ecd9
1 <tool id="query_tabular" name="Query Tabular" version="1.0.0"> 1 <tool id="query_tabular" name="Query Tabular" version="2.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>
24 -s '$workdb' 24 -s '$workdb'
25 #end if 25 #end if
26 -j '$table_json' 26 -j '$table_json'
27 #if $sqlquery: 27 #if $sqlquery:
28 -Q '$query_file' 28 -Q '$query_file'
29 $no_header 29 @RESULT_HEADER@
30 -o '$output' 30 -o '$output'
31 #end if 31 #end if
32 ]]></command> 32 ]]></command>
33 <configfiles> 33 <configfiles>
34 <configfile name="query_file"> 34 <configfile name="query_file">
51 ## #if $tbl.tbl_opts.sel_cols: 51 ## #if $tbl.tbl_opts.sel_cols:
52 ## #set $jtbl['sel_cols'] = $tbl.tbl_opts.sel_cols el_cols 52 ## #set $jtbl['sel_cols'] = $tbl.tbl_opts.sel_cols el_cols
53 ## #end if 53 ## #end if
54 #if $tbl.tbl_opts.pkey_autoincr: 54 #if $tbl.tbl_opts.pkey_autoincr:
55 #set $jtbl['pkey_autoincr'] = str($tbl.tbl_opts.pkey_autoincr) 55 #set $jtbl['pkey_autoincr'] = str($tbl.tbl_opts.pkey_autoincr)
56 #end if
57 #if $tbl.tbl_opts.column_names_from_first_line:
58 #set $jtbl['firstlinenames'] = True
56 #end if 59 #end if
57 #if $tbl.tbl_opts.col_names: 60 #if $tbl.tbl_opts.col_names:
58 #set $col_names = str($tbl.tbl_opts.col_names) 61 #set $col_names = str($tbl.tbl_opts.col_names)
59 #if $tbl.tbl_opts.load_named_columns: 62 #if $tbl.tbl_opts.load_named_columns:
60 #set $jtbl['load_named_columns'] = True 63 #set $jtbl['load_named_columns'] = True
102 <section name="tbl_opts" expanded="false" title="Table Options"> 105 <section name="tbl_opts" expanded="false" title="Table Options">
103 <param name="table_name" type="text" value="" optional="true" label="Specify Name for Table"> 106 <param name="table_name" type="text" value="" optional="true" label="Specify Name for Table">
104 <help>By default, tables will be named: t1,t2,...,tn (table names must be unique)</help> 107 <help>By default, tables will be named: t1,t2,...,tn (table names must be unique)</help>
105 <validator type="regex" message="Table name should start with a letter and may contain additional letters, digits, and underscores">^[A-Za-z]\w*$</validator> 108 <validator type="regex" message="Table name should start with a letter and may contain additional letters, digits, and underscores">^[A-Za-z]\w*$</validator>
106 </param> 109 </param>
110 <param name="column_names_from_first_line" type="boolean" truevalue="True" falsevalue="False" checked="false"
111 label="Use first line as column names"
112 help="The names will be quoted if they are not valid SQLite column names."/>
107 <param name="col_names" type="text" value="" optional="true" label="Specify Column Names (comma-separated list)"> 113 <param name="col_names" type="text" value="" optional="true" label="Specify Column Names (comma-separated list)">
108 <help>By default, table columns will be named: c1,c2,c3,...,cn (column names for a table must be unique) 114 <help>By default, table columns will be named: c1,c2,c3,...,cn (column names for a table must be unique)
109 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. 115 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.
110 </help> 116 </help>
111 <sanitizer sanitize="False"/> 117 <sanitizer sanitize="False"/>
117 <validator type="regex" message="Column name">^([A-Za-z]\w*)?$</validator> 123 <validator type="regex" message="Column name">^([A-Za-z]\w*)?$</validator>
118 </param> 124 </param>
119 <repeat name="indexes" title="Table Index"> 125 <repeat name="indexes" title="Table Index">
120 <param name="unique" type="boolean" truevalue="yes" falsevalue="no" checked="False" label="This is a unique index"/> 126 <param name="unique" type="boolean" truevalue="yes" falsevalue="no" checked="False" label="This is a unique index"/>
121 <param name="index_columns" type="text" value="" label="Index on Columns"> 127 <param name="index_columns" type="text" value="" label="Index on Columns">
122 <help>Create an index on the column names: e,g, c1 or c2,c4</help> 128 <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>
123 <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> 129 <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>
130 <sanitizer sanitize="False"/>
124 </param> 131 </param>
125 </repeat> 132 </repeat>
126 </section> 133 </section>
127 </repeat> 134 </repeat>
128 <param name="save_db" type="boolean" truevalue="yes" falsevalue="no" checked="false" label="Save the sqlite database in your history" 135 <param name="save_db" type="boolean" truevalue="yes" falsevalue="no" checked="false" label="Save the sqlite database in your history"
130 <param name="sqlquery" type="text" area="true" size="20x80" value="" optional="true" label="SQL Query to generate tabular output"> 137 <param name="sqlquery" type="text" area="true" size="20x80" value="" optional="true" label="SQL Query to generate tabular output">
131 <help>By default: tables are named: t1,t2,...,tn and columns in each table: c1,c2,...,cn</help> 138 <help>By default: tables are named: t1,t2,...,tn and columns in each table: c1,c2,...,cn</help>
132 <sanitizer sanitize="False"/> 139 <sanitizer sanitize="False"/>
133 <validator type="regex" message="">^(?ims)\s*select\s+.*\s+from\s+.*$</validator> 140 <validator type="regex" message="">^(?ims)\s*select\s+.*\s+from\s+.*$</validator>
134 </param> 141 </param>
135 <param name="no_header" type="boolean" truevalue="-n" falsevalue="" checked="False" label="Omit column headers from tabular output"/> 142 <expand macro="result_results_header_line" />
136 </inputs> 143 </inputs>
137 <outputs> 144 <outputs>
138 <data format="sqlite" name="sqlitedb" label="sqlite db of ${on_string}"> 145 <data format="sqlite" name="sqlitedb" label="sqlite db of ${on_string}">
139 <filter>save_db</filter> 146 <filter>save_db</filter>
140 </data> 147 </data>
389 </repeat> 396 </repeat>
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'"/> 397 <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'"/>
391 <output name="output" file="pet_normalized_query_results.tsv"/> 398 <output name="output" file="pet_normalized_query_results.tsv"/>
392 </test> 399 </test>
393 400
401 <test>
402 <repeat name="tables">
403 <param name="table" ftype="tabular" value="psm_report.tsv"/>
404 <section name="input_opts">
405 <repeat name="linefilters">
406 <conditional name="filter">
407 <param name="filter_type" value="select_columns"/>
408 <param name="columns" value="1,3,2,6,14,19"/>
409 </conditional>
410 </repeat>
411 </section>
412 <section name="tbl_opts">
413 <param name="table_name" value="PSMs"/>
414 <param name="column_names_from_first_line" value="True"/>
415 <param name="col_names" value="Scan"/>
416 </section>
417 </repeat>
418 <param name="sqlquery" value="SELECT * from PSMs"/>
419 <conditional name="query_result">
420 <param name="header" value="yes"/>
421 <param name="header_prefix" value=""/>
422 </conditional>
423 <output name="output" file="psm_report_out1.tsv"/>
424 </test>
425
426 <test>
427 <repeat name="tables">
428 <param name="table" ftype="tabular" value="psm_report.tsv"/>
429 <section name="input_opts">
430 <repeat name="linefilters">
431 <conditional name="filter">
432 <param name="filter_type" value="select_columns"/>
433 <param name="columns" value="1,3,2,6,14,19"/>
434 </conditional>
435 </repeat>
436 </section>
437 <section name="tbl_opts">
438 <param name="table_name" value="PSMs"/>
439 <param name="column_names_from_first_line" value="True"/>
440 <param name="col_names" value="Scan"/>
441 </section>
442 </repeat>
443 <param name="sqlquery" value="SELECT Scan,&quot;m/z&quot;, &quot;Precursor m/z Error [ppm]&quot;, Sequence, &quot;Protein(s)&quot; FROM PSMs WHERE NOT re_search(', ',&quot;Protein(s)&quot;)"/>
444 <conditional name="query_result">
445 <param name="header" value="yes"/>
446 <param name="header_prefix" value=""/>
447 </conditional>
448 <output name="output" file="psm_report_out2.tsv"/>
449 </test>
450
394 </tests> 451 </tests>
395 <help><![CDATA[ 452 <help><![CDATA[
396 ============= 453 =============
397 Query Tabular 454 Query Tabular
398 ============= 455 =============
403 460
404 An existing SQLite_ data base can be used as input, and any selected tabular datasets will be added as new tables in that data base. 461 An existing SQLite_ data base can be used as input, and any selected tabular datasets will be added as new tables in that data base.
405 462
406 463
407 @LINEFILTERS_HELP@ 464 @LINEFILTERS_HELP@
465
466 **Table Options**
467
468 Specify Name for Table:
469
470 - By default tables will be named: t1, t2, t3, etc.
471
472 - **Specify Name for Table**
473 You can provide your own name for a database table, the name should begin with a letter and only contain letters, digits, or underscores.
474 The name should not be a SQLite key word: https://sqlite.org/lang_keywords.html
475
476
477 There are several ways to name columns in a table:
478
479 - By default table columns will be named: c1, c2, c3, etc.
480
481 - If **Use first line as column names** is selected, the first line is interpreted as column names, and not loaded into the table as a data row.
482 Any missing column name will be assigned cn where *n* is the ordinal position of the column,
483 e.g. a blank header for the second column would be named: c2.
484 The column names will be quoted is they are not valid identifiers,
485 e.g. if they are SQLite keywords, or start with a non letter character, or contain a character other than a letter, digit, or underscore.
486 The precedent for quoting is to enclose the identifier in double quotes,
487 else if it contains a double quote enclose in square brackets,
488 else if it contains a square bracket enclose in grave accents.
489 **NOTE:** that this is the first line after line filtering has been applied.
490 If a line filter *prepend a line number column* had been used, the name of the first column would be "1".
491 You could rename that column using **Specify Column Names**
492
493 - **Specify Column Names** (comma-separated list)
494 This will override any previously assigned column names.
495 You can also choose to only load those columns for which you provided a name,
496 but that is better accomplished with the line filter: *select columns*.
497
498
499 **Table Index**
500
501 Queries on larger tables can be much faster if indexes are specified.
502 In general, specifiy an index for table columns used in joins with other tables,
503 or on columns used in SQL query WHERE clauses or in GROUP BY clauses.
408 504
409 505
410 **Outputs** 506 **Outputs**
411 507
412 The results of a SQL query are output to the history as a tabular file. 508 The results of a SQL query are output to the history as a tabular file.