Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions merfish/to_zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,30 @@
expression = cells.copy()
del expression.obsm["region_radius"]
del expression.obsm["spatial"]
expression.obs["cell_id"] = np.array(map(str, np.arange(len(cells))))
expression.obs["cell_id"] = np.arange(len(cells))
expression = sd.TableModel.parse(
adata=expression,
region="/shapes/cells",
instance_key="cell_id",
)
xy = cells.obsm["spatial"]
regions = sd.ShapesModel.parse(
coords=xy,
shape_type="Circle",
shape_size=cells.obsm["region_radius"],
xy,
geometry=0,
radius=cells.obsm["region_radius"],
index=expression.obs['cell_id'].copy()
)

adata_polygons = sd.PolygonsModel.parse(
path_read / "anatomical.geojson", instance_key="region_id"
polygons = sd.ShapesModel.parse(
path_read / "anatomical.geojson"
)

##
sdata = sd.SpatialData(
table=expression,
shapes={"cells": regions},
shapes={"cells": regions, "anatomical": polygons},
points={"single_molecule": single_molecule},
images={"rasterized": img},
polygons={"anatomical": adata_polygons},
)
print(sdata)
##
Expand Down
195 changes: 0 additions & 195 deletions spatialdata-sandbox-prepare-data.ipynb

This file was deleted.

6 changes: 3 additions & 3 deletions toy/to_zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ def get_points(begin_end):
plt.show()
##
a_circles = sd.ShapesModel.parse(
coords=points,
shape_type="Circle",
shape_size=np.sqrt(np.array(sizes) / np.pi),
points,
geometry=0,
radius=np.sqrt(np.array(sizes) / np.pi),
)
a_points = sd.PointsModel.parse(xy)

Expand Down
Loading