runWGCNA.Rd
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,
...
)
Expression matrix. Row entries are cells, column entries are genes. Colnames and rownames are expected.
Similarity matrix (optional). If not provided, will be computed using method specfiied by cor.metric. If provided, s.mat is not recomputed.
Correction measure to use. Default is "rho_p". See "dismay" package for additional options.
Soft power used to scale s.mat to a.mat (e.g., a.mat = s.mat ^ soft.power)
Logical flag specifying whether to compute topoligical overlap matrix. If false, w.mat = a.mat.
Network type. Allowed values are (unique abbreviations of) "unsigned", "signed" (default), "signed hybrid"
TOM type. Allowed values are "unsigned" (default) or "signed"
Logical indicate whether adjacency matrix is rescaled to [0,1]. Default is False.
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
}
#> Error in DefaultAssay(so): object 'so.query' not found
# transpose expressio matrix (genes are columns)
t.exp.mat <- t(exp.mat)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 't': object 'exp.mat' not found
datExpr <- as.matrix(t.exp.mat)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'as.matrix': object 't.exp.mat' not found
SubGeneNames=colnames(datExpr)
#> Error in is.data.frame(x): object 'datExpr' not found
# 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
}
#> Error in eval(expr, envir, enclos): object 'datExpr' not found
# run WGCNA
output.all <- runWGCNA(datExpr.noz, cor.metric = "rho_p", soft.power = 2, use.TOM = T)
#> 2022-08-03 14:42:38: Computing similarity matrix...
#> Error in loadNamespace(x): there is no package called 'dismay'