Skip to content

Commit 2c802e1

Browse files
committed
fix anndata str index
1 parent 9a99ec6 commit 2c802e1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/spatialdata_io/readers/xenium.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,8 @@ def _poly(arr: ArrayLike) -> Polygon:
384384
assert idx is not None
385385
assert len(idx) == len(geo_df)
386386
assert np.unique(geo_df.index).size == len(geo_df)
387-
assert np.array_equal(index.to_numpy(), idx.to_numpy())
387+
assert index.equals(idx)
388+
# assert np.array_equal(index.to_numpy(), idx.to_numpy())
388389
geo_df.index = idx
389390
else:
390391
geo_df.index = index
@@ -468,6 +469,8 @@ def _get_labels_and_indices_mapping(
468469
"label_index": real_label_index.astype(np.int64),
469470
}
470471
)
472+
# because AnnData converts the indices to str
473+
indices_mapping.index = indices_mapping.index.astype(str)
471474
return labels, indices_mapping
472475

473476

@@ -497,6 +500,8 @@ def _get_cells_metadata_table_from_zarr(
497500

498501
cell_id_str = cell_id_str_from_prefix_suffix_uint32(cell_id_prefix, dataset_suffix)
499502
df[XeniumKeys.CELL_ID] = cell_id_str
503+
# because AnnData converts the indices to str
504+
df.index = df.index.astype(str)
500505
return df
501506

502507

0 commit comments

Comments
 (0)