File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -132,14 +132,16 @@ LinearMemoryAligner::~LinearMemoryAligner()
132132// refactoring: scorematrix_create should be private, called at construction time
133133auto LinearMemoryAligner::scorematrix_create (int64_t match, int64_t mismatch) -> int64_t *
134134{
135+ static constexpr auto last_row = matrix_size - 1 ; // 'N'
136+ static constexpr auto last_column = matrix_size - 1 ; // 'N'
135137 auto * newscorematrix = (int64_t *) xmalloc (matrix_size * matrix_size * sizeof (int64_t ));
136138
137139 for (auto i = 0 ; i < matrix_size; i++)
138140 {
139141 for (auto j = 0 ; j < matrix_size; j++)
140142 {
141143 int64_t value = 0 ;
142- if (opt_n_mismatch && ((i == 15 ) || (j == 15 )))
144+ if (opt_n_mismatch && ((i == last_row ) || (j == last_column )))
143145 {
144146 value = mismatch;
145147 }
@@ -715,6 +717,7 @@ auto LinearMemoryAligner::alignstats(char * cigar,
715717 int64_t * _nwmismatches,
716718 int64_t * _nwgaps) -> void
717719{
720+ static constexpr auto is_N = 15 ; // 4-bit code for 'N' or 'n'
718721 a_seq = _a_seq;
719722 b_seq = _b_seq;
720723
@@ -745,8 +748,8 @@ auto LinearMemoryAligner::alignstats(char * cigar,
745748 {
746749 nwscore += subst_score (a_pos, b_pos);
747750
748- if (opt_n_mismatch && ((chrmap_4bit[(int ) (a_seq[a_pos])] == 15 ) ||
749- (chrmap_4bit[(int ) (b_seq[b_pos])] == 15 )))
751+ if (opt_n_mismatch && ((chrmap_4bit[(int ) (a_seq[a_pos])] == is_N ) ||
752+ (chrmap_4bit[(int ) (b_seq[b_pos])] == is_N )))
750753 {
751754 nwmismatches++;
752755 }
You can’t perform that action at this time.
0 commit comments