arvestad / alv

A console-based alignment viewer
GNU General Public License v3.0
107 stars 13 forks source link

AssertionError due to insufficient margins #16

Open jakobnissen opened 3 years ago

jakobnissen commented 3 years ago

At least I think. I have a large-ish alignment with some sequences having quite long names. Running alv aln.fna works, but alv aln.fna | less results in:

Traceback (most recent call last):
  File "/Users/jakobnissen/miniconda3/bin/alv", line 250, in <module>
    main()
  File "/Users/jakobnissen/miniconda3/bin/alv", line 228, in main
    terminal.output_alignment(alignment, painter, args.width, args.dotted)
  File "/Users/jakobnissen/miniconda3/lib/python3.8/site-packages/alv/alignmentterminal.py", line 93, in output_alignment
    self._setup_left_margin(al, chosen_accessions)
  File "/Users/jakobnissen/miniconda3/lib/python3.8/site-packages/alv/alignmentterminal.py", line 75, in _setup_left_margin
    assert self.left_margin < self.width - 10
AssertionError
arvestad commented 3 years ago

Hi Jakob! Thanks for the bug report. And sorry for the late reply --- it seems github issues have been sent to my spam folder.

What happens here is that there is no or almost no space for the actual sequence. I did not think that would occur, but left the assert for catching possible edge cases. What would be a good solution for when this is happening?

There is the option -aa that you could try. Maybe a version of this would be a good automatic workaround?

arvestad commented 3 years ago

Actually, I realise now that I did not read your bug report properly. I will have another look.

arvestad commented 3 years ago

It would help me if you could share some sample data that triggers this error, because I can't replicate the bug as you report it. Finding other problems, however...

jakobnissen commented 3 years ago

I hate to break it to you, but I created a terminal alignment viewer myself in the meantime :) Check it out, it's pretty neat! https://github.com/jakobnissen/alen I'll try to find a minimal example to trigger the bug when I'm back from holiday.

jakobnissen commented 3 years ago

This FASTA file breaks it on my computer:

>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
a