Skip to content

Commit

Permalink
Fix crash with tiny alignments and fix incorrect check for circulariz…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
skoren committed Nov 13, 2020
1 parent ab08d0c commit 4b8448f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/bogart/AS_BAT_FindCircular.C
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,15 @@ findCircularContigs(TigVector &tigs,
ufNode *fRead = tig->firstBackboneRead();
ufNode *lRead = tig->lastBackboneRead();

bool invert = (fRead->position.isForward() != lRead->position.isForward());
uint32 circularLength = 0;
uint32 ovlLen = 0;
BAToverlap *ovl = OC->getOverlaps(lRead->ident, ovlLen);

for (uint32 oo=0; oo<ovlLen; oo++) {
if ((ovl[oo].b_iid == fRead->ident) &&
(((lRead->position.isForward() == true) && (ovl[oo].AEndIs3prime() == true)) ||
((lRead->position.isForward() == false) && (ovl[oo].AEndIs5prime() == true))))
(((lRead->position.isForward() == true) && (ovl[oo].AEndIs3prime() == true) && (ovl[oo].flipped == invert)) ||
((lRead->position.isForward() == false) && (ovl[oo].AEndIs5prime() == true) && (ovl[oo].flipped == invert))))

// Circular!
circularLength = RI->overlapLength(lRead->ident, fRead->ident, ovl[oo].a_hang, ovl[oo].b_hang);
Expand Down
7 changes: 4 additions & 3 deletions src/utgcns/unitigConsensus.C
Original file line number Diff line number Diff line change
Expand Up @@ -1352,9 +1352,10 @@ unitigConsensus::trimCircular(void) {
align.alignDovetail(bases, length, length-trylen, length, // A: the end of the tig
bases, length, 0, trylen, false); // B: the start of the tig

if ((align.errorRate() < 0.05) && // "Found" if the error rate is reasonable, and
(align.bgnA() > length - trylen) && // A has unaligned stuff at the start, and
(align.endB() < trylen)) // B has unaligned stuff at the end.
if ((align.errorRate() < 0.05) && // "Found" if the error rate is reasonable, and
(align.alignmentLength() >= _minOverlap) && // and length is reasonable
(align.bgnA() > length - trylen) && // A has unaligned stuff at the start, and
(align.endB() < trylen)) // B has unaligned stuff at the end.
found = true;

if ((found == false) && (showPlacement()))
Expand Down

0 comments on commit 4b8448f

Please sign in to comment.