details: http://www.bx.psu.edu/hg/galaxy/rev/bb85df3f0baa changeset: 2370:bb85df3f0baa user: Greg Von Kuster <greg@bx.psu.edu> date: Mon Apr 27 10:50:17 2009 -0400 description: Fix for column_maker tool when input dataset has missing or invalid metadata values. 1 file(s) affected in this change: tools/stats/column_maker.py diffs (33 lines): diff -r 0035ef5580bb -r bb85df3f0baa tools/stats/column_maker.py --- a/tools/stats/column_maker.py Fri Apr 24 15:08:22 2009 -0400 +++ b/tools/stats/column_maker.py Mon Apr 27 10:50:17 2009 -0400 @@ -13,15 +13,27 @@ sys.stderr.write( msg ) sys.exit() +data_err = "This tool can only be used with tab-delimited data." +columns_err = "Missing or invalid 'columns' metadata value, click the pencil icon in the history item and select the Auto-detect option to correct it. " +column_types_err = "Missing or invalid 'column_types' metadata value, click the pencil icon in the history item and select the Auto-detect option to correct it. " +invalid_metadata_err = "The 'columns' metadata setting does not conform to the 'column_types' metadata setting, click the pencil icon in the history item and select the Auto-detect option to correct it. " inp_file = sys.argv[1] out_file = sys.argv[2] expr = sys.argv[3] -round = sys.argv[4] +round = sys.argv[4] try: in_columns = int( sys.argv[5] ) +except: + stop_err( columns_err + data_err ) +if in_columns < 2: + # To be considered tabular, data must fulfill requirements of the sniff.is_column_based() method. + stop_err( columns_err + data_err ) +try: in_column_types = sys.argv[6].split( ',' ) except: - stop_err( "Data does not appear to be tabular. This tool can only be used with tab-delimited data." ) + stop_err( column_types_err + data_err ) +if len( in_column_types ) != in_columns: + stop_err( invalid_metadata_err + data_err ) # Unescape if input has been escaped mapped_str = {