satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.18k stars 891 forks source link

Conversion from h5ad to Seurat object #9072

Open AnnaAntonatouPap opened 2 days ago

AnnaAntonatouPap commented 2 days ago

Hello,

I have an atlas in h5ad format but because I am more familiar with r i want to convert it in seurat object. I am using the following code to do that

 data <-Convert("annotated_filtered.h5ad", dest = "h5seurat", overwrite = TRUE) 
 data <- LoadH5Seurat("annotated_filtered.h5seurat")

but while loading i have the following error

Validating h5Seurat file

Initializing RNA with data

Adding counts for RNA

Adding feature-level metadata for RNA

Error: Too many values for levels provided
Traceback:

1. LoadH5Seurat("/fast/AG_Robson/anna/atlas_limb/PengHe_Teichmann_2023/MouseAllData_annotated_filtered.h5seurat")
2. LoadH5Seurat.character("/fast/AG_Robson/anna/atlas_limb/PengHe_Teichmann_2023/MouseAllData_annotated_filtered.h5seurat")
3. LoadH5Seurat(file = hfile, assays = assays, reductions = reductions, 
 .     graphs = graphs, neighbors = neighbors, images = images, 
 .     meta.data = meta.data, commands = commands, misc = misc, 
 .     tools = tools, verbose = verbose, ...)
4. LoadH5Seurat.h5Seurat(file = hfile, assays = assays, reductions = reductions, 
 .     graphs = graphs, neighbors = neighbors, images = images, 
 .     meta.data = meta.data, commands = commands, misc = misc, 
 .     tools = tools, verbose = verbose, ...)
5. as.Seurat(x = file, assays = assays, reductions = reductions, 
 .     graphs = graphs, neighbors = neighbors, images = images, 
 .     meta.data = meta.data, commands = commands, misc = misc, 
 .     tools = tools, verbose = verbose, ...)
6. as.Seurat.h5Seurat(x = file, assays = assays, reductions = reductions, 
 .     graphs = graphs, neighbors = neighbors, images = images, 
 .     meta.data = meta.data, commands = commands, misc = misc, 
 .     tools = tools, verbose = verbose, ...)
7. AssembleAssay(assay = assay, file = x, slots = assays[[assay]], 
 .     verbose = verbose)
8. as.data.frame(x = assay.group[["meta.features"]], row.names = features)
9. as.data.frame.H5Group(x = assay.group[["meta.features"]], row.names = features)
10. as.factor(x = x[[i]])
11. as.factor(x = x[[i]])
12. stop("Too many values for levels provided", call. = FALSE)

Do you have any ideas how to solve it ? Anna