minimap2 icon indicating copy to clipboard operation
minimap2 copied to clipboard

Non-existent reference file in mappy causes segfault

Open marcus1487 opened this issue 5 years ago • 1 comments

I have just come across this behavior testing out mappy on a genome file that I had accidentally moved. mappy.Aligner is able to initialize with a non-existent file, but any operation (aside from the map function) on that alignment object causes a segmentation fault (seq or seq_names).

It would be nice if the Aligner object raised a python error on a non-existent file, but raising a catchable error for the seq and seq_names functions would be useful as well.

The following code reproduces this error (assuming foo.fasta does not exist):

>> import mappy
>> aligner = mappy.aligner('foo.fasta')
>> aligner.seq_names
Segmentation fault: 11

marcus1487 avatar May 29 '19 13:05 marcus1487

Could you check if 03dc8d5 fixes the issue? Also note that you can

a = mp.Aligner(fn)
if not a: raise Exception("bla")

to test if an index is present.

lh3 avatar Jun 07 '19 13:06 lh3