bppsuite.ml 1.66 KB
Newer Older
LANORE Vincent's avatar
LANORE Vincent committed
1
open Bistro.EDSL
Carine Rey's avatar
Carine Rey committed
2
open Bistro.Std
LANORE Vincent's avatar
LANORE Vincent committed
3
open Core
Carine Rey's avatar
Carine Rey committed
4
open File_formats
LANORE Vincent's avatar
LANORE Vincent committed
5 6


7
let env = docker_image ~account:"carinerey" ~name:"bppsuite" ~tag:"06182018" ()
LANORE Vincent's avatar
LANORE Vincent committed
8 9 10 11

let assign k v =
  seq ~sep:"=" [ string k ; v ]

12

Carine Rey's avatar
Carine Rey committed
13
let conf_file_bppseqgen ~tree ~nb_sites ~config =
14 15 16 17 18 19 20 21
  seq ~sep:"\n" (
    [
      assign "input.tree.file" (dep tree) ;
      assign "output.sequence.file" dest ;
      assign "number_of_sites" (int nb_sites) ;
    ]
    @ config
  )
LANORE Vincent's avatar
LANORE Vincent committed
22

Carine Rey's avatar
Carine Rey committed
23
let bppseqgen ~nb_sites ~tree ~config : nucleotide_fasta workflow =
Carine Rey's avatar
Carine Rey committed
24
  workflow ~descr:"bppsuite.bppseqgen" [
LANORE Vincent's avatar
LANORE Vincent committed
25
    cmd "bppseqgen" ~env [
Carine Rey's avatar
Carine Rey committed
26
      assign "param" (file_dump (conf_file_bppseqgen ~tree ~nb_sites ~config)) ;
Carine Rey's avatar
Carine Rey committed
27 28 29 30
    ]
  ]


Carine Rey's avatar
Carine Rey committed
31
let conf_file_bppseqman_fna2faa ~fna =
Carine Rey's avatar
Carine Rey committed
32 33 34 35 36 37 38 39 40 41 42 43 44
  seq ~sep:"\n" [
    assign "input.sequence.file" (dep fna) ;
    assign "output.sequence.file" dest ;
    string {|alphabet=Codon(letter=DNA)
             genetic_code = Standard
             input.alignment = true
             sequence.manip = Translate
           |}
  ]

let fna2faa ~(fna:nucleotide_fasta workflow) : aminoacid_fasta workflow =
  workflow ~descr:"bppsuite.fna2faa" [
    cmd "bppseqman" ~env [
Carine Rey's avatar
Carine Rey committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
      assign "param" (file_dump (conf_file_bppseqman_fna2faa ~fna)) ;
    ]
  ]

let conf_file_bppseqman_fa2phy ~fna =
  seq ~sep:"\n" [
    assign "input.sequence.file" (dep fna) ;
    assign "output.sequence.file" dest ;
    assign "output.sequence.format" (string "Phylip") ;
    string {| input.alignment = true
             sequence.manip =
           |}
  ]

let fa2phy ~(fna: nucleotide_fasta workflow) : nucleotide_phylip workflow =
  workflow ~descr:"bppsuite.fa2phy" [
    cmd "bppseqman" ~env [
      assign "param" (file_dump (conf_file_bppseqman_fa2phy ~fna)) ;
LANORE Vincent's avatar
LANORE Vincent committed
63 64
    ]
  ]