Skip to content

Commit

Permalink
Fix _rare_ crash when placing reads in abnormally short tigs.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianwalenz committed Jun 28, 2021
1 parent 679a0ea commit 2b70735
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bogart/AS_BAT_PlaceReadUsingOverlaps.C
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ placeRead_fromOverlaps(TigVector &tigs,
if (ovl[oo].b_hang > 0)
bposlen -= ovl[oo].b_hang;

if (bposlen < 0) {
if (bposlen <= 0) {
writeLog("WARNING: read %u overlap to read %u in tig %u at %d-%d - hangs %d %d to large for placement, ignoring overlap\n",
ovl[oo].a_iid,
ovl[oo].b_iid,
Expand Down
7 changes: 4 additions & 3 deletions src/bogart/AS_BAT_Unitig.C
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,10 @@ Unitig::overlapConsistentWithTig(double deviations,
int32 nBelow = 0;
int32 nAbove = 0;

assert(bgn < end);
assert(bgn < getLength());
assert(end <= getLength());
if ((bgn >= end) || // If the read placement is garbage,
(bgn >= getLength()) || // the placement is not consistent!
(end > getLength())) // (used to just assert on these,
return(1.0); // and they almost never occur)

// If this is a singleton tig - we should only be here when finding graph edges to repeats -
// we've got nothing to go on, so default to 'consistent'.
Expand Down

0 comments on commit 2b70735

Please sign in to comment.