-
Notifications
You must be signed in to change notification settings - Fork 0
/
LinkSampler.H
97 lines (79 loc) · 2.73 KB
/
LinkSampler.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
/****************************************************************
LinkSampler.H
william.majoros@duke.edu
This is open-source software, governed by the Gnu General Public License (GPL) version 3
(see www.opensource.org).
****************************************************************/
#ifndef INCL_LinkSampler_H
#define INCL_LinkSampler_H
#include <iostream>
#include "PairHMM/StatePath.H"
#include "BranchHMM.H"
#include "LinkBackward.H"
#include "BranchAttributes.H"
#include "Taxon.H"
using namespace std;
using namespace BOOM;
/****************************************************************
class LinkSampler
Provides sampling of state paths conditional on fixed sequences.
****************************************************************/
class LinkSampler
{
public:
LinkSampler(const BranchHMM &,const LinkBackward &,Taxon &parent,
Taxon &child,BranchAttributes *);
StatePath *samplePath(double &pathScore,double &oldPathScore);
private:
const BranchHMM &hmm;
const LinkBackward &B;
Taxon &parent, &child;
BranchAttributes *branch;
double computePathScore(StatePath &);
void updateCols(STATE,int &i,int &j);
};
/****************************************************************
class RootSampler
For sampling a state path conditional ONLY on the parent sequence
length (but not the sequence's residues, nor on anything about the
child, except the branch length to the child).
****************************************************************/
class RootSampler {
public:
RootSampler(const BranchHMM &,const RootBackward &,Taxon &parent,
Taxon &child,BranchAttributes *);
StatePath *samplePath(int parentLength,double &pathScore);
private:
const BranchHMM &hmm;
const RootBackward &B;
Symbol gapSymbol;
int numStates, nI, nM, nD;
Vector<STATE> QI, QM, QD;
Taxon &parent, &child;
BranchAttributes *branch;
double computePathScore(StatePath &);
void updateCol(STATE,int &i);
};
/****************************************************************
class ChildSampler
For sampling a state path conditional on a parent sequence (but
not conditional on anything about the child, except the branch
length to the child).
****************************************************************/
class ChildSampler {
public:
ChildSampler(const BranchHMM &,const ChildBackward &,Taxon &parent,
Taxon &child,BranchAttributes *);
StatePath *samplePath(double &pathScore);
private:
const BranchHMM &hmm;
const ChildBackward &B;
Symbol gapSymbol;
int numStates, nI, nM, nD;
Vector<STATE> QI, QM, QD;
Taxon &parent, &child;
BranchAttributes *branch;
double computePathScore(StatePath &);
void updateCol(STATE,int &i);
};
#endif