CAFE
Computational Analysis of gene Family Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
birthdeath.h File Reference
#include <assert.h>
#include "hashtable.h"
#include "chooseln_cache.h"

Go to the source code of this file.

Data Structures

struct  square_matrix
 
struct  BirthDeathCacheKey
 
struct  BirthDeathCacheArray
 A cache of values of family size transition probabilities. More...
 

Typedefs

typedef BirthDeathCacheArraypBirthDeathCacheArray
 

Functions

void square_matrix_init (struct square_matrix *matrix, int sz)
 
void square_matrix_set (struct square_matrix *matrix, int x, int y, double val)
 
void square_matrix_resize (struct square_matrix *matrix, int new_size)
 
void square_matrix_multiply (struct square_matrix *matrix, double *vector, int row_start, int row_end, int col_start, int col_end, double *result)
 
void birthdeath_cache_array_free (pBirthDeathCacheArray pbdc_array)
 
double birthdeath_likelihood_with_s_c (int s, int c, double branchlength, double lambda, double mu, struct chooseln_cache *cache)
 Calculates the probability of transitioning from root_family_size to family_size. More...
 
struct square_matrixcompute_birthdeath_rates (double branchlength, double lambda, double mu, int maxFamilysize)
 
struct square_matrixbirthdeath_cache_get_matrix (pBirthDeathCacheArray pbdc_array, double branchlength, double lambda, double mu)
 
void thread_run (int numthreads, void *(*run)(void *), void *param, int size)
 
double birthdeath_rate_with_log_alpha (int s, int c, double log_alpha, double coeff, struct chooseln_cache *cache)
 
void birthdeath_cache_resize (pBirthDeathCacheArray pbdc_array, int remaxFamilysize)
 
pBirthDeathCacheArray birthdeath_cache_init (int size, struct chooseln_cache *ln_cache)
 

Typedef Documentation

Function Documentation

void birthdeath_cache_array_free ( pBirthDeathCacheArray  pbdc_array)
struct square_matrix* birthdeath_cache_get_matrix ( pBirthDeathCacheArray  pbdc_array,
double  branchlength,
double  lambda,
double  mu 
)

Returns square matrix of doubles, rows and columns representing the transition probability in birthdeath rate in a change of one family size to another, with the given values of branch length, lambda, and mu

pBirthDeathCacheArray birthdeath_cache_init ( int  size,
struct chooseln_cache ln_cache 
)
void birthdeath_cache_resize ( pBirthDeathCacheArray  pbdc_array,
int  remaxFamilysize 
)
double birthdeath_likelihood_with_s_c ( int  root_family_size,
int  family_size,
double  branchlength,
double  lambda,
double  mu,
struct chooseln_cache cache 
)

Calculates the probability of transitioning from root_family_size to family_size.

Given the branch length and the expected change rate lammbda

double birthdeath_rate_with_log_alpha ( int  s,
int  c,
double  log_alpha,
double  coeff,
struct chooseln_cache cache 
)
struct square_matrix* compute_birthdeath_rates ( double  branchlength,
double  lambda,
double  mu,
int  maxFamilysize 
)

returns a structure representing a matrix of precalculated transition probabilites from one family size to another, given the specified values of branch length, lambda, and mu. Values are calculated from 0 to the given maxFamilySize. All relevant values are stored in the structure.

lambda is the probability of both gene gain and loss per gene per unit time in the phylogeny [CAFE assumes that gene birth and death are equally probable, see Hahn et al. (2005)]. If mu is provided, lambda and mu represent the probability of gene birth and gene death, respectively.

void square_matrix_init ( struct square_matrix matrix,
int  sz 
)
void square_matrix_multiply ( struct square_matrix matrix,
double *  vector,
int  row_start,
int  row_end,
int  col_start,
int  col_end,
double *  result 
)
void square_matrix_resize ( struct square_matrix matrix,
int  new_size 
)
void square_matrix_set ( struct square_matrix matrix,
int  x,
int  y,
double  val 
)
void thread_run ( int  numthreads,
void *(*)(void *)  run,
void *  param,
int  size 
)