module Biocaml_range:Ranges of contiguous integers (integer intervals). A range is a contiguous sequence of integers from a lower bound to an upper bound. For example,sig..end
[2, 10] is the set of integers from 2 through 10, inclusive of 2 and 10.type t = private {
lo : int;
hi : int;
exception Bad of string
val make : int -> int -> t make l u returns the range from l to u. Raise Bad if l > u.val to_pair : t -> int * intto_pair t returns the int * int pair.val make_opt : int -> int -> t optionmake but returns None instead of raising exception.val size : t -> intsize v returns the number of integers in v, i.e. v.hi - v.lo + 1.val member : t -> int -> boolmember t k returns true if t contains k.val to_string : t -> stringval to_list : t -> int listto_list v returns the set of integers contained in v, in ascending order.val overlap : t -> t -> intoverlap u v returns amount of overlap between two ranges. A positive value indicates number of integers common to u and v. A negative value indicates the number of integers in between non-overlapping ranges. A zero value means the ranges are exactly adjacent to each other. The relation is symmetric.val gap : t -> t -> intgap u v returns the size of the gap between u and v. It is equivalent to the negative of overlap.val union : t -> t -> t listunion u v returns the ranges representing the union of u and v. Returned list length will be 1 if ranges have non-negative overlap or 2 if they do not. In other words, the answer is represented with the fewest possible ranges.val intersect : t -> t -> t optionintersect u v returns the range representing the intersection of u and v. Return None if intersection is empty.val before : t -> t -> boolbefore u v is true if strict_before u v || equal u v.val after : t -> t -> boolafter u v is equivalent to before v u.val strict_before : t -> t -> boolstrict_before u v is true if u.lo < v.lo && u.hi < v.hi.val strict_after : t -> t -> boolstrict_after u v is equivalent to strict_before v u.val compare_positional : t -> t -> int optioncompare_positional u v returns -1 if u is strictly before v, 0 if u is equal to v, +1 if u is strictly after v, and returns None otherwise.val subset : t -> t -> boolsubset u v is true if u is a subset of v.val superset : t -> t -> boolsuperset u v is true if u is a superset of v.val strict_subset : t -> t -> boolstrict_subset u v is true if u is a strict subset of v.val strict_superset : t -> t -> boolstrict_superset u v is true if u is a strict superset of v.val compare_containment : t -> t -> int optioncompare_containment u v returns -1 if u is a strict subset of v, 0 if u is equal to v, +1 if u is a strict superset of v, and returns None otherwise.Order.compose allows generating others. It is suitable to pass compare_positional as the first or second argument, and compare_containment as the second or first, respectively, argument to this function. Also, either can be first reversed by Order.reversep.val compare_lo_then_hi : t -> t -> intlo bounds unless they are equal, in which case return order between hi bounds.val compare_lo : t -> t -> intlo bounds, ignoring hi bounds.val compare_hi : t -> t -> inthi bounds, ignoring lo bounds.val any_overlap : t list -> boolval all_positional : t list -> boolval max_gap_of_positional : t list -> intFailure if any pairs of given ranges not positionally comparable, or if given less than two ranges.val find_min_range : ?init_direction:string ->
t -> (t -> bool) -> int -> t optionfind_min_range v pred i finds the minimum sized range within v centered around i that satisfies pred. Successively larger ranges are created starting from [i, i] and the first one to satisfy pred is returned. None is returned if the given range v itself is reached and pred still fails. Raise Failure if i not within v.
The first range tried is [i, i], by default the second is [i, i+1], the third [i-1, i+1], the fourth [i-1, i+2], and so on. The optional init_direction must be either "fwd" or "rev". If "fwd", which is the default, the range size is initially increased in the forward direction. If "rev", the second range tried will be [i-1, i]. If the range boundary is reached on either side, the size continues to be increased by incrementing on the opposing side.
val expand_assoc_list : (t * 'a) list -> (int * 'a list) listexp_assoc_list dat returns a list associating each integer i with the list of values associated with all ranges overlapping i in dat. The set of integers considered is the union of all in given dat.val find_regions : ?max_gap:int ->
('a -> bool) -> (t * 'a) list -> t listMath.find_regions.