Menu

#23 make-consensus: Assert failure in Overlap_Align

open
nobody
None
5
2014-08-18
2012-08-03
Tom Skelly
No

Running make-consensus from AMOS v2.0.8 (plus a few vendor-supplied
mods), I encountered an assert failure in Overlap_Align in
Align/align.cc:

make-consensus: align.cc:5731: void Overlap_Align(const char*, int, const char*, int, int, int, int, int, int, int, Alignment_t&): Assertion `t_lo <= t_hi' failed.

(gdb) where
#0 0x00007ffff731aed5 in raise () from /lib/libc.so.6
#1 0x00007ffff731c3f3 in abort () from /lib/libc.so.6
#2 0x00007ffff7313dc9 in __assert_fail () from /lib/libc.so.6
#3 0x0000000000421b8c in Overlap_Align ()
#4 0x0000000000422409 in Multi_Alignment_t::Reset_From_Votes ()
#5 0x0000000000425f5b in Multi_Align ()
#6 0x000000000040b2ff in main ()

Input values to Overlap_Align turned out to be bogus, due to problems
earlier on. In align.cc, the routine Multi_Align creates a
Multi_Alignment_t and calls its Reset_From_Votes method repeatedly to
process it. At the end of Reset_From_Votes there is a short loop which
loops through the 'align' vector adjusting the b_lo and b_hi indexes
of each entry. Occasionally an alignment may be empty, however, where
empty is defined as b_lo = b_hi = 0. Empty alignments are ignored in
the main loop of Reset_From_Votes -- but not here. Adjusting the b_lo
and b_hi of an empty alignment makes it non-empty, and specifically
makes b_lo < 0, which leads to grief when Reset_From_Votes is called
on the next iteration.

Here is a patch against v3.1.0 which just adds a check that the
alignment is non-empty before adjusting its indices:

--- /nfs/users/nfs_t/ts6/scr/align.cc 2011-07-25 00:27:26.000000000 +0100
+++ /nfs/users/nfs_t/ts6/scr/align-patched.cc 2012-08-03 19:21:59.053243000 +0100
@@ -2122,8 +2122,11 @@ void Multi_Alignment_t :: Reset_From_Vo
consensus . erase (0, min_b_lo);
for (i = 0; i < n; i ++)
{
- align [i] . b_lo -= min_b_lo;
- align [i] . b_hi -= min_b_lo;
+ if (! align [i] . Is_Empty ())
+ {
+ align [i] . b_lo -= min_b_lo;
+ align [i] . b_hi -= min_b_lo;
+ }
}
}

Discussion


Log in to post a comment.