1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| powers = c(seq(4,10,by=1), seq(12,20, by=2));
powerTables = vector(mode = "list", length = nSets);
for (set in 1:nSets){ powerTables[[set]] = list(data = pickSoftThreshold(multiExpr[[set]]$data, powerVector=powers, verbose = 2)[[2]]); } collectGarbage();
colors = c("black", "red")
plotCols = c(2,5,6,7) colNames = c("Scale Free Topology Model Fit", "Mean connectivity", "Median connectivity", "Max connectivity");
ylim = matrix(NA, nrow = 2, ncol = 4); for (set in 1:nSets){ for (col in 1:length(plotCols)){ ylim[1, col] = min(ylim[1, col], powerTables[[set]]$data[, plotCols[col]], na.rm = TRUE); ylim[2, col] = max(ylim[2, col], powerTables[[set]]$data[, plotCols[col]], na.rm = TRUE); } }
cex1 = 0.7; for (col in 1:length(plotCols)) for (set in 1:nSets){ if (set==1){ plot(powerTables[[set]]$data[,1], -sign(powerTables[[set]]$data[,3])*powerTables[[set]]$data[,2], xlab="Soft Threshold (power)",ylab=colNames[col],type="n", ylim = ylim[, col], main = colNames[col]); addGrid(); } if (col==1){ text(powerTables[[set]]$data[,1], -sign(powerTables[[set]]$data[,3])*powerTables[[set]]$data[,2], labels=powers,cex=cex1,col=colors[set]); } else{ text(powerTables[[set]]$data[,1], powerTables[[set]]$data[,plotCols[col]], labels=powers,cex=cex1,col=colors[set]); } if (col==1){ legend("bottomright", legend = setLabels, col = colors, pch = 20) ; }else{ legend("topright", legend = setLabels, col = colors, pch = 20) ; } }
|