Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WriteH5MU fails #8

Open
bio-la opened this issue Jul 28, 2022 · 4 comments
Open

WriteH5MU fails #8

bio-la opened this issue Jul 28, 2022 · 4 comments

Comments

@bio-la
Copy link

bio-la commented Jul 28, 2022

Hi, thanks for working on interoperability between seurat and mudata!

I am failing to save the seurat object offered in this tutorial

reference <- LoadH5Seurat("../data/pbmc_multimodal.h5seurat")
WriteH5MU(reference, "tea.h5mu")

Defining highly variable features...
Defining highly variable features...
Error in self$exists(name) : 
STRING_ELT() can only be applied to a 'character vector', not a 'NULL'

I tried different things like removing some of the reduction methods but still no luck.
the file is created but it breaks somewhere in the process, still haven't figured out where exactly (and ofc it can't be read with ReadH5MU)
Any idea what I should check next?
thank you!

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.3.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] bmcite.SeuratData_0.3.0 pbmc3k.SeuratData_3.1.4 SeuratData_0.2.2        hdf5r_1.3.5             MuDataSeurat_0.0.0.9000 magrittr_2.0.3          datapasta_3.1.0        
 [8] forcats_0.5.1           stringr_1.4.0           dplyr_1.0.8             purrr_0.3.4             readr_2.1.2             tidyr_1.2.0             tibble_3.1.6           
[15] ggplot2_3.3.5           tidyverse_1.3.1        

loaded via a namespace (and not attached):
  [1] readxl_1.4.0          backports_1.4.1       plyr_1.8.7            igraph_1.3.0          lazyeval_0.2.2        splines_4.1.2         listenv_0.8.0        
  [8] scattermore_0.8       digest_0.6.29         htmltools_0.5.2       fansi_1.0.3           tensor_1.5            cluster_2.1.3         ROCR_1.0-11          
 [15] tzdb_0.3.0            remotes_2.4.2         globals_0.14.0        modelr_0.1.8          matrixStats_0.62.0    spatstat.sparse_2.1-0 prettyunits_1.1.1    
 [22] colorspace_2.0-3      rappdirs_0.3.3        rvest_1.0.2           ggrepel_0.9.1         haven_2.4.3           callr_3.7.0           crayon_1.5.1         
 [29] jsonlite_1.8.0        spatstat.data_2.1-4   survival_3.3-1        zoo_1.8-9             glue_1.6.2            polyclip_1.10-0       gtable_0.3.0         
 [36] leiden_0.3.9          clipr_0.8.0           pkgbuild_1.3.1        future.apply_1.8.1    abind_1.4-5           scales_1.1.1          DBI_1.1.2            
 [43] spatstat.random_2.2-0 miniUI_0.1.1.1        Rcpp_1.0.8.3          viridisLite_0.4.0     xtable_1.8-4          reticulate_1.24       spatstat.core_2.4-2  
 [50] bit_4.0.4             htmlwidgets_1.5.4     httr_1.4.2            anndata_0.7.5.3       RColorBrewer_1.1-3    ellipsis_0.3.2        Seurat_4.1.0         
 [57] ica_1.0-2             pkgconfig_2.0.3       uwot_0.1.11           dbplyr_2.1.1          deldir_1.0-6          utf8_1.2.2            tidyselect_1.1.2     
 [64] rlang_1.0.2           reshape2_1.4.4        later_1.3.0           munsell_0.5.0         cellranger_1.1.0      tools_4.1.2           cli_3.3.0            
 [71] generics_0.1.2        broom_0.7.12          ggridges_0.5.3        fastmap_1.1.0         goftest_1.2-3         processx_3.5.3        bit64_4.0.5          
 [78] fs_1.5.2              fitdistrplus_1.1-8    RANN_2.6.1            pbapply_1.5-0         future_1.24.0         nlme_3.1-157          mime_0.12            
 [85] formatR_1.12          xml2_1.3.3            compiler_4.1.2        rstudioapi_0.13       plotly_4.10.0         curl_4.3.2            png_0.1-7            
 [92] spatstat.utils_2.3-0  reprex_2.0.1          stringi_1.7.6         ps_1.6.0              lattice_0.20-45       Matrix_1.4-1          SeuratDisk_0.0.0.9019
 [99] vctrs_0.3.8           pillar_1.7.0          lifecycle_1.0.1       spatstat.geom_2.4-0   lmtest_0.9-40         RcppAnnoy_0.0.19      addinexamples_0.1.0  
[106] data.table_1.14.2     cowplot_1.1.1         irlba_2.3.5           httpuv_1.6.5          patchwork_1.1.1       R6_2.5.1              promises_1.2.0.1     
[113] KernSmooth_2.23-20    gridExtra_2.3         parallelly_1.31.0     codetools_0.2-18      MASS_7.3-56           assertthat_0.2.1      rprojroot_2.0.3      
[120] withr_2.5.0           SeuratObject_4.0.4    sctransform_0.3.3     mgcv_1.8-40           parallel_4.1.2        hms_1.1.1             grid_4.1.2           
[127] rpart_4.1.16          Rtsne_0.15            shiny_1.7.1           lubridate_1.8.0      
@gtca
Copy link
Contributor

gtca commented Aug 3, 2022

This should be fixed by a5c8251.
Please let me know if it works for you!

@casblaauw
Copy link

Hi, thanks so much for your work on this package so far - it's been a pleasure to use!
However, I'm currently running into the same error, and the fix doesn't seem to help.

I'm trying to convert a multiome Seurat dataset (from Fleck, Jansen et al., 2022, dataset available here, RNA_ATAC_metacells_srt.rds in seurat_objects.tar.gz) to h5mu.
Upon running WriteH5MU():

> WriteH5MU(metacells, "/staging/leuven/stg_00002/lcb/cblaauw/brain_org/preprocessed/RNA_ATAC_metacells_v2.h5mu")

Defining highly variable features...

Defining highly variable features...

Error in self$exists(name): STRING_ELT() can only be applied to a 'character vector', not a 'NULL'

Traceback:
1. WriteH5MU(metacells, "/staging/leuven/stg_00002/lcb/cblaauw/brain_org/preprocessed/RNA_ATAC_metacells_v2.h5mu")

2. WriteH5MU(metacells, "/staging/leuven/stg_00002/lcb/cblaauw/brain_org/preprocessed/RNA_ATAC_metacells_v2.h5mu")

3. varm$create_dataset(varm_key, t(loadings))

4. self$exists(name)

Useful stuff from my sessionInfo():

R version 4.0.5 (2021-03-31)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /lustre1/project/stg_00002/lcb/cblaauw/software/anaconda3/envs/MuDataSeurat/lib/libopenblasp-r0.3.21.so
...
other attached packages:
[1] MuDataSeurat_0.0.0.9000 sp_1.5-0                SeuratObject_4.1.1     
[4] Seurat_4.1.1

@casblaauw
Copy link

After some more debugging, it appears that this is related to the PCA reduction in the data, as removing it (metacells@reductions <- metacells@reductions[c('umap', 'rnacss', 'fa2', 'css', 'cellrank')]) results in successfully writing the h5mu file.
If there's an easy fix for the underlying problem, perhaps one solution could be to clearly indicate the reduction that's causing the problem and proposing that the user removes it.

When reading the .h5mu file back into either MuDataSeurat or muon I'm running into other problems, but I'll put those in an appropriate issue.

@gtca
Copy link
Contributor

gtca commented Nov 9, 2022

Hey @casblaauw, thank you for reporting the issues and digging deeper helping to resolve them!

This seems to be related to PCA loadings indeed (attempted to be stored in .varm), I will have to take a closer look to see if there's an obvious quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants