Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/bbuchfink/diamond
Browse files Browse the repository at this point in the history
  • Loading branch information
bbuchfink committed Oct 25, 2021
2 parents 47d24be + 2107f8f commit 2c66a0c
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/align/gapped_score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static void add_dp_targets(const WorkTarget& target, int target_idx, const Seque
if (target.hsp[frame].empty())
continue;

int d0 = INT_MAX, d1 = INT_MIN, j0 = INT_MAX, j1 = INT_MIN, bits = 0;
int d0 = INT_MAX, d1 = INT_MIN, score = 0;

for (const Hsp_traits &hsp : target.hsp[frame]) {
const int b0 = std::max(hsp.d_min - band, -(slen - 1)),
Expand All @@ -115,24 +115,23 @@ static void add_dp_targets(const WorkTarget& target, int target_idx, const Seque
if (overlap / (d1 - d0) > config.min_band_overlap || overlap / (b1 - b0) > config.min_band_overlap) {
d0 = std::min(d0, b0);
d1 = std::max(d1, b1);
j0 = std::min(j0, hsp.subject_range.begin_);
j1 = std::max(j1, hsp.subject_range.end_);
const int64_t dp_size = (int64_t)DpTarget::banded_cols(qlen, slen, d0, d1) * int64_t(d1 - d0);
bits = std::max(bits, (int)DP::BandedSwipe::bin(hsp_values, d1 - d0, 0, hsp.score, dp_size, score_width, 0));
score = std::max(score, hsp.score);
}
else {
if (d0 != INT_MAX)
dp_targets[frame][bits].emplace_back(target.seq, slen, d0, d1, target_idx, qlen, matrix);
if (d0 != INT_MAX) {
const int64_t dp_size = (int64_t)DpTarget::banded_cols(qlen, slen, d0, d1) * int64_t(d1 - d0);
const auto bin = DP::BandedSwipe::bin(hsp_values, d1 - d0, 0, score, dp_size, score_width, 0);
dp_targets[frame][bin].emplace_back(target.seq, slen, d0, d1, target_idx, qlen, matrix);
}
d0 = b0;
d1 = b1;
j0 = hsp.subject_range.begin_;
j1 = hsp.subject_range.end_;
const int64_t dp_size = (int64_t)DpTarget::banded_cols(qlen, slen, d0, d1) * int64_t(d1 - d0);
bits = (int)DP::BandedSwipe::bin(hsp_values, d1 - d0, 0, hsp.score, dp_size, score_width, 0);
score = hsp.score;
}
}

dp_targets[frame][bits].emplace_back(target.seq, slen, d0, d1, target_idx, qlen, matrix);
const int64_t dp_size = (int64_t)DpTarget::banded_cols(qlen, slen, d0, d1) * int64_t(d1 - d0);
const auto bin = DP::BandedSwipe::bin(hsp_values, d1 - d0, 0, score, dp_size, score_width, 0);
dp_targets[frame][bin].emplace_back(target.seq, slen, d0, d1, target_idx, qlen, matrix);
}
}

Expand Down

0 comments on commit 2c66a0c

Please sign in to comment.