Mercurial > repos > devteam > column_maker
changeset 8:02026300aa45 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/column_maker commit 276e05a2c72c031318eef8c57deebbbde822b538"
author | iuc |
---|---|
date | Tue, 09 Mar 2021 18:33:10 +0000 |
parents | 427903d47026 |
children | 6595517c2dd8 |
files | column_maker.py column_maker.xml |
diffstat | 2 files changed, 23 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/column_maker.py Wed Feb 24 05:20:07 2021 +0000 +++ b/column_maker.py Tue Mar 09 18:33:10 2021 +0000 @@ -10,14 +10,14 @@ import json import re import sys -# functions that may be used in the compute expression +# Functions that may be used in the compute expression from math import ( # noqa: F401 ceil, exp, floor, log, log10, - sqrt + sqrt, ) from numpy import format_float_positional # noqa: F401 @@ -141,15 +141,15 @@ try: exec(code) except Exception as e: - out.close() if str(e).startswith('invalid syntax'): valid_expr = False sys.exit('Expression "%s" likely invalid. See tool tips, syntax and examples.' % expr) else: sys.exit(str(e)) +finally: + out.close() if valid_expr: - out.close() valid_lines = total_lines - skipped_lines print('Creating column %d with expression %s' % (in_columns + 1, expr)) if valid_lines > 0:
--- a/column_maker.xml Wed Feb 24 05:20:07 2021 +0000 +++ b/column_maker.xml Tue Mar 09 18:33:10 2021 +0000 @@ -5,22 +5,21 @@ <requirement type="package" version="1.19.1">numpy</requirement> </requirements> <command detect_errors="aggressive"><![CDATA[ - ln -s '$input' data && +## inject colums and column_types metadata into inputs json +#import json +#set inputs_dict = json.load(open($inputs)) +#set inputs_dict['columns'] = $input.metadata.columns +#set inputs_dict['column_types'] = $input.metadata.column_types +## flatten conditional +#if $header_lines_conditional.header_lines_select == "yes": + #set inputs_dict['header_new_column_name'] = str($header_lines_conditional.header_new_column_name) +#end if +#set x = json.dump($inputs_dict, open($inputs, 'w')) - ## inject colums and column_types metadata into inputs json - #import json - #set inputs_dict = json.load(open($inputs)) - #set inputs_dict['columns'] = $input.metadata.columns - #set inputs_dict['column_types'] = $input.metadata.column_types - ## flatten conditional - #if $header_lines_conditional.header_lines_select == "yes": - #set inputs_dict['header_new_column_name'] = str($header_lines_conditional.header_new_column_name) - #end if - #set x = json.dump($inputs_dict, open($inputs, 'w')) - - python '$__tool_directory__/column_maker.py' - data '$out_file1' - --load_json '$inputs' +python '$__tool_directory__/column_maker.py' +'$input' +'$out_file1' +--load_json '$inputs' ]]></command> <configfiles> <inputs name="inputs"/> @@ -36,7 +35,7 @@ </valid> </sanitizer> </param> - <param format="tabular" name="input" type="data" label="as a new column to" help="Dataset missing? See TIP below"/> + <param name="input" type="data" format="tabular" label="as a new column to" help="Dataset missing? See TIP below"/> <param name="round" type="boolean" truevalue="yes" falsevalue="no" label="Round result?" /> <param name="avoid_scientific_notation" type="boolean" truevalue="yes" falsevalue="no" label="Avoid scientific notation" @@ -45,18 +44,17 @@ <param name="header_lines_select" type="select" label="Input has a header line with column names?" help="Select Yes to be able to specify a name for the new column and have it added to the header line. If you select No, the first line will be treated as a regular line: If it is empty or starts with a # character it will be skipped, otherwise the tool will attempt to compute the specified expression on it." > - <option value="no" >No</option> - <option value="yes" >Yes</option> + <option value="no">No</option> + <option value="yes">Yes</option> </param> - <when value="no"> - </when> + <when value="no" /> <when value="yes"> <param name="header_new_column_name" type="text" value="New Column" label="The new column name" /> </when> </conditional> </inputs> <outputs> - <data format_source="input" name="out_file1" metadata_source="input"/> + <data name="out_file1" format_source="input" metadata_source="input"/> </outputs> <tests> <test> @@ -120,7 +118,6 @@ </test> </tests> <help><![CDATA[ - .. class:: infomark **TIP:** If your data is not TAB delimited, use *Text Manipulation->Convert*