Skip to content

Commit

Permalink
fix: seq len underflow
Browse files Browse the repository at this point in the history
  • Loading branch information
leejoey0921 committed Aug 13, 2024
1 parent ffb0561 commit ef2ebe9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/prefiltering/UngappedAlignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void UngappedAlignment::scoreDiagonalAndUpdateHits(const char * queryProfile,
// hack to avoid too long sequences
// this sequences will be processed by computeLongScore later
seqs[seqIdx].seq = (unsigned char *) tmp.first;
seqs[seqIdx].seqLen = 1;
seqs[seqIdx].seqLen = 0;
seqs[seqIdx].id = seqIdx;
}else{
seqs[seqIdx].seq = (unsigned char *) tmp.first;
Expand All @@ -276,7 +276,7 @@ void UngappedAlignment::scoreDiagonalAndUpdateHits(const char * queryProfile,
unsigned int minSeqLen = std::min(targetMaxLen - minDistToDiagonal, queryLen);
for(size_t i = 0; i < DIAGONALBINSIZE; i++) {
tmpSeqs[i] = seqs[i].seq + minDistToDiagonal;
seqLength[i] = std::min(seqs[i].seqLen - minDistToDiagonal, minSeqLen);
seqLength[i] = (seqs[i].seqLen == 0) ? 0 : std::min(seqs[i].seqLen - minDistToDiagonal, minSeqLen);
}
unrolledDiagonalScoring<Sequence::PROFILE_AA_SIZE + 1>(queryProfile, seqLength,
tmpSeqs, score_arr);
Expand All @@ -286,7 +286,7 @@ void UngappedAlignment::scoreDiagonalAndUpdateHits(const char * queryProfile,
for(size_t hitIdx = 0; hitIdx < hitSize; hitIdx++){
hits[seqs[hitIdx].id]->count = static_cast<unsigned char>(std::min(static_cast<unsigned int>(255),
score_arr[hitIdx]));
if(seqs[hitIdx].seqLen == 1){
if(seqs[hitIdx].seqLen == 0){
std::pair<const unsigned char *, const unsigned int> dbSeq = sequenceLookup->getSequence(hits[hitIdx]->id);
if(dbSeq.second >= 32768){
int max = computeLongScore(queryProfile, queryLen, dbSeq, diagonal);
Expand Down

0 comments on commit ef2ebe9

Please sign in to comment.