forked from diepthihoang/mpboot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphylonode.h
More file actions
176 lines (142 loc) · 3.65 KB
/
phylonode.h
File metadata and controls
176 lines (142 loc) · 3.65 KB
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
//
// C++ Interface: phylonode
//
// Description:
//
//
// Author: BUI Quang Minh, Steffen Klaere, Arndt von Haeseler <minh.bui@univie.ac.at>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef PHYLONODE_H
#define PHYLONODE_H
#include "node.h"
typedef short int UBYTE;
/**
A neighbor in a phylogenetic tree
@author BUI Quang Minh, Steffen Klaere, Arndt von Haeseler <minh.bui@univie.ac.at>
*/
class PhyloNeighbor : public Neighbor {
friend class PhyloNode;
friend class PhyloTree;
friend class IQTree;
friend class PhyloSuperTree;
public:
friend class TinaTree;
friend class PhyloSuperTreePlen;
friend class ParsTree; // DTH ##############
/**
construct class with a node and length @param anode the other end of the branch
@param alength length of branch
*/
PhyloNeighbor(Node *anode, double alength) : Neighbor(anode, alength) {
partial_lh = NULL;
partial_lh_computed = 0;
lh_scale_factor = 0.0;
partial_pars = NULL;
}
/**
construct class with a node and length
@param anode the other end of the branch
@param alength length of branch
@param aid branch ID
*/
PhyloNeighbor(Node *anode, double alength, int aid) : Neighbor(anode, alength, aid) {
partial_lh = NULL;
partial_lh_computed = 0;
lh_scale_factor = 0.0;
partial_pars = NULL;
}
/**
tell that the partial likelihood vector is not computed
*/
inline void clearPartialLh() {
partial_lh_computed = 0;
}
/**
* tell that the partial likelihood vector is computed
*/
inline void unclearPartialLh() {
partial_lh_computed = 1;
}
/**
clear all partial likelihood recursively in forward direction
@param dad dad of this neighbor
*/
void clearForwardPartialLh(Node *dad);
private:
/**
true if the partial likelihood was computed
*/
int partial_lh_computed;
/**
vector containing the partial likelihoods
*/
double *partial_lh;
/**
likelihood scaling factor
*/
double lh_scale_factor;
/**
vector containing number of scaling events per pattern // NEW!
*/
UBYTE *scale_num;
/**
vector containing the partial parsimony scores
*/
UINT *partial_pars;
};
/**
A node in a phylogenetic tree
@author BUI Quang Minh, Steffen Klaere, Arndt von Haeseler <minh.bui@univie.ac.at>
*/
class PhyloNode : public Node {
friend class PhyloTree;
public:
/**
constructor
*/
PhyloNode();
/**
constructor
@param aid id of this node
*/
PhyloNode(int aid);
/**
constructor
@param aid id of this node
@param aname name of this node
*/
PhyloNode(int aid, int aname);
/**
constructor
@param aid id of this node
@param aname name of this node
*/
PhyloNode(int aid, const char *aname);
/**
initialization
*/
void init();
/**
add a neighbor
@param node the neighbor node
@param length branch length
@param id branch ID
*/
virtual void addNeighbor(Node *node, double length, int id = -1);
/**
tell that all partial likelihood vectors below this node are not computed
*/
void clearAllPartialLh(PhyloNode *dad);
/**
tell that all partial likelihood vectors (in reverse direction) below this node are not computed
*/
void clearReversePartialLh(PhyloNode *dad);
};
/**
Node vector
*/
typedef vector<PhyloNode*> PhyloNodeVector;
#endif