moshi4/pyMSAviz

Too large pixels for large protein alignment

Closed this issue · 1 comments

Hi, @moshi4

Thank you for bring this awseome tool. I am trying to visualize single gene protein alignments with 282 samples. But pyMSAviz failed with this error. The command line was stucked long time pymsaviz -i AT5G61270_1.aln.fa -o AT5G61270_1.aln.png --color_scheme Identity.

However, it could easily showd by alv (https://github.com/arvestad/alv)

image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/ebio/abt6_projects/AtGraph/conda/env/lib/python3.10/site-packages/pymsaviz/msaviz.py", line 465, in savefig
    fig = self.plotfig(dpi=dpi)
  File "/ebio/abt6_projects/AtGraph/conda/env/lib/python3.10/site-packages/pymsaviz/msaviz.py", line 419, in plotfig
    fig.tight_layout()
  File "/ebio/abt6/zbao/.local/lib/python3.10/site-packages/matplotlib/figure.py", line 3540, in tight_layout
    engine.execute(self)
  File "/ebio/abt6/zbao/.local/lib/python3.10/site-packages/matplotlib/layout_engine.py", line 181, in execute
    renderer = fig._get_renderer()
  File "/ebio/abt6/zbao/.local/lib/python3.10/site-packages/matplotlib/figure.py", line 2754, in _get_renderer
    return self.canvas.get_renderer()
  File "/ebio/abt6/zbao/.local/lib/python3.10/site-packages/matplotlib/backends/backend_agg.py", line 398, in get_renderer
    self.renderer = RendererAgg(w, h, self.figure.dpi)
  File "/ebio/abt6/zbao/.local/lib/python3.10/site-packages/matplotlib/backends/backend_agg.py", line 70, in __init__
    self._renderer = _RendererAgg(int(width), int(height), dpi)
ValueError: Image size of 1120x131040 pixels is too large. It must be less than 2^16 in each direction.

If you want to test, I could send you this alignment by email.

The error occurs because matplotlib has a limit on the number of pixels that can be plotted.
I think the visibility of a large MSA figure by pyMSAviz is poor, so I would suggest that you avoid plotting with pyMSAviz.

It may be possible to plot your example if you lower the DPI below 100.