let item_of_line ~how line =
let separators = ['\t'; ' '] in
let format, strict =
let base = [| `type_string; `type_int; `type_int |] in
match how with
| `strings -> (base, false)
| `enforce tt -> (Array.append base tt, true) in
Biocaml_table.Row.of_line ~separators ~format
~strict_row_length:strict ~strict_cell_type:strict line
|> begin function
| Ok row when Array.length row >= 3 ->
let n = match row.(0) with `string s -> s | _ -> assert false in
let h = match row.(1) with `int i -> i | _ -> assert false in
let l = match row.(2) with `int i -> i | _ -> assert false in
let q = Array.slice row 3 (Array.length row) in
Ok (n, h, l, q)
| Ok row ->
Error (`bed (`wrong_number_of_columns row))
| Error e -> Error (`bed e)
end