Previous Up Next

Module Biocaml_track (.ml)

Track files in UCSC Genome Browser format. The following documentation assumes knowledge of concepts explained on the UCSC Genome Browser's website. Basically, a track file is one of several types of data (WIG, GFF, etc.), possibly preceded by comments, browser lines, and a track line. This module allows only a single data track within a file, although the UCSC specifies that multiple tracks may be provided together.

module Biocaml_track: 
sig

Track lines define display attributes. They can be thought of as lists of attribute-value pairs. For forward compatibility, this module allows arbitrary attributes to be set. However, the following lists known attributes and specifies restrictions on their values:
  • name - string enclosed in double quotes if there are spaces; recommended to use only alphanumeric characters and length less than 15 characters but this is not enforced
  • description - string enclosed in double quotes if there are spaces; recommended to use only alphanumeric characters and length less than 60 characters but this is not enforced
  • visibility - "hide", "dense", "full", "pack", or "squish"; if type=wiggle_0 then "hide", "dense", or "full"; can also use integer value where 0 = "hide", 1 = "dense", 2 = "full", 3 = "pack", 4 = "squish"
  • color - "R,G,B" where each of R, G, and B are integers between 0 and 255
  • altColor - "R,G,B" where each of R, G, and B are integers between 0 and 255
  • itemRgb - "On" is the only allowed value
  • useScore - 0 or 1
  • group - string
  • priority - integer
  • autoScale - "on" or "off"
  • gridDefault - "on" or "off"
  • maxHeightPixels - "max:default:min" where each of max, default, and min are integers
  • graphType - "bar" or "points"
  • viewLimits - "lower:upper" where each of lower and upper are integers
  • yLineMark - floating point value
  • yLineOnOff - "on" or "off"
  • windowingFunction - "maximum", "mean", or "minimum"
  • smoothingWindow - "off" or an integer between 2 and 16
  • db - should be a valid UCSC assembly ID, but currently any string is accepted
  • offset - integer
  • url - string
  • htmlUrl - string
  • type - "wiggle_0" is the only value currently supported, leaving this attribute unset handles other track types


Item Types


type t = [ `browser of
[ `hide of [ `all ]
| `position of string * int * int
| `unknown of string ]
| `comment of string
| `track of (string * string) list ]
The type of the parser "track" lines.
type 'a content = [ `content of 'a ] 
The "content" lines of the files.

Error Types


module Error: 
sig
type parsing = [ `incomplete_input of
Biocaml_internal_utils.Pos.t * string list * string option
| `wrong_browser_position of Biocaml_internal_utils.Pos.t * string
| `wrong_key_value_format of (string * string) list * string * string ]
The parsing errors that can happen while parsing Track-specific content.
type t = parsing  
The union of all the errors.
val parsing_of_sexp  : Sexplib.Sexp.t -> parsing 
val sexp_of_parsing  : parsing -> Sexplib.Sexp.t
val t_of_sexp  : Sexplib.Sexp.t -> t 
val sexp_of_t  : t -> Sexplib.Sexp.t
end

Low-level transforms.


module Transform: 
sig

Low-level transforms.
val string_to_string_content  : ?filename:string ->
unit ->
(string,
([ `browser of
[ `hide of [ `all ]
| `position of string * int * int
| `unknown of string ]
| `comment of string
| `content of string
| `track of (string * string) list ], [> Biocaml_track.Error.parsing ])
Biocaml_internal_utils.Result.t)
Biocaml_transform.t
Create a parser that gets the "track", comment, and "browser" lines and puts the other lines in `content _.
val string_content_to_string  : ?add_content_new_line:bool ->
unit ->
([ `browser of
[ `hide of [ `all ]
| `position of string * int * int
| `unknown of string ]
| `comment of string
| `content of string
| `track of (string * string) list ], string)
Biocaml_transform.t
Create a printer for track files containing `content line lines.
val string_to_wig  : ?filename:string ->
unit ->
(string,
([ `bed_graph_value of Biocaml_wig.bed_graph_value
| `browser of
[ `hide of [ `all ]
| `position of string * int * int
| `unknown of string ]
| `comment of string
| `fixed_step_state_change of string * int * int * int option
| `fixed_step_value of float
| `track of (string * string) list
| `variable_step_state_change of string * int option
| `variable_step_value of int * float ],
[> `cannot_parse_key_values of Biocaml_internal_utils.Pos.t * string
| `empty_line of Biocaml_internal_utils.Pos.t
| `incomplete_input of
Biocaml_internal_utils.Pos.t * string list * string option
| `missing_chrom_value of Biocaml_internal_utils.Pos.t * string
| `missing_start_value of Biocaml_internal_utils.Pos.t * string
| `missing_step_value of Biocaml_internal_utils.Pos.t * string
| `unrecognizable_line of Biocaml_internal_utils.Pos.t * string list
| `wrong_bed_graph_value of Biocaml_internal_utils.Pos.t * string
| `wrong_browser_position of Biocaml_internal_utils.Pos.t * string
| `wrong_fixed_step_value of Biocaml_internal_utils.Pos.t * string
| `wrong_key_value_format of (string * string) list * string * string
| `wrong_span_value of Biocaml_internal_utils.Pos.t * string
| `wrong_start_value of Biocaml_internal_utils.Pos.t * string
| `wrong_step_value of Biocaml_internal_utils.Pos.t * string
| `wrong_variable_step_value of Biocaml_internal_utils.Pos.t * string ])
Biocaml_internal_utils.Result.t)
Biocaml_transform.t
Create a composite parser for UCSC WIG files.
val wig_to_string  : unit ->
([ `bed_graph_value of Biocaml_wig.bed_graph_value
| `browser of
[ `hide of [ `all ]
| `position of string * int * int
| `unknown of string ]
| `comment of string
| `fixed_step_state_change of string * int * int * int option
| `fixed_step_value of float
| `track of (string * string) list
| `variable_step_state_change of string * int option
| `variable_step_value of int * float ], string)
Biocaml_transform.t
Create a printer for track files containing WIG lines.
val string_to_gff  : ?filename:string ->
tags:Biocaml_gff.Tags.t ->
unit ->
(string,
([ `browser of
[ `hide of [ `all ]
| `position of string * int * int
| `unknown of string ]
| `comment of string
| `record of Biocaml_gff.record
| `track of (string * string) list ],
[> `cannot_parse_float of Biocaml_internal_utils.Pos.t * string
| `cannot_parse_int of Biocaml_internal_utils.Pos.t * string
| `cannot_parse_strand of Biocaml_internal_utils.Pos.t * string
| `cannot_parse_string of Biocaml_internal_utils.Pos.t * string
| `empty_line of Biocaml_internal_utils.Pos.t
| `incomplete_input of
Biocaml_internal_utils.Pos.t * string list * string option
| `wrong_attributes of Biocaml_internal_utils.Pos.t * string
| `wrong_browser_position of Biocaml_internal_utils.Pos.t * string
| `wrong_key_value_format of (string * string) list * string * string
| `wrong_row of Biocaml_internal_utils.Pos.t * string
| `wrong_url_escaping of Biocaml_internal_utils.Pos.t * string ])
Biocaml_internal_utils.Result.t)
Biocaml_transform.t
Create a composite parser for UCSC GFF files.
val gff_to_string  : tags:Biocaml_gff.Tags.t ->
unit ->
([ `browser of
[ `hide of [ `all ]
| `position of string * int * int
| `unknown of string ]
| `comment of string
| `record of Biocaml_gff.record
| `track of (string * string) list ], string)
Biocaml_transform.t
Create a printer for track files containing GFF lines.
val string_to_bed  : ?filename:string ->
?more_columns:Biocaml_bed.parsing_spec ->
unit ->
(string,
([ `browser of
[ `hide of [ `all ]
| `position of string * int * int
| `unknown of string ]
| `comment of string
| `content of Biocaml_bed.item
| `track of (string * string) list ],
[> `bed of Biocaml_bed.Error.parsing_base
| `incomplete_input of
Biocaml_internal_utils.Pos.t * string list * string option
| `wrong_browser_position of Biocaml_internal_utils.Pos.t * string
| `wrong_key_value_format of (string * string) list * string * string ])
Biocaml_internal_utils.Result.t)
Biocaml_transform.t
Create a composite parser for UCSC Bed(Graph) files.
val bed_to_string  : unit ->
([ `browser of
[ `hide of [ `all ]
| `position of string * int * int
| `unknown of string ]
| `comment of string
| `content of Biocaml_bed.item
| `track of (string * string) list ], string)
Biocaml_transform.t
Create a printer for track files containing Bed(Graph) lines.
end
end

AltStyle によって変換されたページ (->オリジナル) /