[go: nahoru, domu]

Skip to content

Commit

Permalink
fix xenium index
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaMarconato committed Jan 18, 2024
1 parent c647f15 commit 48d7d6f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ __pycache__/
# other
_version.py
.code-workspace
temp/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning][].

- (MERSCOPE) don't try to load unexisting elements #87
- (Visium) fixed axes ordering
- (Xenium) fixed index (fail on write)

## [0.0.9] - 2023-11-06

Expand Down
10 changes: 9 additions & 1 deletion src/spatialdata_io/readers/xenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,15 @@ def xenium(
XeniumKeys.NUCLEUS_BOUNDARIES_FILE,
specs,
n_jobs,
idx=table.obs[str(XeniumKeys.CELL_ID)].copy(),
)

polygons["cell_boundaries"] = _get_polygons(
path, XeniumKeys.CELL_BOUNDARIES_FILE, specs, n_jobs, idx=table.obs[str(XeniumKeys.CELL_ID)].copy()
path,
XeniumKeys.CELL_BOUNDARIES_FILE,
specs,
n_jobs,
idx=table.obs[str(XeniumKeys.CELL_ID)].copy(),
)

points = {}
Expand Down Expand Up @@ -194,6 +199,9 @@ def _get_tables_and_circles(
metadata.drop([XeniumKeys.CELL_X, XeniumKeys.CELL_Y], axis=1, inplace=True)
adata.obs = metadata
adata.obs["region"] = specs["region"]
adata.obs["region"] = adata.obs["region"].astype("category")
if isinstance(adata.obs[XeniumKeys.CELL_ID].iloc[0], bytes):
adata.obs[XeniumKeys.CELL_ID] = adata.obs[XeniumKeys.CELL_ID].apply(lambda x: x.decode("utf-8"))
table = TableModel.parse(adata, region=specs["region"], region_key="region", instance_key=str(XeniumKeys.CELL_ID))
if cells_as_shapes:
transform = Scale([1.0 / specs["pixel_size"], 1.0 / specs["pixel_size"]], axes=("x", "y"))
Expand Down

0 comments on commit 48d7d6f

Please sign in to comment.