Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update GenomicFeatures to v3 #10

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
[compat]
BioGenerics = "0.1"
CodecBGZF = "0.1"
GenomicFeatures = "2"
GenomicFeatures = "3"
TranscodingStreams = "0.9.5"
julia = "1.3"

Expand Down
2 changes: 1 addition & 1 deletion src/Indexes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using TranscodingStreams

import CodecBGZF
import BioGenerics
import GenomicFeatures: Interval
import GenomicFeatures: GenomicInterval

include("chunk.jl")
include("bgzfindex.jl")
Expand Down
4 changes: 2 additions & 2 deletions src/overlap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

struct TabixOverlapIterator{T}
reader::T
interval::Interval
interval::GenomicInterval
end

function Base.eltype(::Type{TabixOverlapIterator{T}}) where T
Expand Down Expand Up @@ -76,7 +76,7 @@ function Base.iterate(iter::TabixOverlapIterator, state)
end

function icmp(record, interval)
c = cmp(BioGenerics.seqname(record), BioGenerics.seqname(interval))
c = cmp(BioGenerics.seqname(record), BioGenerics.groupname(interval))

if c < 0 || (c == 0 && BioGenerics.rightposition(record) < BioGenerics.leftposition(interval))
return -1
Expand Down
8 changes: 4 additions & 4 deletions src/tabix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ end


"""
overlapchunks(tabix::Tabix, interval::Interval)
overlapchunks(tabix::Tabix, interval::GenomicInterval)

Return chunks possibly overlapping with the range specified by `interval`.

Note that records within the returned chunks are not guaranteed to actually overlap the query interval.
"""
function overlapchunks(tabix::Tabix, interval::Interval)
seqid = findfirst(isequal(BioGenerics.seqname(interval)), tabix.names)
function overlapchunks(tabix::Tabix, interval::GenomicInterval)
seqid = findfirst(isequal(BioGenerics.groupname(interval)), tabix.names)
if seqid == 0
throw(ArgumentError("failed to find sequence name '$(BioGenerics.seqname(interval))'"))
throw(ArgumentError("failed to find sequence name '$(BioGenerics.groupname(interval))'"))
end
return overlapchunks(tabix.index, seqid, BioGenerics.leftposition(interval):BioGenerics.rightposition(interval))
end
Expand Down