forked from iqtree/iqtree2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodeldnaerror.h
125 lines (97 loc) · 3.04 KB
/
modeldnaerror.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//
// modeldnaerror.hpp
// model
//
// Created by Minh Bui on 26/6/20.
//
#ifndef modeldnaerror_hpp
#define modeldnaerror_hpp
#include "modeldna.h"
/**
DNA models with sequecing error
@author BUI Quang Minh <[email protected]>
*/
class ModelDNAError : public ModelDNA
{
public:
/**
constructor
@param tree associated tree for the model
*/
ModelDNAError(PhyloTree *tree);
/**
constructor
@param model_name model name, e.g., JC, HKY.
@param freq state frequency type
@param tree associated phylogenetic tree
*/
ModelDNAError(const char *model_name, string model_params, StateFreqType freq, string freq_params, string seqerr, PhyloTree *tree);
/**
start structure for checkpointing
*/
virtual void startCheckpoint();
/**
save object into the checkpoint
*/
virtual void saveCheckpoint();
/**
restore object from the checkpoint
*/
virtual void restoreCheckpoint();
/**
* @return model name
*/
virtual string getName();
/**
* @return model name with parameters in form of e.g. GTR{a,b,c,d,e,f}
*/
virtual string getNameParams(bool show_fixed_params = false);
/**
write information
@param out output stream
*/
virtual void writeInfo(ostream &out);
/**
return the number of dimensions
*/
virtual int getNDim();
/**
* setup the bounds for joint optimization with BFGS
*/
virtual void setBounds(double *lower_bound, double *upper_bound, bool *bound_check);
/** compute the tip likelihood vector of a state for Felsenstein's pruning algorithm
@param state character state
@param[out] state_lk state likehood vector of size num_states
*/
virtual void computeTipLikelihood(PML::StateType state, double *state_lk);
/**
* @return TRUE if this is a DNA error model, FALSE otherwise
*/
virtual bool containDNAerror() { return true; }
/**
* get the dna error probability, by default error probability = 0
*/
virtual double getDNAErrProb(int mixture_index = 0) { return epsilon; }
protected:
/**
this function is served for the multi-dimension optimization. It should pack the model parameters
into a vector that is index from 1 (NOTE: not from 0)
@param variables (OUT) vector of variables, indexed from 1
*/
virtual void setVariables(double *variables);
/**
this function is served for the multi-dimension optimization. It should assign the model parameters
from a vector of variables that is index from 1 (NOTE: not from 0)
@param variables vector of variables, indexed from 1
@return TRUE if parameters are changed, FALSE otherwise (2015-10-20)
*/
virtual bool getVariables(double *variables);
private:
/** sequencing error */
double epsilon;
/** true to fix epsilon */
bool fix_epsilon;
/** error model name */
string seqerr_name;
};
#endif /* modeldnaerror_hpp */