WGCNA_ModuleGeneTraitHeatmap: Plot gene module relationship and correlation with traits.

View source: R/WGCNA.R

WGCNA_ModuleGeneTraitHeatmapR Documentation

Plot gene module relationship and correlation with traits.

Description

Plot gene module relationship and correlation with traits.

Usage

WGCNA_ModuleGeneTraitHeatmap(
  datExpr,
  traitData = NULL,
  net,
  corType = "bicor",
  prefix = "ehbio",
  saveplot = NULL,
  ...
)

Arguments

datExpr

Expression data. A matrix (preferred) or data frame in which columns are genes and rows ar samples. NAs are allowed, but not too many. See checkMissingData below and details.

traitData

Sample attributes data frame. Or the "traitData" generated in WGCNA_readindata.

net

WGCNA_coexprNetwork or blockwiseModules returned WGCNA object.

corType

character string specifying the correlation to be used. Allowed values are (unique abbreviations of) "pearson" and "bicor", corresponding to Pearson and bidweight midcorrelation, respectively. Missing values are handled using the pairwise.complete.obs option.

prefix

prefix for output files.

saveplot

Save plot to given file "a.pdf", "b.png".

...

Additional parameters given to plot output (pdf, png,...) like "width", "height", .etc.

Value

A dataframe geneTraitCor

Examples



df = generateAbundanceDF(nSample=30, nGrp=3, sd=5)
datExpr <- WGCNA_dataFilter(df)
datExpr <- WGCNA_sampleClusterDetectOutlier(datExpr)
power <- WGCNA_softpower(datExpr)
net <- WGCNA_coexprNetwork(datExpr, power)
WGCNA_saveModuleAndMe(net, datExpr)
cyt <- WGCNA_cytoscape(net, power, datExpr)
hubgene <- WGCNA_hubgene(cyt)

#2
exprMat <- "test.file"
wgcnaL <- WGCNA_readindata(exprMat)

traitData <- 'trait.file'
wgcnaL <- WGCNA_readindata(exprMat, traitData)
datExpr <- wgcnaL$datExpr
traitData <- wgcnaL$traitData
WGCNA_dataCheck(datExpr)
datExpr <- WGCNA_dataFilter(datExpr)
datExpr <- WGCNA_sampleClusterDetectOutlier(datExpr)
# datExpr <- WGCNA_sampleClusterDetectOutlier(datExpr, traitColors=wgcnaL$traitColors)
power <- WGCNA_softpower(datExpr)
net <- WGCNA_coexprNetwork(datExpr, power)
MEs_col <- WGCNA_saveModuleAndMe(net, datExpr)
WGCNA_MEs_traitCorrelationHeatmap(MEs_col, traitData=traitData)
cyt <- WGCNA_cytoscape(net, power, datExpr)
hubgene <- WGCNA_hubgene(cyt)
WGCNA_moduleTraitPlot(MEs_col, traitData=traitData)
geneTraitCor <- WGCNA_ModuleGeneTraitHeatmap(datExpr, traitData, net)



Tong-Chen/ImageGP documentation built on April 14, 2025, 12:54 p.m.