Skip to content

Commit 1eca173

Browse files
Merge branch 'main' into feat/device-settings
2 parents 20625c4 + 4d44782 commit 1eca173

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
("py:class", "squidpy._constants._constants.SpatialAutocorr"),
152152
("py:class", "squidpy._constants._constants.CoordType"),
153153
("py:class", "squidpy._constants._constants.Transform"),
154+
("py:class", "pandas.core.frame.DataFrame"),
154155
]
155156
# see the solution from: https://github.com/sphinx-doc/sphinx/issues/7369
156157
linkcheck_ignore = [

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ optional-dependencies.dev = [
8888
"ruff",
8989
]
9090
optional-dependencies.docs = [
91+
"docutils<0.22", # Pin to avoid sphinx-tabs KeyError with backrefs
9192
"ipython",
9293
"ipywidgets>=8",
9394
"myst-nb>=0.17.1",

src/squidpy/read/_read.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,24 @@ def visium(
7272
(path / f"{Key.uns.spatial}/scalefactors_json.json").read_bytes()
7373
)
7474

75+
# Space Ranger versions use different file formats:
76+
# - v1: tissue_positions.csv (no header)
77+
# - v2: tissue_positions_list.csv (with header)
78+
# - v3: tissue_positions.csv (with header)
7579
tissue_positions_file = (
7680
path / "spatial/tissue_positions.csv"
7781
if (path / "spatial/tissue_positions.csv").exists()
7882
else path / "spatial/tissue_positions_list.csv"
7983
)
8084

85+
# Detect header by checking if first cell is 'barcode' (header) or a barcode value
86+
with open(tissue_positions_file) as f:
87+
first_cell = f.readline().split(",")[0].strip()
88+
has_header = first_cell.lower() == "barcode"
89+
8190
coords = pd.read_csv(
8291
tissue_positions_file,
83-
header=1 if tissue_positions_file.name == "tissue_positions.csv" else None,
92+
header=0 if has_header else None,
8493
index_col=0,
8594
)
8695
coords.columns = ["in_tissue", "array_row", "array_col", "pxl_col_in_fullres", "pxl_row_in_fullres"]

0 commit comments

Comments
 (0)