美文网首页
Linux R语言打开.h5文件异常

Linux R语言打开.h5文件异常

作者: 倪桦 | 来源:发表于2022-06-10 16:16 被阅读0次

    6月10日从GEO数据库下载了作者上传的表达矩阵h5格式文件,需用从中提取出表达矩阵然后重构Seurat分析对象;该exp_matrix.hdf5文件在我的Window系统上,可以通过rhdf5::H5Fopenhdf5r::H5File$new两种方法打开读取文件内容。但是由于文件太大,有6个G,在我24G内存的Windows系统上没办法完全加载出矩阵。于是就把文件上传到服务器集群进行处理,以同样的方式尝试打开exp_matrix.hdf5文件,碰到了以下问题:

    • 1.rhdf5::H5Fopen函数打开error:
    data.h5 <- H5Fopen(name = "exp_matrix.hdf5")
    Error in H5Fopen(name = "exp_matrix.hdf5",  : 
      HDF5. File accessibility. Unable to open file.
    
    • 2.hdf5r::H5File$new函数打开error:
    hdf5r::H5File$new("exp_matrix.hdf5", mode="r")
    Error in H5File.open(filename, mode, file_create_pl, file_access_pl) : 
      HDF5-API Errors:
        error #000: H5F.c in H5Fopen(): line 620: unable to open file
            class: HDF5
            major: File accessibility
            minor: Unable to open file
    
        error #001: H5VLcallback.c in H5VL_file_open(): line 3501: failed to iterate over available VOL connector plugins
            class: HDF5
            major: Virtual Object Layer
            minor: Iteration failed
    
        error #002: H5PLpath.c in H5PL__path_table_iterate(): line 578: can't iterate over plugins in plugin path '(null)'
            class: HDF5
            major: Plugin for dynamically loaded library
            minor: Iteration failed
    
        error #003: H5PLpath.c in H5PL__path_table_iterate_process_path(): line 620: can't open directory: ~/local/Minconda/envs/scRNA/lib/hdf5/plugin
            class: HDF5
            major: Plugin for dynamically loaded library
            minor: Can't open directory or file
    
        error #004: H5VLcallback.c in H5VL__file_open(): line 3351: open faile
    

    解决方案:编辑Linux用户的配置文件(.bashrc)添加以下两句环境变量:

    export HDF5_USE_FILE_LOCKING="FALSE"
    export RHDF5_USE_FILE_LOCKING="FALSE" 
    

    然后执行source ~/.bashrc,就可以解决Linux环境下无法读取h5文件的错误了。

    Error in H5Fopen(file): Unable to open HDF5 file when using subsetArchRProject to create new arrow files · Issue #248 · GreenleafLab/ArchR (github.com)

    相关文章

      网友评论

          本文标题:Linux R语言打开.h5文件异常

          本文链接:https://www.haomeiwen.com/subject/xljbmrtx.html