From e1a1584799bee61726466f5c979a7ce2f07070ce Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Fri, 20 Dec 2019 11:56:28 +0100 Subject: [PATCH] Fix cool & mcool sniffing on python3 h5py returns bytestrings, so this worked on python 2 but not python 3. Fixes hicexplorer tests on python 3. --- lib/galaxy/datatypes/binary.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index 5016ee313f0..1ba208f2c6f 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -1102,8 +1102,8 @@ class Cool(H5): if super(Cool, self).sniff(filename): keys = ['chroms', 'bins', 'pixels', 'indexes'] with h5py.File(filename, 'r') as handle: - fmt = handle.attrs.get('format') - url = handle.attrs.get('format-url') + fmt = util.unicodify(handle.attrs.get('format')) + url = util.unicodify(handle.attrs.get('format-url')) if fmt == MAGIC or url == URL: if not all(name in handle.keys() for name in keys): return False @@ -1162,8 +1162,8 @@ class MCool(H5): return False res0 = list(handle['resolutions'].keys())[0] keys = ['chroms', 'bins', 'pixels', 'indexes'] - fmt = handle['resolutions'][res0].attrs.get('format') - url = handle['resolutions'][res0].attrs.get('format-url') + fmt = util.unicodify(handle['resolutions'][res0].attrs.get('format')) + url = util.unicodify(handle['resolutions'][res0].attrs.get('format-url')) if fmt == MAGIC or url == URL: if not all(name in handle['resolutions'][res0].keys() for name in keys): return False