Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consensus Modules #6

Open
nmank opened this issue Jun 27, 2022 · 13 comments
Open

Consensus Modules #6

nmank opened this issue Jun 27, 2022 · 13 comments

Comments

@nmank
Copy link

nmank commented Jun 27, 2022

Hello,

I really like your PyWGCNA! I'm interested in using it for some of my research.

I've been looking around what you currently have on git and I can't seem to find a 'detect consensus modules' function. Specifically, I'm looking for the Python equivalent of blockwiseConsensusModule.

Specifically, I'd like to repeat some of the analysis that was done in Eigengene networks for studying the relationships between co-expression modules by Langfelder and Horvath.

Did I miss something? Is there a way for me to detect consensus modules with what you already have? If not, will you be implementing anything like that soon?

Thanks,
Nate

@nargesr
Copy link
Member

nargesr commented Jun 27, 2022

Hi,

I'm glad that you found PyWGCNA package useful!

yeah, I don't implement the blockwiseConsensusModule function but I definitely will add it in the next release. you may find some of the blockwiseConsensusModule function's outputs already in the object but I will add the function ASAP.

Meanwhile, can you give me an example of what type of output are you looking for? i.e if you are interested in presenting the output as a plot, please send me the type of output you're interested in, so I can add that as well

@nmank
Copy link
Author

nmank commented Jun 27, 2022

Hi,

Thanks for your incredibly fast response!

I'm looking for a method that will plot the hierarchical clustering diagram like this:
Screen Shot 2022-06-27 at 3 50 25 PM

I also would like to know the genes in each consensus module. So that could be a dictionary with module color as a key and a list of genes as the value or something of that sort.

I really just need to be able to do consensus module detection and to list the genes in each module.

Thanks,
Nate

@nargesr
Copy link
Member

nargesr commented Jun 28, 2022

So all the information you need to plot this is already saved in the object!

the module color is saved as a column moduleColors in the PyWGCNA.datExpr.var along with other gene information

The information you need for the dendrogram is saved in the PyWGCNA. geneTree. you can use scipy.cluster.hierarchy.dendrogram function to plot dendrogram

@nmank
Copy link
Author

nmank commented Jun 28, 2022

Hooray! Thanks for the info. I'll keep my eye out for the next release.

I'll certainly have more questions about using PyWGCNA and I'll reach out as they come up.

@wangjiawen2013
Copy link

+1

@wangjiawen2013
Copy link

It seems that the dendrogram in python is different from that in R WGCNA, perhaps WGCNA used pvclust, and there is no equivalent python package.
https://github.com/shimo-lab/pvclust

@wangjiawen2013
Copy link

wangjiawen2013 commented Apr 7, 2023

Indeed, we need such a plot to see the modules straightforwardly.
Besides it's better to add colors on the bottom of the module-trait heatmap. May be it's best to transpose it, making it the same as the following figure which I copied from R version WGCNA.
image

@nargesr
Copy link
Member

nargesr commented Apr 8, 2023

Hi,

About blockwiseConsensusModule, all the information you need is already calculated there!
The module color is saved as a column moduleColors in the PyWGCNA.datExpr.var along with other gene information
The information you need for the dendrogram is saved in the PyWGCNA.geneTree. you can use scipy.cluster.hierarchy.dendrogram function to plot the dendrogram

The module trait-relationship heatmap is one of the outputs of the analyseWGCNA() function. If you want to change it based on what you prefer you can grab the information you need (PyWGCNA.moduleTraitCor, PyWGCNA.moduleTraitPvalue) and plot the way you like it. I will add one single function to plot the module trait-relationship heatmap in the next release but if you want to add the annotation to the heatmap you have to write your own code

@wangjiawen2013
Copy link

wangjiawen2013 commented Apr 10, 2023

scipy.cluster.hierarchy.dendrogram don't support the plot that R-version WGCNA used, It will become very crowd when there are lots of genes, while it's clear in R-version WGCNA. could you recommend another package ?
R-C

176041870-dbb3f5b8-3a2d-4239-9400-3e1bb41a46c0

@wangjiawen2013
Copy link

And, do you konw how to generate this plot (copied from R version WGCNA, https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/FemaleLiver-05-Visualization.pdf ?
image

@nargesr
Copy link
Member

nargesr commented Apr 11, 2023

Hi @wangjiawen2013,

I'll look into it to see if there are any other packages out there for the dendrogram plot.
for the other plot, you can use seaborn.clustermap however not sure how good the dendrogram will be

@wangjiawen2013
Copy link

I can reproduce the clustermap exactly now. But the dendrogram in python looks different from that in R version WGCNA. Though the dendrogram are in virtual the same one, they have a different visualization style, R dendrogram plot is more clear.

@nargesr
Copy link
Member

nargesr commented Apr 12, 2023

plotly also have a function to do that
not sure if it's better than the other one or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants