squidpy icon indicating copy to clipboard operation
squidpy copied to clipboard

interface with NAPARI

Open sophieRAIBAUD opened this issue 3 years ago • 4 comments

Description

hello again :) I am trying to add a point layer to napari in interactive mode. I follow these indications to add cells positions that I got with tangram: https://forum.image.sc/t/napari-plugin-to-display-csv-as-image/37399/3 ) when I type :

 data = sq.datasets.visium_hne_adata()
img = sq.datasets.visium_hne_image()
viewer = img.interactive(adata)

the viewer does not accept the .add_points method viewer.add_points give this error message: 'Interactive' object has no attribute 'add_points'

Could you help me with that ?

The other solution would be : viewer = napari.Viewer(); points_layer = viewer.add_points( data) but I dont know how to add all my squidpy results (clusters, genes, ...) Many many thanks sophie ...

sophieRAIBAUD avatar Jul 07 '22 16:07 sophieRAIBAUD

hi @sophieRAIBAUD ,

thanks for the interesting in squidpy. Actually we just released a napari plugin that should allow you to do that (add points directly to viewer), you can check it out here: https://github.com/scverse/napari-spatialdata

and the examples here: https://github.com/scverse/napari-spatialdata/tree/main/examples

let me know if this helps!

giovp avatar Jul 07 '22 19:07 giovp

@giovp many thanks, I'll try it asap

sophieRAIBAUD avatar Jul 25 '22 09:07 sophieRAIBAUD

the first example is working properly thanks !

_import napari import squidpy as sq

adata = sq.datasets.visium_hne_adata() img1 = adata.uns["spatial"]["V1_Adult_Mouse_Brain"]["images"]["hires"].copy()

viewer = napari.Viewer() viewer.add_image( img1, rgb=True, name="image1", metadata={"adata": adata, "library_id": "V1_Adult_Mouse_Brain"}, )_

sophieRAIBAUD avatar Jul 25 '22 14:07 sophieRAIBAUD

for the raster_points_regions I am not really sure what is the fov parameter in adata.obs ....

adata1 = adata[adata.obs.fov == "1"].copy()

sophieRAIBAUD avatar Jul 25 '22 14:07 sophieRAIBAUD

hi @sophieRAIBAUD , the fov is the single slide of the mibitof dataset. It's just an example to extract a single image (and related annotation) from anndata).

does it help?

giovp avatar Aug 19 '22 07:08 giovp

@giovp , OK thanks I am very happy with the spatial transcriptomic data, except minor comments can I continue to comment on this channel ?

sophieRAIBAUD avatar Aug 23 '22 15:08 sophieRAIBAUD

hi @sophieRAIBAUD , for sure! I'd say github is more for bug report and feature requests, whereas discourse is more for usage discussion

giovp avatar Sep 10 '22 12:09 giovp

I'll close this, feel free to reopen if not addressed

giovp avatar Sep 16 '22 16:09 giovp