forked from diepthihoang/mpboot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern.cpp
More file actions
52 lines (45 loc) · 1.05 KB
/
pattern.cpp
File metadata and controls
52 lines (45 loc) · 1.05 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
//
// C++ Implementation: pattern
//
// 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
//
//
#include "pattern.h"
#include "alignment.h"
Pattern::Pattern()
: string()
{
frequency = 0;
is_const = false;
}
Pattern::~Pattern()
{
}
int Pattern::computeAmbiguousChar(int num_states) {
int num = 0;
for (iterator i = begin(); i != end(); i++)
if (*i >= num_states) num++;
return num;
}
int Pattern::computeGapChar(int num_states, int STATE_UNKNOWN) {
int num = 0;
for (iterator i = begin(); i != end(); i++)
if (*i == STATE_UNKNOWN) num++;
return num;
}
void Pattern::computeConst(int STATE_UNKNOWN) {
char ch = STATE_UNKNOWN;
is_const = true;
for (iterator i = begin(); i != end(); i++) {
if (ch != STATE_UNKNOWN && *i != STATE_UNKNOWN && *i != ch) {
is_const = false;
return;
}
if (*i != STATE_UNKNOWN) ch = *i;
}
}