Skip to content

Commit 4d11c1a

Browse files
committed
more code for dp cell
1 parent 11d4a1b commit 4d11c1a

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

src/alignment/de_cell.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
#include "./dp_cell.hpp"
22

3+
// MARK: scores
4+
5+
const int64_t match_score = 1;
6+
const int64_t mismatch_score = -2;
7+
const int64_t opening_gap_score = -5;
8+
const int64_t gap_extension_score = -1;
9+
10+
// MARK: private methods
11+
12+
void dp_cell::score_s(const dp_cell& cell_s) {
13+
throw std::runtime_error("not implemented");
14+
}
15+
16+
void dp_cell::score_d(const dp_cell& cell_d) {
17+
throw std::runtime_error("not implemented");
18+
}
19+
20+
void dp_cell::score_i(const dp_cell& cell_i) {
21+
throw std::runtime_error("not implemented");
22+
}
23+
324
// MARK: public methods
425

526
dp_cell::dp_cell() :
@@ -11,6 +32,9 @@ dp_cell::dp_cell() :
1132
m_i_matches(0) {
1233
}
1334

35+
dp_cell::~dp_cell() {
36+
}
37+
1438
int64_t dp_cell::get_max_score(void) const {
1539
return std::max(this->m_s_score, std::max(this->m_d_score, this->m_i_score));
1640
}
@@ -26,7 +50,9 @@ int32_t dp_cell::get_max_score_matches(void) const {
2650
}
2751

2852
void dp_cell::score_cell(const dp_cell& cell_s, const dp_cell& cell_d, const dp_cell& cell_i) {
29-
throw std::runtime_error("not implemented");
53+
this->score_s(cell_s);
54+
this->score_d(cell_d);
55+
this->score_i(cell_i);
3056
}
3157

3258
void dp_cell::reset_cell(void) {

src/alignment/dp_cell.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
#include <algorithm>
66
#include <stdexcept>
77

8+
extern const int64_t match_score;
9+
extern const int64_t mismatch_score;
10+
extern const int64_t opening_gap_score;
11+
extern const int64_t gap_extension_score;
12+
813
class dp_cell {
914
private:
1015
int64_t m_s_score;
@@ -14,8 +19,13 @@ class dp_cell {
1419
int32_t m_s_matches;
1520
int32_t m_d_matches;
1621
int32_t m_i_matches;
22+
23+
void score_s(const dp_cell& cell_s);
24+
void score_d(const dp_cell& cell_d);
25+
void score_i(const dp_cell& cell_i);
1726
public:
1827
dp_cell();
28+
~dp_cell();
1929
int64_t get_max_score(void) const;
2030
int32_t get_max_score_matches(void) const;
2131
void score_cell(const dp_cell&, const dp_cell&, const dp_cell&);

0 commit comments

Comments
 (0)