1 /***************************************************************************
2  *   Copyright (C) 2009 by BUI Quang Minh   *
3  *   minh.bui@univie.ac.at   *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20 #include "modelbin.h"
21 
ModelBIN(const char * model_name,string model_params,StateFreqType freq,string freq_params,PhyloTree * tree)22 ModelBIN::ModelBIN(const char *model_name, string model_params, StateFreqType freq, string freq_params, PhyloTree *tree)
23 : ModelMarkov(tree)
24 {
25 	init(model_name, model_params, freq, freq_params);
26 }
27 
init(const char * model_name,string model_params,StateFreqType freq,string freq_params)28 void ModelBIN::init(const char *model_name, string model_params, StateFreqType freq, string freq_params)
29 {
30 	ASSERT(num_states == 2); // make sure that you create model for Binary data
31 	StateFreqType def_freq = FREQ_UNKNOWN;
32 	name = model_name;
33 	full_name = model_name;
34 	if (name == "JC2") {
35 		freq = FREQ_EQUAL;
36 	} else if (name == "GTR2") {
37 		freq = FREQ_ESTIMATE;
38 	} else {
39 		readParameters(model_name);
40 	}
41 	if (freq == FREQ_UNKNOWN || def_freq == FREQ_EQUAL) freq = def_freq;
42 	ModelMarkov::init(freq);
43 }
44 
startCheckpoint()45 void ModelBIN::startCheckpoint() {
46     checkpoint->startStruct("ModelBIN");
47 }
48