Skip to content

Commit fb57846

Browse files
Merge pull request #343 from scverse/fix/visium_hd_3.x
Fix scalefactors error visium hd 3.x
2 parents c3fc686 + cd74ebd commit fb57846

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/spatialdata_io/readers/visium_hd.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ def visium_hd(
133133
CELL_GEOJSON_PATH = SEGMENTED_OUTPUTS_PATH / VisiumHDKeys.CELL_SEGMENTATION_GEOJSON_PATH
134134
NUCLEUS_GEOJSON_PATH = SEGMENTED_OUTPUTS_PATH / VisiumHDKeys.NUCLEUS_SEGMENTATION_GEOJSON_PATH
135135
SCALE_FACTORS_PATH = SEGMENTED_OUTPUTS_PATH / VisiumHDKeys.SPATIAL / VisiumHDKeys.SCALEFACTORS_FILE
136+
if not SCALE_FACTORS_PATH.exists():
137+
# Visium HD 3.0.0 does not have the SEGMENTATION_OUTPUTS folder
138+
scale_factors_file = next(
139+
(file for file in path.rglob("*") if file.name.endswith(VisiumHDKeys.SCALEFACTORS_FILE)),
140+
None,
141+
)
142+
assert scale_factors_file is not None, "Scale factors file not found in any of the subdirectories."
143+
SCALE_FACTORS_PATH = scale_factors_file
136144
BARCODE_MAPPINGS_PATH = next(
137145
(file for file in path.rglob("*") if file.name.endswith(VisiumHDKeys.BARCODE_MAPPINGS_FILE)),
138146
None,

0 commit comments

Comments
 (0)