maf_extract_ranges_indexed fails on blocks non-unique reference
(I am Bob H, I don't seem to be able to login, otherwise I would make this change in the source code).
maf_extract_ranges_indexed fails when a maf block contains more than one line with the desired reference sequence. The failure manifests as an abort, from the range error test in coord_to_col() in align/core.py.
What happens is that the index creation program records such a block once for each time the reference species occurs in the block (recording it at different intervals). When maf_extract_ranges_indexed asks for all the blocks intersecting a given interval of interest, it (correctly) is given all such blocks. But the call to get_component_by_src() only returns the first component, and that component may not be the one that actually intersects the interval of interest.
A stopgap change is to add a test for an empty interval after slice_start and slice_end are calculated (the third line shown below):
slice_start = max( start, ref.get_forward_strand_start() ) slice_end = min( end, ref.get_forward_strand_end() ) if (slice_end <= slice_start): continue
This is not necessarily the right solution, but it does prevent the failure.