Legend:
Library
Module
Module type
Parameter
Class
Class type
WIG data.
Internal representation of coordinates always assumes the first position on a chromosome is numbered 1. Also, integer ranges are always closed; the range [1, 10] is the set of integers from 1 to 10 inclusive of 1 and 10. WIG data can be in three formats---bed, variable-step, or fixed-step---and unfortunately each has different conventions as follows:
Bed format requires half-open intervals [low, high\) and numbers the first base as 0. Thus 1 is added to the low value when parsing. The line "chrI 0 10 3.14" is parsed to ("chrI",
1, 10, 3.14).
Variable-step format numbers the first position 1 and uses closed intervals. Thus no change is required. The line "1
3.14" is parsed to (1, 3.14).
Fixed-step format numbers the first position 1 and uses closed intervals. Thus no change is required. The header line "fixedStep chrom=chrI start=1 step=100 span=30" is parsed to ("chrI", 1, 100, 30).
The inverse is done for printing routines. You are freed from these details if you always use this module to parse and print.
All parsers allow columns (fields) on a line to be separated by any combination of space, tab, or carriage return characters. Printers always separate columns with a single tab. Tag-value pairs must be in the form "tag=value" with no space around the '='.
Basic Types
type comment = [
| `comment of string
]
type variable_step = [
| `variable_step_state_change of string * int option
| `variable_step_value of int * float
]
variable_step_state_change of name x span
type fixed_step = [
| `fixed_step_state_change of string * int * int * int option
| `fixed_step_value of float
]
fixed_step_state_change of name, start, step, span
Convert an item to a string (including new line characters).
Note: the parsing of the Tags.t is staged, so storing let
to_string = item_to_string ~tags only once could be slightly more efficient than calling item_to_string ~tags item many times.