Skip to content

Commit

Permalink
fix parsing reads with 'X' or '=' instead of 'M' in cigar
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilong-Li committed Nov 17, 2024
1 parent c95a7dd commit a275cb2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions STITCH/src/bam_access.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ int get_read_span(std::vector<int> cigarLengthVec, std::vector<std::string> ciga
for(std::size_t iM=0; iM < cigarLengthVec.size(); iM++) {
cigarLength = cigarLengthVec[iM];
cigarType = cigarTypeVec[iM];
// keep if it is an M or a D. basically,
if((cigarType == "M") | (cigarType == "D")) {
readLength = readLength + cigarLength;
}
// keep if it is an M or D. basically,
// keep X and = as well
if((cigarType == "M") || (cigarType == "D") || (cigarType == "=") || (cigarType == "X")) {
readLength = readLength + cigarLength;
}
}
return readLength;
}
Expand Down Expand Up @@ -303,7 +304,7 @@ std::tuple<std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int
cigarLength = cigarLengthVec[iM];
cigarType = cigarTypeVec[iM];
// if its an M - scan
if(cigarType == "M") {
if(cigarType == "M" || cigarType == "=" || cigarType == "X") {
x1 = refPosition + refOffset; // left part of M
x2 = refPosition + refOffset + cigarLength-1; // right part of M
// determine whether that snps is spanned by the read
Expand Down

0 comments on commit a275cb2

Please sign in to comment.