STOmics / Stereopy

A toolkit of spatial transcriptomic analysis.
MIT License
179 stars 59 forks source link

Error: Missing required datasets 'levels' and 'values' with h5ad2rds.R #265

Closed maximelepetit closed 2 months ago

maximelepetit commented 2 months ago

Hi I have this error running the h5ad2rds.R file to convert Anndata to RDS.

Rscript ~/Projects/SpatialTranscriptomics/stereoseq/stereoseq_brain_mouse_001/rscript/h5ad2rds.R --infile ./adjusted_seurat_out.h5ad --outfile ./adjusted_seurat_out.rds 

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

Attaching SeuratObject
Seurat v4 was just loaded with SeuratObject v5; disabling v5 assays and
validation routines, and ensuring assays work in strict v3/v4
compatibility mode
Registered S3 method overwritten by 'SeuratDisk':
  method            from  
  as.sparse.H5Group Seurat
Warning: Unknown file type: h5ad
Creating h5Seurat file for version 3.1.5.9900
Adding X as data
Adding X as counts
Adding meta.features from var
Adding X_pca as cell embeddings for pca
Adding X_umap as cell embeddings for umap
Adding spatial as cell embeddings for spatial
Adding gene_exp_leiden to miscellaneous data
Adding hvg to miscellaneous data
Adding raw_cellname to miscellaneous data
Adding raw_counts to miscellaneous data
Adding raw_genename to miscellaneous data
Adding sn to miscellaneous data
[1] "Finished! Converting h5ad to h5seurat file at:"
[2] "./adjusted_seurat_out.h5seurat"                
[1] "h5seurat time consuming: 233.897"
Validating h5Seurat file
Initializing Spatial with data
Adding counts for Spatial
Adding feature-level metadata for Spatial
Error: Missing required datasets 'levels' and 'values'
Execution halted

My Rsession :

R version 4.2.3 (2023-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

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

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

other attached packages:
[1] stringr_1.5.0         hdf5r_1.3.10          SeuratDisk_0.0.0.9021
[4] argparser_0.7.2       ggplot2_3.4.1         SeuratObject_5.0.1   
[7] Seurat_4.3.0          rjson_0.2.21          dplyr_1.1.0          

loaded via a namespace (and not attached):
  [1] nlme_3.1-160           matrixStats_0.62.0     spatstat.sparse_3.0-0 
  [4] bit64_4.0.5            RcppAnnoy_0.0.20       RColorBrewer_1.1-3    
  [7] httr_1.4.4             sctransform_0.3.5      utf8_1.2.2            
 [10] R6_2.5.1               irlba_2.3.5.1          KernSmooth_2.23-20    
 [13] uwot_0.1.14            lazyeval_0.2.2         colorspace_2.0-3      
 [16] withr_3.0.0            sp_1.5-1               tidyselect_1.2.0      
 [19] gridExtra_2.3          bit_4.0.5              compiler_4.2.3        
 [22] progressr_0.11.0       cli_3.6.2              spatstat.explore_3.0-5
 [25] plotly_4.10.1          scales_1.2.1           lmtest_0.9-40         
 [28] spatstat.data_3.0-0    ggridges_0.5.4         pbapply_1.6-0         
 [31] goftest_1.2-3          digest_0.6.30          spatstat.utils_3.0-1  
 [34] pkgconfig_2.0.3        htmltools_0.5.3        parallelly_1.32.1     
 [37] fastmap_1.1.0          htmlwidgets_1.5.4      rlang_1.1.3           
 [40] shiny_1.7.3            generics_0.1.3         zoo_1.8-11            
 [43] jsonlite_1.8.4         spatstat.random_3.0-1  ica_1.0-3             
 [46] magrittr_2.0.3         dotCall64_1.1-1        patchwork_1.1.2       
 [49] Matrix_1.6-4           Rcpp_1.0.10            munsell_0.5.0         
 [52] fansi_1.0.3            abind_1.4-5            reticulate_1.26       
 [55] lifecycle_1.0.3        stringi_1.8.3          MASS_7.3-58.1         
 [58] Rtsne_0.16             plyr_1.8.8             grid_4.2.3            
 [61] parallel_4.2.3         listenv_0.8.0          promises_1.2.0.1      
 [64] ggrepel_0.9.2          crayon_1.5.2           deldir_1.0-6          
 [67] miniUI_0.1.1.1         lattice_0.20-45        cowplot_1.1.1         
 [70] splines_4.2.3          tensor_1.5             pillar_1.8.1          
 [73] igraph_1.3.5           spatstat.geom_3.0-3    future.apply_1.10.0   
 [76] reshape2_1.4.4         codetools_0.2-18       leiden_0.4.3          
 [79] glue_1.6.2             data.table_1.14.4      png_0.1-7             
 [82] vctrs_0.5.2            spam_2.10-0            httpuv_1.6.11         
 [85] polyclip_1.10-4        gtable_0.3.1           RANN_2.6.1            
 [88] purrr_1.0.1            tidyr_1.3.0            scattermore_0.8       
 [91] future_1.29.0          mime_0.12              xtable_1.8-4          
 [94] later_1.3.1            survival_3.4-0         viridisLite_0.4.1     
 [97] tibble_3.1.8           cluster_2.1.4          globals_0.16.1        
[100] fitdistrplus_1.1-8     ellipsis_0.3.2         ROCR_1.0-11  
maximelepetit commented 2 months ago

It mentioned here #239 but this issue persist

tanliwei-coder commented 2 months ago

I think it was caused by the R version, you can try to do as mentioned in #261 .

maximelepetit commented 2 months ago

Solution here #268