aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2021-09-23 15:10:16 +0300
committerAlexander Kabui2021-09-23 15:10:16 +0300
commit9c221e0d89603acd5412be95650a469824e2ab99 (patch)
treecaf589995b0a88c926f33fda150fbaa5cd6607cc
parentfc335fa1394a39d1f9f397cb69c755040ecfc5e1 (diff)
downloadgenenetwork3-9c221e0d89603acd5412be95650a469824e2ab99.tar.gz
check for na powerEst and use a default value
-rw-r--r--scripts/wgcna_analysis.R10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/wgcna_analysis.R b/scripts/wgcna_analysis.R
index ee749e9..c3b1ac8 100644
--- a/scripts/wgcna_analysis.R
+++ b/scripts/wgcna_analysis.R
@@ -62,13 +62,21 @@ enableWGCNAThreads()
powers <- c(c(1:10), seq(from = 12, to=20, by=2))
sft <- pickSoftThreshold(dataExpr, powerVector = powers, verbose = 5)
+# check the power estimate
+
+if (is.na(sft$powerEstimate)){
+ powerEst = 1
+}else{
+ powerEst = sft$powerEstimate
+}
+
# pass user options
network <- blockwiseModules(dataExpr,
#similarity matrix options
corType = corType,
#adjacency matrix options
- power = 5,
+ power = powerEst,
networkType = "unsigned",
#TOM options
TOMtype = TOMtype,