File: modelsblock.h

package info (click to toggle)
iqtree 2.0.7%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 14,620 kB
  • sloc: cpp: 142,571; ansic: 57,789; sh: 275; python: 242; makefile: 95
file content (74 lines) | stat: -rw-r--r-- 1,380 bytes parent folder | download | duplicates (3)
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
/*
 * modelsblock.h
 *
 *  Created on: Jan 9, 2015
 *      Author: minh
 */

#ifndef MODELSBLOCK_H_
#define MODELSBLOCK_H_

#include "ncl/ncl.h"
#include "utils/tools.h"

const int NM_ATOMIC  = 1; // NxsModel is not mixture or +G etc. model
const int NM_FREQ    = 2;   // NxsModel contains state frequency
const int NM_PROTEIN = 4;   // NxsModel contains emprical protein model

class NxsModel {
public:
	/* model name */
	string name;

	/* model description */
	string description;

	/* flag as NM_ATOMIC or NM_FREQ or both */
	int flag;

    NxsModel() {
        flag = 0;
    }

    NxsModel(string name) {
        this->name = name;
        flag = 0;
    }

	virtual ~NxsModel() {}
};

/**
 * Class to parse MODELS block in NEXUS file
 */
class ModelsBlock: public NxsBlock, public unordered_map<string, NxsModel> {
public:
	/** constructor */
	ModelsBlock();
	/** destructor */
	virtual ~ModelsBlock();

    /**
        @param name model name
        @return pointer to model with the name or NULL if not found
    */
	NxsModel *findModel(string name);

    /**
        @param name model name
        @return pointer to a mixed model with the name or NULL if not found
    */
	NxsModel *findMixModel(string name);


protected:

	/**
		main method to read block from file
		@param token a token reader
	*/
	virtual void Read(NxsToken &token);

};

#endif /* MODELSBLOCK_H_ */