zqfang / GSEApy

Gene Set Enrichment Analysis in Python
http://gseapy.rtfd.io/
BSD 3-Clause "New" or "Revised" License
545 stars 113 forks source link

ssgsea function cause "Invalid IHDR data" error #108

Closed afukada-cloud closed 2 years ago

afukada-cloud commented 3 years ago

Setup

I am reporting a problem with GSEApy version, Python version, and operating system as follows:

import sys; print(sys.version)
import platform; print(platform.python_implementation()); print(platform.platform())
import gseapy; print(gseapy.__version__)

(Please copy and run the above in your Python, and copy-and-paste the output)

>>> import sys; print(sys.version)
3.7.7 (default, May  7 2020, 21:25:33) 
[GCC 7.3.0]
>>> import platform; print(platform.python_implementation()); print(platform.platform())
CPython
Linux-5.3.0-51-generic-x86_64-with-debian-buster-sid
>>> import gseapy; print(gseapy.__version__)
0.10.2

Expected behaviour

(Please fill this in) When I use ssgsea function with the library "KEGG_2016" gene set, I got the error of . Actually I also try other gene set, but all gene set couldn't work.

Actual behaviour

(Please fill this in, and provide any exception message in full) The error message as follows:

libpng warning: Image width exceeds user limit in IHDR
libpng error: Invalid IHDR data
Traceback (most recent call last):
  File "GSEA_calculator.py", line 76, in <module>
    verbose=False
  File "/home/hyw/anaconda3/envs/experiment/lib/python3.7/site-packages/gseapy/gsea.py", line 1009, in ssgsea
    ss.run()
  File "/home/hyw/anaconda3/envs/experiment/lib/python3.7/site-packages/gseapy/gsea.py", line 655, in run
    self.runSamples(df=normdat, gmt=gmt)
  File "/home/hyw/anaconda3/envs/experiment/lib/python3.7/site-packages/gseapy/gsea.py", line 771, in runSamples
    figsize=self.figsize, ofname=outfile)
  File "/home/hyw/anaconda3/envs/experiment/lib/python3.7/site-packages/gseapy/plot.py", line 342, in gseaplot
    g.savefig()
  File "/home/hyw/anaconda3/envs/experiment/lib/python3.7/site-packages/gseapy/plot.py", line 317, in savefig
    self._canvas.print_figure(self.ofname, bbox_inches=bbox_inches, dpi=300)
  File "/home/hyw/anaconda3/envs/experiment/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2065, in print_figure
    **kwargs)
  File "/home/hyw/anaconda3/envs/experiment/lib/python3.7/site-packages/matplotlib/backends/backend_pdf.py", line 2506, in print_pdf
    file.finalize()
  File "/home/hyw/anaconda3/envs/experiment/lib/python3.7/site-packages/matplotlib/backends/backend_pdf.py", line 585, in finalize
    self.writeImages()
  File "/home/hyw/anaconda3/envs/experiment/lib/python3.7/site-packages/matplotlib/backends/backend_pdf.py", line 1407, in writeImages
    ob.id, smaskObject)
  File "/home/hyw/anaconda3/envs/experiment/lib/python3.7/site-packages/matplotlib/backends/backend_pdf.py", line 1393, in _writeImg
    self._writePng(data)
  File "/home/hyw/anaconda3/envs/experiment/lib/python3.7/site-packages/matplotlib/backends/backend_pdf.py", line 1348, in _writePng
    _png.write_png(data, buffer)
RuntimeError: libpng signaled error

Steps to reproduce

(Please fill this in) The script look like this:

#!/usr/bin/env python3
# -*- coding:UTF-8 -*-

import pandas as pd
import gseapy as gp

gct_file = "GENE.new.gct"

gct_data = pd.read_table(gct_file, header=0, index_col=0)
print(gct_data.columns)

ssgsea_result = gp.ssgsea(
  data=gct_data,
  gene_sets="KEGG_2016",
  outdir="ssGSEA_by_pygsea",
  sample_norm_method="log_rank",
  min_size=10,
  max_size=500,
  permutation_num=0,
  weighted_score_type=0.25,
  scale=True,
  ascending=False,
  processes=8,
  figsize=[6, 6],
  format="pdf",
  graph_num=50,
  no_plot=False,
  seed=None,
  verbose=False
)

Dose anyone also have this problem?

zqfang commented 3 years ago

It looks like the figure size is not good enough. You could try to set no_plot=True first.

afukada-cloud commented 3 years ago

Yes, I try no_plot=True to avoid the error. But I want to generate the plot. So is this a bug of subsea function?

zqfang commented 3 years ago

Well, it is a bug. I'll see what I could do.

zqfang commented 3 years ago

I could not fixed it yet. If you don't mind sharing the input file, I would find the problem very quick

afukada-cloud commented 3 years ago

Hi,

As attachment.

Any other question please inform me.

Thanks.

Min-Kung Hsu

Zhuoqing Fang <notifications@github.com mailto:notifications@github.com> 於 2021年1月13日 上午10:34 寫道:

I could not fixed it yet. If you don't mind sharing the input file, I would find the problem very quick

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zqfang/GSEApy/issues/108#issuecomment-759163903, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANUGTWWXFWHM46KSN6LV4J3SZUBC7ANCNFSM4UHV6FQA.