-
Notifications
You must be signed in to change notification settings - Fork 3
/
modeldna.h
106 lines (90 loc) · 3.6 KB
/
modeldna.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
/***************************************************************************
* Copyright (C) 2009 by BUI Quang Minh *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef MODELDNA_H
#define MODELDNA_H
#include "gtrmodel.h"
#include <string>
/**
All DNA models are managed here
@author BUI Quang Minh <[email protected]>
*/
class ModelDNA : public GTRModel
{
public:
/**
constructor
@param tree associated tree for the model
*/
ModelDNA(PhyloTree *tree, bool count_rates = true);
/**
constructor
@param model_name model name, e.g., JC, HKY.
@param freq state frequency type
@param tree associated phylogenetic tree
*/
ModelDNA(const char *model_name, string model_params, StateFreqType freq, string freq_params, PhyloTree *tree, bool count_rates = true);
/**
initialization, called automatically by the constructor, no need to call it
@param model_name model name, e.g., JC, HKY.
@param freq state frequency type
*/
virtual void init(const char *model_name, string model_params, StateFreqType freq, string freq_params);
/**
Read the rate parameters from a comma-separated string
It will throw error messages if failed
@param in input stream
*/
virtual void readRates(string str) throw(const char*);
/**
set the substitution rate parameters by a specification
@param rate_spec a string of six letters describing how rates are related
@return TRUE if successful, FALSE otherwise
*/
bool setRateType(const char *rate_spec);
/**
return the number of dimensions
*/
virtual int getNDim();
/**
write parameters, used with modeltest
@param out output stream
*/
virtual void writeParameters(ostream &out);
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
*/
virtual void getVariables(double *variables);
/**
rate parameter specification, a string of 6 characters
*/
string param_spec;
/** vector of boolean, TRUE if corresponding parameter is fixed and FALSE otherwise */
vector<bool> param_fixed;
};
#endif