diff --git a/tools/stats/column_maker.py b/tools/stats/column_maker.py index 2316521be47..7cd81a1a888 100644 --- a/tools/stats/column_maker.py +++ b/tools/stats/column_maker.py @@ -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 diff --git a/tools/stats/column_maker.xml b/tools/stats/column_maker.xml index 93e7c57d8a0..67b9584484e 100644 --- a/tools/stats/column_maker.xml +++ b/tools/stats/column_maker.xml @@ -1,7 +1,7 @@ - + an expression on every row - 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}" diff --git a/tools/stats/filtering.py b/tools/stats/filtering.py index bb3d4d2c953..2da9c370ed6 100644 --- a/tools/stats/filtering.py +++ b/tools/stats/filtering.py @@ -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." ) diff --git a/tools/stats/filtering.xml b/tools/stats/filtering.xml index ad296ab617f..22d3de76460 100644 --- a/tools/stats/filtering.xml +++ b/tools/stats/filtering.xml @@ -1,7 +1,7 @@ data on any column using simple expressions - filtering.py $input $out_file1 "$cond" $input_columns $input_column_types + filtering.py $input $out_file1 "$cond" ${input.metadata.columns} "${input.metadata.column_types}"