Mercurial > repos > jjohnson > query_tabular
comparison query_tabular.xml @ 18:b9f797bf4f38 draft
Uploaded
author | jjohnson |
---|---|
date | Wed, 05 Jul 2017 11:51:15 -0400 |
parents | 5b4f6cf857cf |
children | ab27c4bd14b9 |
comparison
equal
deleted
inserted
replaced
17:c6e6e224509c | 18:b9f797bf4f38 |
---|---|
1 <tool id="query_tabular" name="Query Tabular" version="3.1.0"> | 1 <tool id="query_tabular" name="Query Tabular" version="4.0.0"> |
2 <description>using sqlite sql</description> | 2 <description>using sqlite sql</description> |
3 | 3 |
4 <requirements> | 4 <requirements> |
5 </requirements> | 5 </requirements> |
6 <stdio> | 6 <stdio> |
92 #silent $input_filters.append($filter_dict) | 92 #silent $input_filters.append($filter_dict) |
93 #end if | 93 #end if |
94 #elif $fi.filter.filter_type == 'comment': | 94 #elif $fi.filter.filter_type == 'comment': |
95 #set $filter_dict = dict() | 95 #set $filter_dict = dict() |
96 #set $filter_dict['filter'] = 'regex' | 96 #set $filter_dict['filter'] = 'regex' |
97 #set $filter_dict['pattern'] = '^' + str($fi.filter.comment_char) | 97 #set $filter_dict['pattern'] = '^(%s).*$' % '|'.join([chr(int(x)).replace('|','[|]') for x in (str($fi.filter.comment_char)).split(',')]) |
98 #set $filter_dict['action'] = 'exclude' | 98 #set $filter_dict['action'] = 'exclude_match' |
99 #silent $input_filters.append($filter_dict) | 99 #silent $input_filters.append($filter_dict) |
100 #elif $fi.filter.filter_type == 'regex': | 100 #elif $fi.filter.filter_type == 'regex': |
101 #set $filter_dict = dict() | 101 #set $filter_dict = dict() |
102 #set $filter_dict['filter'] = str($fi.filter.filter_type) | 102 #set $filter_dict['filter'] = str($fi.filter.filter_type) |
103 #set $filter_dict['pattern'] = str($fi.filter.regex_pattern) | 103 #set $filter_dict['pattern'] = str($fi.filter.regex_pattern) |
104 #set $filter_dict['action'] = str($fi.filter.regex_action) | 104 #set $filter_dict['action'] = str($fi.filter.regex_action) |
105 #silent $input_filters.append($filter_dict) | 105 #silent $input_filters.append($filter_dict) |
106 #elif $fi.filter.filter_type == 'select_columns': | 106 #elif $fi.filter.filter_type == 'select_columns': |
107 #set $filter_dict = dict() | 107 #set $filter_dict = dict() |
108 #set $filter_dict['filter'] = str($fi.filter.filter_type) | 108 #set $filter_dict['filter'] = str($fi.filter.filter_type) |
109 #set $filter_dict['columns'] = [int(str($ci)) for $ci in str($fi.filter.columns).split(',')] | 109 #set $filter_dict['columns'] = [int(str($ci).replace('c','')) for $ci in str($fi.filter.columns).split(',')] |
110 #silent $input_filters.append($filter_dict) | 110 #silent $input_filters.append($filter_dict) |
111 #elif $fi.filter.filter_type == 'replace': | 111 #elif $fi.filter.filter_type == 'replace': |
112 #set $filter_dict = dict() | 112 #set $filter_dict = dict() |
113 #set $filter_dict['filter'] = str($fi.filter.filter_type) | 113 #set $filter_dict['filter'] = str($fi.filter.filter_type) |
114 #set $filter_dict['column'] = int(str($fi.filter.column)) | 114 #set $filter_dict['column'] = int(str($fi.filter.column).replace('c','')) |
115 #set $filter_dict['pattern'] = str($fi.filter.regex_pattern) | 115 #set $filter_dict['pattern'] = str($fi.filter.regex_pattern) |
116 #set $filter_dict['replace'] = str($fi.filter.regex_replace) | 116 #set $filter_dict['replace'] = str($fi.filter.regex_replace) |
117 #silent $input_filters.append($filter_dict) | 117 #silent $input_filters.append($filter_dict) |
118 #elif str($fi.filter.filter_type).endswith('pend_line_num'): | 118 #elif str($fi.filter.filter_type).endswith('pend_line_num'): |
119 #set $filter_dict = dict() | 119 #set $filter_dict = dict() |
120 #set $filter_dict['filter'] = str($fi.filter.filter_type) | 120 #set $filter_dict['filter'] = str($fi.filter.filter_type) |
121 #silent $input_filters.append($filter_dict) | 121 #silent $input_filters.append($filter_dict) |
122 #elif str($fi.filter.filter_type).endswith('pend_text'): | |
123 #set $filter_dict = dict() | |
124 #set $filter_dict['filter'] = str($fi.filter.filter_type) | |
125 #set $filter_dict['column_text'] = str($fi.filter.column_text) | |
126 #silent $input_filters.append($filter_dict) | |
122 #elif $fi.filter.filter_type == 'normalize': | 127 #elif $fi.filter.filter_type == 'normalize': |
123 #set $filter_dict = dict() | 128 #set $filter_dict = dict() |
124 #set $filter_dict['filter'] = str($fi.filter.filter_type) | 129 #set $filter_dict['filter'] = str($fi.filter.filter_type) |
125 #set $filter_dict['columns'] = [int(str($ci)) for $ci in str($fi.filter.columns).split(',')] | 130 #set $filter_dict['columns'] = [int(str($ci).replace('c','')) for $ci in str($fi.filter.columns).split(',')] |
126 #set $filter_dict['separator'] = str($fi.filter.separator) | 131 #set $filter_dict['separator'] = str($fi.filter.separator) |
127 #silent $input_filters.append($filter_dict) | 132 #silent $input_filters.append($filter_dict) |
128 #end if | 133 #end if |
129 #end for | 134 #end for |
130 #if $input_filters: | 135 #if $input_filters: |
152 <option value="regex">by regex expression matching</option> | 157 <option value="regex">by regex expression matching</option> |
153 <option value="select_columns">select columns</option> | 158 <option value="select_columns">select columns</option> |
154 <option value="replace">regex replace value in column</option> | 159 <option value="replace">regex replace value in column</option> |
155 <option value="prepend_line_num">prepend a line number column</option> | 160 <option value="prepend_line_num">prepend a line number column</option> |
156 <option value="append_line_num">append a line number column</option> | 161 <option value="append_line_num">append a line number column</option> |
162 <option value="prepend_text">prepend a column with the given text</option> | |
163 <option value="append_text">append a column with the given text</option> | |
157 <option value="normalize">normalize list columns, replicates row for each item in list</option> | 164 <option value="normalize">normalize list columns, replicates row for each item in list</option> |
158 </param> | 165 </param> |
159 <when value="skip"> | 166 <when value="skip"> |
160 <param name="skip_lines" type="integer" value="" min="0" optional="true" label="Skip lines" | 167 <param name="skip_lines" type="integer" value="" min="0" optional="true" label="Skip lines" |
161 help="Leave blank to use the comment lines metadata for this dataset" /> | 168 help="Leave blank to use the comment lines metadata for this dataset" /> |
162 </when> | 169 </when> |
163 <when value="comment"> | 170 <when value="comment"> |
164 <param name="comment_char" type="text" value="#" label="Comment line starting text"> | 171 <param name="comment_char" type="select" display="checkboxes" multiple="True" label="Ignore lines beginning with these characters" help="lines beginning with these are skipped"> |
165 <sanitizer sanitize="False"/> | 172 <option value="62">></option> |
173 <option value="64">@</option> | |
174 <option value="43">+</option> | |
175 <option value="60"><</option> | |
176 <option value="42">*</option> | |
177 <option value="45">-</option> | |
178 <option value="61">=</option> | |
179 <option value="124">|</option> | |
180 <option value="63">?</option> | |
181 <option value="36">$</option> | |
182 <option value="46">.</option> | |
183 <option value="58">:</option> | |
184 <option value="38">&</option> | |
185 <option value="37">%</option> | |
186 <option value="94">^</option> | |
187 <option value="35">#</option> | |
188 <option value="33">!</option> | |
166 </param> | 189 </param> |
167 </when> | 190 </when> |
168 <when value="prepend_line_num"/> | 191 <when value="prepend_line_num"/> |
169 <when value="append_line_num"/> | 192 <when value="append_line_num"/> |
193 <when value="prepend_text"> | |
194 <param name="column_text" type="text" value="" label="text for column"> | |
195 </param> | |
196 </when> | |
197 <when value="append_text"> | |
198 <param name="column_text" type="text" value="" label="text for column"> | |
199 </param> | |
200 </when> | |
170 <when value="regex"> | 201 <when value="regex"> |
171 <param name="regex_pattern" type="text" value="" label="regex pattern"> | 202 <param name="regex_pattern" type="text" value="" label="regex pattern"> |
172 <sanitizer sanitize="False"/> | 203 <sanitizer sanitize="False"/> |
173 </param> | 204 </param> |
174 <param name="regex_action" type="select" label="action for regex match"> | 205 <param name="regex_action" type="select" label="action for regex match"> |
178 <option value="include_find">include line if pattern found</option> | 209 <option value="include_find">include line if pattern found</option> |
179 </param> | 210 </param> |
180 </when> | 211 </when> |
181 <when value="select_columns"> | 212 <when value="select_columns"> |
182 <param name="columns" type="text" value="" label="enter column numbers to keep" | 213 <param name="columns" type="text" value="" label="enter column numbers to keep" |
183 help="example: 1,4,2 (selects the first,fourth, and second columns)"> | 214 help="example: 1,4,2 or c1,c4,c2(selects the first,fourth, and second columns)"> |
184 <validator type="regex" message="Column ordinal positions separated by commas">^([1-9]\d*)(,[1-9]\d*)*$</validator> | 215 <validator type="regex" message="Column ordinal positions separated by commas">^(c?[1-9]\d*)(,c?[1-9]\d*)*$</validator> |
185 </param> | 216 </param> |
186 </when> | 217 </when> |
187 <when value="replace"> | 218 <when value="replace"> |
188 <param name="column" type="data_column" data_ref="table" label="Column to replace text" | 219 <param name="column" type="text" value="" label="enter column number to replace" |
189 help=""/> | 220 help="example: 1 or c1 (selects the first column)"> |
221 <validator type="regex" message="Column ordinal position separated by commas">^(c?[1-9]\d*)$</validator> | |
222 </param> | |
190 <param name="regex_pattern" type="text" value="" label="regex pattern"> | 223 <param name="regex_pattern" type="text" value="" label="regex pattern"> |
191 <sanitizer sanitize="False"/> | 224 <sanitizer sanitize="False"/> |
192 </param> | 225 </param> |
193 <param name="regex_replace" type="text" value="" label="replacement expression"> | 226 <param name="regex_replace" type="text" value="" label="replacement expression"> |
194 <sanitizer sanitize="False"/> | 227 <sanitizer sanitize="False"/> |
195 </param> | 228 </param> |
196 </when> | 229 </when> |
197 <when value="normalize"> | 230 <when value="normalize"> |
198 <param name="columns" type="data_column" data_ref="table" multiple="True" label="Columns to split" | 231 <param name="columns" type="text" value="" label="enter column numbers to normalize"> |
199 help="If multiple columns are selected, they should have the same length and separator on each line"/> | 232 <help><![CDATA[ |
233 example: 2,4 or c2,c4 (selects the second, and fourth columns) | |
234 If multiple columns are selected, they should have the same length and separator on each line | |
235 ]]></help> | |
236 <validator type="regex" message="Column ordinal positions separated by commas">^(c?[1-9]\d*)(,c?[1-9]\d*)*$</validator> | |
237 </param> | |
200 <param name="separator" type="text" value="," label="List item delimiter in column"> | 238 <param name="separator" type="text" value="," label="List item delimiter in column"> |
201 <sanitizer sanitize="False"/> | 239 <sanitizer sanitize="False"/> |
202 <validator type="regex" message="Anything but TAB or Newline">^[^\t\n\r\f\v]+$</validator> | 240 <validator type="regex" message="Anything but TAB or Newline">^[^\t\n\r\f\v]+$</validator> |
203 </param> | 241 </param> |
204 </when> | 242 </when> |
298 </repeat> | 336 </repeat> |
299 <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"/> | 337 <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"/> |
300 <output name="output" file="query_results.tsv"/> | 338 <output name="output" file="query_results.tsv"/> |
301 </test> | 339 </test> |
302 | 340 |
341 <test> | |
342 <repeat name="tables"> | |
343 <param name="table" ftype="tabular" value="pets.tsv"/> | |
344 <repeat name="linefilters"> | |
345 <param name="filter_type" value="comment"/> | |
346 <param name="comment_char" value="35"/> | |
347 </repeat> | |
348 <repeat name="linefilters"> | |
349 <param name="filter_type" value="append_line_num"/> | |
350 </repeat> | |
351 <repeat name="linefilters"> | |
352 <param name="filter_type" value="select_columns"/> | |
353 <param name="columns" value="7,2,3,4,1"/> | |
354 </repeat> | |
355 <repeat name="linefilters"> | |
356 <param name="filter_type" value="replace"/> | |
357 <param name="column" value="c4"/> | |
358 <param name="regex_pattern" value="(\d+)/(\d+)/(\d+)"/> | |
359 <param name="regex_replace" value="19\3-\2-\1"/> | |
360 </repeat> | |
361 <param name="table_name" value="people"/> | |
362 <param name="col_names" value="id,first,last,dob,pets"/> | |
363 | |
364 </repeat> | |
365 <repeat name="tables"> | |
366 <param name="table" ftype="tabular" value="pets.tsv"/> | |
367 <repeat name="linefilters"> | |
368 <param name="filter_type" value="comment"/> | |
369 <param name="comment_char" value="35"/> | |
370 </repeat> | |
371 <repeat name="linefilters"> | |
372 <param name="filter_type" value="append_line_num"/> | |
373 </repeat> | |
374 <repeat name="linefilters"> | |
375 <param name="filter_type" value="select_columns"/> | |
376 <param name="columns" value="c7,c5,c6"/> | |
377 </repeat> | |
378 <repeat name="linefilters"> | |
379 <param name="filter_type" value="normalize"/> | |
380 <param name="columns" value="c2,c3"/> | |
381 <param name="separator" value=","/> | |
382 </repeat> | |
383 <param name="table_name" value="pet"/> | |
384 <param name="col_names" value="id,name,animal"/> | |
385 </repeat> | |
386 <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'"/> | |
387 <output name="output" file="pet_normalized_query_results.tsv"/> | |
388 </test> | |
389 | |
303 </tests> | 390 </tests> |
304 <help><![CDATA[ | 391 <help><![CDATA[ |
305 ============= | 392 ============= |
306 Query Tabular | 393 Query Tabular |
307 ============= | 394 ============= |