1
0
Fork 0
mirror of https://github.com/MillironX/XAM.jl.git synced 2024-11-14 22:33:14 +00:00

Adjust BGZFStreams.virtualoffset

https://github.com/BioJulia/BGZFStreams.jl/issues/22#issuecomment-839746122
This commit is contained in:
Ciarán O’Mara 2021-05-16 12:20:55 +10:00
parent 0e6ef62e3e
commit d370ebe28c

View file

@ -15,6 +15,20 @@ import BioGenerics: isfilled, header
import GenomicFeatures: eachoverlap import GenomicFeatures: eachoverlap
# Overwrite virtualoffset method as per https://github.com/BioJulia/BGZFStreams.jl/issues/22#issuecomment-839746122.
function BGZFStreams.virtualoffset(stream::BGZFStreams.BGZFStream)
if stream.mode == BGZFStreams.READ_MODE
i = BGZFStreams.ensure_buffered_data(stream)
if i == 0
block = stream.blocks[end]
else
block = stream.blocks[i]
end
else
block = stream.blocks[1]
end
return BGZFStreams.VirtualOffset(block.block_offset, block.position - 1)
end
include("bai.jl") include("bai.jl")
include("auxdata.jl") include("auxdata.jl")