CAFE
Computational Analysis of gene Family Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
family.h
Go to the documentation of this file.
1 #ifndef __FAMILIY_H__
2 #define __FAMILIY_H__
3 
4 #include<tree.h>
5 #include<birthdeath.h>
6 #include "input_values.h"
7 
8 #define FAMILYSIZEMAX 1000
9 
10 typedef struct {
11  int min;
12  int max;
13  int root_min;
14  int root_max;
16 
17 typedef struct
18 {
21  double lambda;
22  double mu;
24  int k;
26  int rfsize;
27 }CafeTree;
29 
30 
31 typedef struct
32 {
34  int fromdiff;
35  int todiff;
37  double** errormatrix;
40 
42 {
43  double lambda;
44  double mu;
45  double* param_lambdas;
46  double* param_mus;
47 };
48 
49 void free_probabilities(struct probabilities *probs);
50 
54 typedef struct
55 {
57  double** k_likelihoods;
58  double* likelihoods;
59  int* viterbi;
60 
66  int familysize;
67 
68 
69  struct probabilities birth_death_probabilities;
70 
77 }CafeNode;
79 
80 
88 typedef struct
89 {
90  char** species;
92  int* index;
94  int max_size;
97  int** countbackup;
98 }CafeFamily;
100 
101 void init_family_size(family_size_range* fs, int max);
103 
104 typedef struct tagCafeParam CafeParam;
106 typedef void (*param_func)(pCafeParam param, double* parameters);
108 void cafe_shell_set_lambdas(pCafeParam param, double* lambda);
109 
116 {
117  FILE *fout, *flog;
119 
122 
125 
126  int eqbg;
128 
130  double* ML;
131 
133  double* MAP;
134 
136  double* prior_rfsize;
137 
139 
141 
143 
144  double* lambda;
147 
148  double* mu;
149  int num_mus;
150 
152  double* k_weights;
153  double** p_z_membership;
155 
161 
163 
164  int* root_dist;
165 
166  double pvalue;
167 
169 
171 
172  int quiet;
173 };
174 
175 
176 /****************************************************************************
177  * Cafe Main
178 ****************************************************************************/
179 
180 extern void thread_run_with_arraylist(int numthreads, void* (*run)(void*), pArrayList pal );
181 // cafe tree
182 extern void cafe_tree_set_birthdeath(pCafeTree pcafe, int max_family_size);
183 #endif
void(* param_func)(pCafeParam param, double *parameters)
Definition: family.h:106
input_values input
Definition: family.h:138
Tree super
Definition: family.h:19
int posterior
Definition: family.h:127
int num_params
Definition: family.h:140
Definition: family.h:107
double ** k_likelihoods
Definition: family.h:57
int max
Definition: family.h:12
Definition: family.h:107
CafeParam * pCafeParam
Definition: family.h:105
int todiff
Definition: family.h:35
int * index
indices of the species into the matching CafeTree that was loaded by the user
Definition: family.h:92
int branch_params_cnt
Definition: family.h:23
int * viterbi
Definition: family.h:59
pTree lambda_tree
Definition: family.h:145
int num_mus
Definition: family.h:149
int parameterized_k_value
Definition: family.h:151
void init_family_size(family_size_range *fs, int max)
Definition: cafe_family.c:412
int max_size
Definition: family.h:94
int num_threads
Definition: family.h:168
ErrorStruct * pErrorStruct
Definition: family.h:39
CafeFamily * pCafeFamily
Definition: family.h:99
char ** species
Names (ID's) of the species loaded into the family.
Definition: family.h:90
double lambda
Definition: family.h:21
Definition: family.h:41
pArrayList k_bd
Definition: family.h:75
Definition: utils_string.h:9
int num_branches
Definition: family.h:160
Definition: birthdeath.h:8
int size_of_factor
Definition: family.h:25
int * old_branchlength
Definition: family.h:157
pString str_fdata
Definition: family.h:118
CafeTree * pCafeTree
Definition: family.h:28
double * likelihoods
Definition: family.h:58
void thread_run_with_arraylist(int numthreads, void *(*run)(void *), pArrayList pal)
Definition: cafe_main.c:82
double pvalue
Definition: family.h:166
int fromdiff
Definition: family.h:34
FILE * fout
Definition: family.h:117
struct square_matrix * birthdeath_matrix
Definition: family.h:74
double * k_weights
Definition: family.h:152
int eqbg
Definition: family.h:126
FILE * flog
Definition: family.h:117
char * errorfilename
Definition: family.h:33
Definition: family.h:10
double * lambda
Definition: family.h:144
family_size_range range
Definition: family.h:20
int num_species
Total number of species loaded.
Definition: family.h:91
int quiet
Definition: family.h:172
int root_max
Definition: family.h:14
double * param_lambdas
Definition: family.h:45
CafeNode * pCafeNode
Definition: family.h:78
family_size_range family_size
Definition: family.h:162
Definition: family.h:107
int k
Definition: family.h:24
double sum_branch_length
Definition: family.h:159
pErrorStruct errormodel
Definition: family.h:76
Definition: family.h:54
Definition: family.h:107
int maxfamilysize
Definition: family.h:36
pCafeFamily pfamily
family information stored when the user calls the "load" command
Definition: family.h:124
int ** countbackup
space to store the real counts while simulating error
Definition: family.h:97
PhylogenyNode super
Definition: family.h:56
void copy_range_to_tree(pCafeTree tree, family_size_range *range)
Definition: cafe_main.c:52
double * param_mus
Definition: family.h:46
pCafeTree pcafe
tree information stored when the user calls the "tree" command
Definition: family.h:121
int num_lambdas
Definition: family.h:146
Definition: input_values.h:2
Definition: family.h:31
double mu
Definition: family.h:22
int fixcluster0
Definition: family.h:154
double max_branch_length
Definition: family.h:158
double ** likelihoodRatios
Definition: family.h:170
Singleton structure that holds all of the global data that Cafe acts on.
Definition: family.h:115
int root_min
Definition: family.h:13
int checkconv
Definition: family.h:156
enum OPTIMIZER_INIT_TYPE optimizer_init_type
Definition: family.h:142
int rfsize
Definition: family.h:26
Definition: utils.h:12
double * ML
Max Likelihood - Initialized by the "load" command with the number of families in the table...
Definition: family.h:130
int familysize
Definition: family.h:66
double * mu
Definition: family.h:148
Definition: tree.h:11
pErrorStruct * error_ptr
array of ErrorStruct pointers in the same order as species. the pointers point to errors[]...
Definition: family.h:93
pArrayList errors
list of actual ErrorStruct instances
Definition: family.h:96
double mu
Definition: family.h:44
double lambda
Definition: family.h:43
void cafe_shell_set_lambdas(pCafeParam param, double *lambda)
Definition: cafe_shell.c:31
double * MAP
root size condition with max likelihood for each family - Initialized by the "load" command with the ...
Definition: family.h:133
double ** p_z_membership
Definition: family.h:153
double * prior_rfsize
prior is a poisson distribution on the root size based on leaves' size
Definition: family.h:136
Structure representing a matrix of values of family sizes.
Definition: family.h:88
Definition: family.h:17
double ** errormatrix
Definition: family.h:37
int min
Definition: family.h:11
pArrayList flist
family sizes
Definition: family.h:95
int * root_dist
Definition: family.h:164
Definition: tree.h:66
void cafe_tree_set_birthdeath(pCafeTree pcafe, int max_family_size)
Definition: cafe_tree.c:514
void free_probabilities(struct probabilities *probs)
Definition: cafe_tree.c:337
OPTIMIZER_INIT_TYPE
Definition: family.h:107