Ploting using the original Seurat Embeddings

Hi, thanks for Scanpy.
I am trying to learn scanpy from Seurat. After successful importing Seurat object as an anndata object, I tried to plot the same embedding calculated using Seurat.

rcParams['figure.figsize'] = 5, 5
sc.pl.umap(adata, color='SCT_snn_res_1_2', add_outline=True, legend_loc='on data',
           legend_fontsize=12, legend_fontoutline=2,frameon=False,
           title='clustering of cells', palette='Set1')

Gives an error:


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tiagob/anaconda3/envs/py38/lib/python3.8/site-packages/scanpy/plotting/_tools/scatterplots.py", line 615, in umap
    return embedding(adata, 'umap', **kwargs)
  File "/Users/tiagob/anaconda3/envs/py38/lib/python3.8/site-packages/scanpy/plotting/_tools/scatterplots.py", line 154, in embedding
    data_points, components_list = _get_data_points(
  File "/Users/tiagob/anaconda3/envs/py38/lib/python3.8/site-packages/scanpy/plotting/_tools/scatterplots.py", line 825, in _get_data_points
    raise KeyError(
KeyError: "Could not find entry in `obsm` for 'umap'.\nAvailable keys are: ['pca_cell_embeddings', 'tsne_cell_embeddings', 'umap_cell_embeddings']."

Could you advise me on how to accomplish this?

Thanks

Tiago

I followed this link:
https://theislab.github.io/scanpy-in-R/

and it solved the issue.

Hi @tiagobrc,

Sorry for the late reply, but glad you found a solution. The general problem is that Seurat seems to store the coordinates as "umap_cell_embeddings", while we call this "X_umap". Thus, you could have either renamed via:
adata.obsm['X_umap'] = adata.obsm['umap_cell_embeddings']

Or you can directly tell scanpy to use this keyword by using the sc.pl.embedding() function with basis='umap_cell_embeddings'. I hope that’s useful information.