Skip to content

Commit 2b70735

Browse files
committed
Fix _rare_ crash when placing reads in abnormally short tigs.
1 parent 679a0ea commit 2b70735

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/bogart/AS_BAT_PlaceReadUsingOverlaps.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ placeRead_fromOverlaps(TigVector &tigs,
124124
if (ovl[oo].b_hang > 0)
125125
bposlen -= ovl[oo].b_hang;
126126

127-
if (bposlen < 0) {
127+
if (bposlen <= 0) {
128128
writeLog("WARNING: read %u overlap to read %u in tig %u at %d-%d - hangs %d %d to large for placement, ignoring overlap\n",
129129
ovl[oo].a_iid,
130130
ovl[oo].b_iid,

src/bogart/AS_BAT_Unitig.C

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,10 @@ Unitig::overlapConsistentWithTig(double deviations,
390390
int32 nBelow = 0;
391391
int32 nAbove = 0;
392392

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

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

0 commit comments

Comments
 (0)