CAFE
Computational Analysis of gene Family Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
viterbi.cpp File Reference
#include <iostream>
#include <algorithm>
#include "viterbi.h"
#include "Globals.h"
#include "pvalue.h"
#include <family.h>
#include "cafe.h"
#include <pthread.h>

Functions

void viterbi_parameters_init (viterbi_parameters *viterbi, int nnodes, int nrows)
 
void viterbi_set_max_pvalue (viterbi_parameters *viterbi, int index, const std::vector< double > &values)
 
void viterbi_sum_probabilities (viterbi_parameters *viterbi, pCafeTree pcafe, pCafeFamilyItem pitem)
 
void familysize_sanity_check (pTree ptree)
 
void viterbi_section (pCafeFamily pcf, double pvalue, int num_random_samples, viterbi_parameters *viterbi, int i, pCafeTree pcafe, double *cP, std::vector< std::vector< double > > *pCD)
 
void * __cafe_viterbi_thread_func (void *ptr)
 
void cafe_viterbi (Globals &globals, viterbi_parameters &viterbi, std::vector< std::vector< double > > *pCD)
 
void cafe_viterbi_print (pCafeParam param, viterbi_parameters &viterbi)
 
void __cafe_tree_node_compute_viterbi (pTree ptree, pTreeNode ptnode, va_list ap1)
 
void __cafe_tree_node_backtrack_viterbi (pTree ptree, pTreeNode ptnode, va_list ap1)
 
void __cafe_tree_node_compute_clustered_viterbi (pTree ptree, pTreeNode ptnode, va_list ap1)
 
void cafe_tree_viterbi (pCafeTree pcafe)
 
void cafe_tree_clustered_viterbi (pCafeTree pcafe, int num_likelihoods)
 
void cafe_tree_viterbi_posterior (pCafeTree pcafe, pCafeParam param)
 
void viterbi_family_print (pCafeTree pcafe, pCafeFamily pfamily, int idx)
 

Variables

struct chooseln_cache cache
 A cache of values of chooseln. More...
 
pthread_mutex_t mutex_cafe_viterbi = PTHREAD_MUTEX_INITIALIZER
 

Function Documentation

void __cafe_tree_node_backtrack_viterbi ( pTree  ptree,
pTreeNode  ptnode,
va_list  ap1 
)
void __cafe_tree_node_compute_clustered_viterbi ( pTree  ptree,
pTreeNode  ptnode,
va_list  ap1 
)
void __cafe_tree_node_compute_viterbi ( pTree  ptree,
pTreeNode  ptnode,
va_list  ap1 
)
void* __cafe_viterbi_thread_func ( void *  ptr)
void cafe_tree_clustered_viterbi ( pCafeTree  pcafe,
int  num_likelihoods 
)
void cafe_tree_viterbi ( pCafeTree  pcafe)
void cafe_tree_viterbi_posterior ( pCafeTree  pcafe,
pCafeParam  param 
)
void cafe_viterbi ( Globals globals,
viterbi_parameters viterbi,
std::vector< std::vector< double > > *  pCD 
)
void cafe_viterbi_print ( pCafeParam  param,
viterbi_parameters viterbi 
)
void familysize_sanity_check ( pTree  ptree)
void viterbi_family_print ( pCafeTree  pcafe,
pCafeFamily  pfamily,
int  idx 
)
void viterbi_parameters_init ( viterbi_parameters viterbi,
int  nnodes,
int  nrows 
)
void viterbi_section ( pCafeFamily  pcf,
double  pvalue,
int  num_random_samples,
viterbi_parameters viterbi,
int  i,
pCafeTree  pcafe,
double *  cP,
std::vector< std::vector< double > > *  pCD 
)
void viterbi_set_max_pvalue ( viterbi_parameters viterbi,
int  index,
const std::vector< double > &  values 
)
void viterbi_sum_probabilities ( viterbi_parameters viterbi,
pCafeTree  pcafe,
pCafeFamilyItem  pitem 
)

Variable Documentation

struct chooseln_cache cache

A cache of values of chooseln.

Chooseln evaluates the natural logarithm of Gamma(n+1)/(Gamma(k+1)*Gamma(n-k+1)) The cache holds values for integer values of n and k. It does not appear to be threadsafe.

P(X(t) = c | X(0) = s) = {j=0}^{(s,c)} {s}{j}{s+c-j-1}{s-1} ^{s+c-2j}(1-2)^j

pthread_mutex_t mutex_cafe_viterbi = PTHREAD_MUTEX_INITIALIZER