Transfering data in Shape layer to AnnData.obs #448
-
In a previous version of Squidpy, there was an option to save data from the shapes layer back to the obs layer of the attached AnnData as a boolean to indicate areas within the shape and areas outside the shape when working with Visium and Xenium data. Do you happen to know if this is still possible? Or is there an easy way to accomplish this |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @tawaunl, you can achieve this using the The function had a bug leading to poor performance when working with different coordinate system and large raster data, or when querying by multiple polygons; if you experience such problems please use this PR with Please let me know if it works for you. EDIT: I have added an example on this in the documentation now: https://spatialdata.scverse.org/en/latest/tutorials/notebooks/notebooks/examples/napari_rois.html. |
Beta Was this translation helpful? Give feedback.
Hi @tawaunl, you can achieve this using the
polygon_query()
function, which is available in the latest version. It will return shapes and the table whose rows are contained inside the polygon used for the query.The function had a bug leading to poor performance when working with different coordinate system and large raster data, or when querying by multiple polygons; if you experience such problems please use this PR with
gh pr checkout 422
.Please let me know if it works for you.
EDIT: I have added an example on this in the documentation now: https://spatialdata.scverse.org/en/latest/tutorials/notebooks/notebooks/examples/napari_rois.html.