最近想将单细胞数据从Seurat转还到H5AD格式,但发现Seurat V5直接转换会报错。这里记录一下解决的方案。
1 | library(Seurat) |
直接转换会报错
1 | SaveH5Seurat(pbmc, filename = "data/pbmc.h5Seurat") |
Error in assay.group$obj_copy_to(dst_loc = dfile, dst_name = “X”, src_name = x.data) : HDF5-API Errors: error #000: ../../src/hdf5-1.12.2/src/H5Ocopy.c in H5Ocopy(): line 240: unable to copy object class: HDF5 major: Object header minor: Unable to copy object
error #001: ../../src/hdf5-1.12.2/src/H5VLcallback.c in H5VL_object_copy(): line 5495: object copy failed
class: HDF5
major: Virtual Object Layer
minor: Unable to copy objecterror #002: ../../src/hdf5-1.12.2/src/H5VLcallback.c in H5VL__object_copy(): line 5456: object copy failed
class: HDF5
major: Virtual Object Layer
minor: Unable to copy objecterror #003: ../../src/hdf5-1.12.2/src/H5VLnative_object.c in H5VL__native_object_copy(): line 125: unable to copy object
class: HDF5
major: Object header
minor: Unable to copy objecterror #004: ../../src/hdf5-1.12.2/src/H5Ocopy.c in H5O__copy(): line 291: source object not found
class: HDF5
major: Symbol table
minor: Obj
Seurat V5 多了layer
结构,可能导致了转换的失败。将Seurat V5的Assay转换成V3的Assay就可以使用SeuratDisk
的函数进行转换了
1 | # remove existed files |
希望SeuratDisk这个小问题会在将来修复
完。
Ref:
https://github.com/satijalab/seurat/issues/8220
https://github.com/satijalab/seurat/discussions/7402
https://github.com/satijalab/seurat/issues/8054
https://satijalab.org/seurat/articles/seurat5_essential_commands