Skip to content

Commit

Permalink
Fix setting metadata for some Loom files
Browse files Browse the repository at this point in the history
Loom files created by recent versions of LoomExperiment Bioconductor
package encode the Loom version in an binary array, which breaks
metadata setting in Galaxy.
  • Loading branch information
nsoranzo committed Sep 7, 2021
1 parent 5cc7051 commit 8a7ca52
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/galaxy/datatypes/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from typing import Optional

import h5py
import numpy as np
import pysam
import pysam.bcftools
from bx.seq.twobit import TWOBIT_MAGIC_NUMBER, TWOBIT_MAGIC_NUMBER_SWAP
Expand Down Expand Up @@ -928,7 +929,12 @@ def set_meta(self, dataset, overwrite=True, **kwd):
dataset.metadata.description = loom_file.attrs.get('description')
dataset.metadata.url = loom_file.attrs.get('url')
dataset.metadata.doi = loom_file.attrs.get('doi')
dataset.metadata.loom_spec_version = loom_file.attrs.get('LOOM_SPEC_VERSION')
loom_spec_version = loom_file.attrs.get('LOOM_SPEC_VERSION')
if isinstance(loom_spec_version, np.ndarray):
loom_spec_version = loom_spec_version[0]
if isinstance(loom_spec_version, bytes):
loom_spec_version = loom_spec_version.decode()
dataset.metadata.loom_spec_version = loom_spec_version
dataset.creation_date = loom_file.attrs.get('creation_date')
dataset.metadata.shape = tuple(loom_file['matrix'].shape)

Expand Down

0 comments on commit 8a7ca52

Please sign in to comment.