Open aeisenbarth opened 2 years ago
Hey @aeisenbarth thanks for this bug report. One quick clarification:
How come it is not sufficient to simply rename your spatial embedding in the resulting AnnData object to X_spatial
?
According to the anndata docs, the obsm key need not be defined strictly as spatial
- see the screenshot below
@aeisenbarth checking back in on this — is this issue resolved with the above fix?
Hello, yes, renaming works around the issue (with the downside of not being in line with scanpy's default; we aim to generate standard scanpy AnnData files). To satisfy scanpy and CellXGene, I could also copy the key, consuming more disk space and having redundancy.
If that is the solution, it would be helpful to mention it in the documentation, which can be easily understood that default spatial coordinates would be supported.
Describe the bug
When loading a spatial AnnData file, only embeddings like "pca", "umap" are offered but not "spatial". According to the documentation, it should be possible to display spatial x, y coordinates.
To Reproduce Steps to reproduce the behavior:
Expected behavior Spatial coordinates should be shown as another choice next to available embeddings.
Version (please complete the following information):
Additional context By convention, Scanpy/Squidpy store spatial coordinates in a 2-dimensional
obsm
column named "spatial". However, CellXGene's AnnData adapter looks only forobsm
columns prefixed withX_
, likeX_umap
for embedding "umap". This means another branch needs to be added that checks for the presence ofobsm["spatial"]
(not prefixed) and adds it with the same name to available embeddings.