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
192 stars 46 forks source link

calculate Gene Significance #72

Open bsb2014 opened 8 months ago

bsb2014 commented 8 months 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 8 months 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 8 months ago

Thanks for your prompt response.

GS : Gene Significance MM: Module Membership

bsb2014 commented 8 months 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 8 months 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 8 months ago

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

nargesr commented 8 months ago

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