Skip to content

Commit

Permalink
Fix TypeError when running cooler show
Browse files Browse the repository at this point in the history
  • Loading branch information
robomics authored and nvictus committed Jan 11, 2023
1 parent d625f23 commit bfaa993
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cooler/cli/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __call__(self, i0, i1, j0, j1, transpose=False):
if (i1 - i0 > 0) or (j1 - j0 > 0):

# coarsegrain the offsets to extract a big chunk of rows at a time
offsets = self.offset_selector[i0 : i1 + 1]
offsets = self.offset_selector[i0 : i1 + i1.dtype.type(1)]
which_offsets = _prune_partition(offsets, chunksize)

for o0, o1 in zip(which_offsets[:-1], which_offsets[1:]):
Expand Down
8 changes: 4 additions & 4 deletions cooler/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ def _region_to_extent(h5, chrom_ids, region, binsize):
chrom_lo = h5["indexes"]["chrom_offset"][cid]
chrom_hi = h5["indexes"]["chrom_offset"][cid + 1]
chrom_bins = h5["bins"]["start"][chrom_lo:chrom_hi]
yield chrom_lo + np.searchsorted(chrom_bins, start, "right") - 1
yield chrom_lo + np.searchsorted(chrom_bins, end, "left")
yield chrom_lo + chrom_lo.dtype.type(np.searchsorted(chrom_bins, start, "right") - 1)
yield chrom_lo + chrom_lo.dtype.type(np.searchsorted(chrom_bins, end, "left"))


def region_to_offset(h5, chrom_ids, region, binsize=None):
Expand Down Expand Up @@ -238,7 +238,7 @@ def __init__(self, h5, field, max_chunk):

def index_col(self, i0, i1, j0, j1):
"""Retrieve pixel table row IDs corresponding to query rectangle."""
edges = self.h5["indexes"]["bin1_offset"][i0 : i1 + 1]
edges = self.h5["indexes"]["bin1_offset"][i0 : i1 + i1.dtype.type(1)]
index = []
for lo1, hi1 in zip(edges[:-1], edges[1:]):
if hi1 - lo1 > 0:
Expand All @@ -257,7 +257,7 @@ def query(self, i0, i1, j0, j1):

i, j, v = [], [], []
if (i1 - i0 > 0) or (j1 - j0 > 0):
edges = h5["indexes"]["bin1_offset"][i0 : i1 + 1]
edges = h5["indexes"]["bin1_offset"][i0 : i1 + i1.dtype.type(1)]
data = h5["pixels"][field]
p0, p1 = edges[0], edges[-1]

Expand Down

0 comments on commit bfaa993

Please sign in to comment.