Mercurial > repos > iuc > table_compute
comparison table_compute.xml @ 1:9190f11e46cd draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/table_compute commit 6820ec9431a22576f3716c40feeb27f0b8cf5e83"
| author | iuc |
|---|---|
| date | Fri, 30 Aug 2019 05:27:52 -0400 |
| parents | b38b271a94aa |
| children | fd9f92324423 |
comparison
equal
deleted
inserted
replaced
| 0:b38b271a94aa | 1:9190f11e46cd |
|---|---|
| 1 <tool id="table_compute" name="Table Compute" version="@VERSION@"> | 1 <tool id="table_compute" name="Table Compute" version="@VERSION@"> |
| 2 <description>computes operations on table data</description> | 2 <description>computes operations on table data</description> |
| 3 <macros> | 3 <macros> |
| 4 <token name="@VERSION@">0.8</token> | 4 <token name="@VERSION@">0.9.1</token> |
| 5 <token name="@COPEN@"><![CDATA[<code>]]></token> | 5 <token name="@COPEN@"><![CDATA[<code>]]></token> |
| 6 <token name="@CCLOSE@"><![CDATA[</code>]]></token> | 6 <token name="@CCLOSE@"><![CDATA[</code>]]></token> |
| 7 <import>allowed_functions.xml</import> | 7 <import>allowed_functions.xml</import> |
| 8 <!-- text field validators --> | 8 <!-- text field validators --> |
| 9 <macro name="validator_text" > | 9 <macro name="validator_text" > |
| 17 <macro name="validator_index_identifiers" > | 17 <macro name="validator_index_identifiers" > |
| 18 <validator type="regex" message="Specify a comma-separated list of index names without special characters">^(?:\w+(?:, *\w+)*)?$</validator> | 18 <validator type="regex" message="Specify a comma-separated list of index names without special characters">^(?:\w+(?:, *\w+)*)?$</validator> |
| 19 <sanitizer sanitize="false" /> | 19 <sanitizer sanitize="false" /> |
| 20 </macro> | 20 </macro> |
| 21 <macro name="validator_index_ranges"> | 21 <macro name="validator_index_ranges"> |
| 22 <validator type="regex" message="Specify a comma-separated list index numbers or ranges">^(?:\d+(?::\d)*(?:, *\d+(?::\d)*)*)?$</validator> | 22 <validator type="regex" message="Specify a comma-separated list index numbers or ranges">^(?:-?\d+(?::-?\d+)*(?:, *-?\d+(?::-?\d+)*)*)?$</validator> |
| 23 <sanitizer sanitize="false" /> | 23 <sanitizer sanitize="false" /> |
| 24 </macro> | 24 </macro> |
| 25 <macro name="validator_functiondef"> | 25 <macro name="validator_functiondef"> |
| 26 <validator type="regex" message="An expression is required and is allowed to contain only letters, numbers and the characters '_ !-+=/*%.<>()'">^[\w !\-+=/*%,.<>()]+$</validator> | 26 <validator type="regex" message="An expression is required and is allowed to contain only letters, numbers and the characters '_ !-+=/*%.<>()'">^['"\w !\-+=/*%,.<>()]+$</validator> |
| 27 <sanitizer sanitize="false" /> | 27 <sanitizer sanitize="false" /> |
| 28 </macro> | 28 </macro> |
| 29 <!-- macro for main input tests --> | 29 <!-- macro for main input tests --> |
| 30 <macro name="test_inputs_single" > | 30 <macro name="test_inputs_single" > |
| 31 <conditional name="singtabop" > | 31 <conditional name="singtabop" > |
| 32 <param name="use_type" value="single" /> | 32 <param name="use_type" value="single" /> |
| 33 <param name="input" value="small.tsv" /> | 33 <param name="input" value="small.tsv" /> |
| 34 <conditional name="user" > | 34 <conditional name="user" > |
| 35 <yield /> | |
| 36 </conditional> | |
| 37 </conditional> | |
| 38 </macro> | |
| 39 <macro name="test_inputs_ranges" > | |
| 40 <conditional name="singtabop" > | |
| 41 <param name="use_type" value="single" /> | |
| 42 <param name="input" value="examples.1.tsv" /> | |
| 43 <conditional name="user" > | |
| 44 <param name="mode" value="select" /> | |
| 35 <yield /> | 45 <yield /> |
| 36 </conditional> | 46 </conditional> |
| 37 </conditional> | 47 </conditional> |
| 38 </macro> | 48 </macro> |
| 39 <!-- macro for umi to transcript tests --> | 49 <!-- macro for umi to transcript tests --> |
| 51 </macro> | 61 </macro> |
| 52 <!-- macro for file inputs --> | 62 <!-- macro for file inputs --> |
| 53 <macro name="file_opts"> | 63 <macro name="file_opts"> |
| 54 <param name="input" type="data" format="tsv,tabular" label="Table" /> | 64 <param name="input" type="data" format="tsv,tabular" label="Table" /> |
| 55 <param name="col_row_names" type="select" display="checkboxes" multiple="true" optional="true" | 65 <param name="col_row_names" type="select" display="checkboxes" multiple="true" optional="true" |
| 56 label="This input data has"> | 66 label="Input data has"> |
| 57 <option value="has_col_names" selected="true">Column names on the first row</option> | 67 <option value="has_col_names" selected="true">Column names on the first row</option> |
| 58 <option value="has_row_names" selected="true">Row names on the first column"</option> | 68 <option value="has_row_names" selected="true">Row names on the first column</option> |
| 59 </param> | 69 </param> |
| 70 <section name="adv" title="Advanced File Options " expanded="false" > | |
| 71 <param name="header" type="integer" min="0" optional="true" label="Header begins at line N" help="All lines before line N will be skipped. If a value is set, this will override the above 'Column names on the first row' parameter." /> | |
| 72 <param name="nrows" type="integer" min="0" optional="true" label="Read N lines only" help="Parses only N lines after the header line." /> | |
| 73 <param name="skipfooter" type="integer" min="0" optional="true" label="Skip N lines from bottom" help="Do not use this in conjunction with the 'Read N lines only' parameter." /> | |
| 74 <param name="skip_blank_lines" type="boolean" checked="true" falsevalue="False" truevalue="True" label="Skip blank lines" help="Otherwise it will insert NaN values for every blank line detected." /> | |
| 75 </section> | |
| 60 </macro> | 76 </macro> |
| 61 <!-- element value macro --> | 77 <!-- element value macro --> |
| 62 <macro name="elem_val_macro" > | 78 <macro name="elem_val_macro" token_when="@WHEN@" > |
| 63 <param name="element_value" type="text" optional="true" label="Filter value" help="This value is converted to numeric if possible, otherwise it is treated as a string" /> | 79 <when value="@WHEN@" > |
| 80 <param name="element_value" type="text" optional="true" label="Filter value" help="This value is converted to numeric if possible, otherwise it is treated as a string" /> | |
| 81 </when> | |
| 82 </macro> | |
| 83 <!-- Row/Col macro --> | |
| 84 <macro name="select_rowcols" > | |
| 85 <param name="select_cols_wanted" type="text" optional="true" label="List of columns to select" help="Comma separated. (e.g. @COPEN@3:5,10,-1,2:-2@CCLOSE@ will select columns @COPEN@3,4,5,10,-1,2,1,0,-1,-2@CCLOSE@, where negative indices refer to the offset from the last index). Columns can be duplicated by specifying them multiple times. Leave blank to retain all columns. See Example #1 for an example of using this mode." > | |
| 86 <expand macro="validator_index_ranges" /> | |
| 87 </param> | |
| 88 <param name="select_rows_wanted" type="text" optional="true" label="List of rows to select" help="The same rules apply as above" > | |
| 89 <expand macro="validator_index_ranges" /> | |
| 90 </param> | |
| 64 </macro> | 91 </macro> |
| 65 </macros> | 92 </macros> |
| 66 <requirements> | 93 <requirements> |
| 67 <requirement type="package" version="0.25">pandas</requirement> | 94 <requirement type="package" version="0.25">pandas</requirement> |
| 68 <requirement type="package" version="1.17">numpy</requirement> | 95 <requirement type="package" version="1.17">numpy</requirement> |
| 69 </requirements> | 96 </requirements> |
| 70 | 97 |
| 71 <version_command><![CDATA[ | 98 <version_command><![CDATA[ |
| 72 touch '$__tool_directory__/scripts/userconfig.py' && python '$__tool_directory__/scripts/table_compute.py' --version | 99 python '$__tool_directory__/scripts/table_compute.py' --version |
| 73 ]]></version_command> | 100 ]]></version_command> |
| 74 | 101 |
| 75 <command detect_errors="exit_code"><![CDATA[ | 102 <command detect_errors="exit_code"><![CDATA[ |
| 76 ## Can only import generated userconfig.py if calling | 103 ## Can only import generated userconfig.py if calling |
| 77 ## script is in the same directory. Soft-linking does | 104 ## script is in the same directory. Soft-linking does |
| 81 cp '$__tool_directory__/scripts/table_compute.py' ./table_compute.py && | 108 cp '$__tool_directory__/scripts/table_compute.py' ./table_compute.py && |
| 82 python ./table_compute.py | 109 python ./table_compute.py |
| 83 ]]></command> | 110 ]]></command> |
| 84 <configfiles> | 111 <configfiles> |
| 85 <configfile name="userconf"><![CDATA[ | 112 <configfile name="userconf"><![CDATA[ |
| 86 | |
| 87 ## Range Maker | |
| 88 ## "2:5,11,1:2" specifies "2,3,4,5,11,1,2" which in python is "1,2,3,4,10,0,1" | |
| 89 #def rangemake(tab): | |
| 90 #echo [(n-1) for r in map(lambda y: range(int(y[0]),int(y[-1])+1), map(lambda x: x.split(':'), tab.split(','))) for n in r] | |
| 91 #end def | |
| 92 | |
| 93 ## Strip leading and trailing whitespace off custom functions | |
| 94 | |
| 95 Default = { | 113 Default = { |
| 96 "reader_skip": 0, | 114 "reader_skip": 0, |
| 97 "precision": $precision, | 115 "precision": $precision, |
| 98 #if 'ignore_nas' in str($out_opts): | 116 #if 'ignore_nas' in str($out_opts): |
| 99 "narm": True, | 117 "narm": True, |
| 116 | 134 |
| 117 #if str($singtabop.use_type) == "single": | 135 #if str($singtabop.use_type) == "single": |
| 118 Data = { | 136 Data = { |
| 119 "tables": [ | 137 "tables": [ |
| 120 { | 138 { |
| 121 "reader_file": '$singtabop.input', | 139 "file": '$singtabop.input', |
| 122 #if 'has_col_names' in str($singtabop.col_row_names): | 140 #if $singtabop.adv.header: |
| 123 "reader_header": 0, | 141 "header": int('$singtabop.adv.header'), |
| 142 #elif 'has_col_names' in str($singtabop.col_row_names): | |
| 143 "header": 0, | |
| 124 #else: | 144 #else: |
| 125 "reader_header": None, | 145 "header": None, |
| 126 #end if | 146 #end if |
| 127 #if 'has_row_names' in str($singtabop.col_row_names): | 147 "row_names": #if ('has_row_names' in str($singtabop.col_row_names)) then 0 else False#, |
| 128 "reader_row_col": 0, | 148 "skipfooter": #if $singtabop.adv.skipfooter then int($singtabop.adv.skipfooter) else 0#, |
| 129 #else: | 149 #if $singtabop.adv.skip_blank_lines |
| 130 "reader_row_col": False, | 150 "skip_blank_lines": $singtabop.adv.skip_blank_lines, |
| 151 #else | |
| 152 "skip_blank_lines": None, | |
| 153 #end if | |
| 154 #if $singtabop.adv.nrows | |
| 155 "nrows": int('$singtabop.adv.nrows'), | |
| 156 #else | |
| 157 "nrows": None, | |
| 131 #end if | 158 #end if |
| 132 } | 159 } |
| 133 ], | 160 ], |
| 134 "params": { | 161 "params": { |
| 135 "user_mode_single": '$singtabop.user.mode.value', | 162 "user_mode_single": '$singtabop.user.mode.value', |
| 139 } | 166 } |
| 140 #elif $singtabop.user.mode.value == 'select': | 167 #elif $singtabop.user.mode.value == 'select': |
| 141 "select_cols_unique": #echo 'select_cols_keepdupe' in str($singtabop.user.select_keepdupe)#, | 168 "select_cols_unique": #echo 'select_cols_keepdupe' in str($singtabop.user.select_keepdupe)#, |
| 142 "select_rows_unique": #echo 'select_rows_keepdupe' in str($singtabop.user.select_keepdupe)#, | 169 "select_rows_unique": #echo 'select_rows_keepdupe' in str($singtabop.user.select_keepdupe)#, |
| 143 #if $singtabop.user.select_cols_wanted: | 170 #if $singtabop.user.select_cols_wanted: |
| 144 "select_cols_wanted": $rangemake(str($singtabop.user.select_cols_wanted)), | 171 "select_cols_wanted": '$singtabop.user.select_cols_wanted', |
| 145 #else | 172 #else |
| 146 "select_cols_wanted": None, | 173 "select_cols_wanted": None, |
| 147 #end if | 174 #end if |
| 148 #if $singtabop.user.select_rows_wanted: | 175 #if $singtabop.user.select_rows_wanted: |
| 149 "select_rows_wanted": $rangemake(str($singtabop.user.select_rows_wanted)), | 176 "select_rows_wanted": '$singtabop.user.select_rows_wanted', |
| 150 #else | 177 #else |
| 151 "select_rows_wanted": None, | 178 "select_rows_wanted": None, |
| 152 #end if | 179 #end if |
| 153 } | 180 } |
| 154 #elif $singtabop.user.mode.value == 'filtersumval': | 181 #elif $singtabop.user.mode.value == 'filtersumval': |
| 179 "matrixapply_custom_func": None, | 206 "matrixapply_custom_func": None, |
| 180 "matrixapply_op": '$singtabop.user.matrixapply_func.vector_op', | 207 "matrixapply_op": '$singtabop.user.matrixapply_func.vector_op', |
| 181 #end if | 208 #end if |
| 182 } | 209 } |
| 183 #elif $singtabop.user.mode.value == 'element': | 210 #elif $singtabop.user.mode.value == 'element': |
| 184 #if str($singtabop.user.elem_val.element_op) != "None": | 211 #if str($singtabop.user.elem_val.element_op) == "None": |
| 212 "element_op": None, | |
| 213 #elif str($singtabop.user.elem_val.element_op) == "rowcol": | |
| 214 "element_op": "rowcol", | |
| 215 #if $singtabop.user.elem_val.select_rows_wanted | |
| 216 "element_rows": '$singtabop.user.elem_val.select_rows_wanted', | |
| 217 #end if | |
| 218 #if $singtabop.user.elem_val.select_cols_wanted | |
| 219 "element_cols": '$singtabop.user.elem_val.select_cols_wanted', | |
| 220 #end if | |
| 221 "element_inclusive": $singtabop.user.elem_val.inclusive_selection, | |
| 222 #else: | |
| 185 "element_op": '$singtabop.user.elem_val.element_op.value', | 223 "element_op": '$singtabop.user.elem_val.element_op.value', |
| 186 ## Value is string or float, parsed in code later | 224 ## Value is string or float, parsed in code later |
| 187 "element_value" : '$singtabop.user.elem_val.element_value', | 225 "element_value" : '$singtabop.user.elem_val.element_value', |
| 188 #else: | |
| 189 "element_op": None, | |
| 190 #end if | 226 #end if |
| 191 "element_mode": '$singtabop.user.element.mode.value', | 227 "element_mode": '$singtabop.user.element.mode.value', |
| 192 #if str($singtabop.user.element.mode) == "replace": | 228 #if str($singtabop.user.element.mode) == "replace": |
| 193 "element_replace": '$singtabop.user.element.replace_value.value', | 229 "element_replace": '$singtabop.user.element.replace_value.value', |
| 194 #elif str($singtabop.user.element.mode) == "modify": | 230 #elif str($singtabop.user.element.mode) == "modify": |
| 250 Data = { | 286 Data = { |
| 251 "tables": [ | 287 "tables": [ |
| 252 #for $i, $s in enumerate($singtabop.tables) | 288 #for $i, $s in enumerate($singtabop.tables) |
| 253 { | 289 { |
| 254 "file": '${s.input}', | 290 "file": '${s.input}', |
| 255 #if 'has_col_names' in str($s.col_row_names): | 291 #if $s.adv.header: |
| 292 "header": int('${s.adv.header}'), | |
| 293 #elif 'has_col_names' in str($s.col_row_names): | |
| 256 "header": 0, | 294 "header": 0, |
| 257 #else: | 295 #else: |
| 258 "header": None, | 296 "header": None, |
| 259 #end if | 297 #end if |
| 260 #if 'has_row_names' in str($s.col_row_names): | 298 "row_names": #if ('has_row_names' in str($s.col_row_names)) then 0 else False#, |
| 261 "row_names": 0, | 299 "skipfooter": #if $s.adv.skipfooter then int('$s.adv.skipfooter') else 0#, |
| 262 #else: | 300 #if $s.adv.skip_blank_lines: |
| 263 "row_names": False, | 301 "skip_blank_lines": $s.adv.skip_blank_lines, |
| 302 #else | |
| 303 "skip_blank_lines": None, | |
| 264 #end if | 304 #end if |
| 305 #if $s.adv.nrows: | |
| 306 "nrows": int('${s.adv.nrows}'), | |
| 307 #else | |
| 308 "nrows": None, | |
| 309 #end if | |
| 310 | |
| 265 }, | 311 }, |
| 266 #end for | 312 #end for |
| 267 ], | 313 ], |
| 268 'params': { | 314 'params': { |
| 269 "fulltable_customop" : '$custom_func', | 315 "fulltable_customop" : '$custom_func', |
| 291 <option value="element">Manipulate selected table elements</option> | 337 <option value="element">Manipulate selected table elements</option> |
| 292 <option value="fulltable">Perform a full table operation</option> | 338 <option value="fulltable">Perform a full table operation</option> |
| 293 </param> | 339 </param> |
| 294 <when value="precision" /> | 340 <when value="precision" /> |
| 295 <when value="select"> | 341 <when value="select"> |
| 296 <param name="select_cols_wanted" type="text" optional="true" label="List of columns to select" help="Comma separated. (e.g. @COPEN@3:5,99,2:4@CCLOSE@ will select columns @COPEN@3,4,5,99,2,3,4@CCLOSE@). Columns can be duplicated by specifying them multiple times. Leave blank to retain all columns. See Example #1 for an example of using this mode." > | 342 <expand macro="select_rowcols" /> |
| 297 <expand macro="validator_index_ranges" /> | |
| 298 </param> | |
| 299 <param name="select_rows_wanted" type="text" optional="true" label="List of rows to select" help="The same rules apply as above" > | |
| 300 <expand macro="validator_index_ranges" /> | |
| 301 </param> | |
| 302 <param name="select_keepdupe" type="select" display="checkboxes" multiple="true" label="Duplicate Indices" help="Keep duplicates when specifying ranges (e.g. if unset, @COPEN@1:3,2:4@CCLOSE@ will yield @COPEN@1,2,3,4@CCLOSE@ instead of @COPEN@1,2,3,2,3,4@CCLOSE@)" > | 343 <param name="select_keepdupe" type="select" display="checkboxes" multiple="true" label="Duplicate Indices" help="Keep duplicates when specifying ranges (e.g. if unset, @COPEN@1:3,2:4@CCLOSE@ will yield @COPEN@1,2,3,4@CCLOSE@ instead of @COPEN@1,2,3,2,3,4@CCLOSE@)" > |
| 303 <option value="select_cols_keepdupe" selected="true" >Keep duplicate columns</option> | 344 <option value="select_cols_keepdupe" selected="true" >Keep duplicate columns</option> |
| 304 <option value="select_rows_keepdupe" selected="true" >Keep duplicate rows</option> | 345 <option value="select_rows_keepdupe" selected="true" >Keep duplicate rows</option> |
| 305 </param> | 346 </param> |
| 306 </when> | 347 </when> |
| 445 <expand macro="select_twovaluenumericoperator" /> | 486 <expand macro="select_twovaluenumericoperator" /> |
| 446 </param> | 487 </param> |
| 447 <param name="scale_value" type="float" value="0" label="Second operand value" /> | 488 <param name="scale_value" type="float" value="0" label="Second operand value" /> |
| 448 </when> | 489 </when> |
| 449 <when value="custom"> | 490 <when value="custom"> |
| 450 <param name="custom_expr" type="text" | 491 <param name="custom_expr" type="text" label="Custom expression on 'elem'" |
| 451 label="Custom expression on 'elem'" | 492 help="The parameter name is @COPEN@elem@CCLOSE@, referring to the element being acted on. Most operators and @COPEN@if@CCLOSE@ @COPEN@else@CCLOSE@ statements are supported. See Examples #3 and #4 in the Help section."> |
| 452 help="The parameter name is @COPEN@elem@CCLOSE@, referring to the element being acted on. Most operators and @COPEN@if@CCLOSE@ @COPEN@else@CCLOSE@ statements are supported. See Examples #3 and #4 in the Help section."> | |
| 453 <expand macro="validator_functiondef" /> | 493 <expand macro="validator_functiondef" /> |
| 454 </param> | 494 </param> |
| 455 </when> | 495 </when> |
| 456 </conditional> | 496 </conditional> |
| 457 <conditional name="elem_val" > | 497 <conditional name="elem_val" > |
| 458 <param name="element_op" type="select" label="Operate on elements" | 498 <param name="element_op" type="select" label="Operate on elements" |
| 459 help="Only selected elements will be manipulated. Other elements will retain their original value." > | 499 help="Only selected elements will be manipulated. Other elements will retain their original value." > |
| 460 <expand macro="select_twovaluebooleanops" > | 500 <expand macro="select_twovaluebooleanops" > |
| 461 <option value="None" selected="true">All</option> | 501 <option value="None" selected="true">All</option> |
| 502 <option value="rowcol" >Specific Rows and/or Columns</option> | |
| 462 </expand> | 503 </expand> |
| 463 </param> | 504 </param> |
| 464 <when value="None" /> | 505 <when value="None" /> |
| 465 <when value="lt"> | 506 <expand macro="elem_val_macro" when="lt" /> |
| 466 <expand macro="elem_val_macro" /> | 507 <expand macro="elem_val_macro" when="le" /> |
| 467 </when> | 508 <expand macro="elem_val_macro" when="gt" /> |
| 468 <when value="le"> | 509 <expand macro="elem_val_macro" when="ge" /> |
| 469 <expand macro="elem_val_macro" /> | 510 <expand macro="elem_val_macro" when="eq" /> |
| 470 </when> | 511 <expand macro="elem_val_macro" when="ne" /> |
| 471 <when value="gt"> | 512 <when value="rowcol" > |
| 472 <expand macro="elem_val_macro" /> | 513 <expand macro="select_rowcols" /> |
| 473 </when> | 514 <param name="inclusive_selection" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Inclusive Selection" help="If enabled, all elements that match ANY row or column given above will be acted on. Otherwise, only the elements that match BOTH a row or column given above will be acted on." /> |
| 474 <when value="ge"> | |
| 475 <expand macro="elem_val_macro" /> | |
| 476 </when> | |
| 477 <when value="eq"> | |
| 478 <expand macro="elem_val_macro" /> | |
| 479 </when> | |
| 480 <when value="ne"> | |
| 481 <expand macro="elem_val_macro" /> | |
| 482 </when> | 515 </when> |
| 483 </conditional> | 516 </conditional> |
| 484 </when> | 517 </when> |
| 485 </conditional> | 518 </conditional> |
| 486 </when> | 519 </when> |
| 1037 <has_line_matching expression="^one\s+1\s+2\s+3$" /> | 1070 <has_line_matching expression="^one\s+1\s+2\s+3$" /> |
| 1038 <has_line_matching expression="^two\s+4\s+5\s+6$" /> | 1071 <has_line_matching expression="^two\s+4\s+5\s+6$" /> |
| 1039 </assert_contents> | 1072 </assert_contents> |
| 1040 </output> | 1073 </output> |
| 1041 </test> | 1074 </test> |
| 1075 <test expect_num_outputs="1" > | |
| 1076 <!-- Test 33: Subtracting table means #1 --> | |
| 1077 <conditional name="singtabop" > | |
| 1078 <param name="use_type" value="single" /> | |
| 1079 <param name="input" value="examples.5.tsv" /> | |
| 1080 <param name="col_row_names" value="has_col_names,has_row_names" /> | |
| 1081 <conditional name="user" > | |
| 1082 <param name="mode" value="fulltable" /> | |
| 1083 <conditional name="general" > | |
| 1084 <param name="use" value="custom" /> | |
| 1085 <param name="fulltable_custom_expr" value="table - table.mean(1)/table.std(1)" /> | |
| 1086 </conditional> | |
| 1087 </conditional> | |
| 1088 </conditional> | |
| 1089 <output name="table" > | |
| 1090 <assert_contents> | |
| 1091 <has_n_columns n="8" /> | |
| 1092 <!-- should give nonsense empty output --> | |
| 1093 <has_line_matching expression="^\sc1\sc2\sc3\sg1\sg2\sg3\sg4$" /> | |
| 1094 <has_line_matching expression="^g4\s+$" /> | |
| 1095 </assert_contents> | |
| 1096 </output> | |
| 1097 </test> | |
| 1098 <test expect_num_outputs="1" > | |
| 1099 <!-- Test 34: Subtracting table means #2 --> | |
| 1100 <conditional name="singtabop" > | |
| 1101 <param name="use_type" value="single" /> | |
| 1102 <param name="input" value="examples.5.tsv" /> | |
| 1103 <param name="col_row_names" value="has_col_names,has_row_names" /> | |
| 1104 <conditional name="user" > | |
| 1105 <param name="mode" value="fulltable" /> | |
| 1106 <conditional name="general" > | |
| 1107 <param name="use" value="custom" /> | |
| 1108 <param name="fulltable_custom_expr" value="table.sub(table.mean(1), 0).div(table.std(1),0)" /> | |
| 1109 </conditional> | |
| 1110 </conditional> | |
| 1111 </conditional> | |
| 1112 <output name="table" > | |
| 1113 <assert_contents> | |
| 1114 <has_n_columns n="4" /> | |
| 1115 <has_line_matching expression="^g1\s+-1\.\d+\s+0\.\d+\s+1\.\d+\s*$" /> | |
| 1116 <has_line_matching expression="^g4\s+1\.1\d+\s+-0\.5\d+\s+-0\.5\d+\s*$" /> | |
| 1117 </assert_contents> | |
| 1118 </output> | |
| 1119 </test> | |
| 1120 <test expect_num_outputs="1" > | |
| 1121 <!-- Test 35: Subtracting table means #3 --> | |
| 1122 <conditional name="singtabop" > | |
| 1123 <param name="use_type" value="single" /> | |
| 1124 <param name="input" value="examples.5.tsv" /> | |
| 1125 <param name="col_row_names" value="has_col_names,has_row_names" /> | |
| 1126 <conditional name="user" > | |
| 1127 <param name="mode" value="fulltable" /> | |
| 1128 <conditional name="general" > | |
| 1129 <param name="use" value="custom" /> | |
| 1130 <param name="fulltable_custom_expr" value="(table.T - table.mean(1)).T" /> | |
| 1131 </conditional> | |
| 1132 </conditional> | |
| 1133 </conditional> | |
| 1134 <output name="table" > | |
| 1135 <assert_contents> | |
| 1136 <has_n_columns n="4" /> | |
| 1137 <has_line_matching expression="^g1\s+-10\.\d+\s+0\.\d+\s+10\.\d+\s*$" /> | |
| 1138 <has_line_matching expression="^g4\s+47\.3\d+\s+-23\.6\d+\s+-23\.6\d+\s*$" /> | |
| 1139 </assert_contents> | |
| 1140 </output> | |
| 1141 </test> | |
| 1142 <test expect_num_outputs="1" > | |
| 1143 <!-- Test 36: Negative range test #1 --> | |
| 1144 <expand macro="test_inputs_ranges" > | |
| 1145 <param name="select_cols_wanted" value="-2:2,1,-1" /> | |
| 1146 <param name="select_rows_wanted" value="1,3:-3,1" /> | |
| 1147 </expand> | |
| 1148 <output name="table" > | |
| 1149 <assert_contents> | |
| 1150 <has_n_columns n="7" /> | |
| 1151 <has_line_matching expression="^\s*c2\s+c3\s+c1\s+c2\s+c1\s+c3$" /> | |
| 1152 <has_line_matching expression="^g1\s+20\s+30\s+10\s+20\s+10\s+30$" /> | |
| 1153 </assert_contents> | |
| 1154 </output> | |
| 1155 </test> | |
| 1156 <test expect_num_outputs="1" > | |
| 1157 <!-- Test 37: Negative range test #2 --> | |
| 1158 <expand macro="test_inputs_ranges" > | |
| 1159 <param name="select_cols_wanted" value="-1,-3,3:-3,2" /> | |
| 1160 <param name="select_rows_wanted" value="3:-1" /> | |
| 1161 <param name="select_keepdupe" value="" /> | |
| 1162 </expand> | |
| 1163 <output name="table" > | |
| 1164 <assert_contents> | |
| 1165 <has_n_columns n="7" /> | |
| 1166 <has_line_matching expression="^\s*c3\s+c1\s+c3\s+c2\s+c1\s+c2$" /> | |
| 1167 <has_line_matching expression="^g4\s+3\s+81\s+3\s+6\s+81\s+6$" /> | |
| 1168 </assert_contents> | |
| 1169 </output> | |
| 1170 </test> | |
| 1171 <test expect_num_outputs="1"> | |
| 1172 <!-- Test 38: Skip first 3 lines --> | |
| 1173 <conditional name="singtabop" > | |
| 1174 <param name="use_type" value="single" /> | |
| 1175 <param name="input" value="skiplines.tsv" /> | |
| 1176 <section name="adv" > | |
| 1177 <param name="header" value="2" /> | |
| 1178 <param name="nrows" value="4" /> | |
| 1179 <param name="skip_blank_lines" value="true" /> | |
| 1180 </section> | |
| 1181 <conditional name="user" > | |
| 1182 <param name="mode" value="precision" /> | |
| 1183 </conditional> | |
| 1184 </conditional> | |
| 1185 <param name="precision" value="2" /> | |
| 1186 <output name="table" > | |
| 1187 <assert_contents> | |
| 1188 <has_n_columns n="4" /> | |
| 1189 <has_line_matching expression="^\s+c1\s+c2\s+c3$" /> | |
| 1190 <has_line_matching expression="^g4\s+81\s+6\s+3$" /> | |
| 1191 </assert_contents> | |
| 1192 </output> | |
| 1193 </test> | |
| 1194 <test expect_num_outputs="1"> | |
| 1195 <!-- Test 39: Skip first 3 lines --> | |
| 1196 <conditional name="singtabop" > | |
| 1197 <param name="use_type" value="single" /> | |
| 1198 <param name="input" value="skiplines.tsv" /> | |
| 1199 <section name="adv" > | |
| 1200 <param name="header" value="2" /> | |
| 1201 <param name="skipfooter" value="2" /> | |
| 1202 <param name="skip_blank_lines" value="false" /> | |
| 1203 </section> | |
| 1204 <conditional name="user" > | |
| 1205 <param name="mode" value="precision" /> | |
| 1206 </conditional> | |
| 1207 </conditional> | |
| 1208 <param name="precision" value="2" /> | |
| 1209 <param name="out_opts" value="" /> | |
| 1210 <output name="table" > | |
| 1211 <assert_contents> | |
| 1212 <has_n_columns n="3" /> | |
| 1213 <has_line_matching expression="^10.00\s+20.00\s+30.00$" /> | |
| 1214 <has_line_matching expression="^\s+$" /> | |
| 1215 </assert_contents> | |
| 1216 </output> | |
| 1217 </test> | |
| 1218 <test expect_num_outputs="1" > | |
| 1219 <!-- Test 40: Row Col custom op #1 --> | |
| 1220 <conditional name="singtabop" > | |
| 1221 <param name="use_type" value="single" /> | |
| 1222 <param name="input" value="examples.1.tsv" /> | |
| 1223 <param name="col_row_names" value="has_col_names,has_row_names" /> | |
| 1224 <conditional name="user" > | |
| 1225 <param name="mode" value="element" /> | |
| 1226 <conditional name="element" > | |
| 1227 <param name="mode" value="custom" /> | |
| 1228 <param name="custom_expr" value=""chr%.f" % elem" /> | |
| 1229 </conditional> | |
| 1230 <conditional name="elem_val" > | |
| 1231 <param name="element_op" value="rowcol" /> | |
| 1232 <param name="select_cols_wanted" value="2" /> | |
| 1233 <param name="select_rows_wanted" value="2,4" /> | |
| 1234 <param name="inclusive_selection" value="True" /> | |
| 1235 </conditional> | |
| 1236 </conditional> | |
| 1237 </conditional> | |
| 1238 <output name="table" > | |
| 1239 <assert_contents> | |
| 1240 <has_n_columns n="4" /> | |
| 1241 <has_line_matching expression="^g2\s+chr3\s+chr6\s+chr9$" /> | |
| 1242 <has_line_matching expression="^g4\s+chr81\s+chr6\s+chr3$" /> | |
| 1243 </assert_contents> | |
| 1244 </output> | |
| 1245 </test> | |
| 1246 <test expect_num_outputs="1" > | |
| 1247 <!-- Test 41: Row Col custom op #2 --> | |
| 1248 <conditional name="singtabop" > | |
| 1249 <param name="use_type" value="single" /> | |
| 1250 <param name="input" value="examples.1.tsv" /> | |
| 1251 <param name="col_row_names" value="has_col_names,has_row_names" /> | |
| 1252 <conditional name="user" > | |
| 1253 <param name="mode" value="element" /> | |
| 1254 <conditional name="element" > | |
| 1255 <param name="mode" value="custom" /> | |
| 1256 <param name="custom_expr" value=""chr%.f" % elem" /> | |
| 1257 </conditional> | |
| 1258 <conditional name="elem_val" > | |
| 1259 <param name="element_op" value="rowcol" /> | |
| 1260 <param name="select_cols_wanted" value="2" /> | |
| 1261 <param name="select_rows_wanted" value="2,4" /> | |
| 1262 <param name="inclusive_selection" value="False" /> | |
| 1263 </conditional> | |
| 1264 </conditional> | |
| 1265 </conditional> | |
| 1266 <output name="table" > | |
| 1267 <assert_contents> | |
| 1268 <has_n_columns n="4" /> | |
| 1269 <has_line_matching expression="^g2\s+3\s+chr6\s+9$" /> | |
| 1270 <has_line_matching expression="^g4\s+81\s+chr6\s+3$" /> | |
| 1271 </assert_contents> | |
| 1272 </output> | |
| 1273 </test> | |
| 1042 </tests> | 1274 </tests> |
| 1043 <help><![CDATA[ | 1275 <help><![CDATA[ |
| 1044 This tool computes table expressions on the element, row, and column basis. It can sub-select, | 1276 This tool computes table expressions on the element, row, and column basis. It can sub-select, |
| 1045 duplicate, as well as perform general and custom expressions on rows, columns or elements. | 1277 duplicate, as well as perform general and custom expressions on rows, columns or elements. |
| 1046 | 1278 |
| 1434 * *Column* → "bar" | 1666 * *Column* → "bar" |
| 1435 * *Values* → "baz" | 1667 * *Values* → "baz" |
| 1436 | 1668 |
| 1437 This splits the matrix using "foo" and "bar" using only the values from "baz". Header values may contain extra information. | 1669 This splits the matrix using "foo" and "bar" using only the values from "baz". Header values may contain extra information. |
| 1438 | 1670 |
| 1671 | |
| 1672 Example 9: Replacing text in specific rows or columns | |
| 1673 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 1674 | |
| 1675 We have the following table | |
| 1676 | |
| 1677 === === === === | |
| 1678 . c1 c2 c3 | |
| 1679 === === === === | |
| 1680 g1 10 20 30 | |
| 1681 g2 3 3 9 | |
| 1682 g3 4 8 12 | |
| 1683 g4 81 6 3 | |
| 1684 === === === === | |
| 1685 | |
| 1686 and we want to add "chr" to the elements in column 2 AND rows 2 and 4: | |
| 1687 | |
| 1688 === === ==== === | |
| 1689 . c1 c2 c3 | |
| 1690 === === ==== === | |
| 1691 g1 10 20 30 | |
| 1692 g2 3 chr3 9 | |
| 1693 g3 4 8 12 | |
| 1694 g4 81 chr6 3 | |
| 1695 === === ==== === | |
| 1696 | |
| 1697 In Galaxy we would select the following: | |
| 1698 | |
| 1699 * *Input Single or Multiple Tables* → **Single Table** | |
| 1700 * *Column names on first row?* → **Yes** | |
| 1701 * *Row names on first column?* → **Yes** | |
| 1702 | |
| 1703 * *Type of table operation* → **Manipulate selected table elements** | |
| 1704 | |
| 1705 * *Operation to perform* → **Custom** | |
| 1706 | |
| 1707 * *Custom Expression* → :: | |
| 1708 | |
| 1709 "chr%.f" % elem | |
| 1710 | |
| 1711 * *Operate on elements* → **Specific Rows and/or Columns** | |
| 1712 * *List of columns to select* → "2" | |
| 1713 * *List of rows to select* → "2,4" | |
| 1714 * *Inclusive Selection* → "No" | |
| 1715 | |
| 1716 | |
| 1717 If we wanted to instead add "chr" to the ALL elements in column 2 and rows 2 and 4, we would repeat the steps above but set the *Inclusive Selection* to "Yes", to give: | |
| 1718 | |
| 1719 === ===== ===== ===== | |
| 1720 . c1 c2 c3 | |
| 1721 === ===== ===== ===== | |
| 1722 g1 10 chr20 30 | |
| 1723 g2 chr3 chr3 chr9 | |
| 1724 g3 4 8 12 | |
| 1725 g4 chr81 chr6 chr3 | |
| 1726 === ===== ===== ===== | |
| 1727 | |
| 1728 | |
| 1729 | |
| 1439 ]]></help> | 1730 ]]></help> |
| 1440 <citations></citations> | 1731 <citations></citations> |
| 1441 </tool> | 1732 </tool> |
