Skip to content

Commit

Permalink
don't accidentally dask process metadata arrays with X in their name
Browse files Browse the repository at this point in the history
  • Loading branch information
nayib-jose-gloria committed Dec 21, 2024
1 parent fa25f40 commit 2df0e0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cellxgene_schema_cli/cellxgene_schema/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ def read_backed(f: h5py.File, chunk_size: int = 10_000) -> ad.AnnData:
"""

def callback(func, elem_name: str, elem, iospec):
if "layers" in elem_name or ("X" in elem_name and "X_" not in elem_name):
if "layers" in elem_name or elem_name == "/X" or elem_name == "/raw/X":
if iospec.encoding_type in (
"csr_matrix",
"csc_matrix",
):
n_vars = elem.attrs.get("shape")[1]
return read_elem_as_dask(elem, chunks=(chunk_size, n_vars))
elif iospec.encoding_type == "array" and len(elem.shape) > 1:
elif iospec.encoding_type == "array" and len(elem.shape) == 2:
n_vars = elem.shape[1]
return read_elem_as_dask(elem, chunks=(chunk_size, n_vars))

Check warning on line 138 in cellxgene_schema_cli/cellxgene_schema/utils.py

View check run for this annotation

Codecov / codecov/patch

cellxgene_schema_cli/cellxgene_schema/utils.py#L137-L138

Added lines #L137 - L138 were not covered by tests
else:
Expand Down

0 comments on commit 2df0e0d

Please sign in to comment.