Skip to content

Example 4 - KeyError: 'spatial' #31

@Leroy-Xiong

Description

@Leroy-Xiong

Hello!

I encountered the following error when I ran example 4:

Traceback (most recent call last):
  File ".../STitch3D/example_4_dlpfc.py", line 83, in <module>
    adata_st_list = STitch3D.utils.align_spots(adata_st_list_raw, plot=True)
  File "D:\Programs\Anaconda3\envs\STitch3D\lib\site-packages\STitch3D\utils.py", line 39, in align_spots
    plt.scatter(adata_st_list[i].obsm[coor_key][:, 0],
  File "D:\Programs\Anaconda3\envs\STitch3D\lib\site-packages\anndata\_core\aligned_mapping.py", line 113, in __getitem__
    _subset(self.parent_mapping[key], self.subset_idx),
  File "D:\Programs\Anaconda3\envs\STitch3D\lib\site-packages\anndata\_core\aligned_mapping.py", line 148, in __getitem__
    return self._data[key]
KeyError: 'spatial'

May I ask if you know what caused it?

I printed the adata_st_list[0]:

View of AnnData object with n_obs × n_vars = 3611 × 33538
    obs: 'barcode', 'slice_id', 'layer'
    var: 'gene_ids', 'feature_types', 'genome'
    uns: 'spatial'

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions