mojaveazure / seurat-disk

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

error saving updated Seurat (2.X -> 3.X) object #104

Open dtenenba opened 2 years ago

dtenenba commented 2 years ago

Hi,

I have an old seurat object that was saved in an .rds file. I loaded the RDS file and ran UpdateSeuratObject() on the old object, then tried to save it with SaveH5Seurat().

I got an error, which is below, followed by the output of traceback() and sessionInfo(). If you like I can provide the .rds file with the old seurat object, but would prefer to share it with you privately.

I am not sure whether the issue is in SeuratDisk or SeuratObject so please point me in the right direction.

Thanks.

> srold <- readRDS("ccRCC_6pat_Seurat.rds")
> updated <- UpdateSeuratObject(srold)
Updating from v2.X to v3.X
Validating object structure
Updating object slots
Ensuring keys are in the proper strucutre
Ensuring feature names don't have underscores or pipes
Object representation is consistent with the most current Seurat version
> SaveH5Seurat(updated, "updated.h5Seurat")
Creating h5Seurat file for version 3.1.5.9900
Adding counts for RNA
Adding data for RNA
No variable features found for RNA
No feature-level metadata found for RNA
Adding cell embeddings for pca
No loadings for pca
No projected loadings for pca
Error in attr$write(robj) : HDF5-API Errors:
    error #000: H5A.c in H5Awrite(): line 619: null attribute buffer
        class: HDF5
        major: Invalid arguments to routine
        minor: Bad value
> traceback()
9: .Call("R_H5Awrite", self$id, mem_type$id, buffer, PACKAGE = "hdf5r")
8: attr$write(robj)
7: xgroup$create_attr(attr_name = "global", robj = BoolToInt(x = IsGlobal(object = x)),
       dtype = GuessDType(x = IsGlobal(object = x)))
6: WriteH5Group(x = x[[reduc]], name = reduc, hgroup = hfile[["reductions"]],
       verbose = verbose)
5: WriteH5Group(x = x[[reduc]], name = reduc, hgroup = hfile[["reductions"]],
       verbose = verbose)
4: as.h5Seurat.Seurat(x = object, filename = filename, overwrite = overwrite,
       verbose = verbose, ...)
3: as.h5Seurat(x = object, filename = filename, overwrite = overwrite,
       verbose = verbose, ...)
2: SaveH5Seurat.Seurat(updated, "updated.h5Seurat")
1: SaveH5Seurat(updated, "updated.h5Seurat")
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS

Matrix products: default
BLAS/LAPACK: /app/software/OpenBLAS/0.3.7-GCC-8.3.0/lib/libopenblas_haswellp-r0.3.7.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] SeuratDisk_0.0.0.9019 SeuratObject_4.0.4    Seurat_4.1.0

loaded via a namespace (and not attached):
  [1] nlme_3.1-148          matrixStats_0.56.0    spatstat.sparse_2.1-0
  [4] bit64_0.9-7           RcppAnnoy_0.0.19      RColorBrewer_1.1-2
  [7] httr_1.4.1            sctransform_0.3.3     tools_4.0.2
 [10] R6_2.4.1              irlba_2.3.3           rpart_4.1-15
 [13] KernSmooth_2.23-17    uwot_0.1.11           lazyeval_0.2.2
 [16] mgcv_1.8-31           colorspace_1.4-1      withr_2.2.0
 [19] tidyselect_1.1.0      gridExtra_2.3         bit_1.1-15.2
 [22] compiler_4.0.2        cli_2.0.2             hdf5r_1.3.2
 [25] plotly_4.9.2.1        scales_1.1.1          lmtest_0.9-37
 [28] spatstat.data_2.1-2   ggridges_0.5.2        pbapply_1.4-2
 [31] rappdirs_0.3.1        goftest_1.2-2         stringr_1.4.0
 [34] digest_0.6.25         spatstat.utils_2.3-0  pkgconfig_2.0.3
 [37] htmltools_0.5.2       fastmap_1.1.0         htmlwidgets_1.5.1
 [40] rlang_0.4.10          shiny_1.5.0           generics_0.0.2
 [43] zoo_1.8-8             jsonlite_1.7.0        ica_1.0-2
 [46] spatstat.random_2.1-0 dplyr_1.0.0           magrittr_1.5
 [49] patchwork_1.0.1       Matrix_1.4-0          fansi_0.4.1
 [52] Rcpp_1.0.8            munsell_0.5.0         abind_1.4-5
 [55] reticulate_1.16       lifecycle_0.2.0       stringi_1.4.6
 [58] MASS_7.3-51.6         Rtsne_0.15            plyr_1.8.6
 [61] grid_4.0.2            parallel_4.0.2        listenv_0.8.0
 [64] promises_1.1.1        ggrepel_0.8.2         crayon_1.3.4
 [67] miniUI_0.1.1.1        deldir_1.0-6          lattice_0.20-41
 [70] cowplot_1.0.0         splines_4.0.2         tensor_1.5
 [73] pillar_1.4.4          igraph_1.2.5          spatstat.geom_2.3-2
 [76] future.apply_1.6.0    reshape2_1.4.4        codetools_0.2-16
 [79] leiden_0.3.3          glue_1.4.1            data.table_1.12.8
 [82] png_0.1-7             vctrs_0.3.1           httpuv_1.5.4
 [85] gtable_0.3.0          RANN_2.6.1            purrr_0.3.4
 [88] spatstat.core_2.4-0   polyclip_1.10-0       tidyr_1.1.0
 [91] assertthat_0.2.1      scattermore_0.8       future_1.17.0
 [94] ggplot2_3.3.2         mime_0.9              xtable_1.8-4
 [97] later_1.1.0.1         survival_3.2-3        viridisLite_0.3.0
[100] tibble_3.0.1          cluster_2.1.0         globals_0.12.5
[103] fitdistrplus_1.1-1    ellipsis_0.3.1        ROCR_1.0-11
>
dtenenba commented 2 years ago

It turns out the data that causes this issue is public so I can share it here. It is from

https://trace.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?analysis=SRZ190804

...specifically, the ccRCC_6pat_Seurat file.