Skip to content

Commit e77237c

Browse files
rename count_file in internal API to counts_file (#944)
Co-authored-by: Tim Treis <[email protected]>
1 parent 6d13527 commit e77237c

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/squidpy/read/_read.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
import os
55
import re
66
from pathlib import Path
7-
from typing import (
8-
Any,
9-
Union, # noqa: F401
10-
)
7+
from typing import Any
118

129
import numpy as np
1310
import pandas as pd
@@ -64,7 +61,7 @@ def visium(
6461
- :attr:`anndata.AnnData.uns` ``['spatial']['{library_id}']['metadata']`` - various metadata.
6562
""" # noqa: E501
6663
path = Path(path)
67-
adata, library_id = _read_counts(path, count_file=counts_file, library_id=library_id, **kwargs)
64+
adata, library_id = _read_counts(path, counts_file=counts_file, library_id=library_id, **kwargs)
6865

6966
if not load_images:
7067
return adata
@@ -149,7 +146,7 @@ def vizgen(
149146
"""
150147
path = Path(path)
151148
adata, library_id = _read_counts(
152-
path=path, count_file=counts_file, library_id=library_id, delimiter=",", first_column_names=True, **kwargs
149+
path=path, counts_file=counts_file, library_id=library_id, delimiter=",", first_column_names=True, **kwargs
153150
)
154151
blank_genes = np.array(["Blank" in v for v in adata.var_names])
155152
adata.obsm["blank_genes"] = pd.DataFrame(

src/squidpy/read/_utils.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
def _read_counts(
1818
path: str | Path,
19-
count_file: str,
19+
counts_file: str,
2020
library_id: str | None = None,
2121
**kwargs: Any,
2222
) -> tuple[AnnData, str]:
2323
path = Path(path)
24-
if count_file.endswith(".h5"):
25-
adata: AnnData = read_10x_h5(path / count_file, **kwargs)
26-
with File(path / count_file, mode="r") as f:
24+
if counts_file.endswith(".h5"):
25+
adata: AnnData = read_10x_h5(path / counts_file, **kwargs)
26+
with File(path / counts_file, mode="r") as f:
2727
attrs = dict(f.attrs)
2828
if library_id is None:
2929
try:
@@ -46,9 +46,9 @@ def _read_counts(
4646
if library_id is None:
4747
raise ValueError("Please explicitly specify library id.")
4848

49-
if count_file.endswith((".csv", ".txt")):
50-
adata = read_text(path / count_file, **kwargs)
51-
elif count_file.endswith(".mtx.gz"):
49+
if counts_file.endswith((".csv", ".txt")):
50+
adata = read_text(path / counts_file, **kwargs)
51+
elif counts_file.endswith(".mtx.gz"):
5252
adata = read_10x_mtx(path, **kwargs)
5353
else:
5454
raise NotImplementedError("TODO")

0 commit comments

Comments
 (0)