{"id":202,"date":"2017-12-14T02:29:14","date_gmt":"2017-12-13T18:29:14","guid":{"rendered":"http:\/\/www.wuchangsong.com\/?p=202"},"modified":"2017-12-15T16:11:45","modified_gmt":"2017-12-15T08:11:45","slug":"wgcna%e5%88%86%e6%9e%90%e6%b5%81%e7%a8%8b","status":"publish","type":"post","link":"http:\/\/www.wuchangsong.com\/?p=202","title":{"rendered":"WGCNA\u5206\u6790\u6d41\u7a0b"},"content":{"rendered":"<p>WGCNA\u662f\u4e00\u4e2aR\u5305\uff0c\u5bf9\u4e00\u4e2a\u5b8c\u5168\u4e0d\u4f1aR\u7684\u4eba\u6765\u8bf4\uff0c\u786e\u5b9e\u8d39\u4e86\u4e00\u756a\u529f\u592b\uff0c\u4e0d\u8fc7\u4e5f\u5c06\u6211\u5bf9R\u7684\u5b66\u4e60\u63d0\u524d\u63d0\u4e0a\u65e5\u7a0b\u3002<\/p>\n<p>\u5206\u6790\u6b65\u9aa4\uff1a<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-203\" src=\"http:\/\/www.wuchangsong.com\/wp-content\/uploads\/2017\/12\/QQ\u56fe\u724720171213165251.png\" alt=\"\" width=\"533\" height=\"451\" \/><\/p>\n<h3>1.WGCNA\u5b89\u88c5<\/h3>\n<pre>source(\"http:\/\/bioconductor.org\/biocLite.R\")\r\nbiocLite(c(\"AnnotationDbi\", \"impute\", \"GO.db\", \"preprocessCore\"))\r\ninstall.packages(\"WGCNA\")<\/pre>\n<h3>2.\u8f93\u5165\u6570\u636e\u51c6\u5907<\/h3>\n<p>\u539f\u59cb\u6570\u636e<a href=\"https:\/\/www.ncbi.nlm.nih.gov\/geo\/query\/acc.cgi?acc=GSE48213\">https:\/\/www.ncbi.nlm.nih.gov\/geo\/query\/acc.cgi?acc=GSE48213<\/a>\uff0c\u517156\u4e2a\u6837\u672c\uff1b\u5bf9\u6570\u636e\u7684\u5408\u5e76\u53ef\u53c2\u8003<a href=\"http:\/\/www.biotrainee.com:8080\/thread-603-1-1.html\">http:\/\/www.biotrainee.com:8080\/thread-603-1-1.html<\/a>\uff0c\u8f93\u5165\u6587\u4ef6\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-204\" src=\"http:\/\/www.wuchangsong.com\/wp-content\/uploads\/2017\/12\/QQ\u56fe\u724720171213175807.png\" alt=\"\" width=\"670\" height=\"200\" \/><\/p>\n<p>&nbsp;<\/p>\n<pre>setwd('WGCNA\/')\r\nfpkm=read.table('test.txt',sep = '\\t',stringsAsFactors = F)\r\nhead(fpkm)\r\ndim(fpkm) ##\u517156\u4e2a\u7ec6\u80de\u7cfb\uff0c36953\u4e2a\u57fa\u56e0\u7684\u8868\u8fbe\u77e9\u9635\r\nnames(fpkm)##\u7ec6\u80de\u7cfb\u540d\u79f0<\/pre>\n<h3>3.\u6570\u636e\u9884\u5904\u7406<\/h3>\n<pre>library(reshape2)\r\nlibrary('WGCNA')\r\nRNAseq_voom &lt;- fpkm\r\nWGCNA_matrix = t(RNAseq_voom[order(apply(RNAseq_voom,1,mad), decreasing = T)[1:3000],]) ##top 3000 mad genes\uff0ct\u53c2\u6570\u5c06\u77e9\u9635\u53d8\u4e3a\u7b26\u5408WGCNA\u8981\u6c42\u7684\u5f62\u5f0f\uff1a\u884c\u540d\u4e3agene\uff0c\u5217\u540d\u4e3a\u6837\u54c1\r\ndatExpr &lt;- WGCNA_matrix\r\nsave(datExpr, file = \"AS-green-FPKM-01-dataInput.RData\")<\/pre>\n<h3>4.\u786e\u5b9a\u6700\u4f73beta\u503c<\/h3>\n<p>&nbsp;<\/p>\n<pre>powers = c(c(1:10), seq(from = 12, to=20, by=2))\r\n# Call the network topology analysis function\r\nsft = pickSoftThreshold(datExpr, powerVector = powers, verbose = 5)\r\n# Plot the results:\r\n##sizeGrWindow(9, 5)\r\npar(mfrow = c(1,2));\r\ncex1 = 0.9;\r\n# Scale-free topology fit index as a function of the soft-thresholding power\r\nplot(sft$fitIndices[,1], -sign(sft$fitIndices[,3])*sft$fitIndices[,2],\r\n     xlab=\"Soft Threshold (power)\",ylab=\"Scale Free Topology Model Fit,signed R^2\",type=\"n\",\r\n     main = paste(\"Scale independence\"));\r\ntext(sft$fitIndices[,1], -sign(sft$fitIndices[,3])*sft$fitIndices[,2],\r\n     labels=powers,cex=cex1,col=\"red\");\r\n# this line corresponds to using an R^2 cut-off of h\r\nabline(h=0.90,col=\"red\")\r\n# Mean connectivity as a function of the soft-thresholding power\r\nplot(sft$fitIndices[,1], sft$fitIndices[,5],\r\n     xlab=\"Soft Threshold (power)\",ylab=\"Mean Connectivity\", type=\"n\",\r\n     main = paste(\"Mean connectivity\"))\r\ntext(sft$fitIndices[,1], sft$fitIndices[,5], labels=powers, cex=cex1,col=\"red\")<\/pre>\n<p>\u6700\u4f73\u7684beta\u503c\u5c31\u662fsft$powerEstimate,\u6b64\u4f8b\u4e3a6<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-205\" src=\"http:\/\/www.wuchangsong.com\/wp-content\/uploads\/2017\/12\/QQ\u56fe\u724720171214004538.png\" alt=\"\" width=\"1171\" height=\"651\" \/><\/p>\n<h3>5.\u4e00\u6b65\u6cd5\u6784\u5efa\u5171\u8868\u8fbe\u77e9\u9635<\/h3>\n<pre>net = blockwiseModules(datExpr, power = 6, maxBlockSize = 6000,\r\n                       TOMType = \"unsigned\", minModuleSize = 30,\r\n                       reassignThreshold = 0, mergeCutHeight = 0.25,\r\n                       numericLabels = TRUE, pamRespectsDendro = FALSE,\r\n                       saveTOMs = TRUE,\r\n                       saveTOMFileBase = \"AS-green-FPKM-TOM\",\r\n                       verbose = 3)\r\ntable(net$colors)\r\n#\u7ed8\u56fe\u7ed3\u679c\u5c55\u793a\r\nmergedColors = labels2colors(net$colors)\r\n# Plot the dendrogram and the module colors underneath\r\nplotDendroAndColors(net$dendrograms[[1]], mergedColors[net$blockGenes[[1]]],\r\n                    \"Module colors\",\r\n                    dendroLabels = FALSE, hang = 0.03,\r\n                    addGuide = TRUE, guideHang = 0.05)\r\n#\u7ed3\u679c\u4fdd\u5b58\r\nmoduleLabels = net$colors\r\nmoduleColors = labels2colors(net$colors)\r\ntable(moduleColors)\r\nMEs = net$MEs;\r\ngeneTree = net$dendrograms[[1]];\r\nsave(MEs, moduleLabels, moduleColors, geneTree,\r\n     file = \"AS-green-FPKM-02-networkConstruction-auto.RData\")<\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-206\" src=\"http:\/\/www.wuchangsong.com\/wp-content\/uploads\/2017\/12\/QQ\u56fe\u724720171214005708.png\" alt=\"\" width=\"1150\" height=\"650\" \/><\/p>\n<pre>#\u5bf9\u6837\u672c\u505a\u4e2a\u7cfb\u7edf\u805a\u7c7b\u6811\r\n#\u660e\u786e\u57fa\u56e0\u6570\u548c\u6837\u672c\u6570\r\nnGenes = ncol(datExpr)\r\nnSamples = nrow(datExpr)\r\ndatExpr_tree&lt;-hclust(dist(datExpr), method = \"average\")\r\npar(mar = c(0,5,2,0))\r\nplot(datExpr_tree, main = \"Sample clustering\", sub=\"\", xlab=\"\", cex.lab = 2, \r\n     cex.axis = 1, cex.main = 1,cex.lab=1)<\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-207\" src=\"http:\/\/www.wuchangsong.com\/wp-content\/uploads\/2017\/12\/QQ\u56fe\u724720171214011203.png\" alt=\"\" width=\"1167\" height=\"517\" \/><\/p>\n<h3>6.\u5bfc\u51fa\u7f51\u7edc\u5230Cytoscape<\/h3>\n<pre># Recalculate topological overlap if needed\r\nTOM = TOMsimilarityFromExpr(datExpr, power = 6);\r\n# Read in the annotation file\r\n# annot = read.csv(file = \"GeneAnnotation.csv\");\r\n# Select modules\u9700\u8981\u4fee\u6539\uff0c\u9009\u62e9\u9700\u8981\u5bfc\u51fa\u7684\u6a21\u5757\u989c\u8272\r\nmodules = c(\"turquoise\", \"blue\");\r\n# Select module probes\u9009\u62e9\u6a21\u5757\u63a2\u6d4b\r\nprobes = colnames(datExpr)\r\ninModule = is.finite(match(moduleColors, modules));\r\nmodProbes = probes[inModule];\r\n#modGenes = annot$gene_symbol[match(modProbes, annot$substanceBXH)];\r\n# Select the corresponding Topological Overlap\r\nmodTOM = TOM[inModule, inModule];\r\ndimnames(modTOM) = list(modProbes, modProbes)\r\n# Export the network into edge and node list files Cytoscape can read\r\ncyt = exportNetworkToCytoscape(modTOM,\r\n                               edgeFile = paste(\"AS-green-FPKM-One-step-CytoscapeInput-edges-\", paste(modules, collapse=\"-\"), \".txt\", sep=\"\"),\r\n                               nodeFile = paste(\"AS-green-FPKM-One-step-CytoscapeInput-nodes-\", paste(modules, collapse=\"-\"), \".txt\", sep=\"\"),\r\n                               weighted = TRUE,\r\n                               threshold = 0.02,\r\n                               nodeNames = modProbes,\r\n                               #altNodeNames = modGenes,\r\n                               nodeAttr = moduleColors[inModule]);<\/pre>\n<h3>7.\u5206\u6790\u7f51\u7edc\u53ef\u89c6\u5316<\/h3>\n<p>\u7528heatmap\u53ef\u89c6\u5316\u6743\u91cd\u7f51\u7edc\uff0cheatmap\u6bcf\u4e00\u884c\u6216\u5217\u5bf9\u5e94\u4e00\u4e2a\u57fa\u56e0\uff0c\u989c\u8272\u8d8a\u6df1\u8868\u793a\u6709\u8f83\u9ad8\u7684\u90bb\u8fd1<\/p>\n<pre>options(stringsAsFactors = FALSE);\r\nlnames = load(file = \"AS-green-FPKM-01-dataInput.RData\");\r\nlnames\r\nlnames = load(file = \"AS-green-FPKM-02-networkConstruction-auto.RData\");\r\nlnames\r\nnGenes = ncol(datExpr)\r\nnSamples = nrow(datExpr)\r\n#\u53ef\u89c6\u5316\u5168\u90e8\u57fa\u56e0\u7f51\u7edc\r\n# Calculate topological overlap anew: this could be done more efficiently by saving the TOM\r\n# calculated during module detection, but let us do it again here.\r\ndissTOM = 1-TOMsimilarityFromExpr(datExpr, power = 6);\r\n# Transform dissTOM with a power to make moderately strong connections more visible in the heatmap\r\nplotTOM = dissTOM^7;\r\n# Set diagonal to NA for a nicer plot\r\ndiag(plotTOM) = NA;\r\n# Call the plot function\r\n#sizeGrWindow(9,9)\r\nTOMplot(plotTOM, geneTree, moduleColors, main = \"Network heatmap plot, all genes\")\r\n#\u968f\u4fbf\u9009\u53d61000\u4e2a\u57fa\u56e0\u6765\u53ef\u89c6\u5316\r\nnSelect = 1000\r\n# For reproducibility, we set the random seed\r\nset.seed(10);\r\nselect = sample(nGenes, size = nSelect);\r\nselectTOM = dissTOM[select, select];\r\n# There's no simple way of restricting a clustering tree to a subset of genes, so we must re-cluster.\r\nselectTree = hclust(as.dist(selectTOM), method = \"average\")\r\nselectColors = moduleColors[select];\r\n# Open a graphical window\r\n#sizeGrWindow(9,9)\r\n# Taking the dissimilarity to a power, say 10, makes the plot more informative by effectively changing\r\n# the color palette; setting the diagonal to NA also improves the clarity of the plot\r\nplotDiss = selectTOM^7;\r\ndiag(plotDiss) = NA;\r\nTOMplot(plotDiss, selectTree, selectColors, main = \"Network heatmap plot, selected genes\")<\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-208\" src=\"http:\/\/www.wuchangsong.com\/wp-content\/uploads\/2017\/12\/QQ\u56fe\u724720171214013545.png\" alt=\"\" width=\"622\" height=\"653\" \/><\/p>\n<h3>8.\u591a\u6b65\u6cd5\u6784\u5efa\u7f51\u7edc<\/h3>\n<pre>#2.\u9009\u62e9\u5408\u9002\u7684\u9600\u503c\uff0c\u540c\u4e0a\r\n#3. \u7f51\u7edc\u6784\u5efa\uff1a(1) Co-expression similarity and adjacency\r\nsoftPower = 6;\r\nadjacency = adjacency(datExpr, power = softPower);\r\n#(2) \u90bb\u8fd1\u77e9\u9635\u5230\u62d3\u6251\u77e9\u9635\u7684\u8f6c\u6362\uff0cTurn adjacency into topological overlap\r\nTOM = TOMsimilarity(adjacency);\r\ndissTOM = 1-TOM\r\n# (3) \u805a\u7c7b\u62d3\u6251\u77e9\u9635\r\n#Call the hierarchical clustering function\r\ngeneTree = hclust(as.dist(dissTOM), method = \"average\");\r\n# Plot the resulting clustering tree (dendrogram)\r\n#sizeGrWindow(12,9)\r\nplot(geneTree, xlab=\"\", sub=\"\", main = \"Gene clustering on TOM-based dissimilarity\",\r\n     labels = FALSE, hang = 0.04);\r\n#(4) \u805a\u7c7b\u5206\u652f\u7684\u4f11\u6574dynamicTreeCut\r\n# We like large modules, so we set the minimum module size relatively high:\r\nminModuleSize = 30;\r\n# Module identification using dynamic tree cut:\r\ndynamicMods = cutreeDynamic(dendro = geneTree, distM = dissTOM,\r\n                            deepSplit = 2, pamRespectsDendro = FALSE,\r\n                            minClusterSize = minModuleSize);\r\ntable(dynamicMods)\r\n#4. \u7ed8\u753b\u7ed3\u679c\u5c55\u793a\r\n# Convert numeric lables into colors\r\ndynamicColors = labels2colors(dynamicMods)\r\ntable(dynamicColors)\r\n# Plot the dendrogram and colors underneath\r\n#sizeGrWindow(8,6)\r\nplotDendroAndColors(geneTree, dynamicColors, \"Dynamic Tree Cut\",\r\n                    dendroLabels = FALSE, hang = 0.03,\r\n                    addGuide = TRUE, guideHang = 0.05,\r\n                    main = \"Gene dendrogram and module colors\")\r\n#5. \u805a\u7c7b\u7ed3\u679c\u76f8\u4f3c\u6a21\u5757\u7684\u878d\u5408\uff0cMerging of modules whose expression profiles are very similar\r\n#\u5728\u805a\u7c7b\u6811\u4e2d\u6bcf\u4e00leaf\u662f\u4e00\u4e2a\u77ed\u7ebf\uff0c\u4ee3\u8868\u4e00\u4e2a\u57fa\u56e0\uff0c\r\n#\u4e0d\u540c\u5206\u4e4b\u95f4\u9760\u7684\u8d8a\u8fd1\u8868\u793a\u6709\u9ad8\u7684\u5171\u8868\u8fbe\u57fa\u56e0\uff0c\u5c06\u5171\u8868\u8fbe\u6781\u5176\u76f8\u4f3c\u7684modules\u8fdb\u884c\u878d\u5408\r\n# Calculate eigengenes\r\nMEList = moduleEigengenes(datExpr, colors = dynamicColors)\r\nMEs = MEList$eigengenes\r\n# Calculate dissimilarity of module eigengenes\r\nMEDiss = 1-cor(MEs);\r\n# Cluster module eigengenes\r\nMETree = hclust(as.dist(MEDiss), method = \"average\");\r\n# Plot the result\r\n#sizeGrWindow(7, 6)\r\nplot(METree, main = \"Clustering of module eigengenes\",\r\n     xlab = \"\", sub = \"\")\r\n#\u9009\u62e9\u670975%\u76f8\u5173\u6027\u7684\u8fdb\u884c\u878d\u5408\r\nMEDissThres = 0.25\r\n# Plot the cut line into the dendrogram\r\nabline(h=MEDissThres, col = \"red\")\r\n# Call an automatic merging function\r\nmerge = mergeCloseModules(datExpr, dynamicColors, cutHeight = MEDissThres, verbose = 3)\r\n# The merged module colors\r\nmergedColors = merge$colors;\r\n# Eigengenes of the new merged modules:\r\nmergedMEs = merge$newMEs;\r\n#\u7ed8\u5236\u878d\u5408\u524d(Dynamic Tree Cut)\u548c\u878d\u5408\u540e(Merged dynamic)\u7684\u805a\u7c7b\u56fe\r\n#sizeGrWindow(12, 9)\r\n#pdf(file = \"Plots\/geneDendro-3.pdf\", wi = 9, he = 6)\r\nplotDendroAndColors(geneTree, cbind(dynamicColors, mergedColors),\r\n                    c(\"Dynamic Tree Cut\", \"Merged dynamic\"),\r\n                    dendroLabels = FALSE, hang = 0.03,\r\n                    addGuide = TRUE, guideHang = 0.05)\r\n#dev.off()\r\n# \u53ea\u662f\u7ed8\u5236\u878d\u5408\u540e\u805a\u7c7b\u56fe\r\nplotDendroAndColors(geneTree,mergedColors,\"Merged dynamic\",\r\n                    dendroLabels = FALSE, hang = 0.03,\r\n                    addGuide = TRUE, guideHang = 0.05)\r\n#5.\u7ed3\u679c\u4fdd\u5b58\r\n# Rename to moduleColors\r\nmoduleColors = mergedColors\r\n# Construct numerical labels corresponding to the colors\r\ncolorOrder = c(\"grey\", standardColors(50));\r\nmoduleLabels = match(moduleColors, colorOrder)-1;\r\nMEs = mergedMEs;\r\n# Save module colors and labels for use in subsequent parts\r\nsave(MEs, moduleLabels, moduleColors, geneTree, file = \"AS-green-FPKM-02-networkConstruction-stepByStep.RData\")\r\n#6. \u5bfc\u51fa\u7f51\u7edc\u5230Cytoscape\r\n# Recalculate topological overlap if needed\r\nTOM = TOMsimilarityFromExpr(datExpr, power = 6);\r\n# Read in the annotation file\r\n# annot = read.csv(file = \"GeneAnnotation.csv\");\r\n# Select modules\u9700\u8981\u4fee\u6539\r\nmodules = c(\"brown\", \"red\");\r\n# Select module probes\r\nprobes = colnames(datExpr)\r\ninModule = is.finite(match(moduleColors, modules));\r\nmodProbes = probes[inModule];\r\n#modGenes = annot$gene_symbol[match(modProbes, annot$substanceBXH)];\r\n# Select the corresponding Topological Overlap\r\nmodTOM = TOM[inModule, inModule];\r\ndimnames(modTOM) = list(modProbes, modProbes)\r\n# Export the network into edge and node list files Cytoscape can read\r\ncyt = exportNetworkToCytoscape(modTOM,\r\n                               edgeFile = paste(\"AS-green-FPKM-Step-by-step-CytoscapeInput-edges-\", paste(modules, collapse=\"-\"), \".txt\", sep=\"\"),\r\n                               nodeFile = paste(\"AS-green-FPKM-Step-by-step-CytoscapeInput-nodes-\", paste(modules, collapse=\"-\"), \".txt\", sep=\"\"),\r\n                               weighted = TRUE,\r\n                               threshold = 0.02,\r\n                               nodeNames = modProbes,\r\n                               #altNodeNames = modGenes,\r\n                               nodeAttr = moduleColors[inModule]);\r\n#=====================================================================================\r\n#  \u5206\u6790\u7f51\u7edc\u53ef\u89c6\u5316\uff0c\u7528heatmap\u53ef\u89c6\u5316\u6743\u91cd\u7f51\u7edc\uff0cheatmap\u6bcf\u4e00\u884c\u6216\u5217\u5bf9\u5e94\u4e00\u4e2a\u57fa\u56e0\uff0c\u989c\u8272\u8d8a\u6df1\u8868\u793a\u6709\u8f83\u9ad8\u7684\u90bb\u8fd1\r\n#=====================================================================================\r\noptions(stringsAsFactors = FALSE);\r\nlnames = load(file = \"AS-green-FPKM-01-dataInput.RData\");\r\nlnames\r\nlnames = load(file = \"AS-green-FPKM-02-networkConstruction-stepByStep.RData\");\r\nlnames\r\nnGenes = ncol(datExpr)\r\nnSamples = nrow(datExpr)\r\n#1. \u53ef\u89c6\u5316\u5168\u90e8\u57fa\u56e0\u7f51\u7edc\r\n# Calculate topological overlap anew: this could be done more efficiently by saving the TOM\r\n# calculated during module detection, but let us do it again here.\r\ndissTOM = 1-TOMsimilarityFromExpr(datExpr, power = 6);\r\n# Transform dissTOM with a power to make moderately strong connections more visible in the heatmap\r\nplotTOM = dissTOM^7;\r\n# Set diagonal to NA for a nicer plot\r\ndiag(plotTOM) = NA;\r\n# Call the plot function\r\n#sizeGrWindow(9,9)\r\nTOMplot(plotTOM, geneTree, moduleColors, main = \"Network heatmap plot, all genes\")\r\n#\u968f\u4fbf\u9009\u53d61000\u4e2a\u57fa\u56e0\u6765\u53ef\u89c6\u5316\r\nnSelect = 1000\r\n# For reproducibility, we set the random seed\r\nset.seed(10);\r\nselect = sample(nGenes, size = nSelect);\r\nselectTOM = dissTOM[select, select];\r\n# There's no simple way of restricting a clustering tree to a subset of genes, so we must re-cluster.\r\nselectTree = hclust(as.dist(selectTOM), method = \"average\")\r\nselectColors = moduleColors[select];\r\n# Open a graphical window\r\n#sizeGrWindow(9,9)\r\n# Taking the dissimilarity to a power, say 10, makes the plot more informative by effectively changing\r\n# the color palette; setting the diagonal to NA also improves the clarity of the plot\r\nplotDiss = selectTOM^7;\r\ndiag(plotDiss) = NA;\r\nTOMplot(plotDiss, selectTree, selectColors, main = \"Network heatmap plot, selected genes\")<\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-209\" src=\"http:\/\/www.wuchangsong.com\/wp-content\/uploads\/2017\/12\/QQ\u56fe\u724720171214020908.png\" alt=\"\" width=\"625\" height=\"655\" \/><br \/>\n\u6839\u636e\u57fa\u56e0\u95f4\u8868\u8fbe\u91cf\u8fdb\u884c\u6a21\u5757\u805a\u7c7b\uff08\u524d\u8fb9\u5f97\u5230\uff09\u548c\u6240\u5f97\u5230\u7684\u5404\u6a21\u5757\u95f4\u7684\u76f8\u5173\u6027<\/p>\n<pre>MEs = moduleEigengenes(datExpr, moduleColors)$eigengenes\r\nMET = orderMEs(MEs)\r\nsizeGrWindow(7, 6) \r\nplotEigengeneNetworks(MET, \"Eigengene adjacency heatmap\", marHeatmap = c(3,4,2,2), plotDendrograms = FALSE, xLabelsAngle = 90)<\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-210\" src=\"http:\/\/www.wuchangsong.com\/wp-content\/uploads\/2017\/12\/QQ\u56fe\u724720171214015927.png\" alt=\"\" width=\"800\" height=\"200\" \/><br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-211\" src=\"http:\/\/www.wuchangsong.com\/wp-content\/uploads\/2017\/12\/QQ\u56fe\u724720171214021155.png\" alt=\"\" width=\"800\" height=\"200\" \/><\/p>\n<p>\u811a\u672c\u6765\u81ea\uff1a<br \/>\n<a href=\"http:\/\/tiramisutes.github.io\/2016\/09\/14\/WGCNA.html\">http:\/\/tiramisutes.github.io\/2016\/09\/14\/WGCNA.html<\/a><\/p>\n<p><a href=\"https:\/\/bioconductor.org\/packages\/devel\/bioc\/vignettes\/CVE\/inst\/doc\/WGCNA_from_TCGA_RNAseq.html\">https:\/\/bioconductor.org\/packages\/devel\/bioc\/vignettes\/CVE\/inst\/doc\/WGCNA_from_TCGA_RNAseq.html<\/a><\/p>\n<p><a href=\"http:\/\/www.bio-info-trainee.com\/2535.html\">http:\/\/www.bio-info-trainee.com\/2535.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>WGCNA\u662f\u4e00\u4e2aR\u5305\uff0c\u5bf9\u4e00\u4e2a\u5b8c\u5168\u4e0d\u4f1aR\u7684\u4eba\u6765\u8bf4\uff0c\u786e\u5b9e\u8d39\u4e86\u4e00\u756a\u529f\u592b\uff0c\u4e0d\u8fc7\u4e5f\u5c06\u6211\u5bf9R\u7684\u5b66\u4e60\u63d0\u524d\u63d0\u4e0a\u65e5\u7a0b\u3002 \u5206\u6790\u6b65\u9aa4\uff1a 1.WGCNA\u5b89\u88c5 source(&#8220;http:\/\/bioconductor.org\/biocLite.R&#8221;) biocLite(c(&#8220;AnnotationDbi&#8221;, &#8220;impute&#8221;, &#8220;GO.db&#8221;, &#8220;preprocessCore&#8221;)) install.packages(&#8220;WGCNA&#8221;) 2.\u8f93\u5165\u6570\u636e\u51c6\u5907 \u539f\u59cb\u6570\u636ehttps:\/\/www.ncbi.nlm.nih.gov\/geo\/query\/acc.cgi?acc=GSE48213\uff0c\u517156\u4e2a\u6837\u672c\uff1b\u5bf9\u6570\u636e\u7684\u5408\u5e76\u53ef\u53c2\u8003http:\/\/www.biotrainee.com:8080\/thread-603-1-1.html\uff0c\u8f93\u5165\u6587\u4ef6\u683c\u5f0f\u5982\u4e0b\uff1a &nbsp; setwd(&#8216;WGCNA\/&#8217;) fpkm=read.table(&#8216;test.txt&#8217;,sep = &#8216;\\t&#8217;,stringsAsFactors = F) head(fpkm) dim(fpkm) ##\u517156\u4e2a\u7ec6\u80de\u7cfb\uff0c36953\u4e2a\u57fa\u56e0\u7684\u8868\u8fbe\u77e9\u9635 names(fpkm)##\u7ec6\u80de\u7cfb\u540d\u79f0 3.\u6570\u636e\u9884\u5904\u7406 library(reshape2) library(&#8216;WGCNA&#8217;) RNAseq_voom &lt;- fpkm WGCNA_matrix = t(RNAseq_voom[order(apply(RNAseq_voom,1,mad), decreasing = T)[1:3000],]) ##top 3000 mad genes\uff0ct\u53c2\u6570\u5c06\u77e9\u9635\u53d8\u4e3a\u7b26\u5408WGCNA\u8981\u6c42\u7684\u5f62\u5f0f\uff1a\u884c\u540d\u4e3agene\uff0c\u5217\u540d\u4e3a\u6837\u54c1 datExpr &lt;- WGCNA_matrix save(datExpr, file = &#8220;AS-green-FPKM-01-dataInput.RData&#8221;) 4.\u786e\u5b9a\u6700\u4f73beta\u503c &nbsp; powers = c(c(1:10), seq(from = 12, to=20, by=2)) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,10],"tags":[],"_links":{"self":[{"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/posts\/202"}],"collection":[{"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=202"}],"version-history":[{"count":3,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/posts\/202\/revisions"}],"predecessor-version":[{"id":215,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/posts\/202\/revisions\/215"}],"wp:attachment":[{"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=202"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}