From 9c221e0d89603acd5412be95650a469824e2ab99 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Thu, 23 Sep 2021 15:10:16 +0300 Subject: check for na powerEst and use a default value --- scripts/wgcna_analysis.R | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'scripts') 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, -- cgit v1.2.3