mojaveazure / seurat-disk

Interfaces for HDF5-based Single Cell File Formats
https://mojaveazure.github.io/seurat-disk
GNU General Public License v3.0
150 stars 48 forks source link

Cannot convert an h5ad file back to Seurat object #31

Open bapoorva opened 3 years ago

bapoorva commented 3 years ago

Hi,

Great package. But I'm having issues converting a seurat object to h5ad file and then reading that file back in. I analyzed my data using Seurat and saved it as sc.h5ad

> SaveH5Seurat(scrna, filename = "sc.h5Seurat")

Creating h5Seurat file for version 3.1.5.9900
Adding counts for RNA
Adding data for RNA
Adding variable features for RNA
Adding feature-level metadata for RNA
Adding counts for SCT
Adding data for SCT
Adding scale.data for SCT
Adding variable features for SCT
Adding feature-level metadata for SCT
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 tsne
No loadings for tsne
No projected loadings for tsne
No standard deviations for tsne
No JackStraw data for tsne
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("sc.h5Seurat", dest = "h5ad")

Validating h5Seurat file
Adding scale.data from SCT as X
Transfering meta.features to var
Adding data from SCT as raw
Transfering meta.features to raw/var
Transfering meta.data to obs
Adding dimensional reduction information for pca
Adding feature loadings for pca
Adding dimensional reduction information for tsne
Adding dimensional reduction information for umap
Adding SCT_snn as neighbors

I now want this h5ad file to be read into a shiny interface. But converting it back gives me this issue

> Convert("sc.h5ad", dest = "h5seurat", overwrite = TRUE)

Warning: Unknown file type: h5ad
Warning: 'assay' not set, setting to 'RNA'
Creating h5Seurat file for version 3.1.5.9900
Adding X as scale.data
Adding raw/X as data
Adding raw/X as counts
Adding meta.features from raw/var
Merging sct.detection_rate from scaled feature-level metadata
Merging sct.gmean from scaled feature-level metadata
Merging sct.residual_mean from scaled feature-level metadata
Merging sct.residual_variance from scaled feature-level metadata
Merging sct.variable from scaled feature-level metadata
Merging sct.variance from scaled feature-level metadata
Adding X_pca as cell embeddings for pca
Adding X_tsne as cell embeddings for tsne
Adding X_umap as cell embeddings for umap
Adding PCs as feature loadings fpr pca
Saving nearest-neighbor graph as RNA_snn
Error in dfile[["graphs"]][[graph.name]]$create_attr(attr_name = "assay.used",  : 
  Can't create attribute; already exists

>scrna <- LoadH5Seurat("sc.h5seurat")

Same issue with the example pbmc data in the documentation.

XiaolongYang-HZAU commented 5 months ago

same question,have you solve it?