smorabit / hdWGCNA

High dimensional weighted gene co-expression network analysis
https://smorabit.github.io/hdWGCNA/
Other
316 stars 31 forks source link

Question about color of modules in volcano plots #194

Open DelongZHOU opened 5 months ago

DelongZHOU commented 5 months ago

Hello,

I'm a bit confused about how color is used in the volcano plots vs in PlotKMEs and other plots

In some of my volcano plots all the modules retain their color, regardless if the pval of comparison; while other plots all modules are grey. Is there a meaningful difference in these two color regime?

Thank you!

smorabit commented 5 months ago

Hi,

Can you provide some more details, the code that you ran and the plots that were generated? What is the expected result vs the actual result etc.

DelongZHOU commented 5 months ago

My script follows your basic tutorial and Differential module eigengene (DME) analysis. It first sets up the seurat object, then loop over the cell types with a function.

The codes I used to generate the volcano plot is as following:

group1 <- seurat_obj@meta.data %>% subset(subtype == celltype & condition == 'ctrl') %>% rownames group2 <- seurat_obj@meta.data %>% subset(subtype == celltype & condition == 'treatment') %>% rownames DMEs <- FindDMEs( seurat_obj, barcodes1 = group1, barcodes2 = group2, test.use='wilcox', wgcna_name='' ) p<-PlotDMEsVolcano( seurat_obj, DMEs, wgcna_name = 'project1' )

color no_color

but the figures generated in the basic tuto is colored code:

p <- PlotKMEs(seurat_obj, ncol=3) kme

smorabit commented 5 months ago

Looks like a bug to me, each point in the volcano plot should be colored based on the module's color. Can you reproduce this behavior with the tutorial dataset? I have not personally encountered this. There might be a problem with your code though, it looks like you didn't specify the same wgcna_name for both the FindDMEs function and the PlotDMEsVolcano function.

DMEs <- FindDMEs(
seurat_obj,
barcodes1 = group1,
barcodes2 = group2,
test.use='wilcox',
wgcna_name=''
)
p<-PlotDMEsVolcano(
seurat_obj,
DMEs,
wgcna_name = 'project1'
)
DelongZHOU commented 4 months ago

Hi Sam,

The wgcna name part is because I was trying to remove information relative to my project. The code I ran use the correct name.

For the tutorial dataset, the KME, lollipop and volcano plot are consistant: creation: https://smorabit.github.io/hdWGCNA/articles/basic_tutorial.html diff eigen: https://smorabit.github.io/hdWGCNA/articles/differential_MEs.html

tuto plotkme inh lollipop inh volcano

The lollipop and volcano plots are using the color from the KME plot.

A few minute issues I noticed: (1) in my case the M13 module is assigned very pale blue and is almost invisible (2) the wgcna is named "tutorial" in the creation but in the DME is a different name (3) same with the rds name (4) in the DME tutorial, right before you introduce the volcano plot, the spelling of the lollipop function contains a typo (should be uppercase L here) image

BTW can I assume no "real" module is assigned grey, i.e. once a module is created after the dendrogram it should get a color other than grey?

dyinboisry4u commented 3 months ago

@DelongZHOU FindDMEs() will create a new assay to reuse Seurat::FindMarkers(). In your case, L6_CT-M2 is illegal for Seurat(underscores ('_')), which cause PlotDMEsVolcano() receive wrong module names.

DelongZHOU commented 2 months ago

@DelongZHOU FindDMEs() will create a new assay to reuse Seurat::FindMarkers(). In your case, L6_CT-M2 is illegal for Seurat(underscores ('_')), which cause PlotDMEsVolcano() receive wrong module names.

Heh this seems indeed to be the case. All my other modules with underscore in their name also failed to get the color while those without underscore are fine.