detection_pipeline.ml 2.98 KB
Newer Older
1 2 3 4 5
open Bistro
open File_formats

module type Dataset = sig
  type t
Philippe Veber's avatar
Philippe Veber committed
6
  val tree : t -> nhx file
7

Philippe Veber's avatar
Philippe Veber committed
8
  val nucleotide_alignment : t -> nucleotide_fasta file
9 10 11 12 13 14 15 16 17 18 19
end

module Make(D : Dataset) = struct
  open D

  let amino_acid_alignment d =
    Bppsuite.fna2faa (nucleotide_alignment d)

  let phylip_nucleotide_alignment d =
    Bppsuite.fna2phy ~fna:(nucleotide_alignment d)

20 21 22
  let gene_tree d =
    Tree_dataset.raxmlng_fna ~fna:(nucleotide_alignment d) ()

23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
  let identical d =
    let tree_sc = Tree_dataset.prepare_sc_tree (tree d) in
    let tree_id = Tree_dataset.prepare_tree_with_node_id (tree d) in
    Identical.identical ~tree_id ~tree_sc ~prot_model:"LG08" ~faa:(amino_acid_alignment d) ()
    |> Identical.results

  let topological d =
    let faa = amino_acid_alignment d in
    let tree_conv = Tree_dataset.prepare_topological_tree (tree d) in
    let tree = Tree_dataset.prepare_tree_with_node_id (tree d) in
    Topological.topological ~faa ~tree ~tree_conv ~prot_model:"LG08" ()
    |> Topological.results

  let multinomial d =
    Multinomial.multinomial
      ~tree_sc:(tree d)
      ~faa:(amino_acid_alignment d)
Philippe Veber's avatar
Philippe Veber committed
40
      ()
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91

  let multinomial_asymptotic_lrt d =
    Multinomial.multinomial_asymptotic_lrt
      ~tree_sc:(tree d)
      ~faa:(amino_acid_alignment d)

  let multinomial_asymptotic_sparse d =
    Multinomial.multinomial_asymptotic_sparse
      ~tree_sc:(tree d)
      ~faa:(amino_acid_alignment d)

  let multinomial_simulation_lrt d =
    Multinomial.multinomial_simulation_lrt
      ~tree_sc:(tree d)
      ~faa:(amino_acid_alignment d)

  let multinomial_simulation_sparse d =
    Multinomial.multinomial_simulation_sparse
      ~tree_sc:(tree d)
      ~faa:(amino_acid_alignment d)

  let tdg09 d =
    Tamuri.tdg09
      ~tree:(tree d)
      ~faa:(amino_acid_alignment d)
      ()
    |> Tamuri.results

  let diffseltree d =
    Tree_dataset.prepare_diffsel_tree (tree d)

  let diffsel d =
    Diffsel.diffsel
      ~phy_n:(phylip_nucleotide_alignment d)
      ~tree:(diffseltree d)
      ~w_every:1
      ~n_cycles:50
      ()
    |> Diffsel.selector

  let diffseldsparse ?pi ?shiftprob ?eps d =
    Diffseldsparse.diffseldsparse
      ?pi ?shiftprob ?eps
      ~alignment:(phylip_nucleotide_alignment d)
      ~tree:(diffseltree d)
      ~w_every:1
      ~n_cycles:50
      ()
    |> Diffseldsparse.readdiffseldsparse
    |> Diffseldsparse.results

92
  let pcoc ?(gamma = true) ?(ncat = 10) d =
93 94 95 96
    let faa = amino_acid_alignment d in
    let tree = tree d in
    Pcoc.pcoc ~catx_est:ncat ~plot_complete:false ~gamma ~faa ~tree ()
    |> Pcoc.results
97 98 99 100 101 102

  let pcoc_v2 ?(gamma = true) ?(aa_profiles = `C10) d =
    let faa = amino_acid_alignment d in
    let tree = tree d in
    Pcoc.pcoc_v2 ~aa_profiles ~gamma ~faa ~tree ()
    |> Pcoc.results
103 104 105 106 107 108 109 110
  
  let dn_ds_dnds_trees d =
    Testnh.dn_ds_trees_real_data ~fna:(nucleotide_alignment d) ~tree:(tree d) ()
    
  let dn_tree d   = (dn_ds_dnds_trees d).dn_tsv
  let ds_tree d   = (dn_ds_dnds_trees d).ds_tsv
  let dnds_tree d = (dn_ds_dnds_trees d).dnds_tsv
    
111
end