Error in H5Dclose(h5dataset) when trying to read in kallisto h5 files
0
0
Entering edit mode
Sofia • 0
@c010c7d6
Last seen 3 days ago
United Kingdom

Hello,

I am trying to import kallisto h5 files into R using


files <- file.path(kallisto_dir, paste0("barcode", sample_sheet$Barcode), "kallisto_out/quant-tcc/abundance.h5")
names(files) <- sample_sheet$Sample

# Import kallisto abundance files with tximport
kallisto_counts <- tximport(files,
                            type = "kallisto", txOut = TRUE)

But sometimes get the following error: 1 2 3 4 Error in H5Dclose(h5dataset) : HDF5. Dataset. Unable to decrement reference count. Which I think might be to do with the files not closing properly after I use them for previous analysis but I am not sure how to close them.

sessionInfo()
R version 4.3.3 (2024-02-29)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS 15.3.2

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

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

time zone: Europe/London
tzcode source: internal

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

other attached packages:
 [1] org.Hs.eg.db_3.18.0         clusterProfiler_4.10.1      rhdf5_2.46.1               
 [4] tximport_1.30.0             IsoformSwitchAnalyzeR_2.2.0 pfamAnalyzeR_1.2.0         
 [7] dplyr_1.1.4                 stringr_1.5.1               readr_2.1.5                
[10] ggplot2_3.5.1               sva_3.50.0                  genefilter_1.84.0          
[13] mgcv_1.9-1                  nlme_3.1-167                satuRn_1.10.0              
[16] DEXSeq_1.48.0               RColorBrewer_1.1-3          AnnotationDbi_1.64.1       
[19] DESeq2_1.42.1               SummarizedExperiment_1.32.0 GenomicRanges_1.54.1       
[22] GenomeInfoDb_1.38.8         IRanges_2.36.0              S4Vectors_0.40.2           
[25] MatrixGenerics_1.14.0       matrixStats_1.5.0           Biobase_2.62.0             
[28] BiocGenerics_0.48.1         BiocParallel_1.36.0         limma_3.58.1               

loaded via a namespace (and not attached):
  [1] splines_4.3.3                 later_1.4.1                   BiocIO_1.12.0                
  [4] ggplotify_0.1.2               bitops_1.0-9                  filelock_1.0.3               
  [7] tibble_3.2.1                  polyclip_1.10-7               XML_3.99-0.18                
 [10] lifecycle_1.0.4               edgeR_4.0.16                  vroom_1.6.5                  
 [13] MASS_7.3-60.0.1               lattice_0.22-6                ensembldb_2.26.0             
 [16] magrittr_2.0.3                yaml_2.3.10                   httpuv_1.6.15                
 [19] cowplot_1.1.3                 pbapply_1.7-2                 DBI_1.2.3                    
 [22] abind_1.4-8                   zlibbioc_1.48.2               purrr_1.0.4                  
 [25] AnnotationFilter_1.26.0       ggraph_2.2.1                  RCurl_1.98-1.17              
 [28] yulab.utils_0.2.0             tweenr_2.0.3                  rappdirs_0.3.3               
 [31] GenomeInfoDbData_1.2.11       enrichplot_1.22.0             ggrepel_0.9.6                
 [34] tidytree_0.4.6                annotate_1.80.0               codetools_0.2-20             
 [37] DelayedArray_0.28.0           ggforce_0.4.2                 DOSE_3.28.2                  
 [40] xml2_1.3.8                    tidyselect_1.2.1              aplot_0.2.5                  
 [43] futile.logger_1.4.3           locfdr_1.1-8                  farver_2.1.2                 
 [46] viridis_0.6.5                 BiocFileCache_2.10.2          GenomicAlignments_1.38.2     
 [49] jsonlite_2.0.0                tidygraph_1.3.1               survival_3.8-3               
 [52] tools_4.3.3                   progress_1.2.3                treeio_1.26.0                
 [55] Rcpp_1.0.14                   glue_1.8.0                    gridExtra_2.3                
 [58] SparseArray_1.2.4             qvalue_2.34.0                 withr_3.0.2                  
 [61] formatR_1.14                  BiocManager_1.30.25           fastmap_1.2.0                
 [64] boot_1.3-31                   rhdf5filters_1.14.1           digest_0.6.37                
 [67] gridGraphics_0.5-1            R6_2.6.1                      mime_0.13                    
 [70] colorspace_2.1-1              GO.db_3.18.0                  biomaRt_2.58.2               
 [73] RSQLite_2.3.9                 tidyr_1.3.1                   generics_0.1.3               
 [76] data.table_1.17.0             tximeta_1.20.3                rtracklayer_1.62.0           
 [79] graphlayouts_1.2.2            prettyunits_1.2.0             httr_1.4.7                   
 [82] S4Arrays_1.2.1                scatterpie_0.2.4              pkgconfig_2.0.3              
 [85] gtable_0.3.6                  blob_1.2.4                    hwriter_1.3.2.1              
 [88] XVector_0.42.0                shadowtext_0.1.4              htmltools_0.5.8.1            
 [91] fgsea_1.28.0                  geneplotter_1.80.0            ProtGenerics_1.34.0          
 [94] scales_1.3.0                  png_0.1-8                     ggfun_0.1.8                  
 [97] lambda.r_1.2.4                rstudioapi_0.17.1             tzdb_0.5.0                   
[100] reshape2_1.4.4                rjson_0.2.23                  curl_6.2.2                   
[103] cachem_1.1.0                  BiocVersion_3.18.1            parallel_4.3.3               
[106] HDO.db_0.99.1                 restfulr_0.0.15               pillar_1.10.1                
[109] grid_4.3.3                    vctrs_0.6.5                   promises_1.3.2               
[112] dbplyr_2.5.0                  xtable_1.8-4                  VennDiagram_1.7.3            
[115] GenomicFeatures_1.54.4        cli_3.6.4                     locfit_1.5-9.12              
[118] compiler_4.3.3                futile.options_1.0.1          Rsamtools_2.18.0             
[121] rlang_1.1.5                   crayon_1.5.3                  plyr_1.8.9                   
[124] fs_1.6.5                      stringi_1.8.4                 viridisLite_0.4.2            
[127] munsell_0.5.1                 Biostrings_2.70.3             lazyeval_0.2.2               
[130] GOSemSim_2.28.1               Matrix_1.6-5                  BSgenome_1.70.2              
[133] patchwork_1.3.0               hms_1.1.3                     bit64_4.6.0-1                
[136] Rhdf5lib_1.24.2               KEGGREST_1.42.0               statmod_1.5.0                
[139] shiny_1.10.0                  interactiveDisplayBase_1.40.0 AnnotationHub_3.10.1         
[142] igraph_2.1.4                  memoise_2.0.1                 ggtree_3.10.1                
[145] fastmatch_1.1-6               bit_4.6.0                     gson_0.1.0                   
[148] ape_5.8-1
tximport rhdf5 • 543 views
ADD COMMENT
0
Entering edit mode
  1. I have tried to update the packages and R but to no avail. I keep getting either this error or : Error in H5Fclose(file$H5Identifier) : HDF5. File accessibility. Unable to close file.
  2. Running h5ls(files[1]) led to r session aborting,
  3. But running h5dump from terminal worked fine
  4. BiocManager::install("rhdf5", force = TRUE) just led to the error happening further down the list of files : 1 2 3 4 5 6 7 Error in H5Dclose(h5dataset) : HDF5. Dataset. Unable to decrement reference count.

    sessionInfo()
    R version 4.4.3 (2025-02-28)
    Platform: x86_64-apple-darwin20
    Running under: macOS Sequoia 15.3.2
    
    Matrix products: default
    BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
    LAPACK: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0
    
    locale:
    [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
    
    time zone: Europe/London
    tzcode source: internal
    
    attached base packages:
    [1] stats4    stats     graphics  grDevices utils     datasets  methods   base     
    
    other attached packages:
     [1] rhdf5_2.50.2                tximport_1.34.0             RColorBrewer_1.1-3         
     [4] AnnotationDbi_1.68.0        DESeq2_1.46.0               SummarizedExperiment_1.36.0
     [7] GenomicRanges_1.58.0        GenomeInfoDb_1.42.3         IRanges_2.40.1             
    [10] S4Vectors_0.44.0            MatrixGenerics_1.18.1       matrixStats_1.5.0          
    [13] Biobase_2.66.0              BiocGenerics_0.52.0         BiocParallel_1.40.0        
    [16] limma_3.62.2                readr_2.1.5                
    
    loaded via a namespace (and not attached):
     [1] KEGGREST_1.46.0         gtable_0.3.6            ggplot2_3.5.1           lattice_0.22-6         
     [5] tzdb_0.5.0              rhdf5filters_1.18.1     bitops_1.0-9            vctrs_0.6.5            
     [9] tools_4.4.3             generics_0.1.3          parallel_4.4.3          tibble_3.2.1           
    [13] RSQLite_2.3.9           blob_1.2.4              pkgconfig_2.0.3         Matrix_1.7-3           
    [17] lifecycle_1.0.4         GenomeInfoDbData_1.2.13 compiler_4.4.3          progress_1.2.3         
    [21] Rsamtools_2.22.0        Biostrings_2.74.1       statmod_1.5.0           munsell_0.5.1          
    [25] codetools_0.2-20        pillar_1.10.1           crayon_1.5.3            cachem_1.1.0           
    [29] DelayedArray_0.32.0     abind_1.4-8             tidyselect_1.2.1        locfit_1.5-9.12        
    [33] dplyr_1.1.4             fastmap_1.2.0           grid_4.4.3              colorspace_2.1-1       
    [37] cli_3.6.4               SparseArray_1.6.2       magrittr_2.0.3          S4Arrays_1.6.0         
    [41] withr_3.0.2             prettyunits_1.2.0       UCSC.utils_1.2.0        scales_1.3.0           
    [45] bit64_4.6.0-1           XVector_0.46.0          httr_1.4.7              bit_4.6.0              
    [49] png_0.1-8               hms_1.1.3               memoise_2.0.1           rlang_1.1.5            
    [53] Rcpp_1.0.14             glue_1.8.0              DBI_1.2.3               BiocManager_1.30.25    
    [57] vroom_1.6.5             jsonlite_2.0.0          Rhdf5lib_1.28.0         R6_2.6.1               
    [61] zlibbioc_1.52.0
    
ADD REPLY
0
Entering edit mode

Tricky to try and debug this without some example files to work with. Can you provide the output of traceback() called immediately after you've encountered the error. That way I can at least see the underlying function in tximport that is hitting the issue with the HDF5 file.

ADD REPLY

Login before adding your answer.

Traffic: 926 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6