mirror of
https://github.com/MillironX/XAM.jl.git
synced 2024-12-23 13:28:16 +00:00
Return early
This commit is contained in:
parent
8f26bbf4a7
commit
9d2a70531a
1 changed files with 5 additions and 3 deletions
|
@ -52,10 +52,11 @@ function Base.iterate(iter::OverlapIterator)
|
|||
end
|
||||
@assert iter.reader.index !== nothing
|
||||
chunks = Indexes.overlapchunks(iter.reader.index.index, refindex, iter.interval)
|
||||
if !isempty(chunks)
|
||||
seek(iter.reader, first(chunks).start)
|
||||
if isempty(chunks)
|
||||
return nothing
|
||||
end
|
||||
state = OverlapIteratorState(refindex, chunks, 1, Record())
|
||||
seek(iter.reader, state.chunks[state.chunkid].start)
|
||||
return iterate(iter, state)
|
||||
end
|
||||
|
||||
|
@ -65,7 +66,7 @@ function Base.iterate(iter::OverlapIterator, state)
|
|||
while BGZFStreams.virtualoffset(iter.reader.stream) < chunk.stop
|
||||
read!(iter.reader, state.record)
|
||||
c = compare_intervals(state.record, (state.refindex, iter.interval))
|
||||
if c == 0
|
||||
if c == 0 # overlapping
|
||||
return copy(state.record), state
|
||||
end
|
||||
if c > 0
|
||||
|
@ -78,6 +79,7 @@ function Base.iterate(iter::OverlapIterator, state)
|
|||
seek(iter.reader, state.chunks[state.chunkid].start)
|
||||
end
|
||||
end
|
||||
# no more overlapping records
|
||||
return nothing
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue