package biocaml

  1. Overview
  2. Docs
The OCaml Bioinformatics Library

Install

Dune Dependency

Authors

Maintainers

Sources

biocaml-0.11.2.tbz
sha256=fae219e66db06f81f3fd7d9e44717ccf2d6d85701adb12004ab4ae6d3359dd2d
sha512=f6abd60dac2e02777be81ce3b5acdc0db23b3fa06731f5b2d0b32e6ecc9305fe64f407bbd95a3a9488b14d0a7ac7c41c73a7e18c329a8f18febfc8fd50eccbc6

doc/biocaml.unix/Biocaml_unix/Interval_tree/index.html

Module Biocaml_unix.Interval_treeSource

Interval tree (data structure)

An interval tree is a collection of integer-bounded intervals labeled by a value.

For a brief description of the implementation, see the matching Wikipedia article

Sourcetype 'a t
Sourceexception Empty_tree
Accessors
Sourceval is_empty : 'a t -> bool
Sourceval cardinal : 'a t -> int
Sourceval intersects : 'a t -> low:int -> high:int -> bool

intersects a b t returns true if one interval in t intersects with the interval [a;b].

Constructors
Sourceval empty : 'a t

the empty tree

Sourceval add : 'a t -> low:int -> high:int -> data:'a -> 'a t

add lo hi v t adds the interval (lo, hi) labeled with value v to the contents of t. Note that in contrast to sets, identical intervals (even with identical labels) may be *repeated* in an interval tree. E.g., add 1 2 () (add 1 2 ()) contains 2 intervals.

Conversion
Sourceval elements : 'a t -> (int * int * 'a) list
Sourceval to_stream : 'a t -> (int * int * 'a) Stream.t
Sourceval to_backwards_stream : 'a t -> (int * int * 'a) Stream.t
Searching and filtering
Sourceval find_closest : int -> int -> 'a t -> int * int * 'a * int

find_closest lo hi t returns the interval in t which is at minimal distance of the interval [lo;hi]. The resulting tuple contains from left to right, left-end of the interval, right-end of the interval, value associated to the interval and distance to the interval given in argument. Overlapping intervals are at distance 0 of each other.

Raises Empty_tree if t is empty

Sourceval find_intersecting_elem : int -> int -> 'a t -> (int * int * 'a) Stream.t

find_intersecting_elem a b t is equivalent to Stream.filter ~f:(fun (x,y,_) -> intersects x y t) (stream t) but is more efficient.

Sourceval filter_overlapping : 'a t -> low:int -> high:int -> 'a t

Create an interval tree with the elements which overlap with [low, high].

Misc
Sourceval print : 'a t -> unit

Used for debugging purpose, should be removed in the long run

Sourceval check_integrity : 'a t -> unit

Used for debugging purpose, should be removed in the long run

OCaml

Innovation. Community. Security.