Mercurial > repos > jjohnson > sqlite_to_tabular
comparison sqlite_to_tabular.xml @ 3:f079ea3884b3 draft default tip
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/sqlite_to_tabular commit 64a950cafd655311c99a54f96a27b49f0bdf2731-dirty
| author | jjohnson |
|---|---|
| date | Thu, 21 Jan 2016 09:34:45 -0500 |
| parents | bc50a7b7f246 |
| children |
comparison
equal
deleted
inserted
replaced
| 2:bc50a7b7f246 | 3:f079ea3884b3 |
|---|---|
| 2 <tool id="sqlite_to_tabular" name="SQLite to tabular" version="0.0.1"> | 2 <tool id="sqlite_to_tabular" name="SQLite to tabular" version="0.0.1"> |
| 3 <description>for SQL query</description> | 3 <description>for SQL query</description> |
| 4 <stdio> | 4 <stdio> |
| 5 <exit_code range="1:" level="fatal" description="Error" /> | 5 <exit_code range="1:" level="fatal" description="Error" /> |
| 6 </stdio> | 6 </stdio> |
| 7 <command interpreter="python"><![CDATA[ | |
| 8 sqlite_to_tabular.py | |
| 9 --sqlitedb="$sqlitedb" | |
| 10 --query_file="$query_file" | |
| 11 $no_header | |
| 12 --output="$query_results" | |
| 13 ]]></command> | |
| 7 <configfiles> | 14 <configfiles> |
| 8 <configfile name="query_file"> | 15 <configfile name="query_file"> |
| 9 $sqlquery | 16 $sqlquery |
| 10 </configfile> | 17 </configfile> |
| 11 </configfiles> | 18 </configfiles> |
| 12 | |
| 13 <command interpreter="python"> | |
| 14 sqlite_to_tabular.py | |
| 15 --sqlitedb="$sqlitedb" | |
| 16 --query_file="$query_file" | |
| 17 $no_header | |
| 18 --output="$query_results" | |
| 19 </command> | |
| 20 <inputs> | 19 <inputs> |
| 21 <param name="sqlitedb" type="data" format="sqlite" label="SQLite Database"/> | 20 <param name="sqlitedb" type="data" format="sqlite" label="SQLite Database"/> |
| 22 <param name="sqlquery" type="text" area="True" size="120x20" label="SQL query"> | 21 <param name="sqlquery" type="text" area="True" size="120x20" label="SQL query"> |
| 23 <validator type="regex">^(?im)\s*SELECT\s.*\sFROM\s.*$</validator> | 22 <validator type="regex">^(?im)\s*SELECT\s.*\sFROM\s.*$</validator> |
| 24 <sanitizer sanitize="False"/> | 23 <sanitizer sanitize="False"/> |
| 38 <not_has_text text="Doe" /> | 37 <not_has_text text="Doe" /> |
| 39 </assert_contents> | 38 </assert_contents> |
| 40 </output> | 39 </output> |
| 41 </test> | 40 </test> |
| 42 </tests> | 41 </tests> |
| 43 <help> | 42 <help><![CDATA[ |
| 44 Outputs the results of a query on a SQLite Database as a tabular file. | 43 Outputs the results of a query on a SQLite_ Database as a tabular file. |
| 45 </help> | 44 |
| 45 In addition to the standard SQLite_functions_ regular_expression_ functions are included. | |
| 46 | |
| 47 For example, with SQLite table "customers": | |
| 48 | |
| 49 =========== ========== ========== ===================== ========== ============ | |
| 50 #CustomerID FirstName LastName Email BirthDate Phone | |
| 51 =========== ========== ========== ===================== ========== ============ | |
| 52 1 John Smith John.Smith@yahoo.com 1968-02-04 626 222-2222 | |
| 53 2 Steven Goldfish goldfish@fishhere.net 1974-04-04 323 455-4545 | |
| 54 3 Paula Brown pb@herowndomain.org 1978-05-24 416 323-3232 | |
| 55 4 James Smith jim@supergig.co.uk 1980-10-20 416 323-8888 | |
| 56 =========== ========== ========== ===================== ========== ============ | |
| 57 | |
| 58 :: | |
| 59 | |
| 60 matching: re_match('pattern',column) | |
| 61 | |
| 62 SELECT FirstName, LastName | |
| 63 FROM customers | |
| 64 WHERE re_match('^.*\.(net|org)$',Email) | |
| 65 | |
| 66 Results: | |
| 67 | |
| 68 =========== ========== | |
| 69 #FirstName LastName | |
| 70 =========== ========== | |
| 71 Steven Goldfish | |
| 72 Paula Brown | |
| 73 =========== ========== | |
| 74 | |
| 75 | |
| 76 :: | |
| 77 | |
| 78 searching: re_search('pattern',column) | |
| 79 substituting: re_sub('pattern','replacement,column) | |
| 80 | |
| 81 SELECT FirstName, LastName, re_sub('^\d{2}(\d{2})-(\d\d)-(\d\d)','\3/\2/\1',BirthDate) as "DOB" | |
| 82 FROM customers | |
| 83 WHERE re_search('[hp]er',Email) | |
| 84 | |
| 85 Results: | |
| 86 | |
| 87 =========== ========== ========== | |
| 88 #FirstName LastName DOB | |
| 89 =========== ========== ========== | |
| 90 Steven Goldfish 04/04/74 | |
| 91 Paula Brown 24/05/78 | |
| 92 James Smith 20/10/80 | |
| 93 =========== ========== ========== | |
| 94 | |
| 95 | |
| 96 | |
| 97 .. _Regular_expression: https://docs.python.org/release/2.7/library/re.html | |
| 98 .. _SQLite: http://www.sqlite.org/index.html | |
| 99 .. _SQLite_functions: http://www.sqlite.org/docs.html | |
| 100 | |
| 101 ]]></help> | |
| 46 </tool> | 102 </tool> |
