Skip to content

Commit

Permalink
fix bug that caused bed12 blocks from -split with BAMs having M,N,I,M…
Browse files Browse the repository at this point in the history
… operations. Thx to @mbroad1
  • Loading branch information
arq5x committed Mar 9, 2024
1 parent 705ccfd commit 6213eeb
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/utils/BlockedIntervals/BlockedIntervals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ void GetBamBlocks(const BamAlignment &bam,
if (!breakOnDeletionOps)
blockLength += cigItr->Length;
else {
bedBlocks.push_back( BED(chrom, currPosition, currPosition + blockLength,
bam.Name, ToString(bam.MapQuality), strand) );
if (blockLength > 0)
{
bedBlocks.push_back( BED(chrom, currPosition, currPosition + blockLength,
bam.Name, ToString(bam.MapQuality), strand) );
}
currPosition += cigItr->Length + blockLength;
blockLength = 0;
}
Expand All @@ -51,8 +54,11 @@ void GetBamBlocks(const BamAlignment &bam,
if (!breakOnSkipOps)
blockLength += cigItr->Length;
else {
bedBlocks.push_back( BED(chrom, currPosition, currPosition + blockLength,
bam.Name, ToString(bam.MapQuality), strand) );
if (blockLength > 0)
{
bedBlocks.push_back( BED(chrom, currPosition, currPosition + blockLength,
bam.Name, ToString(bam.MapQuality), strand) );
}
currPosition += cigItr->Length + blockLength;
blockLength = 0;
}
Expand Down

0 comments on commit 6213eeb

Please sign in to comment.