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

Converting the data from Seurat to Anndata #184

Open
TakuroIwami opened this issue Jul 11, 2024 · 4 comments
Open

Converting the data from Seurat to Anndata #184

TakuroIwami opened this issue Jul 11, 2024 · 4 comments

Comments

@TakuroIwami
Copy link

Hi, thank you for providing with us a great package.
I have been analyzing snRNA-seq data using Seurat, and now need to convert the data to Anndata format for the downstream analysis.
I tried to replicate the codes described in the article "Converting from Seurat to AnnData via h5Seurat", resulting in getting the error below.
I would appreciate your comments based on the attached code and errors. Thank you.

Takuro

R
library(Seurat)
library(SeuratData)
library(SeuratDisk)
library(reticulate)
anndata <- import("anndata")

sample1 <- readRDS("${dir}/obj1_v2.rds")

sample1
An object of class Seurat
23255 features across 6163 samples within 1 assay
Active assay: RNA (23255 features, 2000 variable features)
3 layers present: counts, data, scale.data
2 dimensional reductions calculated: pca, umap

SaveH5Seurat(sample1, filename = "sample1.h5Seurat")
"Creating h5Seurat file for version 3.1.5.9900
Adding cell embeddings for pca
Adding loadings for pca
No projected loadings for pca
Adding standard deviations for pca
No JackStraw data for pca
Adding cell embeddings for umap
No loadings for umap
No projected loadings for umap
No standard deviations for umap
No JackStraw data for umap"
Convert("sample1.h5Seurat", dest = "h5ad")
"Validating h5Seurat file
Adding data from RNA as X
Error in assay.group$obj_copy_to(dst_loc = dfile, dst_name = "X", src_name = x.data) :
HDF5-API Errors:
error #000: H5Ocopy.c in H5Ocopy(): line 247: source object not found
class: HDF5
major: Symbol table
minor: Object not found

error #001: H5Gloc.c in H5G_loc_find(): line 428: can't find object
    class: HDF5
    major: Symbol table
    minor: Object not found

error #002: H5Gtraverse.c in H5G_traverse(): line 867: internal path traversal failed
    class: HDF5
    major: Symbol table
    minor: Object not found

error #003: H5Gtraverse.c in H5G_traverse_real(): line 639: traversal operator failed
    class: HDF5
    major: Symbol table
    minor: Callback failed

error #004: H5Gloc.c in H5G_loc_find_cb(): line 383: object 'data' doesn't exist
    class: HDF5
    major: Symbol table
    minor: Object not found"
@eva-artano
Copy link

Hello,
I have the same error as you. Did you find a solution?

Best,
EA

@yuanG2000
Copy link

Hello, I got the same error, did you find a solution? thx a lot

@TakuroIwami
Copy link
Author

Hi, I apologize for not noticing your questions earlier. I was able to run the command successfully by switching from the V5 assay to the V3 assay, using the following script. I hope this helps!

sample1[["RNA3"]] <- as(object = sample1[["RNA"]], Class = "Assay")
  DefaultAssay(sample1) <- "RNA3"
  sample1[["RNA"]] <- NULL
 sample1 <- RenameAssays(sample1, RNA3 = 'RNA')
  save_file <- paste0("sample1.h5Seurat")
  SaveH5Seurat(sample1, filename = save_file)
  Convert(save_file, dest = "h5ad")

@yuanG2000
Copy link

Hi, I apologize for not noticing your questions earlier. I was able to run the command successfully by switching from the V5 assay to the V3 assay, using the following script. I hope this helps!

sample1[["RNA3"]] <- as(object = sample1[["RNA"]], Class = "Assay")
  DefaultAssay(sample1) <- "RNA3"
  sample1[["RNA"]] <- NULL
 sample1 <- RenameAssays(sample1, RNA3 = 'RNA')
  save_file <- paste0("sample1.h5Seurat")
  SaveH5Seurat(sample1, filename = save_file)
  Convert(save_file, dest = "h5ad")

I work out!thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants