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

Commit

Permalink
fix linear index access of BAM, fundamentally (#395)
Browse files Browse the repository at this point in the history
The previous commit (049ed2d) fixes a special
case but this will fix the problem fundamentally.
  • Loading branch information
bicycle1885 committed Feb 17, 2017
1 parent 789a12f commit 7f5e7af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/intervals/index/bgzfindex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ function overlapchunks(index::BGZFIndex, seqid::Integer, interval::UnitRange)
binindex, linindex, pbin = index.data[seqid]
bins = reg2bins(first(interval), last(interval))
ret = Chunk[]
if !isempty(linindex)
idx = cld(first(interval), LinearWindowSize)
if endof(linindex) idx
# `linindex` may be empty for contigs with no records
offset = linindex[cld(first(interval), LinearWindowSize)]
offset = linindex[idx]
for bin in bins
if haskey(binindex, bin)
for chunk in binindex[bin]
Expand Down

0 comments on commit 7f5e7af

Please sign in to comment.