Closed pakiessling closed 3 months ago
Hi, thank for reporting! Can you please paste the output of values count on the radius
column of the circles (shapes elements) that are present in sdata
? Thanks 😊
len(sdata.shapes["cell_circles"])
122259
sdata.shapes["cell_circles"].radius.isna().sum()
6978
sdata.shapes["cell_circles"].hist(bins=100)
Interesting, I guess the NaN are the problem? This is Xenium data loaded with spatialdata_io.xeniun
Thanks for the details, yes we expect the NaN
to be the problem. The radius is computed from the raw data with this line: https://github.com/scverse/spatialdata-io/blob/a26feba6092a79bd1d7d141f42a89e0bd9027ed5/src/spatialdata_io/readers/xenium.py#L509, could you please check what the area contains in the AnnData
table?
Is the dataset public? In such a case I'd also like to have a look.
In your case a fix would be to recompute the area using geopandas
https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoSeries.area.html, and manually adjust the radius column. Alternatively you could set the able to annotate the shapes and work directly with those instead of working with the cell circles. You can achieve this by setting cells_as_circles=False
in xenium()
, or, if the object is already created, you can use the method set_table_annotates_spatialelement()
of the SpatialData
class.
Unfortunately I can't share the data.
I subset the table to the problematic cells and I can see that they all have valid cell_area
values but that nucleus_area
is NaN for all of them.
Is it possible that those are cells where the Xenium pipeline only segmented cells?
The cells.parquet file already has the NaN in it
You are right, it is probably due to cells without nuclei, as shown in the first figure here: https://pages.10xgenomics.com/rs/446-PBO-704/images/AGBT_2024_Cell_Segmentation_Poster.pdf.
They changed the file format but we added support for it. I will move this issue to spatialdata-io
and make a fix to the reader.
A solution to this issue, discussed in https://github.com/scverse/spatialdata-io/issues/123, is now available via https://github.com/scverse/spatialdata-io/pull/179.
Hi,
I am running into the following problem:
Any idea what causes this?
sdata.query.bounding_box works fine