Skip to content

Commit

Permalink
Bugfix for the CIGAR out of bounds issue in correct/features.cpp.
Browse files Browse the repository at this point in the history
  • Loading branch information
John Stone committed Jul 30, 2024
1 parent 187baab commit 9b5ba45
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dorado/correct/features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,10 @@ std::tuple<at::Tensor, at::Tensor> get_features_for_window(
qseq = utils::reverse_complement(qseq);
std::reverse(qqual.begin(), qqual.end());
}
int cigar_len = overlap.cigar_end_idx - overlap.cigar_start_idx + 1;
int cigar_end = std::min((int)cigar.size(), cigar_len);

const int cigar_len_total = static_cast<int>(std::size(cigar));
const int cigar_len = overlap.cigar_end_idx - overlap.cigar_start_idx + 1;
const int cigar_end = std::min(cigar_len_total - overlap.cigar_start_idx, cigar_len);

uint8_t gap = fwd ? '*' : '#';

Expand Down

0 comments on commit 9b5ba45

Please sign in to comment.