mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fixes for column_maker and filtering tool to use new approach for handling metadata in the tool params - functional tests should now pass.
This commit is contained in:
@@ -19,7 +19,9 @@ expr = sys.argv[3]
|
||||
round = sys.argv[4]
|
||||
try:
|
||||
in_columns = int( sys.argv[5] )
|
||||
in_column_types = sys.argv[6].split( ',' )
|
||||
# in_column_types is passed as a string that looks something like:
|
||||
# "[u'str', u'int', u'int', u'str', u'int', u'str']"
|
||||
in_column_types = sys.argv[6].strip( '[' ).strip( ']' ).replace( 'u', '' ).replace( "'", '' ).split( ',' )
|
||||
except:
|
||||
stop_err( "Data does not appear to be tabular. This tool can only be used with tab-delimited data." )
|
||||
|
||||
@@ -42,12 +44,12 @@ cols, type_casts = [], []
|
||||
for col in range( 1, in_columns + 1 ):
|
||||
col_name = "c%d" % col
|
||||
cols.append( col_name )
|
||||
col_type = in_column_types[ col - 1 ]
|
||||
col_type = in_column_types[ col - 1 ].strip()
|
||||
if round == 'no' and col_type == 'int':
|
||||
col_type = 'float'
|
||||
type_cast = "%s(%s)" % ( col_type, col_name )
|
||||
type_casts.append( type_cast )
|
||||
|
||||
|
||||
col_str = ', '.join( cols ) # 'c1, c2, c3, c4'
|
||||
type_cast_str = ', '.join( type_casts ) # 'str(c1), int(c2), int(c3), str(c4)'
|
||||
assign = "%s = line.split( '\\t' )" % col_str
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<tool id="Add a column1" name="Compute">
|
||||
<tool id="Add_a_column1" name="Compute">
|
||||
<description>an expression on every row</description>
|
||||
<command interpreter="python">
|
||||
column_maker.py $input $out_file1 "$cond" $round $input_columns $input_column_types
|
||||
column_maker.py $input $out_file1 "$cond" $round ${input.metadata.columns} "${input.metadata.column_types}"
|
||||
</command>
|
||||
<inputs>
|
||||
<param name="cond" size="40" type="text" value="c3-c2" label="Add expression"/>
|
||||
|
||||
@@ -26,7 +26,9 @@ out_fname = sys.argv[2]
|
||||
cond_text = sys.argv[3]
|
||||
try:
|
||||
in_columns = int( sys.argv[4] )
|
||||
in_column_types = sys.argv[5].split( ',' )
|
||||
# in_column_types is passed as a string that looks something like:
|
||||
# "[u'str', u'int', u'int', u'str', u'int', u'str']"
|
||||
in_column_types = sys.argv[5].strip( '[' ).strip( ']' ).replace( 'u', '' ).replace( "'", '' ).split( ',' )
|
||||
except:
|
||||
stop_err( "Data does not appear to be tabular. This tool can only be used with tab-delimited data." )
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<tool id="Filter1" name="Filter">
|
||||
<description>data on any column using simple expressions</description>
|
||||
<command interpreter="python">
|
||||
filtering.py $input $out_file1 "$cond" $input_columns $input_column_types
|
||||
filtering.py $input $out_file1 "$cond" ${input.metadata.columns} "${input.metadata.column_types}"
|
||||
</command>
|
||||
<inputs>
|
||||
<param format="tabular" name="input" type="data" label="Filter" help="Query missing? See TIP below."/>
|
||||
|
||||
Reference in New Issue
Block a user