Skip to content

failing debug assertion in compute_ts_equal_cost_ranges #193

Description

@jeeeesper

I stumbled upon a weird behaviour in lib_tsalign version 3.0.0. To reproduce, run the following:

//        [-- 10 --][-- 11 ---]1
let r = b"AAAAAAAAAACCCCCCCCCCCC";
let q = b"AAAAAAAAAATTTTTTTTTTTC";

let mut tsa = Aligner::<DnaAlphabetOrN>::default();

let mut costs = TemplateSwitchConfig::default();
costs.base_cost.qrr = 4u64.into();
tsa.set_costs(costs.clone());
let _tsa_res = tsa.align("ref", r, "qry", q, None, None, None, false);

This crashes during TS equal cost range extension from a debug assertion:

thread '::tests::compute_cost_shenanigans' (68464) panicked at <...>/lib_tsalign-3.0.0/src/a_star_aligner/alignment_result.rs:445:17:
assertion `left == right` failed
  left: U64Cost(18446744073709551615)
 right: U64Cost(4)
stack backtrace:
	...
   4: lib_tsalign::a_star_aligner::alignment_result::AlignmentResult<lib_tsalign::a_star_aligner::template_switch_distance::alignment_type::AlignmentType,Cost>::compute_ts_equal_cost_ranges
             at <...>/lib_tsalign-3.0.0/src/a_star_aligner/alignment_result.rs:445:17
   5: lib_tsalign::a_star_aligner::template_switch_distance_a_star_align
             at <...>/lib_tsalign-3.0.0/src/a_star_aligner.rs:252:12
	...

The failing assertion reads
debug_assert_eq!(current_cost, (statistics.cost.round().raw() as u64).into());

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions