package biocaml

  1. Overview
  2. Docs
The OCaml Bioinformatics Library

Install

Dune Dependency

Authors

Maintainers

Sources

v0.11.0.tar.gz
md5=486aeb3e552dabae85839e2af30d6c52
sha512=4ed2df0b7cbd80bd6e29bd8fee9d2dacd9379ad0f4ff142bd8e16ade3f1507f6cc7cbe4c614943b8feb8fa4705935695cb458606b0da813dbf255b1e566a43cf

doc/src/biocaml.unix/seq_range.ml.html

Source file seq_range.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31


module type Identifier = sig
  include Comparable
  include Sexpable with type t := t
  val to_string : t -> string
end

module Make(S : Identifier) = struct
  type t = S.t * Range.t
  [@@deriving compare, sexp]

  let make s lo hi =
    let open Or_error in
    Range.make lo hi >>= fun r ->
    Or_error.return (s, r)

  let seq = fst

  let size (_, r) = Range.size r

  let to_string (seq, { Range.lo ; hi }) =
    sprintf "%s:%d-%d" (S.to_string seq) lo hi
end

include Make(String)

let of_string s =
  try Scanf.sscanf s "%s@:%d-%d" make
  with Scanf.Scan_failure _ ->
    Or_error.errorf "Seq_range.of_string: invalid format %s" s
OCaml

Innovation. Community. Security.