Generic “tables” (like CSV, TSV, Bed …).
module Biocaml_table:
sig
module Row:
sig
typeitem =
[ `float of float | `int of int | `string of string ]
typet =
item array
typeitem_type =
[ `type_float | `type_int | `type_string ]
typet_type =
item_type array
module Tags:
sig
Biocaml_tags.t
.typet =
[ `format of Biocaml_table.Row.t_type
| `separator of char
| `strict_about of [ `cell_type | `row_length ] ] list
`separator c
adds c
in the list of separators used.`strict_about something
ensures that the format is fully
compliant with something
(example: otherwise the parser may
ignore some errors to keep going). `tail_format array
describes the format of the
columns of the row, if not provided everything is assumed to
be `type_string
. val separators : t -> char list
t
.val strict_row_length : t -> bool
`format _
).val strict_cell_type : t -> bool
`format _
).val format : t -> Biocaml_table.Row.t_type option
val default_extension : t -> string
"tsv"
, "csv"
, or "table"
).end
module Error:
sig
typeline_parsing =
[ `wrong_format of
[ `column_number | `float_of_string of string | `int_of_string of string ] *
Biocaml_table.Row.t_type * string ]
typet =
line_parsing
val line_parsing_of_sexp : Sexplib.Sexp.t -> line_parsing
val sexp_of_line_parsing : line_parsing -> Sexplib.Sexp.t
end
val of_line : ?separators:char list ->
?strict_row_length:bool ->
?strict_cell_type:bool ->
?format:t_type ->
Biocaml_internal_utils.Line.t ->
(t, [> Error.line_parsing ])
Biocaml_internal_utils.Result.t
Line.t
into a row while specifying a format
.format
is None
(the default), then all the elements are
put in `string _
rows.[' '; '\t']
.strict_row_length
is true
and format
provided,
then check that the number of columns is at least the one
of the format
.strict_cell_type
is true
and format
provided,
then check that each cell has the exactly right format.Transform.t
Creationsmodule Transform:
sig
val line_to_item : ?tags:Biocaml_table.Row.Tags.t ->
unit ->
(Biocaml_lines.item,
(Biocaml_table.Row.t,
[> `table_row of Biocaml_table.Row.Error.line_parsing ])
Biocaml_internal_utils.Result.t)
Biocaml_transform.t
Biocaml_transform.t
that converts lines to
table-rows according to the tags
(default: Biocaml_table.Row.Tags.default
).val item_to_line : ?tags:Biocaml_table.Row.Tags.t ->
unit -> (Biocaml_table.Row.t, Biocaml_lines.item) Biocaml_transform.t
Biocaml_transform.t
that converts rows to lines
using the first separator in the tags or '\t'
if none
(default tags
: Biocaml_table.Row.Tags.default
).end
val item_of_sexp : Sexplib.Sexp.t -> item
val sexp_of_item : item -> Sexplib.Sexp.t
val item_type_of_sexp : Sexplib.Sexp.t -> item_type
val sexp_of_item_type : item_type -> Sexplib.Sexp.t
val t_type_of_sexp : Sexplib.Sexp.t -> t_type
val sexp_of_t_type : t_type -> Sexplib.Sexp.t
end
end