#include "cafe.h"#include <stdlib.h>#include <math.h>#include <stdio.h>#include <pthread.h>#include <mathfunc.h>#include <memalloc.h>#include <utils.h>Data Structures | |
| struct | LRTParam |
Typedefs | |
| typedef LRTParam * | pLRTParam |
Functions | |
| void | cafe_log (pCafeParam param, const char *msg,...) |
| Logs the message and parameters in a standard way. More... | |
| void | cafe_free_birthdeath_cache (pCafeTree pcafe) |
| void | copy_range_to_tree (pCafeTree tree, family_size_range *range) |
| void | thread_run (int numthreads, void *(*run)(void *), void *param, int size) |
| void | thread_run_with_arraylist (int numthreads, void *(*run)(void *), pArrayList pal) |
| void | cafe_lambda_set_default (pCafeParam param, double *lambda) |
| void | show_sizes (FILE *f, pCafeTree pcafe, family_size_range *range, pCafeFamilyItem pitem, int i) |
| void | input_values_randomize (input_values *vals, int lambda_len, int mu_len, int k, int kfix, double max_branch_length, double *k_weights) |
| double | cafe_get_clustered_posterior (pCafeParam param, double *ML, double *MAP, double *prior_rfsize) |
| double | __lnLGamma (double *palphabeta, void *data) |
| double | __cafe_cluster_lambda_search (double *parameters, void *args) |
| void | reset_birthdeath_cache (pCafeTree tree, int k_value, family_size_range *range) |
| double | __cafe_each_best_lambda_search (double *plambda, void *args) |
| double * | cafe_each_best_lambda_by_fminsearch (pCafeParam param, int lambda_len) |
| void * | __cafe_likelihood_ratio_test_thread_func (pLRTParam plrt) |
| void | cafe_likelihood_ratio_test (pCafeParam param, double *maximumPvalues) |
Variables | |
| pBirthDeathCacheArray | probability_cache = NULL |
| struct chooseln_cache | cache |
| A cache of values of chooseln. More... | |
| int | chooseln_cache_size |
| pthread_mutex_t | mutex_cafe_likelihood = PTHREAD_MUTEX_INITIALIZER |
| double __cafe_cluster_lambda_search | ( | double * | parameters, |
| void * | args | ||
| ) |
| double __cafe_each_best_lambda_search | ( | double * | plambda, |
| void * | args | ||
| ) |
| void* __cafe_likelihood_ratio_test_thread_func | ( | pLRTParam | plrt | ) |
| double __lnLGamma | ( | double * | palphabeta, |
| void * | data | ||
| ) |
| double* cafe_each_best_lambda_by_fminsearch | ( | pCafeParam | param, |
| int | lambda_len | ||
| ) |
| void cafe_free_birthdeath_cache | ( | pCafeTree | pcafe | ) |
| double cafe_get_clustered_posterior | ( | pCafeParam | param, |
| double * | ML, | ||
| double * | MAP, | ||
| double * | prior_rfsize | ||
| ) |
| void cafe_lambda_set_default | ( | pCafeParam | param, |
| double * | lambda | ||
| ) |
| void cafe_likelihood_ratio_test | ( | pCafeParam | param, |
| double * | maximumPvalues | ||
| ) |
| void cafe_log | ( | pCafeParam | param, |
| const char * | msg, | ||
| ... | |||
| ) |
Logs the message and parameters in a standard way.
If the user has assigned a file for logging, message is written to the file and also to stdout. The stdout write will be suppressed if the param "quiet" flag is set.
| void copy_range_to_tree | ( | pCafeTree | tree, |
| family_size_range * | range | ||
| ) |
| void input_values_randomize | ( | input_values * | vals, |
| int | lambda_len, | ||
| int | mu_len, | ||
| int | k, | ||
| int | kfix, | ||
| double | max_branch_length, | ||
| double * | k_weights | ||
| ) |
| void reset_birthdeath_cache | ( | pCafeTree | tree, |
| int | k_value, | ||
| family_size_range * | range | ||
| ) |
| void show_sizes | ( | FILE * | f, |
| pCafeTree | pcafe, | ||
| family_size_range * | range, | ||
| pCafeFamilyItem | pitem, | ||
| int | i | ||
| ) |
| void thread_run | ( | int | numthreads, |
| void *(*)(void *) | run, | ||
| void * | param, | ||
| int | size | ||
| ) |
| void thread_run_with_arraylist | ( | int | numthreads, |
| void *(*)(void *) | run, | ||
| pArrayList | pal | ||
| ) |
| 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
| int chooseln_cache_size |
| pthread_mutex_t mutex_cafe_likelihood = PTHREAD_MUTEX_INITIALIZER |
| pBirthDeathCacheArray probability_cache = NULL |
The variable cafe_param is a global singleton that holds general program state. cafe_param holds pcafe, a CafeTree, and pfamily, a CafeFamily . These are set by the user via the commands "tree" and "load" respectively. When the user calls the command "lambda" calculations are performed on the pcafe and pfamily variables.