StochHMM
v0.34
Flexible Hidden Markov Model C++ Library and Application
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
alignment.h
Go to the documentation of this file.
1
//
2
// alignment.h
3
// StochHMM
4
//
5
// Created by Paul Lott on 5/18/12.
6
// Copyright (c) 2012 University of California, Davis. All rights reserved.
7
//
8
9
#ifndef StochHMM_alignment_h
10
#define StochHMM_alignment_h
11
12
#include <iostream>
13
#include <vector>
14
#include <string>
15
#include <map>
16
#include <algorithm>
17
#include <stdint.h>
18
#include "
track.h
"
19
#include "
sequence.h
"
20
#include "seqTools.h"
21
22
namespace
StochHMM {
23
24
enum
tracebackDirection
{
NONE
,
DIAGONAL
,
LEFT
,
UP
};
25
enum
alignment_type
{
cGlobal
,
cLocal
,
cGlocal
};
26
27
28
class
cell
{
29
public
:
30
cell
();
31
inline
void
setTraceback
(
tracebackDirection
dir){
traceback
= dir;}
32
inline
void
setScore
(
double
value){
score
=value;}
33
inline
void
setDiag
(
double
value){
scores
[0]=value;}
34
inline
void
setLeft
(
double
value){
scores
[1]=value;}
35
inline
void
setUp
(
double
value){
scores
[2]=value;}
36
inline
double
getScore
(){
return
score
;}
37
inline
tracebackDirection
getTraceback
(){
return
traceback
;}
38
private
:
39
tracebackDirection
traceback
;
40
double
score
;
41
std::vector<double>
scores
;
//(DIAGONAL, LEFT, UP)
42
};
43
44
typedef
std::vector<std::vector<double> >
mmMatrix
;
45
46
class
alignment
{
47
public
:
48
alignment
();
49
50
51
double
align
(
alignment_type
typ);
52
double
align
(
sequence
&
target
,
sequence
&
query
,
alignment_type
typ);
53
double
align
(
sequence
& target,
sequence
& query,
alignment_type
typ,
double
match,
double
mismatch,
double
gap
,
double
gapext);
54
double
align
(
sequence
& target,
sequence
& query,
alignment_type
typ,
const
mmMatrix
&,
double
gap,
double
gapext);
55
56
double
calcLambda
(std::vector<double>&);
57
double
estimateLambda
();
58
double
calc_pvalue
();
59
60
void
setMatrix
(
mmMatrix
&);
61
void
setMatch
(
double
);
62
void
setMismatch
(
double
);
63
64
inline
void
setGap
(
double
value){gap = value;}
65
inline
void
setGapExt
(
double
value){
gap_ext
= value;}
66
67
void
setTarget
(
sequence
&);
68
void
setQuery
(
sequence
&);
69
70
inline
int
getHighScore
(){
return
high_score
;}
71
72
inline
size_t
getAlignmentSize
(){
73
if
(
end_position
!=0)
return
end_position
-
start_position
+1;
74
return
0;
75
}
76
77
78
std::string
getAlignment
();
79
void
printAlignment
();
80
81
void
printTrellis
();
82
83
std::string
traceback
();
84
std::string
stochasticTraceback
();
85
86
private
:
87
88
sequence
*
target
;
89
sequence
*
query
;
90
91
track
*
tr
;
92
93
std::vector<std::vector<cell> >*
trellis
;
94
std::vector<std::vector<double> >*
mMatrix
;
95
96
double
gap
;
97
double
gap_ext
;
98
99
double
high_score
;
100
size_t
start_position
;
101
size_t
end_position
;
102
103
void
_reset
();
104
void
_resetSeqs
();
105
double
_getGapScore
(
size_t
,
size_t
,
tracebackDirection
);
106
void
_initTrellis
(
size_t
,
size_t
);
107
108
};
109
110
}
111
112
113
114
#endif
Generated on Tue Jul 30 2013 13:23:11 for StochHMM by
1.8.1