Documentation ¶
Overview ¶
Package intervals is a library for representing genomic intervals, and for creating and reading elsites files.
Index ¶
- Constants
- func FromBed(bd bed.Bed) (intervals map[string][]Interval)
- func FromBedFile(filename string) map[string][]Interval
- func FromBedFileOrdered(filename string) utils.SmallMap
- func FromBedOrdered(bd bed.Bed) (intervals utils.SmallMap)
- func FromElsitesFile(filename string) map[string][]Interval
- func FromVcf(vcf *vcf.Vcf) map[string][]Interval
- func FromVcfFile(filename string) map[string][]Interval
- func Overlap(intervals []Interval, start, end int32) bool
- func ParallelSortByStart(intervals []Interval)
- func SortByStart(intervals []Interval)
- func ToElsitesFile(intervals map[string][]Interval, filename string)
- type Interval
Constants ¶
const ElsitesHeader = "# elsites format version 1.0\n"
ElsitesHeader is the header line that every .elsites file starts with.
Variables ¶
This section is empty.
Functions ¶
func FromBed ¶
FromBed returns a mapping from contigs to slices of intervals that correspond to the BED file entries.
func FromBedFile ¶
FromBed returns a mapping from contigs to slices of intervals that correspond to the BED file entries.
func FromBedFileOrdered ¶
FromBedOrdered returns a mapping from contigs to slices of intervals that correspond to the BED file entries, with entries in the same order as they are encountered in the BED file.
func FromBedOrdered ¶
FromBedOrdered returns a mapping from contigs to slices of intervals that correspond to the BED file entries, with entries in the same order as they are encountered in the BED file.
func FromElsitesFile ¶
FromElsitesFile loads intervals from an elPrep-defined .elsites file.
func FromVcf ¶
FromVcf returns a mapping from contigs to slices of intervals that correspond to the Vcf file entries.
func FromVcfFile ¶
FromVcf returns a mapping from contigs to slices of intervals that correspond to the Vcf file entries.
func Overlap ¶
Overlap determines whether the given start/end range overlaps with any of the given intervals. intervals must be Flattened and sorted by Start.
func ParallelSortByStart ¶
func ParallelSortByStart(intervals []Interval)
ParallelSortByStart sorts a slice of Interval by Start position using a parallel stable sort.
func SortByStart ¶
func SortByStart(intervals []Interval)
SortByStart sorts a slice of Interval by Start position.
func ToElsitesFile ¶
ToElsitesFile stores intervals in an elPrep-defined .elsites file.
Types ¶
type Interval ¶
type Interval struct {
Start, End int32
}
Interval is a generic struct with a start and an end position.
func Flatten ¶
Flatten merges overlapping intervals into larger intervals. intervals must be sorted by Start before calling Flatten. The resulting slice is sorted by Start, and no two intervals in the result overlap with each other. The result shares memory with the intervals argument.
func Intersect ¶
Intersect returns a slice of all intervals that overlap with the given start/end range. intervals must be Flattened and sorted by Start. The result shares memory with the intervals argument.
func ParallelFlatten ¶
ParallelFlatten merges overlapping intervals into larger intervals, using a parallel algorithm. intervals must be sorted by Start before calling Flatten. The resulting slice is sorted by Start, and no two intervals in the result overlap with each other. The result shares memory with the intervals argument.
func (*Interval) Extend ¶
Extend makes interval1 larger if it overlaps with interval2, by storing max(interval1.End, interval2.End) in interval1.End; otherwise, interval1 remains unchanged. Returns true if the two intervals overlap, false otherwise. interval2.Start >= interval1.Start must be true before calling Extend.