Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert h5ad to seurat #9630

Open
salvatore92 opened this issue Jan 20, 2025 · 3 comments
Open

convert h5ad to seurat #9630

salvatore92 opened this issue Jan 20, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@salvatore92
Copy link

Hi,

I am trying to load data that I previously merged from two datasets in python. The data is saved as .h5ad (anndata), and I now want to load it in R by converting it to a Seurat object, and I am using the SeuratDisk Convert function, as follows:
Convert("C:/Users/data/xtrop_mouse_concatenated_filtered.h5ad", dest = "h5seurat", overwrite = TRUE)
But I get the error:
Warning: Unknown file type: h5ad Warning: '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_pca as cell embeddings for pca 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

But I double checked the .h5ad anndata.X in python and it is a sparse matrix, so that does not explain the issue. I am using SeuratDisk 0.0.0.9021, Seurat version 5.1.0 in Rstudio 2024.12.0

@salvatore92 salvatore92 added the bug Something isn't working label Jan 20, 2025
@samuel-marsh
Copy link
Collaborator

Hi,

Not member of dev team but hopefully can be helpful. The SeuratDisk package has been discontinued for some time (other issues here in this repo). I would suggest trying tools like sceasy (https://github.com/cellgeni/sceasy) to convert straight to Seurat or zellkonverter (https://bioconductor.org/packages/release/bioc/html/zellkonverter.html) to convert to SCE and the Seurat to convert from SCE.

Best,
Sam

@samuel-marsh
Copy link
Collaborator

Hi @mojaveazure & @dcollins15,

Leaving this issue open for now and wanted to tag both of you here as similar issues have arisen due to discontinuation of SeuratDisk package. Could large warning be added to GitHub page stating that package support stopped as of XX date and likely won't function properly with current object structures? Also maybe one final update to the package to add similar warning message on package load to let users know (in case they download without looking at GitHub page) that package is no longer supported and likely won't function properly with current object structures?

Hopefully these might stave off future user issues trying to use convert functionality.

Thanks as always,
Sam

@AndrewOkin
Copy link

Hi @samuel-marsh,

Thanks for the suggestion! I have installed sceasy, but I was also using sceasy for loading h5Seurat object), like the following:

combined_seurat <- Connect("~/data/concatendated_filtered_CSR.h5seurat", mode = "r")
metadata <- h5read("~/data/concatendated_filtered_CSR.h5seurat", "/meta.data")

Would you have any suggestion on how to do this with sceasy or other packages besides SeuratDisk?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants