Skip to content

Commit

Permalink
Fix for not-null in 'column_list' object
Browse files Browse the repository at this point in the history
Co-authored-by: Nicola Soranzo <[email protected]>
  • Loading branch information
hujambo-dunia and nsoranzo committed Jul 24, 2024
1 parent f742784 commit 0d01a6d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/galaxy/datatypes/tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -1814,15 +1814,14 @@ def set_meta(
with open(dataset.get_file_name()) as dataset_fh:
comment_lines = 0
column_headers = None
cleaned_column_types = None
cleaned_column_types = []
number_of_columns = 0
for i, line in enumerate(dataset_fh):
line = line.strip("\n")
if line.startswith("#"):
if line.startswith("#h"):
column_headers = line.split("\t")[1:]
elif line.startswith("#f"):
cleaned_column_types = []
for column_type in line.split("\t")[1:]:
if column_type == "Hex":
cleaned_column_types.append("str")
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/tools/parameters/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,7 @@ def get_options(self, trans, other_values):
except Exception:
column_list = self.get_column_list(trans, other_values)
if self.numerical: # If numerical was requested, filter columns based on metadata
if hasattr(dataset, "metadata") and hasattr(dataset.metadata, "column_types"):
if hasattr(dataset, "metadata") and getattr(dataset.metadata, "column_types", None) is not None:
if len(dataset.metadata.column_types) >= len(column_list):
numerics = [i for i, x in enumerate(dataset.metadata.column_types) if x in ["int", "float"]]
column_list = [column_list[i] for i in numerics]
Expand Down

0 comments on commit 0d01a6d

Please sign in to comment.