mirror of
https://github.com/MillironX/XAM.jl.git
synced 2024-12-25 14:18:17 +00:00
Adjust BGZFStreams.virtualoffset
https://github.com/BioJulia/BGZFStreams.jl/issues/22#issuecomment-839746122
This commit is contained in:
parent
0e6ef62e3e
commit
d370ebe28c
1 changed files with 14 additions and 0 deletions
|
@ -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")
|
||||||
|
|
Loading…
Reference in a new issue