Describe the bug
An H5 file fails to be built from the sample parquet file.
To Reproduce
capcruncher interactions count \
results/<sample>/<sample>.parquet \
-o interim/pileups/counts_by_restriction_fragment/<sample>.hdf5 \
-f resources/restriction_fragments/genome.digest.bed.gz \
-v <viewpoints.bed> -p 5 --assay capture
fails with:
*** TypeError: '<' not supported between instances of 'str' and 'int'
Workaround
This can be fixed by patching the cooler library, though I'm not sure if it's correct to, and I'm sure the error occurs elsewhere upstream. This is the fix that I implemented though:
In ~/micromamba/envs/cc/lib/python3.10/site-packages/cooler/create/_create.py, change lines 110-127 from:
# Store bins
try:
chrom_dset = grp.create_dataset(
"chrom", shape=(n_bins,), dtype=chrom_dtype, data=chrom_ids, **h5opts
)
except ValueError:
# If too many scaffolds for HDF5 enum header,
# try storing chrom IDs as raw int instead
if chrom_as_enum:
chrom_as_enum = False
chrom_dtype = CHROMID_DTYPE
chrom_dset = grp.create_dataset(
"chrom", shape=(n_bins,), dtype=chrom_dtype, data=chrom_ids, **h5opts
)
else:
raise
if not chrom_as_enum:
chrom_dset.attrs["enum_path"] = "/chroms/name"
to:
try:
chrom_dset = grp.create_dataset(
"chrom", shape=(n_bins,), dtype=chrom_dtype, data=chrom_ids, **h5opts
)
except (ValueError, TypeError):
# TypeError: '<' not supported between instances of 'str' and 'int'
# If too many scaffolds for HDF5 enum header,
# try storing chrom IDs as raw int instead
if chrom_as_enum:
chrom_as_enum = False
chrom_dtype = CHROMID_DTYPE
chrom_dset = grp.create_dataset(
"chrom", shape=(n_bins,), dtype=chrom_dtype, data=chrom_ids, **h5opts
)
else:
raise
if not chrom_as_enum:
chrom_dset.attrs["enum_path"] = "/chroms/name"
Describe the bug
An H5 file fails to be built from the sample parquet file.
To Reproduce
fails with:
Workaround
This can be fixed by patching the cooler library, though I'm not sure if it's correct to, and I'm sure the error occurs elsewhere upstream. This is the fix that I implemented though:
In
~/micromamba/envs/cc/lib/python3.10/site-packages/cooler/create/_create.py, change lines 110-127 from:to: