diff --git a/lib/galaxy/datatypes/genetics.py b/lib/galaxy/datatypes/genetics.py index a17ee92c9b08..1ce24261aebf 100644 --- a/lib/galaxy/datatypes/genetics.py +++ b/lib/galaxy/datatypes/genetics.py @@ -863,16 +863,15 @@ def set_meta(self, dataset: DatasetProtocol, overwrite: bool = True, **kwd) -> N pp = os.path.join(dataset.extra_files_path, pn) dataset.metadata.pheno_path = pp try: - with open(pp) as f: - pf = f.readlines() # read the basename.phenodata in the extra_files_path + with open(pp) as file: + pf = file.readlines() # read the basename.phenodata in the extra_files_path except Exception: pf = None if pf: - h = pf[0].strip() - h = h.split("\t") # hope is header - h = [escape(x) for x in h] - dataset.metadata.column_names = h - dataset.metadata.columns = len(h) + header = pf[0].strip() + columns = [escape(x) for x in header.split("\t")] # hope is header + dataset.metadata.column_names = columns + dataset.metadata.columns = len(columns) dataset.peek = "".join(pf[:5]) else: dataset.metadata.column_names = [] diff --git a/lib/galaxy/datatypes/protocols.py b/lib/galaxy/datatypes/protocols.py index ac4e3de166ca..4f5bd1593371 100644 --- a/lib/galaxy/datatypes/protocols.py +++ b/lib/galaxy/datatypes/protocols.py @@ -27,7 +27,7 @@ def ext(self): ... class HasExtraFilesPath(Protocol): @property - def extra_files_path(self): ... + def extra_files_path(self) -> str: ... class HasFileName(Protocol):