Skip to content

hicConvertFormat shall use "HDF5::MCOOL" rather than "HDF5::Cooler" for mcool hdf attribute format #952

Description

@Fan-iX

Dear HiCExplorer team,

When I use cooler.fileops.list_coolers to inspect mcool files created by hicConvertFormat, I always received a warning

fileops.py:211: UserWarning: Cooler path / appears to be corrupt
  if _is_cooler(grp):

I noticed that mcool files created by hicConvertFormat use "HDF5::Cooler" as its format, so cooler.fileops.list_coolers reports the root group ("/") as a (corrupted) cooler dataset.

https://github.com/open2c/cooler/blob/b009aea8c6aadd7c7848bca9bdd6ea708ef0a554/src/cooler/fileops.py#L116-L126

mcool files created by cooler.zoomify_cooler have "HDF5::MCOOL" as their format.

steps to reproduce

# create mcool with HiCExplorer::hicConvertFormat
hicConvertFormat -m hic_matrix.h5 -o hic_matrix.mcool --inputFormat h5 --outputFormat mcool --resolutions 20000 40000 70000 120000 500000

# create mcool with cooler
hicConvertFormat -m hic_matrix.h5 -o hic_matrix.cool --inputFormat h5 --outputFormat cool
cooler zoomify hic_matrix.cool -o cooler_matrix.mcool -r 20000,40000,70000,120000,500000
$ hicInfo -m hic_matrix.mcool
KeyError: "No cooler found at: hic_matrix.mcool. Coolers found in ['/', '/resolutions/20000', '/resolutions/40000', '/resolutions/70000', '/resolutions/120000', '/resolutions/500000']. Use '::' to specify a group path"
# note that '/' is listed as a cooler group path

$ hicInfo -m cooler_matrix.mcool
KeyError: "No cooler found at: hic_matrix.mcool. Coolers found in ['/resolutions/20000', '/resolutions/40000', '/resolutions/70000', '/resolutions/120000', '/resolutions/500000']. Use '::' to specify a group path"
import h5py
h5py.File("hic_matrix.mcool").attrs.get("format")  # return 'HDF5::Cooler'
h5py.File("cooler_matrix.mcool").attrs.get("format")  # return 'HDF5::MCOOL'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions