comparison main_macros.xml @ 10:badf6af0a182 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 97c4f22cdcfa6cddeeffc7b102c418a7ff12a888
author bgruening
date Tue, 05 Jun 2018 06:44:55 -0400
parents 049c8e817869
children 0ba38603a0d6
comparison
equal deleted inserted replaced
9:049c8e817869 10:badf6af0a182
1 <macros> 1 <macros>
2 <token name="@VERSION@">0.9</token> 2 <token name="@VERSION@">0.9</token>
3 3
4 <token name="@COLUMNS_FUNCTION@"> 4 <token name="@COLUMNS_FUNCTION@">
5 def read_columns(f, c, return_df=False, **args): 5 def read_columns(f, c=None, c_option='by_index_number', return_df=False, **args):
6 data = pandas.read_csv(f, **args) 6 data = pandas.read_csv(f, **args)
7 cols = c.split (',') 7 if c_option == 'by_index_number':
8 cols = map(int, cols) 8 cols = list(map(lambda x: x - 1, c))
9 cols = list(map(lambda x: x - 1, cols)) 9 data = data.iloc[:,cols]
10 data = data.iloc[:,cols]
11 y = data.values 10 y = data.values
12 if return_df: 11 if return_df:
13 return y, data 12 return y, data
14 else: 13 else:
15 return y 14 return y
16 return y 15 return y
17 </token> 16 </token>
18 17
19 ## generate an instance for one of sklearn.feature_selection classes 18 ## generate an instance for one of sklearn.feature_selection classes
20 ## must call "@COLUMNS_FUNCTION@"
21 <token name="@FEATURE_SELECTOR_FUNCTION@"> 19 <token name="@FEATURE_SELECTOR_FUNCTION@">
22 def feature_selector(inputs): 20 def feature_selector(inputs):
23 selector = inputs["selected_algorithm"] 21 selector = inputs["selected_algorithm"]
24 selector = getattr(sklearn.feature_selection, selector) 22 selector = getattr(sklearn.feature_selection, selector)
25 options = inputs["options"] 23 options = inputs["options"]
426 <param name="infile2" type="data" format="@FORMAT2@" label="@LABEL2@" help="@HELP2@"/> 424 <param name="infile2" type="data" format="@FORMAT2@" label="@LABEL2@" help="@HELP2@"/>
427 <param name="col2" multiple="@MULTIPLE2@" type="data_column" data_ref="infile2" label="Select target column(s):"/> 425 <param name="col2" multiple="@MULTIPLE2@" type="data_column" data_ref="infile2" label="Select target column(s):"/>
428 <yield/> 426 <yield/>
429 </xml> 427 </xml>
430 428
431 <xml name="samples_tabular" token_multiple1="False" token_multiple2="False"> 429 <xml name="samples_tabular" token_multiple1="false" token_multiple2="false">
432 <param name="infile1" type="data" format="tabular" label="Training samples dataset:"/> 430 <param name="infile1" type="data" format="tabular" label="Training samples dataset:"/>
433 <param name="header1" type="boolean" optional="True" truevalue="booltrue" falsevalue="boolfalse" checked="False" label="Does the dataset contain header:" /> 431 <param name="header1" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolfalse" checked="False" label="Does the dataset contain header:" />
434 <param name="col1" multiple="@MULTIPLE1@" type="data_column" data_ref="infile1" label="Select target column(s):"/> 432 <conditional name="column_selector_options_1">
433 <expand macro="samples_column_selector_options" multiple="@MULTIPLE1@"/>
434 </conditional>
435 <param name="infile2" type="data" format="tabular" label="Dataset containing class labels:"/> 435 <param name="infile2" type="data" format="tabular" label="Dataset containing class labels:"/>
436 <param name="header2" type="boolean" optional="True" truevalue="booltrue" falsevalue="boolfalse" checked="False" label="Does the dataset contain header:" /> 436 <param name="header2" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolfalse" checked="False" label="Does the dataset contain header:" />
437 <param name="col2" multiple="@MULTIPLE2@" type="data_column" data_ref="infile2" label="Select target column(s):"/> 437 <conditional name="column_selector_options_2">
438 <expand macro="samples_column_selector_options" column_option="selected_column_selector_option2" col_name="col2" multiple="@MULTIPLE2@" infile="infile2"/>
439 </conditional>
438 <yield/> 440 <yield/>
441 </xml>
442
443 <xml name="samples_column_selector_options" token_column_option="selected_column_selector_option" token_col_name="col1" token_multiple="False" token_infile="infile1">
444 <param name="@COLUMN_OPTION@" type="select" label="Choose how to select data by column:">
445 <option value="by_index_number" selected="true">Select columns by column index number(s)</option>
446 <!--
447 <option value="by_header_name">Select columns by column header name(s)</option>
448 <option value="all_but_by_index_number">All columns but by column index number(s)</option>
449 <option value="all_but_by_header_name">All columns but by column header name(s)</option>
450 -->
451 <option value="all_columns">All columns</option>
452 </param>
453 <when value="by_index_number">
454 <param name="@COL_NAME@" multiple="@MULTIPLE@" type="data_column" data_ref="@INFILE@" label="Select target column(s):"/>
455 </when>
456 <when value="all_columns">
457 </when>
439 </xml> 458 </xml>
440 459
441 <xml name="clf_inputs_extended" token_label1=" " token_label2=" " token_multiple="False"> 460 <xml name="clf_inputs_extended" token_label1=" " token_label2=" " token_multiple="False">
442 <conditional name="true_columns"> 461 <conditional name="true_columns">
443 <param name="selected_input1" type="select" label="Select the input type of true labels dataset:"> 462 <param name="selected_input1" type="select" label="Select the input type of true labels dataset:">
468 </xml> 487 </xml>
469 488
470 <xml name="clf_inputs" token_label1="Dataset containing true labels (tabular):" token_label2="Dataset containing predicted values (tabular):" token_multiple1="False" token_multiple="False"> 489 <xml name="clf_inputs" token_label1="Dataset containing true labels (tabular):" token_label2="Dataset containing predicted values (tabular):" token_multiple1="False" token_multiple="False">
471 <param name="infile1" type="data" format="tabular" label="@LABEL1@"/> 490 <param name="infile1" type="data" format="tabular" label="@LABEL1@"/>
472 <param name="header1" type="boolean" optional="True" truevalue="booltrue" falsevalue="boolfalse" checked="False" label="Does the dataset contain header:" /> 491 <param name="header1" type="boolean" optional="True" truevalue="booltrue" falsevalue="boolfalse" checked="False" label="Does the dataset contain header:" />
473 <param name="col1" multiple="@MULTIPLE1@" type="data_column" data_ref="infile1" label="Select the target column:"/> 492 <conditional name="column_selector_options_1">
493 <expand macro="samples_column_selector_options" multiple="@MULTIPLE1@"/>
494 </conditional>
474 <param name="infile2" type="data" format="tabular" label="@LABEL2@"/> 495 <param name="infile2" type="data" format="tabular" label="@LABEL2@"/>
475 <param name="header2" type="boolean" optional="True" truevalue="booltrue" falsevalue="boolfalse" checked="False" label="Does the dataset contain header:" /> 496 <param name="header2" type="boolean" optional="True" truevalue="booltrue" falsevalue="boolfalse" checked="False" label="Does the dataset contain header:" />
476 <param name="col2" multiple="@MULTIPLE@" type="data_column" data_ref="infile2" label="Select target column(s):"/> 497 <conditional name="column_selector_options_2">
498 <expand macro="samples_column_selector_options" column_option="selected_column_selector_option2" col_name="col2" multiple="@MULTIPLE@" infile="infile2"/>
499 </conditional>
477 </xml> 500 </xml>
478 501
479 <xml name="multiple_input" token_name="input_files" token_max_num="10" token_format="txt" token_label="Sparse matrix file (.mtx, .txt)" token_help_text="Specify a sparse matrix file in .txt format."> 502 <xml name="multiple_input" token_name="input_files" token_max_num="10" token_format="txt" token_label="Sparse matrix file (.mtx, .txt)" token_help_text="Specify a sparse matrix file in .txt format.">
480 <repeat name="@NAME@" min="1" max="@MAX_NUM@" title="Select input file(s):"> 503 <repeat name="@NAME@" min="1" max="@MAX_NUM@" title="Select input file(s):">
481 <param name="input" type="data" format="@FORMAT@" label="@LABEL@" help="@HELP_TEXT@"/> 504 <param name="input" type="data" format="@FORMAT@" label="@LABEL@" help="@HELP_TEXT@"/>