package biocaml
Install
Dune Dependency
Authors
Maintainers
Sources
md5=497e3f2f7128a6ca347d66848da38a3d
sha512=4a76ebbafda3bc944afaff40d69791dfe153a0638ef5d7e6e1bc962b7f991d9545cd0af2d7930b39f8b31dbf067d0603cfa03d9b7a49396ab1ae452df47fd1f3
doc/biocaml.unix/Biocaml_unix/Wig/index.html
Module Biocaml_unix.Wig
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
The most general type that the default parser outputs.
type t = [comment | variable_step | fixed_step | `bed_graph_value of bed_graph_value ]
Error Types
module Error : sig ... end
The errors of the Wig
module.
Tags
module Tags : sig ... end
In_channel
Functions
exception Error of Error.t
val in_channel_to_item_stream :
?buffer_size:int ->
?filename:string ->
?tags:Tags.t ->
Core_kernel.In_channel.t ->
(item, Error.t) Core_kernel.result Stream.t
Get a stream of item
values out of an input-channel.
val in_channel_to_item_stream_exn :
?buffer_size:int ->
?filename:string ->
?tags:Tags.t ->
Core_kernel.In_channel.t ->
item Stream.t
Do like in_channel_to_item_stream
but each call to Stream.next
may throw an exception.
val in_channel_to_bed_graph :
?buffer_size:int ->
?filename:string ->
?tags:Tags.t ->
Core_kernel.In_channel.t ->
(bed_graph_value, Error.t) Core_kernel.result Stream.t
Get a stream of bed_graph_value
values out of a WIG-file input-channel.
val in_channel_to_bed_graph_exn :
?buffer_size:int ->
?filename:string ->
?tags:Tags.t ->
Core_kernel.In_channel.t ->
bed_graph_value Stream.t
Do like in_channel_to_bed_graph
but each call to Stream.next
may throw an exception.
To_string
Functions
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.
Transform Creations
S-Expressions
val comment_of_sexp : Sexplib.Sexp.t -> comment
val sexp_of_comment : comment -> Sexplib.Sexp.t
val variable_step_of_sexp : Sexplib.Sexp.t -> variable_step
val sexp_of_variable_step : variable_step -> Sexplib.Sexp.t
val fixed_step_of_sexp : Sexplib.Sexp.t -> fixed_step
val sexp_of_fixed_step : fixed_step -> Sexplib.Sexp.t
val bed_graph_value_of_sexp : Sexplib.Sexp.t -> bed_graph_value
val sexp_of_bed_graph_value : bed_graph_value -> Sexplib.Sexp.t
val item_of_sexp : Sexplib.Sexp.t -> item
val sexp_of_item : item -> Sexplib.Sexp.t