Skip to content

Commit b62645d

Browse files
authored
fix: Convert chromsizes to int64 in cooler tiles to prevent overflow … (#157)
* fix: Convert chromsizes to int64 in cooler tiles to prevent overflow error * Updated the readme * Remove python3.8 tests * Fix linter error
1 parent 55061be commit b62645d

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
strategy:
3131
matrix:
32-
python-version: ['3.8', '3.9', '3.10']
32+
python-version: ['3.9', '3.10']
3333

3434
steps:
3535
- uses: actions/checkout@v3

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
v0.20.2
2+
3+
- Convert cooler chromsizes to int64 to prevent overflow error with recent versions of h5py and numpy
4+
15
v0.20.1
26

37
- Remove use of deprecated `max_chunk` argument from cooler tile fetcher.

clodius/tiles/cooler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get_chromosome_names_cumul_lengths(c):
5757
(names, sizes, lengths) -> (list(string), dict, np.array(int))
5858
"""
5959
chrom_names = c.chromnames
60-
chrom_sizes = dict(c.chromsizes)
60+
chrom_sizes = dict(c.chromsizes.astype(np.int64))
6161
chrom_cum_lengths = np.r_[0, np.cumsum(c.chromsizes.values)]
6262
return chrom_names, chrom_sizes, chrom_cum_lengths
6363

clodius/tiles/multivec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def tileset_info(filename):
261261
if "row_infos" in f["resolutions"][str(resolutions[0])].attrs:
262262
row_infos = f["resolutions"][str(resolutions[0])].attrs["row_infos"]
263263

264-
if type(row_infos[0]) == str:
264+
if isinstance(row_infos[0], str):
265265
try:
266266
tileset_info["row_infos"] = [json.loads(r) for r in row_infos]
267267
except json.JSONDecodeError:

0 commit comments

Comments
 (0)