-
Hi, apologies for such a basic question but I'm pretty confused about the input files required for running the I've been trying to go through the tutorial and know that both the adata and ldata should be loom files but I'm uncertain as to what exactly is the difference between the two and how/where they can be generated. Any guidance would be appreciated, thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
@Jeff87075, sorry, not sure what you mean by I'll try to briefly outline how to proceed on going from a Seurat object to AnnData and using scVelo: Conversion from Seurat to AnnDataWhen you have your Seurat object Alternatively, if you want to do everything in R, you can use library(Seurat)
library(SeuratDisk)
data <- ReadRDS(data.rds)
SaveH5Seurat(data, filename = "data_from_seurat.h5Seurat")
Convert('data_from_seurat.h5Seurat', dest='h5ad') Disclaimer: I previously ran into problems using the latter approach when the neighbor graph shape did not match the count matrix (e.g. more nodes than observations because they were subsetted after graph construction). Loading loom files and aligning dataimport scanpy as sc
adata_from_seurat = sc.read()
adata = sc.read_loom(LOOM_FILE.loom)
# Remove observations/features not present in data from Seurat
adata = adata[
adata_from_seurat.obs_names.intersection(adata.obs_names),
adata_from_seurat.var_names.intersection(adata.var_names)
]
# Add Seurat UMAP embedding and clusters
adata.obs['seurat_clusters'] = adata_from_seurat.obs['seurat_clusters']
adata.obsm['X_umap'] = adata_from_seurat.obsm['X_umap'] |
Beta Was this translation helpful? Give feedback.
@Jeff87075, sorry, not sure what you mean by
ldata
. Could you elaborate?I'll try to briefly outline how to proceed on going from a Seurat object to AnnData and using scVelo:
Conversion from Seurat to AnnData
When you have your Seurat object
data
you can, for example, convert it toAnnData
usinganndata2ri
. See, for example, here how you can use it in a Jupyter notebook. This will keep the UMAP embedding (should be added asadata.obsm['X_umap']
) and clusters (stored as column inadata.obs
).Alternatively, if you want to do everything in R, you can use
Seurat
andSeuratDisk
: