CAFE
Computational Analysis of gene Family Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
viterbi.h
Go to the documentation of this file.
1 #ifndef VITERBI_H_A08989A1_B4B4_461C_B863_A1AE2FE9BD98
2 #define VITERBI_H_A08989A1_B4B4_461C_B863_A1AE2FE9BD98
3 
4 #include <vector>
5 #include <map>
6 
7 extern "C"
8 {
9 #include <family.h>
10 #include <cafe.h>
11 void compute_viterbis(pCafeNode node, int k, double *factors, int rootfamilysize_start, int rootfamilysize_end, int familysize_start, int familysize_end);
12 }
13 
14 class Globals;
15 
16 struct change
17 {
18  change(int e, int r, int d) : expand(e), remain(r), decrease(d)
19  {
20 
21  }
22  change() : expand(0), remain(0), decrease(0)
23  {
24 
25  }
26  int expand;
27  int remain;
28  int decrease;
29 };
30 
32 {
33 public:
35  int num_nodes;
36 
38  int num_rows;
39 
41  std::vector<change> expandRemainDecrease;
42 
43  // first value is node ID
44  using NodeFamilyKey = std::pair<int, pCafeFamilyItem>;
45 
46  std::map<NodeFamilyKey, int> viterbiNodeFamilysizes;
47 
49  std::map<NodeFamilyKey, double> viterbiPvalues;
50 
51  double* maximumPvalues;
52  std::vector<double> averageExpansion;
53  double** cutPvalues;
54 
56  void compute_size_deltas(pTree ptree, pCafeFamilyItem pitem);
57  void clear(int nnodes);
58 } ;
59 
60 void viterbi_parameters_init(viterbi_parameters *viterbi, int nnodes, int nrows);
61 
62 void viterbi_set_max_pvalue(viterbi_parameters* viterbi, int index, const std::vector<double>& values );
63 
64 void cafe_viterbi(Globals& globals, viterbi_parameters& viterbi, std::vector<std::vector<double> >* pCD);
66 void* __cafe_viterbi_thread_func(void* ptr);
67 void viterbi_family_print(pCafeTree pcafe, pCafeFamily pfamily, int idx);
68 
70 {
76  double pvalue;
77 
78  std::vector<std::vector<double> >* pCD;
79  int from;
80 };
81 
82 
83 #endif
pCafeFamily pfamily
Definition: viterbi.h:71
std::vector< double > averageExpansion
Definition: viterbi.h:52
double pvalue
Definition: viterbi.h:76
void set_node_familysize(pCafeTree tree, pCafeFamilyItem pItem)
Definition: viterbi.cpp:505
void viterbi_family_print(pCafeTree pcafe, pCafeFamily pfamily, int idx)
Definition: viterbi.cpp:563
int decrease
Definition: viterbi.h:28
double ** cutPvalues
Definition: viterbi.h:53
std::pair< int, pCafeFamilyItem > NodeFamilyKey
Definition: viterbi.h:44
int num_random_samples
Definition: viterbi.h:75
int num_threads
Definition: viterbi.h:73
Definition: Globals.h:13
void viterbi_parameters_init(viterbi_parameters *viterbi, int nnodes, int nrows)
Definition: viterbi.cpp:21
std::map< NodeFamilyKey, double > viterbiPvalues
Definition: viterbi.h:49
void cafe_viterbi(Globals &globals, viterbi_parameters &viterbi, std::vector< std::vector< double > > *pCD)
Definition: viterbi.cpp:141
int remain
Definition: viterbi.h:27
std::vector< std::vector< double > > * pCD
Definition: viterbi.h:78
std::vector< change > expandRemainDecrease
Definition: viterbi.h:41
int expand
Definition: viterbi.h:26
std::map< NodeFamilyKey, int > viterbiNodeFamilysizes
Definition: viterbi.h:46
viterbi_parameters * viterbi
Definition: viterbi.h:74
int from
Definition: viterbi.h:79
change()
Definition: viterbi.h:22
Definition: family.h:54
int num_nodes
Definition: viterbi.h:35
change(int e, int r, int d)
Definition: viterbi.h:18
Definition: viterbi.h:31
void viterbi_sum_probabilities(viterbi_parameters *viterbi, pCafeTree pcafe, pCafeFamilyItem pitem)
Definition: viterbi.cpp:44
Represents a single gene family and the number of members of that family that exist in each species...
Definition: cafe.h:11
void viterbi_set_max_pvalue(viterbi_parameters *viterbi, int index, const std::vector< double > &values)
Definition: viterbi.cpp:32
Definition: viterbi.h:16
double * maximumPvalues
Definition: viterbi.h:51
Definition: viterbi.h:69
pCafeTree pcafe
Definition: viterbi.h:72
Definition: tree.h:11
int num_rows
Definition: viterbi.h:38
void clear(int nnodes)
Definition: viterbi.cpp:542
Structure representing a matrix of values of family sizes.
Definition: family.h:88
void * __cafe_viterbi_thread_func(void *ptr)
Definition: viterbi.cpp:120
void compute_viterbis(pCafeNode node, int k, double *factors, int rootfamilysize_start, int rootfamilysize_end, int familysize_start, int familysize_end)
Definition: cafe_tree.c:257
Definition: family.h:17
void compute_size_deltas(pTree ptree, pCafeFamilyItem pitem)
Definition: viterbi.cpp:515