Skip to content
This repository was archived by the owner on Aug 26, 2023. It is now read-only.

Commit 7f5e7af

Browse files
committed
fix linear index access of BAM, fundamentally (#395)
The previous commit (049ed2d) fixes a special case but this will fix the problem fundamentally.
1 parent 789a12f commit 7f5e7af

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/intervals/index/bgzfindex.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ function overlapchunks(index::BGZFIndex, seqid::Integer, interval::UnitRange)
4949
binindex, linindex, pbin = index.data[seqid]
5050
bins = reg2bins(first(interval), last(interval))
5151
ret = Chunk[]
52-
if !isempty(linindex)
52+
idx = cld(first(interval), LinearWindowSize)
53+
if endof(linindex) idx
5354
# `linindex` may be empty for contigs with no records
54-
offset = linindex[cld(first(interval), LinearWindowSize)]
55+
offset = linindex[idx]
5556
for bin in bins
5657
if haskey(binindex, bin)
5758
for chunk in binindex[bin]

0 commit comments

Comments
 (0)