mortazavilab / PyWGCNA

PyWGCNA is a Python package designed to do Weighted Gene Correlation Network analysis (WGCNA)
https://academic.oup.com/bioinformatics/advance-article/doi/10.1093/bioinformatics/btad415/7218311
MIT License
209 stars 48 forks source link

TypeError in analyseWGCNA #17

Closed RayRay-23 closed 1 year ago

RayRay-23 commented 1 year ago

Hi nargesr,

When I run pyWGCNA_5xFAD.analyseWGCNA(geneList=geneList), I got a TypeError: enrichr() got an unexpected keyword argument 'description'. How should I resolve this?

Thank you

nargesr commented 1 year ago

Hi, which version of PyWGCNA are you using? I believe I resolved this error in the latest version (V1.15.1)

you can install it using pip install PyWGCNA==1.15.1

RayRay-23 commented 1 year ago

Hi I check the version and it is V1.15.1. Another issue is I just find the shape of the data I downloaded is different from your description in tutorials, which should be 193, 5548 but turn out 192, 55449. The gene_id format also different from normal (ENSMUSG00000000003.15). Could you please check that if it could be the reason? Thank you so much.

nargesr commented 1 year ago

can you also check the version of gseapy package?

I'm a little confused about your next question... The gene expression data is a table which the rows are samples and columns are genes (similar to what we have in the tutorials) column names should be gene id or a gene name or anything else you want, the main thing is that it should be unique.... so it doesn't matter if it's ENSMUSG00000000003.15 or ENSMUSG00000000003 or Pbsn as long as it's unique

RayRay-23 commented 1 year ago

Hi, I also check the version of gseapy (0.14.0) and every other dependent packages. But still I get the error below:

`` pyWGCNA_5xFAD.analyseWGCNA(geneList=geneList) Analysing WGCNA... Calculating module trait relationship ... Done..

Adding (signed) eigengene-based connectivity (module membership) ... Done..

Updating gene information based on given gene list ... Done..

plotting module heatmap eigengene... Done..

plotting module barplot eigengene... Done..

doing Enrichr GO analysis for each module... Traceback (most recent call last):

File "/var/folders/92/y1bxhnw57djg_97p9x5sr2sc0000gn/T/ipykernel_50284/269853499.py", line 1, in pyWGCNA_5xFAD.analyseWGCNA(geneList=geneList)

File "/opt/anaconda3/lib/python3.9/site-packages/PyWGCNA/wgcna.py", line 441, in analyseWGCNA self.functional_enrichment_analysis(type="GO",

File "/opt/anaconda3/lib/python3.9/site-packages/PyWGCNA/wgcna.py", line 3030, in functional_enrichment_analysis enr = gp.enrichr(gene_list=geneModule,

TypeError: enrichr() got an unexpected keyword argument 'description' ``

In addition, when I try to run

`` pyWGCNA_5xFAD.CoexpressionModulePlot(modules=["darkgray"], numGenes=10, numConnections=100, minTOM=0) Traceback (most recent call last):

File "/var/folders/92/y1bxhnw57djg_97p9x5sr2sc0000gn/T/ipykernel_50284/1756115348.py", line 1, in pyWGCNA_5xFAD.CoexpressionModulePlot(modules=["darkgray"], numGenes=10, numConnections=100, minTOM=0)

File "/opt/anaconda3/lib/python3.9/site-packages/PyWGCNA/wgcna.py", line 3319, in CoexpressionModulePlot net.show(f"{self.outputPath}/figures/network/{file_name}.html")

File "/opt/anaconda3/lib/python3.9/site-packages/pyvis/network.py", line 551, in show self.write_html(name, local)

File "/opt/anaconda3/lib/python3.9/site-packages/pyvis/network.py", line 536, in write_html with open(f"{tempdir}/{name}", "w+") as out:

FileNotFoundError: [Errno 2] No such file or directory: ".//Users/Raymond/Library/CloudStorage/OneDrive-TheUniversityofQueensland/Documents/figures/network/darkgray.html" ``

Do you have any suggestions? By the way, thank you for developing this good python version and I really wish I could use it.

tyaoi commented 1 year ago

Hi !

I ended up downgrading gseapy to ver. 0.10.5 to resolve this error. The steps to do so are as follows

pip install pywgcna pip uninstall gseapy pip install pywgcna==0.10.5

However, there seems to have been an improvement in the corrected p-values in ver 0.13.0 and above, so support for 0.14.0 is desired.

RayRay-23 commented 1 year ago

Hi tyaoi,

It does work for me. Thank you so much. Just a kind reminder for others that it should be "pip install gseapy==0.10.5".

For someone who also has problems in network plotting by pyWGCNA_5xFAD.CoexpressionModulePlot, you can try to delete the "self.outputPath" in line 3319 in wgcna.py file, and the figure will be output in your current working directory. It works for me.

Many thanks Ray

nargesr commented 1 year ago

Hi!

sorry for the late respond! There is one issue with the new version of gseapy precisely the dotplot function that's why I didn't update the function yet! I will update it once that problem resolved

for CoexpressionModulePlot(), it seems there is a problem with your path {self.outputPath}/figures/network/{file_name}.html. I would recommend printing the path to make sure your path exists.

RayRay-23 commented 1 year ago

Thank you, Narges!