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); } }
sizeGrWindow(8, 6) png(file = "scaleFreeAnalysis.png") par(mfcol = c(2,2)); par(mar = c(4.2, 4.2 , 2.2, 0.5)) 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) ; } dev.off();
|