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
214 stars 52 forks source link

calculate Gene Significance #72

Open bsb2014 opened 1 year ago

bsb2014 commented 1 year ago

Hi, Narges 1) is there any way to extract the data used for the module-trait plotting?

2) How to extract genes with their MM and GS scores in each module?

Thanks!

nargesr commented 1 year ago

Hi @bsb2014

  1. you can extract the correlation using self. moduleTraitCor and corresponding p-value from self. moduleTraitPvalue.

  2. can you explain more about what you mean by MM and GS scores?

best, Narges

bsb2014 commented 1 year ago

Thanks for your prompt response.

GS : Gene Significance MM: Module Membership

bsb2014 commented 1 year ago

Hi Narges

I am a newbie in Python, could you please give me more help with the self.moduleTraitCor/self.moduleTraitPvalue?

I tried the codes below

pyWGCNA_ASM1 = PyWGCNA.readWGCNA("ASM.p") pyWGCNA_ASM1.self. moduleTraitCor.head(5)

and got an error saying [AttributeError: 'WGCNA' object has no attribute 'self']

Thanks

nargesr commented 1 year ago

for module membership, you can use this function called: CalculateSignedKME()

Unfortunately, I didn’t implement the GS yet, if you know how to calculate it and you can send it to me as a function I would be happy to add it to the PyWGCNA.

self would be the name of your object which in your case is pyWGCNA_ASM1, so your code would be something like that:

pyWGCNA_ASM1 = PyWGCNA.readWGCNA("ASM.p")
pyWGCNA_ASM1.moduleTraitCor.head(5)
bsb2014 commented 1 year ago

Here is an R method (https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/FemaleLiver-03-relateModsToExt.pdf)

nargesr commented 1 year ago

I need it as a Python function if you want to add it to the package.

SgtVil commented 2 months ago

Dear Narges,

We are also looking for GS and MM calculation. I see that you set that issue as enhancement, do you have any function to perform that ?

In addition, is there a way to export the model to R ? It would be nice to be able to export some parts of your tool to R to use all the functions from WGCNA.

Thx for all the work

Best

Rémy

nargesr commented 2 months ago

Hi @SgtVil

For module membership, you can use this function called: CalculateSignedKME()

Right now I don't have any plan to add new features unless somebody provides the body of the function and I'm happy to review it and add it to the package.

about your second question, if you look at WGCNA API, you can grab any table you want and save it as a CSV table and read it again in the R. I tried to use the same name as the reference, so you should be able to find the value you are looking for.