View source: R/utility_functions.R
runWGCNA | R Documentation |
Run WGCNA analysis on scRNAseq expression matrix, using WGCNA R package.
runWGCNA(
e.mat,
s.mat = NULL,
cor.metric = "rho_p",
soft.power = 2,
use.TOM = T,
network.type = "signed",
TOM.type = "unsigned",
rescale.adjacency = F,
verbose = T,
...
)
e.mat |
Expression matrix. Row entries are cells, column entries are genes. Colnames and rownames are expected. |
s.mat |
Similarity matrix (optional). If not provided, will be computed using method specfiied by cor.metric. If provided, s.mat is not recomputed. |
cor.metric |
Correction measure to use. Default is "rho_p". See "dismay" package for additional options. |
soft.power |
Soft power used to scale s.mat to a.mat (e.g., a.mat = s.mat ^ soft.power) |
use.TOM |
Logical flag specifying whether to compute topoligical overlap matrix. If false, w.mat = a.mat. |
network.type |
Network type. Allowed values are (unique abbreviations of) "unsigned", "signed" (default), "signed hybrid" |
TOM.type |
TOM type. Allowed values are "unsigned" (default) or "signed" |
rescale.adjacency |
Logical indicate whether adjacency matrix is rescaled to [0,1]. Default is False. |
verbose |
Print progress. Default is TRUE |
... |
Additional arguments passessed to TOMsimilarity WGCNA package |
List containing similarity matrix (s.mat), adacency matrix (a.mat), topological overlap matrix (w.mat) and disimilarity matrix (d.mat)
# Get expression matrix
which.data <- "scale"
# variable gene only matrix
use.var <- T
if (use.var){
exp.mat <- getExpressionMatrix(so.query, only.variable = use.var, which.data = which.data, use.additional.genes = NA)
} else {
exp.mat <- exp.mat.complete
}
# transpose expressio matrix (genes are columns)
t.exp.mat <- t(exp.mat)
datExpr <- as.matrix(t.exp.mat)
SubGeneNames=colnames(datExpr)
# capture output used to hide undesired print statement
print2hide <- capture.output(allowWGCNAThreads())
# transform matrix if necessary
if (min(datExpr) < 0) {
datExpr.noz <- datExpr + abs(min(datExpr))
} else {
datExpr.noz <- datExpr
}
# run WGCNA
output.all <- runWGCNA(datExpr.noz, cor.metric = "rho_p", soft.power = 2, use.TOM = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.