mojaveazure / seurat-disk

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

Error in adding RNA assay #178

Open eblchen opened 8 months ago

eblchen commented 8 months ago

Having difficulty converting h5Seurat to Anndata. Had similar issues to #27 in the SaveH5Seurat step(), resolved by FindVariableFeatures() suggestion. Now having issues with the Convert() step:

Convert("data/ut_seurat.h5Seurat",` dest = "h5ad", assay = "RNA", overwrite = T)
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: ../../src/H5Ocopy.c in H5Ocopy(): line 233: unable to copy object
        class: HDF5
        major: Object header
        minor: Unable to copy object

    error #001: ../../src/H5Ocopy.c in H5O__copy(): line 286: source object not found
        class: HDF5
        major: Symbol table
        minor: Object not found

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

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

    error #004: ../../src/H5Gtraverse.c in H5G__traverse_real(): line 627: traversal operator failed
        class: HDF5
        major: Symbol table
        minor: Callback failed

    error #005: ../../src/H5Gloc.c in H5G__loc_find_cb(): line 378: object 'data' doesn't exist
        class: HD

Same error as quoted by Rohit-Satyam in #166. Have tried downgrading to Seurat and SeuratObject v4, also didn't solve the issue.

N.B. I can add the SCT assay, the error is only when I try to add the RNA assay and I need the uncorrected counts in the AnnData object.

sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Rocky Linux 8.9 (Green Obsidian)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblaso-r0.3.15.so;  LAPACK version 3.9.0

locale:
[1] C

time zone: UTC
tzcode source: system (glibc)

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] SeuratDisk_0.0.0.9021       hues_0.2.0                  ggbeeswarm_0.7.2            scattermore_1.2             patchwork_1.2.0.9000       
 [6] slingshot_2.10.0            princurve_2.1.6             TSCAN_1.38.0                TrajectoryUtils_1.10.1      scater_1.30.1              
[11] ggplot2_3.5.0               scuttle_1.10.2              SingleCellExperiment_1.22.0 SummarizedExperiment_1.32.0 Biobase_2.62.0             
[16] GenomicRanges_1.54.1        GenomeInfoDb_1.38.6         IRanges_2.36.0              S4Vectors_0.40.2            BiocGenerics_0.48.1        
[21] MatrixGenerics_1.14.0       matrixStats_1.1.0           Seurat_5.0.1                SeuratObject_5.0.0          sp_2.1-1                   

loaded via a namespace (and not attached):
  [1] RcppAnnoy_0.0.21          splines_4.3.2             later_1.3.1               bitops_1.0-7              tibble_3.2.1             
  [6] polyclip_1.10-6           fastDummies_1.7.3         lifecycle_1.0.4           hdf5r_1.3.9               processx_3.8.2           
 [11] globals_0.16.2            lattice_0.21-9            pals_1.8                  MASS_7.3-60               magrittr_2.0.3           
 [16] plotly_4.10.4             remotes_2.4.2.1           httpuv_1.6.12             sctransform_0.4.1         spam_2.10-0              
 [21] pkgbuild_1.4.3            spatstat.sparse_3.0-3     reticulate_1.34.0         cowplot_1.1.1             mapproj_1.2.11           
 [26] pbapply_1.7-2             RColorBrewer_1.1-3        maps_3.4.1                abind_1.4-5               zlibbioc_1.48.0          
 [31] Rtsne_0.16                purrr_1.0.2               RCurl_1.98-1.14           GenomeInfoDbData_1.2.11   ggrepel_0.9.4            
 [36] irlba_2.3.5.1             listenv_0.9.0             spatstat.utils_3.0-4      goftest_1.2-3             RSpectra_0.16-1          
 [41] spatstat.random_3.2-1     fitdistrplus_1.1-11       parallelly_1.36.0         DelayedMatrixStats_1.22.6 leiden_0.4.3             
 [46] codetools_0.2-19          DelayedArray_0.28.0       tidyselect_1.2.0          ScaledMatrix_1.8.1        viridis_0.6.5            
 [51] spatstat.explore_3.2-5    jsonlite_1.8.7            BiocNeighbors_1.18.0      ellipsis_0.3.2            progressr_0.14.0         
 [56] ggridges_0.5.4            survival_3.5-8            tools_4.3.2               ica_1.0-3                 Rcpp_1.0.12              
 [61] glue_1.7.0                gridExtra_2.3             SparseArray_1.2.4         mgcv_1.9-0                dplyr_1.1.3              
 [66] withr_3.0.0               combinat_0.0-8            fastmap_1.1.1             fansi_1.0.6               callr_3.7.3              
 [71] caTools_1.18.2            digest_0.6.33             rsvd_1.0.5                R6_2.5.1                  mime_0.12                
 [76] colorspace_2.1-0          gtools_3.9.4              tensor_1.5                dichromat_2.0-0.1         spatstat.data_3.0-3      
 [81] utf8_1.2.4                tidyr_1.3.0               generics_0.1.3            data.table_1.14.8         httr_1.4.7               
 [86] htmlwidgets_1.6.2         S4Arrays_1.2.0            uwot_0.1.16               pkgconfig_2.0.3           gtable_0.3.4             
 [91] lmtest_0.9-40             XVector_0.42.0            htmltools_0.5.6.1         dotCall64_1.1-0           scales_1.3.0             
 [96] png_0.1-8                 rstudioapi_0.15.0         reshape2_1.4.4            curl_5.1.0                nlme_3.1-163             
[101] zoo_1.8-12                stringr_1.5.0             KernSmooth_2.23-22        parallel_4.3.2            miniUI_0.1.1.1           
[106] vipor_0.4.5               desc_1.4.3                pillar_1.9.0              grid_4.3.2                fastICA_1.2-3            
[111] vctrs_0.6.5               RANN_2.6.1                gplots_3.1.3              promises_1.2.1            BiocSingular_1.16.0      
[116] beachmat_2.16.0           xtable_1.8-4              cluster_2.1.4             beeswarm_0.4.0            cli_3.6.2                
[121] compiler_4.3.2            rlang_1.1.3               crayon_1.5.2              future.apply_1.11.0       mclust_6.0.0             
[126] ps_1.7.5                  plyr_1.8.9                stringi_1.7.12            viridisLite_0.4.2         deldir_1.0-9             
[131] BiocParallel_1.36.0       munsell_0.5.0             lazyeval_0.2.2            spatstat.geom_3.2-7       Matrix_1.6-1.1           
[136] RcppHNSW_0.5.0            bit64_4.0.5               sparseMatrixStats_1.12.2  future_1.33.0             shiny_1.7.5.1            
[141] ROCR_1.0-11               igraph_2.0.2              bit_4.0.5   
yz3n18 commented 5 months ago

I had the same issue. Following the suggestion from Alexis-Varin #27 solved my issue.

adata[["RNA"]] <- as(object = adata[["RNA"]], Class = "Assay")
SaveH5Seurat(adata,overwrite = T,verbose = T, filename ='./adata.h5Seurat')
Convert('./adata.h5Seurat',dest='h5ad')