Skip to content

Commit

Permalink
[fix] alignment bug
Browse files Browse the repository at this point in the history
  • Loading branch information
h-2 committed Nov 17, 2023
1 parent 73f370d commit f1ebc9a
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/search_algo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,26 +911,23 @@ inline void _writeRecord(TBlastRecord & record, TLocalHolder & lH)
template <typename TBlastMatch, typename TLocalHolder>
inline void _setupAlignInfix(TBlastMatch & bm, typename TLocalHolder::TMatch const & m, TLocalHolder & lH)
{
int64_t startMod = (int64_t)m.subjStart - (int64_t)m.qryStart;
/* create bm coordinates from m coordinates */

bm.qEnd = lH.transQrySeqs[m.qryId].size();
decltype(bm.qEnd) band = _bandSize(bm.qEnd);
if (startMod >= 0)
{
bm.sStart = startMod;
bm.qStart = 0;
}
else
{
bm.sStart = 0;
bm.qStart = -startMod;
}
bm.sEnd = std::min<size_t>(bm.sStart + bm.qEnd - bm.qStart + band, lH.gH.transSbjSeqs[m.subjId].size());
// move sStart as far left as needed to cover the part of query before qryStart
bm.sStart = (m.subjStart < m.qryStart) ? 0 : m.subjStart - m.qryStart;

if (bm.sStart >= band)
bm.sStart -= band;
else
bm.sStart = 0;
/* always align full query independent of hit-region */
bm.qStart = 0;
bm.qEnd = lH.transQrySeqs[m.qryId].size();

// there is no band in computation but this value extends begin and end of Subj to account for gaps
decltype(bm.qEnd) band = _bandSize(lH.transQrySeqs[m.qryId].size());

// end on subject is beginning plus full query length plus band
bm.sEnd = std::min<size_t>(bm.sStart + lH.transQrySeqs[m.qryId].size() + band, lH.gH.transSbjSeqs[m.subjId].size());

// account for band in subj start
bm.sStart = (band < bm.sStart) ? bm.sStart - band : 0;

seqan::assignSource(bm.alignRow0, lH.transQrySeqs[m.qryId] | bio::views::slice(bm.qStart, bm.qEnd));
seqan::assignSource(bm.alignRow1, lH.gH.transSbjSeqs[m.subjId] | bio::views::slice(bm.sStart, bm.sEnd));
Expand Down

0 comments on commit f1ebc9a

Please sign in to comment.