Skip to content

Commit

Permalink
Merge pull request galaxyproject#18958 from davelopez/fix_extra_files…
Browse files Browse the repository at this point in the history
…_path_type_hint

Fix extra files path type hint
  • Loading branch information
nsoranzo authored Oct 10, 2024
2 parents 790b30b + 422221d commit 90cbbfa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions lib/galaxy/datatypes/genetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/datatypes/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 90cbbfa

Please sign in to comment.