package phylogenetics

  1. Overview
  2. Docs
Algorithms and datastructures for phylogenetics

Install

dune-project
 Dependency

Authors

Maintainers

Sources

phylogenetics-0.3.0.tbz
sha256=de867d7cc017a8e434dab43ef16f0f6495973892cd7b6a8446b18e79393704a8
sha512=0209538caf94be47eabcaa25399c54849bd4fa0fc79e0579acee27f46ef3b72aa50e17bdb48fed8e86674d4caee6c1c4c423833a2757db12e2a6cc28234510de

doc/src/phylogenetics/rejection_sampling.ml.html

Source file rejection_sampling.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
(** Deprecated. Utility functions for rejection sampling *)

open Core
open Sigs

module Make(Align : ALIGNMENT) = struct
  let generate_trees ~(sampler:unit->Phylogenetic_tree.t) amount =
    List.init amount ~f:(fun _ -> sampler ())

  let reject seqgen p align trees =
    List.filter_map trees ~f:(fun t ->
        if Align.equal align (seqgen p t 1) then Some t else None
      )

  let mean_floats l =
    List.fold l ~init:0.0 ~f:(fun acc x -> acc +. x)
    /. float_of_int (List.length l)

  let get_branch i trees =
    List.map trees ~f:(fun t -> List.nth_exn (Phylogenetic_tree.get_branch_lengths t) i)

  let mean_specific_branch i trees =
    get_branch i trees |> mean_floats

end