Skip to content

Commit

Permalink
fixed reading 10x formatted visium mtx files (#803)
Browse files Browse the repository at this point in the history
* fixed reading 10x formatted visium mtx files

solves #802

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update notes-dev.rst

added release notes

* Update _utils.py

fixed counts file suffix to match 10x spec

* Update docs/release/notes-dev.rst

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Giovanni Palla <25887487+giovp@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 22, 2024
1 parent 4ea8e61 commit 0485aef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/release/notes-dev.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
Squidpy dev (the-future)
========================
- Fixed the reading of 10x formatted mtx files `@LinearParadox <https://github.com/LinearParadox>`__
`#803 <https://github.com/scverse/squidpy/pull/803>`__
8 changes: 4 additions & 4 deletions src/squidpy/read/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from typing import Any, Optional, Tuple

import numpy as np
from anndata import AnnData, read_mtx, read_text
from anndata import AnnData, read_text
from h5py import File
from PIL import Image
from scanpy import read_10x_h5
from scanpy import read_10x_h5, read_10x_mtx

from squidpy._constants._pkg_constants import Key
from squidpy._utils import NDArrayA
Expand Down Expand Up @@ -48,8 +48,8 @@ def _read_counts(

if count_file.endswith((".csv", ".txt")):
adata = read_text(path / count_file, **kwargs)
elif count_file.endswith(".mtx"):
adata = read_mtx(path / count_file, **kwargs)
elif count_file.endswith(".mtx.gz"):
adata = read_10x_mtx(path, **kwargs)
else:
raise NotImplementedError("TODO")

Expand Down

0 comments on commit 0485aef

Please sign in to comment.