cljam.util.region

Utility functions for manipulating chromosomal regions.

complement-regions

(complement-regions base-region)(complement-regions base-region in-regions)
Returns a sequence of regions complement to in-regions.
in-regions must be sorted.
Returns a stateful transducer when no regions provided.

divide-refs

(divide-refs refs step)
Divides refs into several chunks with maximum length 'step'.
Returns a lazy sequence of map containing {:chr :start :end}.

divide-region

(divide-region start end step)
Divides a region [start end] into several chunks with maximum length 'step'.
Returns a lazy sequence of vector.

format-region

(format-region {:keys [chr start end]})
Format a region map into a string.

format-region-strict

(format-region-strict region-map)
Format a region map into a string strictly.

merge-regions

(merge-regions)(merge-regions max-gap)(merge-regions max-gap regions)
Same as 'merge-regions-with' except for 'merge-two-regions' is
partially applied as merge-fn.

merge-regions-with

(merge-regions-with merge-fn)(merge-regions-with merge-fn max-gap)(merge-regions-with merge-fn max-gap regs)
Returns a lazy sequence of merged regions. Input regions must be sorted.
Neighboring regions apart less than or equal to 'max-gap' will be merged
with 'merge-fn'. Returns a stateful transducer when no input 'regions' is
provided.

overlapped-regions?

(overlapped-regions? x y)
Returns true if two regions are overlapped with each other.

parse-region

(parse-region region-str)
Parse a region string into a map.

parse-region-strict

(parse-region-strict region-str)
Parse a region string into a map strictly.

subtract-region

(subtract-region lhs-reg rhs-reg)
Subtract a region from another one.
Returns a vector of regions.

valid-region?

(valid-region? {:keys [chr start end]})
Checks if the given region map is a valid 1-based closed range.

valid-rname?

(valid-rname? rname)
Checks if the given rname conforms to the spec of sam.