package bistro-bio

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file gff.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
open Bistro
open Formats

let of_bed3 ~feature_type ~attribute_type (bed : #bed3 file) : gff file =
  let f = fun%workflow dest ->
    let feature_type, attribute_type =
      [%param feature_type, attribute_type] in
    let open Biotk.Pipe_parsers in
    run (
      from_file [%path bed]
      $$ bed_parser ()
      $$ filter_map (fun (chr, start_pos, stop_pos, _) ->
          let r = Biocaml_base.Gff.{
              seqname = chr ;
              source = None ;
              feature = Some feature_type ;
              start_pos ; stop_pos ;
              score = None ;
              strand = `Not_stranded ; phase = None ;
              attributes = [attribute_type, [Printf.sprintf "%s:%d-%d" chr start_pos stop_pos]]
            } in
          Some (`Record r)
        )
      $$ gff_unparser `three
      $$ to_file dest
    )
  in
  Workflow.path_plugin ~descr:"gff.of_bed3" f
OCaml

Innovation. Community. Security.