Skip to content

Should reassign_modules be set to TRUE or FALSE in ModuleConnectivity() for pseudobulk hdWGCNA? #417

@pengjiao

Description

@pengjiao

Hi, thank you for developing hdWGCNA.
I am using hdWGCNA for pseudobulk analysis, and I noticed that many genes are reassigned to different modules after running ModuleConnectivity(). Would you recommend using reassign_modules = FALSE or reassign_modules = TRUE in a pseudobulk hdWGCNA workflow?
Thank you so much.

Here is the relevant code:

obj <- readRDS("Vascu.rds")
obj <- subset(obj, subset = cogdx %in% c(1,4)) #select samples

obj <- SetupForWGCNA(
  obj,
  gene_select = "fraction",
  fraction = 0.05,
  wgcna_name = paste0(str_sub(ct,1,3), "_pseudobulk")
)

# get the counts matrix and the meta-data
X <- GetAssayData(obj, layer = "counts")
meta <- obj@meta.data

# create a pseudo-bulk SummarizedExperiment object
se <- AggregatePseudobulk(
  X, meta,
  replicate_col = "individualID",
  group_col = "cell_type",
  assay_name = "counts"
)

# normalize the pseudobulk SummarizedExperiment
se <- NormalizeCounts(
  se,
  method = "VST",
  assay_name = "counts"
)

# Set the pseudobulk matrix using the SummarizedExperiment object
obj <- SetDatExpr(
  obj,
  mat = se,
  layer = "VST"
)

# select the soft power threshold
obj <- TestSoftPowers(obj) #soft_power = 9
p <- PlotSoftPowers(obj)
cowplot::plot_grid(plotlist = p)

# construct the co-expression network and identify gene modules
obj <- ConstructNetwork(obj, tom_name = paste0(str_sub(ct,1,3), "_test1_pseudobulk"),)

PlotDendrogram(obj, main="after ConstructNetwork")

obj1 <- ModuleEigengenes(obj)
PlotDendrogram(obj1, main="after ModuleEigengenes")

obj2 <- ModuleConnectivity(obj1)
PlotDendrogram(obj2, main="after ModuleConnectivity")
Image Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions