seurat-disk icon indicating copy to clipboard operation
seurat-disk copied to clipboard

anndata to seurat not working with scVI processed data

Open bjstewart1 opened this issue 2 years ago • 0 comments

I have an anndata object which has been processed through the scVI pipeline. scVI adds _scvi_extra_categorical_covs and _scvi_extra_continuous_covs to obsm. These are dataframes not matrices. So SeuratDisk is throwing this error:

Warning message:
“Unknown file type: h5ad”
Warning message:
“'assay' not set, setting to 'RNA'”
Creating h5Seurat file for version 3.1.5.9900

Adding X as data

Adding X as counts

Adding meta.features from var

Adding X_scVI as cell embeddings for scVI

Adding X_umap as cell embeddings for umap

Adding _scvi_extra_categorical_covs as cell embeddings for _scvi_extra_categorical_covs

Error: Not a sparse matrix
Traceback:

1. SeuratDisk::Convert(healthy_dir, dest = "h5seurat", overwrite = TRUE, 
 .     verbose = TRUE)
2. Convert.character(healthy_dir, dest = "h5seurat", overwrite = TRUE, 
 .     verbose = TRUE)
3. Convert(source = hfile, dest = dest, assay = assay, overwrite = overwrite, 
 .     verbose = verbose, ...)
4. Convert.H5File(source = hfile, dest = dest, assay = assay, overwrite = overwrite, 
 .     verbose = verbose, ...)
5. H5ADToH5Seurat(source = source, dest = dest, assay = assay, overwrite = overwrite, 
 .     verbose = verbose)
6. Transpose(x = source[["obsm"]][[reduc]], dest = reduc.group, 
 .     dname = "cell.embeddings", verbose = FALSE)
7. Transpose.H5Group(x = source[["obsm"]][[reduc]], dest = reduc.group, 
 .     dname = "cell.embeddings", verbose = FALSE)
8. stop("Not a sparse matrix", call. = FALSE)

Suggest either 1) specifying some way of managing _scvi_extra_categorical_covs and _scvi_extra_continuous_covs or 2) only copying across obsm with "X_"

bjstewart1 avatar Mar 31 '22 09:03 bjstewart1