Documentation ¶
Overview ¶
Package interval provides functions for manipulating and analyzing intervals including sorting, calculating overlaps, and liftover functions.
Index ¶
- func AreEqual(a Interval, b Interval) bool
- func BedSliceToIntervalMap(inBed []bed.Bed) map[string]*IntervalNode
- func BuildTree(intervals []Interval) map[string]*IntervalNode
- func CoordsToString(i Interval) string
- func GoReadToChan(inputFile string) <-chan Interval
- func IntervalSimilarity(a []Interval, b []Interval) (float64, float64, float64)
- func IntervalSize(i Interval) int
- func Overlap(a, b Interval) bool
- func OverlapSize(a, b Interval) int
- func PrettyPrint(q Interval)
- func PrintRelationships()
- func QueryBool(treeMap map[string]*IntervalNode, q Interval, relationship string, ...) bool
- func ReadToChan(inputFile string, send chan<- Interval)
- func SortByCoord(in []Interval)
- func TestValidRelationship(op string) bool
- type AggregateInterval
- type Interval
- type IntervalNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreEqual ¶ added in v1.0.1
AreEqual takes in two intervals and returns a bool of whether they have the same coordinates or not
func BedSliceToIntervalMap ¶ added in v1.0.1
func BedSliceToIntervalMap(inBed []bed.Bed) map[string]*IntervalNode
BedSliceToIntervalMap takes in a slice of bed and returns a map of string -- *IntervalNode which can be used for interval.Query
func BuildTree ¶
func BuildTree(intervals []Interval) map[string]*IntervalNode
BuildTree takes a slice of intervals and returns a map that can be used for Querying overlaps.
func CoordsToString ¶
CoordsToString takes in a interval and returns a string in the format of chr:start-end
func GoReadToChan ¶
GoReadToChan reads Interval interfaces to a channel from an input file (bed, axt, vcf, sam, chain).
func IntervalSimilarity ¶ added in v1.0.1
IntervalSimilarity takes in two slices of interval and returns the proportion of elements in the first slice that overlap an element in the second slice, the proportion of elements in the second slice that overlap an element in the first slice, and the average of those two metrics (a metric of how similar the two interval sets are). Interval sets must not be self-overlapping
func IntervalSize ¶ added in v1.0.1
IntervalSize calculates the size of the interval
func Overlap ¶ added in v1.0.1
Overlap determines whether 2 intervals have overlap, assuming they are from the same genome
func OverlapSize ¶ added in v1.0.1
OverlapSize calculates the size of the overlap between 2 intervals, assuming they are from the same genome
func PrettyPrint ¶
func PrettyPrint(q Interval)
PrettyPrint displays the chrom, chromstart, and chromend on a line as a print for debugging.
func PrintRelationships ¶
func PrintRelationships()
PrintRelationships is used to print the supported overlap relationships as part of the usage message
func QueryBool ¶
func QueryBool(treeMap map[string]*IntervalNode, q Interval, relationship string, ans []Interval) bool
QueryBool searches the input treeMap and returns true if any interval satisfies the input relationship relative to the input interval q. QueryBool is faster than Query and is preferred when simply checking if the input q does or does not overlap the tree.
func ReadToChan ¶
ReadToChan reads from a file (bed, axt, vcf, sam, chain) to send interval interfaces to a chan<- interval.
func SortByCoord ¶ added in v1.0.1
func SortByCoord(in []Interval)
SortByCoord takes in a slice of Interval and sorts the slice according to coordinates
func TestValidRelationship ¶
TestValidRelationship tests that the input relationship string for a query is supported.
Types ¶
type AggregateInterval ¶
type AggregateInterval struct {
// contains filtered or unexported fields
}
func (*AggregateInterval) GetChrom ¶
func (a *AggregateInterval) GetChrom() string
func (*AggregateInterval) GetChromEnd ¶
func (a *AggregateInterval) GetChromEnd() int
func (*AggregateInterval) GetChromStart ¶
func (a *AggregateInterval) GetChromStart() int
type Interval ¶
Interval is a type interface for any genomic datatype that has chromosomal coordinate info (chromosome, start, end). In order to satisfy this interface, a type must have GetChrom(), GetChromStart(), and GetChromEnd() methods. Note that the these methods must return positions for a 0-base half-closed interval [start - end).
func BedSliceToIntervals ¶ added in v1.0.1
BedSliceToIntervals takes in a slice of beds and returns a slice of intervals. Useful before using BuildTree
func MergeIntervals ¶
MergeIntervals takes a slice of type Interval and returns a slice of type Interval in which all overlapping entries have been merged together.
type IntervalNode ¶
type IntervalNode struct {
// contains filtered or unexported fields
}