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

Go to the source code of this file.

Data Structures

struct  CafeFamilyItem
 Represents a single gene family and the number of members of that family that exist in each species. More...
 

Macros

#define E_NOT_SYNCHRONIZED   1
 
#define E_INCONSISTENT_SIZE   2
 

Typedefs

typedef CafeFamilyItempCafeFamilyItem
 

Enumerations

enum  enumCafeReport { CAFE_REPORT_TEXT = 0, CAFE_REPORT_HTML, CAFE_REPORT_PDF }
 

Functions

pCafeTree cafe_tree_new (const char *sztree, family_size_range *range, double lambda, double mu)
 
pTreeNode cafe_tree_new_empty_node (pTree pcafe)
 
void cafe_tree_set_parameters (pCafeTree pcafe, family_size_range *range, double lambda)
 
pCafeTree cafe_tree_copy (pCafeTree psrc)
 
pCafeTree cafe_tree_split (pCafeTree pcafe, int idx)
 
void cafe_tree_free (pCafeTree pcafe)
 
void __cafe_tree_free_node (pTree ptree, pTreeNode ptnode, va_list ap)
 
void cafe_tree_string_name (pString pstr, pPhylogenyNode ptnode)
 
pString cafe_tree_string_with_lambda (pCafeTree pcafe)
 
pString cafe_tree_string_with_id (pCafeTree pcafe)
 
pString cafe_tree_string (pCafeTree pcafe)
 
pString cafe_tree_string_with_familysize_lambda (pCafeTree pcafe)
 
pString cafe_tree_string_with_familysize (pCafeTree pcafe)
 
void cafe_tree_string_print (pCafeTree pcafe)
 
void compute_internal_node_likelihood (pTree ptree, pTreeNode ptnode)
 
void compute_tree_likelihoods (pCafeTree pcafe)
 
double * get_likelihoods (const pCafeTree pcafe)
 
void cafe_tree_node_free_clustered_likelihoods (pCafeParam param)
 
double ** cafe_tree_clustered_likelihood (pCafeTree pcafe, struct chooseln_cache *ln_cache)
 
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 initialize_leaf_likelihood_clustered (pTree ptree, pTreeNode ptnode)
 
double cafe_tree_mp_remark (pString str, pTree ptree, pMetapostConfig pmc, va_list ap)
 
int cafe_tree_random_familysize (pCafeTree pcafe, int rootFamilysize, int maxFamilySize)
 
void node_set_birthdeath_matrix (pCafeNode pcnode, pBirthDeathCacheArray cache, int num_lambdas)
 Initialize node with probability values that it may need. If multiple lambdas are set, k_bd is set to an arraylist of matrices with probability values In this case, values are set up to the value of num_lambdas otherwise the value birthdeath_matrix is used probability values are drawn from the cache argument, which should hold a variety of possible values. More...
 
void add_key (pArrayList arr, double branchlength, double lambda, double mu)
 
void cafe_family_set_size (pCafeFamily pcf, pCafeFamilyItem pitem, pCafeTree pcafe)
 Copy sizes of an individual gene family into the tree. More...
 
int cafe_family_set_species_index (pCafeFamily pcf, pCafeTree pcafe)
 Synchronize a family and tree together. More...
 
int cafe_family_get_species_index (pCafeFamily pcf, char *speciesname)
 
void cafe_family_set_size_with_family (pCafeFamily pcf, int idx, pCafeTree pcafe)
 
void cafe_family_set_truesize_with_family (pCafeFamily pcf, int idx, pCafeTree pcafe)
 
void cafe_family_set_size_by_species (char *speciesname, int size, pCafeTree pcafe)
 
int cafe_family_get_index (pCafeFamily pcf, const char *szid)
 
void cafe_family_set_size_with_family_forced (pCafeFamily pcf, int idx, pCafeTree pcafe)
 
void cafe_family_filter (pCafeParam param)
 
void cafe_family_reset_maxlh (pCafeFamily pcf)
 
int cafe_family_split_cvfiles_byfamily (pCafeParam param, int cv_fold)
 
void cafe_family_split_cvfiles_byspecies (pCafeParam param)
 
void cafe_log (pCafeParam param, const char *msg,...)
 Logs the message and parameters in a standard way. More...
 
void reset_birthdeath_cache (pCafeTree tree, int k_value, family_size_range *range)
 
double * cafe_best_lambda_by_fminsearch (pCafeParam param, int lambda_len, int k)
 
double * cafe_each_best_lambda_by_fminsearch (pCafeParam param, int lambda_len)
 
void cafe_lambda_set_default (pCafeParam param, double *lambda)
 
void cafe_free_birthdeath_cache (pCafeTree pcafe)
 
void cafe_likelihood_ratio_test (pCafeParam param, double *maximumPvalues)
 
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 initialize_leaf_likelihoods_for_viterbi (double **matrix, int num_rows, int range, int familysize, int num_cols, pErrorStruct errormodel)
 Initialize matrix values according to the error model or to defaults if familysize < 0, sets the first (range) values of each row to 1, ignoring the others otherwise if errormodel is NULL, initializes all values of each row to 0 except for the one indexed by familysize, which is 1 otherwise, sets each row of matrix to the row of errormatrix indexed by familysize I doubt this function is doing what was intended. More...
 
void reset_k_likelihoods (pCafeNode pcnode, int k, int num_factors)
 
double cafe_get_clustered_posterior (pCafeParam param, double *ML, double *MAP, double *prior_rfsize)
 
int sync_sanity_check (pCafeFamily pcf, pCafeTree pcafe)
 

Macro Definition Documentation

#define E_INCONSISTENT_SIZE   2
#define E_NOT_SYNCHRONIZED   1

Typedef Documentation

Enumeration Type Documentation

Enumerator
CAFE_REPORT_TEXT 
CAFE_REPORT_HTML 
CAFE_REPORT_PDF 

Function Documentation

void __cafe_tree_free_node ( pTree  ptree,
pTreeNode  ptnode,
va_list  ap 
)
void add_key ( pArrayList  arr,
double  branchlength,
double  lambda,
double  mu 
)
double* cafe_best_lambda_by_fminsearch ( pCafeParam  param,
int  lambda_len,
int  k 
)
double* cafe_each_best_lambda_by_fminsearch ( pCafeParam  param,
int  lambda_len 
)
void cafe_family_filter ( pCafeParam  param)
int cafe_family_get_index ( pCafeFamily  pcf,
const char *  szid 
)
int cafe_family_get_species_index ( pCafeFamily  pcf,
char *  speciesname 
)
void cafe_family_reset_maxlh ( pCafeFamily  pcf)
void cafe_family_set_size ( pCafeFamily  pcf,
pCafeFamilyItem  pitem,
pCafeTree  pcafe 
)

Copy sizes of an individual gene family into the tree.

Takes the given gene family and copies the size of the family in the species into the tree node that corresponds to that species

Side effect is to set the familysize member for each node in the tree, but since that is a convenience variable it shouldn't make any difference

void cafe_family_set_size_by_species ( char *  speciesname,
int  size,
pCafeTree  pcafe 
)
void cafe_family_set_size_with_family ( pCafeFamily  pcf,
int  idx,
pCafeTree  pcafe 
)
void cafe_family_set_size_with_family_forced ( pCafeFamily  pcf,
int  idx,
pCafeTree  pcafe 
)
int cafe_family_set_species_index ( pCafeFamily  pcf,
pCafeTree  pcafe 
)

Synchronize a family and tree together.

Sets the value of index in pcf to the node index in the tree of the leaf with the matching species ID.

Returns
0 on success, or -1 if there is a species in the tree with no matching species in the family
void cafe_family_set_truesize_with_family ( pCafeFamily  pcf,
int  idx,
pCafeTree  pcafe 
)
int cafe_family_split_cvfiles_byfamily ( pCafeParam  param,
int  cv_fold 
)
void cafe_family_split_cvfiles_byspecies ( pCafeParam  param)
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.

double** cafe_tree_clustered_likelihood ( pCafeTree  pcafe,
struct chooseln_cache ln_cache 
)
void cafe_tree_clustered_viterbi ( pCafeTree  pcafe,
int  num_likelihoods 
)
pCafeTree cafe_tree_copy ( pCafeTree  psrc)
void cafe_tree_free ( pCafeTree  pcafe)
double cafe_tree_mp_remark ( pString  str,
pTree  ptree,
pMetapostConfig  pmc,
va_list  ap 
)
pCafeTree cafe_tree_new ( const char *  sztree,
family_size_range range,
double  lambda,
double  mu 
)
pTreeNode cafe_tree_new_empty_node ( pTree  pcafe)
void cafe_tree_node_free_clustered_likelihoods ( pCafeParam  param)
int cafe_tree_random_familysize ( pCafeTree  pcafe,
int  rootFamilysize,
int  maxFamilySize 
)

Sets the family size of each node to random value between 0 and the tree's pbdc_array maxFamilySize.

void cafe_tree_set_parameters ( pCafeTree  pcafe,
family_size_range range,
double  lambda 
)
pCafeTree cafe_tree_split ( pCafeTree  pcafe,
int  idx 
)
pString cafe_tree_string ( pCafeTree  pcafe)
void cafe_tree_string_name ( pString  pstr,
pPhylogenyNode  ptnode 
)
void cafe_tree_string_print ( pCafeTree  pcafe)
pString cafe_tree_string_with_familysize ( pCafeTree  pcafe)
pString cafe_tree_string_with_familysize_lambda ( pCafeTree  pcafe)
pString cafe_tree_string_with_id ( pCafeTree  pcafe)
pString cafe_tree_string_with_lambda ( pCafeTree  pcafe)
void cafe_tree_viterbi ( pCafeTree  pcafe)
void cafe_tree_viterbi_posterior ( pCafeTree  pcafe,
pCafeParam  param 
)
void compute_internal_node_likelihood ( pTree  ptree,
pTreeNode  ptnode 
)
void compute_tree_likelihoods ( pCafeTree  pcafe)
double* get_likelihoods ( const pCafeTree  pcafe)
void initialize_leaf_likelihood_clustered ( pTree  ptree,
pTreeNode  ptnode 
)
void initialize_leaf_likelihoods_for_viterbi ( double **  matrix,
int  num_rows,
int  range,
int  familysize,
int  num_cols,
pErrorStruct  errormodel 
)

Initialize matrix values according to the error model or to defaults if familysize < 0, sets the first (range) values of each row to 1, ignoring the others otherwise if errormodel is NULL, initializes all values of each row to 0 except for the one indexed by familysize, which is 1 otherwise, sets each row of matrix to the row of errormatrix indexed by familysize I doubt this function is doing what was intended.

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 node_set_birthdeath_matrix ( pCafeNode  pcnode,
pBirthDeathCacheArray  cache,
int  num_lambdas 
)

Initialize node with probability values that it may need. If multiple lambdas are set, k_bd is set to an arraylist of matrices with probability values In this case, values are set up to the value of num_lambdas otherwise the value birthdeath_matrix is used probability values are drawn from the cache argument, which should hold a variety of possible values.

void reset_birthdeath_cache ( pCafeTree  tree,
int  k_value,
family_size_range range 
)
void reset_k_likelihoods ( pCafeNode  pcnode,
int  k,
int  num_factors 
)
int sync_sanity_check ( pCafeFamily  pcf,
pCafeTree  pcafe 
)