comparison query_tabular.xml @ 2:ffa5e34a55c1

Uploaded
author jjohnson
date Sun, 04 Oct 2015 10:52:21 -0400
parents 24f0911f75ee
children afdbc7198353
comparison
equal deleted inserted replaced
1:24f0911f75ee 2:ffa5e34a55c1
4 <requirements> 4 <requirements>
5 </requirements> 5 </requirements>
6 <stdio> 6 <stdio>
7 <exit_code range="1:" /> 7 <exit_code range="1:" />
8 </stdio> 8 </stdio>
9 9 <configfiles>
10 <configfile name="query_file">
11 $sqlquery
12 </configfile>
13 </configfiles>
10 <command interpreter="python"><![CDATA[ 14 <command interpreter="python"><![CDATA[
11 query_tabular.py 15 query_tabular.py
12 #if $save_db 16 #if $save_db
13 -s $sqlitedb 17 -s $sqlitedb
14 #else 18 #else
25 #else 29 #else
26 #set $col_names = '' 30 #set $col_names = ''
27 #end if 31 #end if
28 -t ${tbl.table}=${tname}${$col_names} 32 -t ${tbl.table}=${tname}${$col_names}
29 #end for 33 #end for
30 #if $query: 34 #if $sqlquery:
31 -q "$query" 35 -Q "$query_file"
32 $no_header 36 $no_header
33 -o $output 37 -o $output
34 #end if 38 #end if
35 ]]></command> 39 ]]></command>
36 <inputs> 40 <inputs>
47 <param name="col_names" type="text" value="" optional="true" label="Column names"> 51 <param name="col_names" type="text" value="" optional="true" label="Column names">
48 <help>By default, table columns will be named: c1,c2,c3,...,cn</help> 52 <help>By default, table columns will be named: c1,c2,c3,...,cn</help>
49 <validator type="regex" message="A List of separated by commas: Column names should start with a letter and may contain additional letters, digits, and underscores">^([A-Za-z]\w*)?(,([A-Za-z]\w*)?)*$</validator> 53 <validator type="regex" message="A List of separated by commas: Column names should start with a letter and may contain additional letters, digits, and underscores">^([A-Za-z]\w*)?(,([A-Za-z]\w*)?)*$</validator>
50 </param> 54 </param>
51 </repeat> 55 </repeat>
52 <param name="query" type="text" area="true" size="10x80" value="" optional="true" label="SQL Query"> 56 <param name="sqlquery" type="text" area="true" size="10x80" value="" optional="true" label="SQL Query">
53 <help>By default, tables will be named: t1,t2,...,tn</help> 57 <help>By default, tables will be named: t1,t2,...,tn</help>
54 <sanitizer sanitize="False"/> 58 <sanitizer sanitize="False"/>
55 <validator type="regex" message="">^(?i)\s*select\s+.*\s+from\s+.*$</validator> 59 <validator type="regex" message="">^(?i)\s*select\s+.*\s+from\s+.*$</validator>
56 </param> 60 </param>
57 <param name="no_header" type="boolean" truevalue="-n" falsevalue="" checked="False" label="Omit column headers"/> 61 <param name="no_header" type="boolean" truevalue="-n" falsevalue="" checked="False" label="Omit column headers"/>
58 62
59 <param name="save_db" type="boolean" truevalue="yes" falsevalue="no" checked="false" label="Save the sqlite database"/> 63 <param name="save_db" type="boolean" truevalue="yes" falsevalue="no" checked="false" label="Save the sqlite database"/>
60 </inputs> 64 </inputs>
61 <outputs> 65 <outputs>
62 <data format="sqlite" name="sqlitedb" label="sqlite"> 66 <data format="sqlite" name="sqlitedb" label="sqlite">
63 <filter>save_db or not (query and len(query) > 0)</filter> 67 <filter>save_db or not (sqlquery and len(sqlquery) > 0)</filter>
64 </data> 68 </data>
65 <data format="tabular" name="output" label="query results"> 69 <data format="tabular" name="output" label="query results">
66 <filter>query and len(query) > 0</filter> 70 <filter>sqlquery and len(sqlquery) > 0</filter>
67 </data> 71 </data>
68 </outputs> 72 </outputs>
69 <tests> 73 <tests>
70 74
71 <test> 75 <test>
77 <repeat name="tables"> 81 <repeat name="tables">
78 <param name="table" ftype="tabular" value="sales.tsv"/> 82 <param name="table" ftype="tabular" value="sales.tsv"/>
79 <param name="table_name" value="sales"/> 83 <param name="table_name" value="sales"/>
80 <param name="col_names" value="CustomerID,Date,SaleAmount"/> 84 <param name="col_names" value="CustomerID,Date,SaleAmount"/>
81 </repeat> 85 </repeat>
82 <param name="query" 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"/> 86 <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"/>
83 <output name="output" file="sales_results.tsv"/> 87 <output name="output" file="sales_results.tsv"/>
84 </test> 88 </test>
85 89
86 <test> 90 <test>
87 <repeat name="tables"> 91 <repeat name="tables">
89 <param name="col_names" value=",FirstName,LastName,,DOB,"/> 93 <param name="col_names" value=",FirstName,LastName,,DOB,"/>
90 </repeat> 94 </repeat>
91 <repeat name="tables"> 95 <repeat name="tables">
92 <param name="table" ftype="tabular" value="sales.tsv"/> 96 <param name="table" ftype="tabular" value="sales.tsv"/>
93 </repeat> 97 </repeat>
94 <param name="query" 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;"/> 98 <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;"/>
95 <output name="output" file="sales_results.tsv"/> 99 <output name="output" file="sales_results.tsv"/>
96 </test> 100 </test>
97 101
98 <test> 102 <test>
99 <repeat name="tables"> 103 <repeat name="tables">
104 <repeat name="tables"> 108 <repeat name="tables">
105 <param name="table" ftype="tabular" value="netMHC_summary.tsv"/> 109 <param name="table" ftype="tabular" value="netMHC_summary.tsv"/>
106 <param name="table_name" value="mhc_summary"/> 110 <param name="table_name" value="mhc_summary"/>
107 <param name="col_names" value="pos,peptide,logscore,affinity,Bind_Level,Protein,Allele"/> 111 <param name="col_names" value="pos,peptide,logscore,affinity,Bind_Level,Protein,Allele"/>
108 </repeat> 112 </repeat>
109 <param name="query" 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"/> 113 <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"/>
110 <output name="output" file="query_results.tsv"/> 114 <output name="output" file="query_results.tsv"/>
111 </test> 115 </test>
112 116
113 </tests> 117 </tests>
114 <help><![CDATA[ 118 <help><![CDATA[