API Reference
Public
GenomicFeatures.STRAND_BOTH
— ConstantBoth strand ('.')
GenomicFeatures.STRAND_NA
— ConstantUnknown strand ('?')
GenomicFeatures.STRAND_NEG
— ConstantNegative strand ('-')
GenomicFeatures.STRAND_POS
— ConstantPositive strand ('+')
GenomicFeatures.GenomicInterval
— TypeGenomicInterval{T} <: AbstractGenomicInterval{T}
A genomic interval specifies interval with some associated metadata. The first three fields (groupname
, first
, and last
) are mandatory arguments when constructing the Interval
object.
Fields
groupname::String
: the group name associated with the interval.first::Int64
: the leftmost position.last::Int64
: the rightmost position.strand::Strand
: thestrand
.metadata::T
GenomicFeatures.GenomicInterval
— MethodGenomicInterval{T}(data)
The returned data is converted to GenomicInterval{T} if there is an implemented Base.convert
function for the type of data. This method provides a useful hook for converting custom types to GenomicInterval{T}.
GenomicFeatures.GenomicIntervalCollection
— TypeGenomicIntervalCollection(data, sort::Bool=false)
Constructor that guesses metadatatype, and offers conversion through collection.
GenomicFeatures.GenomicIntervalCollection
— TypeA GenomicIntervalCollection is an efficiently stored and indexed set of annotated genomic intervals.
GenomicFeatures.GenomicIntervalCollection
— MethodGenomicIntervalCollection(intervals::AbstractVector{I}, sort::Bool=false) where {I<:Interval}
Shorthand constructor.
GenomicFeatures.GenomicIntervalCollection
— MethodGenomicIntervalCollection{I}(data, sort::Bool=false) where {I<:Interval}
Constructor that offers conversion through collection.
GenomicFeatures.GenomicIntervalCollection
— MethodGenomicIntervalCollection{T}(data, sort::Bool=true) where {T}
Shorthand for metadata type bulk insertion.
GenomicFeatures.GenomicPosition
— TypeA genomic position is distinguished from an interval and only specifies a position with some associated metadata.
GenomicFeatures.Strand
— TypeOuter constructors
Strand
can take four kinds of values listed in the next table:
Symbol | Constant | Meaning |
---|---|---|
'?' | STRAND_NA | strand is unknown or inapplicable |
'+' | STRAND_POS | positive strand |
'-' | STRAND_NEG | negative strand |
'.' | STRAND_BOTH | non-strand-specific feature |
GenomicFeatures.Strand
— MethodStrand(strand::Char)
GenomicFeatures.Strand
— MethodStrand(strand::UInt8)
BioGenerics.isoverlapping
— MethodReturn true if interval a
overlaps interval b
, with no consideration to strand
BioGenerics.leftposition
— Methodleftposition(i::AbstractGenomicInterval)
Return the leftmost position of i
.
BioGenerics.rightposition
— Methodrightposition(i::AbstractGenomicInterval)
Return the rightmost position of i
.
GenomicFeatures.coverage
— Functioncoverage(intervals)
Compute the coverage of a collection of intervals and return an GenomicIntervalCollection
that contains run-length encoded coverage data.
For example, given intervals like:
[------] [------------]
[---------------]
This function would return a new set of disjoint intervals with annotated coverage like:
[1][-2-][-1-][--2--][--1--]
Example
julia> intervals = [
GenomicInterval("chr1", 1, 8),
GenomicInterval("chr1", 4, 20),
GenomicInterval("chr1", 14, 27)];
julia> coverage(intervals)
GenomicIntervalCollection{GenomicInterval{UInt32}} with 5 intervals:
chr1:1-3 . 1
chr1:4-8 . 2
chr1:9-13 . 1
chr1:14-20 . 2
chr1:21-27 . 1
GenomicFeatures.eachoverlap
— Functioneachoverlap(intervals_a, intervals_b, [groupname_isless=Base.isless])
Create an iterator of overlapping intervals between intervals_a
and intervals_b
.
This function assumes elements of intervals_a
and intervals_b
are sorted by its group name and left position. If the element type is not a subtype of GenomicFeatures.AbstractGenomicInterval
, elements are converted to GenomicInterval
objects.
The third optional argument is a function that defines the order of the group names. The default function is Base.isless
, which is the lexicographical order.
GenomicFeatures.hasintersection
— Methodhasintersection(interval::AbstractGenomicInterval, col::GenomicIntervalCollection)::Bool
Query whether an interval
has an intersection with col
.
GenomicFeatures.span
— Methodspan(interval::AbstractGenomicInterval)::Int
Get the span of interval
.
Internal
Base.findfirst
— MethodFind a the first interval with matching start and end points.
Returns that interval, or 'nothing' if no interval was found.
Base.position
— Methodposition(p::AbstractGenomicPosition)
Return the position of p
.
GenomicFeatures.baseintervaltype
— MethodGet the interval type without metadata. This query is useful when converting an interval's metadata or when implementing promotion rules.
GenomicFeatures.intervaltype
— MethodGet the interval type. Overwrite to suggest stream element conversions during iteration.
GenomicFeatures.isordered
— FunctionCheck if two intervals are well ordered.
AbstractGenomicInterval
are considered well ordered if groupname(a) <= groupname(b) and leftposition(a) <= leftposition(b).
GenomicFeatures.metadatatype
— MethodGet the interval's metadata type.
GenomicFeatures.precedes
— FunctionReturn true if interval a
entirely precedes b
.
GenomicFeatures.volume
— Methodvolume(interval::AbstractGenomicInterval)
Get the product of the interval
's span and metadata.