bcftools icon indicating copy to clipboard operation
bcftools copied to clipboard

plot-roh.py - SystemError: tile cannot extend outside image

Open thedam opened this issue 3 years ago • 1 comments

Hey, after executing plot-roh.py inputs/ I get error:

plot-roh.py inputs/
/usr/local/bin/plot-roh.py:432: UserWarning: Attempting to set identical left == right == 0 results in singular transformations; automatically expanding.
  ax1.set_xlim(min_x,max_x+xlim*max_x)
Traceback (most recent call last):
  File "/home/damian/anaconda3/envs/aimed4/lib/python3.9/site-packages/PIL/ImageFile.py", line 506, in _save
    fh = fp.fileno()
AttributeError: '_idat' object has no attribute 'fileno'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/plot-roh.py", line 450, in <module>
    plt.savefig(file,dpi=dpi)
  File "/home/damian/anaconda3/envs/aimed4/lib/python3.9/site-packages/matplotlib/pyplot.py", line 859, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/home/damian/anaconda3/envs/aimed4/lib/python3.9/site-packages/matplotlib/figure.py", line 2311, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/damian/anaconda3/envs/aimed4/lib/python3.9/site-packages/matplotlib/backend_bases.py", line 2210, in print_figure
    result = print_method(
  File "/home/damian/anaconda3/envs/aimed4/lib/python3.9/site-packages/matplotlib/backend_bases.py", line 1639, in wrapper
    return func(*args, **kwargs)
  File "/home/damian/anaconda3/envs/aimed4/lib/python3.9/site-packages/matplotlib/backends/backend_agg.py", line 510, in print_png
    mpl.image.imsave(
  File "/home/damian/anaconda3/envs/aimed4/lib/python3.9/site-packages/matplotlib/image.py", line 1611, in imsave
    image.save(fname, **pil_kwargs)
  File "/home/damian/anaconda3/envs/aimed4/lib/python3.9/site-packages/PIL/Image.py", line 2158, in save
    save_handler(self, fp, filename)
  File "/home/damian/anaconda3/envs/aimed4/lib/python3.9/site-packages/PIL/PngImagePlugin.py", line 1284, in _save
    ImageFile._save(im, _idat(fp, chunk), [("zip", (0, 0) + im.size, 0, rawmode)])
  File "/home/damian/anaconda3/envs/aimed4/lib/python3.9/site-packages/PIL/ImageFile.py", line 514, in _save
    e.setimage(im.im, b)
SystemError: tile cannot extend outside image

in the inputs/ folder I have such bcftools roh outputs: roh3.txt.gz roh2.txt.gz roh1.txt.gz

Cheers!

thedam avatar Sep 08 '22 16:09 thedam

I am not sure what's causing this, the error comes deep from inside matplotlib. Any matplolib experts out there?

pd3 avatar Sep 10 '22 14:09 pd3

The plot-roh.py script needs GT tags to work and your roh files do not have any.

plot-roh.py organises its collection of data around GT entries. When it does not have them then none of the plotting data in matplotlib is set (or is set to zero). With no data set then an error is thrown when the script attempts to create an image.

The first exception is a warning about setting invalid data (all zeros) and the second is the create image failure.

Did you create the files using run-roh.pl?

whitwham avatar Oct 24 '22 11:10 whitwham