From 8d82dfb2be3b383ae7d54132820896fd8543aeee Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Wed, 11 Feb 2015 12:33:49 -0500 Subject: [PATCH 1/3] Fix for Data Tables persisting when .loc file doesn't exist. --- lib/galaxy/tools/data/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/data/__init__.py b/lib/galaxy/tools/data/__init__.py index 190a9c18fd5..2f648ac0b0c 100644 --- a/lib/galaxy/tools/data/__init__.py +++ b/lib/galaxy/tools/data/__init__.py @@ -495,7 +495,7 @@ class TabularToolDataTable( ToolDataTable, Dictifiable ): try: data_table_fh = open( filename, 'r+b' ) except IOError, e: - log.warning( 'Error opening data table file (%s) with r+b, assuming file does not exist and will open as wb: %s', self.filename, e ) + log.warning( 'Error opening data table file (%s) with r+b, assuming file does not exist and will open as wb: %s', filename, e ) data_table_fh = open( filename, 'wb' ) if os.stat( filename )[6] != 0: # ensure last existing line ends with new line From b7e5183ba3a39e71bbb583e08048ac18c21915fe Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Wed, 11 Feb 2015 12:37:59 -0500 Subject: [PATCH 2/3] Fix for TabularToolDataTable.get_named_fields_list() when a data line has extra columns. --- lib/galaxy/tools/data/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tools/data/__init__.py b/lib/galaxy/tools/data/__init__.py index 2f648ac0b0c..ecff997dbfd 100644 --- a/lib/galaxy/tools/data/__init__.py +++ b/lib/galaxy/tools/data/__init__.py @@ -335,11 +335,13 @@ class TabularToolDataTable( ToolDataTable, Dictifiable ): def get_named_fields_list( self ): rval = [] - named_colums = self.get_column_name_list() + named_columns = self.get_column_name_list() for fields in self.get_fields(): field_dict = {} for i, field in enumerate( fields ): - field_name = named_colums[i] + if i == len( named_columns ): + break + field_name = named_columns[i] if field_name is None: field_name = i #check that this is supposed to be 0 based. field_dict[ field_name ] = field From 41fcc8ecdb348525f5cc464968702eda6cb79828 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Wed, 11 Feb 2015 12:40:33 -0500 Subject: [PATCH 3/3] Fix for parsing Tool Data Table columns that are defined as individual xml elements. --- lib/galaxy/tools/data/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/galaxy/tools/data/__init__.py b/lib/galaxy/tools/data/__init__.py index ecff997dbfd..3e7ac75b65e 100644 --- a/lib/galaxy/tools/data/__init__.py +++ b/lib/galaxy/tools/data/__init__.py @@ -368,6 +368,7 @@ class TabularToolDataTable( ToolDataTable, Dictifiable ): self.columns[ name ] = index self.largest_index = index else: + self.largest_index = 0 for column_elem in config_element.findall( 'column' ): name = column_elem.get( 'name', None ) assert name is not None, "Required 'name' attribute missing from column def"