Hi!
I mainly analyse my data using SCANPY, but I want to try out CCA batch correction. I have a few .h5ad files with some of my datasets. But everytime I try to read them in Seurat using the function:
data <- ReadH5AD("~/file_name.h5ad", assay="RNA")
I get the following error:
Pulling expression matrices and metadata
Data is scaled
Error in file[["obs"]][] :
object of type 'environment' is not subsettable
Here is a dataset that throws this error: https://drive.google.com/file/d/1QnH7FiyIIX1GDaKR1fQC5qsE5coT-hIc/view?usp=sharing
Below are my scanpy versions:
scanpy==1.4.5.1 anndata==0.7.1 umap==0.3.10 numpy==1.18.1 scipy==1.4.1 pandas==1.0.1 scikit-learn==0.21.3 statsmodels==0.11.0 python-igraph==0.7.1+4.bed07760 louvain==0.6.1 scvelo==0.1.26.dev22+gf165453 loompy==3.0.6 matplotlib==3.1.3
And this is the output of sessionInfo():
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
locale:
[1] LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252 LC_MONETARY=Dutch_Netherlands.1252
[4] LC_NUMERIC=C LC_TIME=Dutch_Netherlands.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] loomR_0.2.1.9000 hdf5r_1.3.1 R6_2.4.1 Seurat_3.1.4
loaded via a namespace (and not attached):
[1] TH.data_1.0-10 Rtsne_0.15 colorspace_1.4-1 ellipsis_0.3.0 ggridges_0.5.2
[6] rprojroot_1.3-2 fs_1.3.2 rstudioapi_0.11 leiden_0.3.3 listenv_0.8.0
[11] npsurv_0.4-0 remotes_2.1.1 bit64_0.9-7 ggrepel_0.8.2 fansi_0.4.1
[16] mvtnorm_1.1-0 codetools_0.2-16 splines_3.6.3 mnormt_1.5-6 lsei_1.2-0
[21] TFisher_0.2.0 pkgload_1.0.2 jsonlite_1.6.1 ica_1.0-2 cluster_2.1.0
[26] png_0.1-7 uwot_0.1.5 sctransform_0.2.1 compiler_3.6.3 httr_1.4.1
[31] backports_1.1.5 assertthat_0.2.1 Matrix_1.2-18 lazyeval_0.2.2 cli_2.0.2
[36] prettyunits_1.1.1 htmltools_0.4.0 tools_3.6.3 rsvd_1.0.3 igraph_1.2.4.2
[41] gtable_0.3.0 glue_1.3.2 RANN_2.6.1 reshape2_1.4.3 dplyr_0.8.5
[46] rappdirs_0.3.1 Rcpp_1.0.3 Biobase_2.46.0 vctrs_0.2.4 multtest_2.42.0
[51] gdata_2.18.0 ape_5.3 nlme_3.1-144 gbRd_0.4-11 lmtest_0.9-37
[56] stringr_1.4.0 globals_0.12.5 ps_1.3.2 testthat_2.3.2 lifecycle_0.2.0
[61] irlba_2.3.3 devtools_2.2.2 gtools_3.8.1 future_1.16.0 MASS_7.3-51.5
[66] zoo_1.8-7 scales_1.1.0 parallel_3.6.3 sandwich_2.5-1 RColorBrewer_1.1-2
[71] curl_4.3 memoise_1.1.0 reticulate_1.14 pbapply_1.4-2 gridExtra_2.3
[76] ggplot2_3.3.0 stringi_1.4.6 desc_1.2.0 mutoss_0.1-12 plotrix_3.7-7
[81] caTools_1.18.0 BiocGenerics_0.32.0 pkgbuild_1.0.6 bibtex_0.4.2.2 Rdpack_0.11-1
[86] rlang_0.4.5 pkgconfig_2.0.3 bitops_1.0-6 lattice_0.20-38 ROCR_1.0-7
[91] purrr_0.3.3 patchwork_1.0.0 htmlwidgets_1.5.1 bit_1.1-15.2 cowplot_1.0.0
[96] processx_3.4.2 tidyselect_1.0.0 RcppAnnoy_0.0.16 plyr_1.8.6 magrittr_1.5
[101] gplots_3.0.3 multcomp_1.4-12 withr_2.1.2 pillar_1.4.3 sn_1.5-5
[106] fitdistrplus_1.0-14 survival_3.1-8 tibble_2.1.3 future.apply_1.4.0 tsne_0.1-3
[111] crayon_1.3.4 KernSmooth_2.23-16 plotly_4.9.2 usethis_1.5.1 grid_3.6.3
[116] data.table_1.12.8 callr_3.4.2 metap_1.3 digest_0.6.25 tidyr_1.0.2
[121] numDeriv_2016.8-1.1 RcppParallel_4.4.4 stats4_3.6.3 munsell_0.5.0 viridisLite_0.3.0
[126] sessioninfo_1.1.1
And yes, this is the exact same issue as #2485, but that one is closed due to not enough information.
Thanks for reposting with a clear example. We're working on this now.
Hi,
I am also getting the same error as above. Thanks for looking into this.
scanpy environment
scanpy==1.4.6 anndata==0.7.1 umap==0.3.10 numpy==1.18.1 scipy==1.4.1 pandas==1.0.1 scikit-learn==0.22.1 statsmodels==0.11.0 python-igraph==0.7.1 louvain==0.6.1
Seurat environment
R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/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] Seurat_3.1.4
loaded via a namespace (and not attached):
[1] tsne_0.1-3 nlme_3.1-145 bitops_1.0-6 bit64_0.9-7 RcppAnnoy_0.0.16
[6] RColorBrewer_1.1-2 httr_1.4.1 numDeriv_2016.8-1.1 sctransform_0.2.1 tools_3.6.0
[11] R6_2.4.1 irlba_2.3.3 KernSmooth_2.23-16 uwot_0.1.8 lazyeval_0.2.2
[16] BiocGenerics_0.32.0 colorspace_1.4-1 sn_1.6-0 npsurv_0.4-0 gridExtra_2.3
[21] tidyselect_1.0.0 mnormt_1.5-6 bit_1.1-15.2 compiler_3.6.0 cli_2.0.2
[26] Biobase_2.46.0 hdf5r_1.3.2 TFisher_0.2.0 plotly_4.9.2 sandwich_2.5-1
[31] caTools_1.18.0 scales_1.1.0 lmtest_0.9-37 mvtnorm_1.1-0 ggridges_0.5.2
[36] pbapply_1.4-2 rappdirs_0.3.1 stringr_1.4.0 digest_0.6.25 htmltools_0.4.0
[41] pkgconfig_2.0.3 bibtex_0.4.2.2 plotrix_3.7-7 htmlwidgets_1.5.1 rlang_0.4.5
[46] rstudioapi_0.11 zoo_1.8-7 jsonlite_1.6.1 ica_1.0-2 gtools_3.8.2
[51] dplyr_0.8.5 magrittr_1.5 patchwork_1.0.0.9000 Matrix_1.2-18 Rcpp_1.0.4
[56] munsell_0.5.0 fansi_0.4.1 ape_5.3 reticulate_1.14 lifecycle_0.2.0
[61] stringi_1.4.6 multcomp_1.4-12 gbRd_0.4-11 MASS_7.3-51.5 gplots_3.0.3
[66] Rtsne_0.15 plyr_1.8.6 grid_3.6.0 parallel_3.6.0 gdata_2.18.0
[71] listenv_0.8.0 ggrepel_0.8.2 crayon_1.3.4 lattice_0.20-40 cowplot_1.0.0
[76] splines_3.6.0 multtest_2.42.0 pillar_1.4.3 igraph_1.2.5 reshape2_1.4.3
[81] future.apply_1.4.0 codetools_0.2-16 stats4_3.6.0 leiden_0.3.3 mutoss_0.1-12
[86] glue_1.3.2 lsei_1.2-0 metap_1.3 data.table_1.12.8 png_0.1-7
[91] vctrs_0.2.4 Rdpack_0.11-1 tidyr_1.0.2 gtable_0.3.0 RANN_2.6.1
[96] purrr_0.3.3 future_1.16.0 assertthat_0.2.1 ggplot2_3.3.0 rsvd_1.0.3
[101] viridisLite_0.3.0 survival_3.1-11 tibble_3.0.0 cluster_2.1.0 globals_0.12.5
[106] fitdistrplus_1.0-14 TH.data_1.0-10 ellipsis_0.3.0 ROCR_1.0-7
I have a similar probleem:
I am trying to read a .h5ad file using the function>
file.seurat <- ReadH5AD(file = "D:/.../file.h5ad")
I am getting the following error:
Pulling expression matrices and metadata
Error in self$read_low_level(file_space = self_space_id, mem_space = mem_space_id, :
HDF5-API Errors:
error #000: c:/msys64/home/Jeroen/hdf5-1.8.16/src/H5Dio.c in H5Dread(): line 173: can't read data
class: HDF5
major: Dataset
minor: Read failed
error #001: c:/msys64/home/Jeroen/hdf5-1.8.16/src/H5Dio.c in H5D__read(): line 551: can't read data
class: HDF5
major: Dataset
minor: Read failed
error #002: c:/msys64/home/Jeroen/hdf5-1.8.16/src/H5Dchunk.c in H5D__chunk_read(): line 1875: unable to read raw data chunk
class: HDF5
major: Low-level I/O
minor: Read failed
error #003: c:/msys64/home/Jeroen/hdf5-1.8.16/src/H5Dchunk.c in H5D__chunk_lock(): line 2905: data pipeline read failed
class: HDF5
major: Data filters
minor: Filter operation failed
error #004: c:/msys64/home/Jeroen/hdf5-1.8.16/src/H5Z.c in H5Z_pipeline(): line 1347: required filter 'lzf' is not registered
class: HDF5
major: Data filters
minor: Read failed
Hi,
We are transitioning our support for AnnData/H5AD files to SeuratDisk, our new package for interfacing Seurat objects with single-cell HDF5-based file formats. We would very much like it if you could give this a shot for reading in your data.
You can install SeuratDisk with the following:
if (!requireNamespace("remotes", quietly = TRUE)) {
install.packages("remotes")
}
remotes::install_github("mojaveazure/seurat-disk")
A tutorial on how to read in AnnData/H5AD files via the h5Seurat intermediate can be found here. Greater detail about the new Convert mechanism can be found here
If you come across any bugs in reading in your HDF5 files, please post them in mojaveazure/seurat-disk#1. Please note, there are some stipulations about the format of your AnnData/H5AD posted in https://github.com/mojaveazure/seurat-disk/issues/1#issue-619215532
@mojaveazure Thanks alot for your help.
Will check it out.
Hi,
We are transitioning our support for AnnData/H5AD files to SeuratDisk, our new package for interfacing
Seuratobjects with single-cell HDF5-based file formats. We would very much like it if you could give this a shot for reading in your data.You can install SeuratDisk with the following:
if (!requireNamespace("remotes", quietly = TRUE)) { install.packages("remotes") } remotes::install_github("mojaveazure/seurat-disk")A tutorial on how to read in AnnData/H5AD files via the h5Seurat intermediate can be found here. Greater detail about the new
Convertmechanism can be found hereIf you come across any bugs in reading in your HDF5 files, please post them in mojaveazure/seurat-disk#1. Please note, there are some stipulations about the format of your AnnData/H5AD posted in mojaveazure/seurat-disk#1 (comment)
It worked for me. Thanks a lot!
SeuratDisk approach works for me as well:
eg _from AnnData to Seurat object_
Convert("scanpy_object.h5ad", dest = "h5seurat", overwrite = F)
scanpy_object_Seurat <- LoadH5Seurat("scanpy_object.h5seurat")
scanpy=1.5.1 anndata=0.7.3 h5py=2.10.0 hdf5=1.10.6
@mojaveazure Thank a lot for solving this!
Most helpful comment
Hi,
We are transitioning our support for AnnData/H5AD files to SeuratDisk, our new package for interfacing
Seuratobjects with single-cell HDF5-based file formats. We would very much like it if you could give this a shot for reading in your data.You can install SeuratDisk with the following:
A tutorial on how to read in AnnData/H5AD files via the h5Seurat intermediate can be found here. Greater detail about the new
Convertmechanism can be found hereIf you come across any bugs in reading in your HDF5 files, please post them in mojaveazure/seurat-disk#1. Please note, there are some stipulations about the format of your AnnData/H5AD posted in https://github.com/mojaveazure/seurat-disk/issues/1#issue-619215532