plotSoftPower: Plot soft power for WGCNA analysis

Description Usage Arguments Value Examples

View source: R/plots.R

Description

Plot soft power and corresponding scale free topology fitting index to find a proper soft power for WGCNA analysis.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
plotSoftPower(
  expr,
  rowSample = FALSE,
  weights = NULL,
  powerVector = c(seq(10), seq(12, 20, by = 2)),
  RsquaredCut = 0.85,
  networkType = "unsigned",
  removeFirst = FALSE,
  nBreaks = 10,
  corFnc = WGCNA::cor,
  corOptions = list(use = "p")
)

Arguments

expr

Gene expression data, either a matrix or a data frame. By default, each row represents a gene, each column represents a sample.

rowSample

logic. If TRUE, each row represents a sample. The default is FALSE.

weights,

optional observation weights for expr to be used in correlation calculation.

powerVector

a vector of soft thresholding powers for which the scale free topology fit indices are to be calculated.

RsquaredCut

desired minimum scale free topology fitting index R^2. The default is 0.85.

networkType

character, network type. Allowed values are (unique abbreviations of) "unsigned" (default), "signed", "signed hybrid". See adjacency.

removeFirst,

should the first bin be removed from the connectivity histogram? The default is FALSE.

nBreaks,

number of bins in connectivity histograms. The default is 10.

corFnc,

correlation function to be used in adjacency calculation. The default is the cor function in WGCNA.

corOptions,

a named list of options to the correlation function specified in corFnc. The default is list(use = "p").

Value

a list of three elements: powerEstimate, fitIndices, and plot. powerEstimate is an estimate of an appropriate soft-thresholding power. fitIndices is a data frame containing the fit indices for scale free topology. The plot is a ggplot object.

Examples

1
2
3
4
5
6
7
data(Lyme_GSE63085)
log2FPKM = log2(Lyme_GSE63085$FPKM + 1)
log2FPKMhi = log2FPKM[rowMeans(log2FPKM) >= 10^-3, , drop = FALSE]
log2FPKMhi = head(log2FPKMhi, 3000) # First 3000 genes for example

softP = plotSoftPower(log2FPKMhi, RsquaredCut = 0.85)
print(softP)

WTaoUMC/RegEnrich documentation built on Aug. 4, 2021, 4:11 p.m.