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

GenomicInterval type

This commit is contained in:
Ciarán O’Mara 2021-06-28 21:17:06 +10:00
parent c3c2a9ceda
commit a933ac6ab2
4 changed files with 6 additions and 6 deletions

View file

@ -20,8 +20,8 @@ BGZFStreams = "0.3"
BioAlignments = "2"
BioGenerics = "0.1"
BioSequences = "2.0.4"
GenomicFeatures = "2"
Indexes = "0.1"
GenomicFeatures = "3"
Indexes = "0.3"
TranscodingStreams = "0.6, 0.7, 0.8, 0.9"
julia = "1"

View file

@ -220,7 +220,7 @@ close(reader)
## Getting records overlapping genomic features
The `eachoverlap` method also accepts the `Interval` type defined in [GenomicFeatures.jl](https://github.com/BioJulia/GenomicFeatures.jl).
The `eachoverlap` method also accepts the `GenomicInterval` type defined in [GenomicFeatures.jl](https://github.com/BioJulia/GenomicFeatures.jl).
This allows you to do things like first read in the genomic features from a GFF3 file, and then for each feature, iterate over all the BAM records that overlap with that feature.

View file

@ -15,12 +15,12 @@ function Base.eltype(::Type{OverlapIterator{T}}) where T
return Record
end
function GenomicFeatures.eachoverlap(reader::Reader, interval::Interval)
function GenomicFeatures.eachoverlap(reader::Reader, interval::GenomicInterval)
return GenomicFeatures.eachoverlap(reader, GenomicFeatures.seqname(interval), GenomicFeatures.leftposition(interval):GenomicFeatures.rightposition(interval))
end
function GenomicFeatures.eachoverlap(reader::Reader, interval)
return GenomicFeatures.eachoverlap(reader, convert(Interval, interval))
return GenomicFeatures.eachoverlap(reader, convert(GenomicInterval, interval))
end
function GenomicFeatures.eachoverlap(reader::Reader, refname::AbstractString, interval::UnitRange)

View file

@ -246,7 +246,7 @@
reader = open(BAM.Reader, filepath, index=filepath * ".bai")
@test isa(eachoverlap(reader, "chr1", 1:100), BAM.OverlapIterator)
@test isa(eachoverlap(reader, GenomicFeatures.Interval("chr1", 1, 100)), BAM.OverlapIterator)
@test isa(eachoverlap(reader, GenomicFeatures.GenomicInterval("chr1", 1, 100)), BAM.OverlapIterator)
# expected values are counted using samtools
for (refname, interval, expected) in [