diff --git a/src/utils/BlockedIntervals/BlockedIntervals.cpp b/src/utils/BlockedIntervals/BlockedIntervals.cpp index 589020e68..e8d03e127 100644 --- a/src/utils/BlockedIntervals/BlockedIntervals.cpp +++ b/src/utils/BlockedIntervals/BlockedIntervals.cpp @@ -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; } @@ -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; }