napari-spatialdata icon indicating copy to clipboard operation
napari-spatialdata copied to clipboard

Issue of annotations of table

Open Nazim0001 opened this issue 1 year ago • 17 comments

Hi, after following the tutorial part of https://spatialdata.scverse.org/en/latest/tutorials/notebooks/notebooks/examples/napari_rois.html#extracting-cells-under-the-regions, I tried to apply the 'Extracting cells under the regions'.

I used this script: categories = ["unassigned"] + list(filtered_tables.keys()) n = len(sdata["table"])

sdata["table"].obs["annotation"] = pd.Categorical( ["unassigned" for _ in range(n)], categories=categories)

for shape, subtable in filtered_tables.items(): in_shape = subtable.obs.index sdata["table"].obs["annotation"].loc[in_shape] = shape

My issue is about the lack of identification of annotations in sdata['table']: annotation myoepi 3935
unassigned 0 n 0 tubes 0 Name: count, dtype: int64

I tried to figure out the filtered : {'n': AnnData object with n_obs × n_vars = 3935 × 17943 obs: 'in_tissue', 'array_row', 'array_col', 'spot_id', 'region' var: 'gene_ids', 'feature_types', 'genome' uns: 'spatial', 'spatialdata_attrs' obsm: 'spatial', 'tubes': AnnData object with n_obs × n_vars = 3935 × 17943 obs: 'in_tissue', 'array_row', 'array_col', 'spot_id', 'region' var: 'gene_ids', 'feature_types', 'genome' uns: 'spatial', 'spatialdata_attrs' obsm: 'spatial', 'myoepi': AnnData object with n_obs × n_vars = 3935 × 17943 obs: 'in_tissue', 'array_row', 'array_col', 'spot_id', 'region' var: 'gene_ids', 'feature_types', 'genome' uns: 'spatial', 'spatialdata_attrs' obsm: 'spatial'}

But, I don't understand why? Could you please help to resolve it?

Thank you in advance Best Nazim

Nazim0001 avatar Apr 14 '24 15:04 Nazim0001