{"id":25573,"date":"2024-01-22T17:05:44","date_gmt":"2024-01-22T09:05:44","guid":{"rendered":"http:\/\/www.biocloudservice.com\/wordpress\/?p=25573"},"modified":"2024-01-22T17:05:45","modified_gmt":"2024-01-22T09:05:45","slug":"%e6%8e%a2%e7%b4%a2%e5%9f%ba%e5%9b%a0%e5%85%b1%e8%a1%a8%e8%be%be%e7%bd%91%e7%bb%9c%ef%bc%9awgcna%e6%8f%ad%e7%a4%ba%e5%9f%ba%e5%9b%a0%e8%b0%83%e6%8e%a7%e7%bd%91%e7%bb%9c%e7%9a%84%e5%a5%a5%e7%a7%98","status":"publish","type":"post","link":"http:\/\/www.biocloudservice.com\/wordpress\/?p=25573","title":{"rendered":"\u63a2\u7d22\u57fa\u56e0\u5171\u8868\u8fbe\u7f51\u7edc\uff1aWGCNA\u63ed\u793a\u57fa\u56e0\u8c03\u63a7\u7f51\u7edc\u7684\u5965\u79d8"},"content":{"rendered":"<p>\u5f15\u8a00\uff1a<\/p>\n<p>\u968f\u7740\u9ad8\u901a\u91cf\u6d4b\u5e8f\u6280\u672f\u7684\u5feb\u901f\u53d1\u5c55\uff0c\u6211\u4eec\u80fd\u591f\u83b7\u53d6\u5927\u91cf\u57fa\u56e0\u8868\u8fbe\u6570\u636e\uff0c\u8fd9\u4e3a\u6211\u4eec\u6df1\u5165\u7406\u89e3\u57fa\u56e0\u8c03\u63a7\u7f51\u7edc\u63d0\u4f9b\u4e86\u5de8\u5927\u7684\u673a\u4f1a\u3002\u7136\u800c\uff0c\u5982\u4f55\u4ece\u8fd9\u4e9b\u6d77\u91cf\u6570\u636e\u4e2d\u63d0\u53d6\u6709\u610f\u4e49\u7684\u4fe1\u606f\u4ecd\u7136\u662f\u4e00\u4e2a\u6311\u6218\u3002\u5728\u8fd9\u65b9\u9762\uff0cWGCNA\u6210\u4e3a\u4e86\u7814\u7a76\u4eba\u5458\u7684\u5f97\u529b\u5de5\u5177\uff0c\u5e2e\u52a9\u6211\u4eec\u63ed\u793a\u57fa\u56e0\u5171\u8868\u8fbe\u6a21\u5f0f\u3001\u53d1\u73b0\u5173\u952e\u8c03\u63a7\u57fa\u56e0\u4ee5\u53ca\u4e86\u89e3\u57fa\u56e0\u8c03\u63a7\u7f51\u7edc\u7684\u529f\u80fd\u3002<\/p>\n<p>WGCNA\u539f\u7406\uff1a<\/p>\n<p>WGCNA\u57fa\u4e8e\u57fa\u56e0\u5171\u8868\u8fbe\u6a21\u5f0f\uff0c\u5373\u5177\u6709\u76f8\u4f3c\u8868\u8fbe\u6a21\u5f0f\u7684\u57fa\u56e0\u503e\u5411\u4e8e\u5728\u751f\u7269\u5b66\u529f\u80fd\u548c\u8c03\u63a7\u7f51\u7edc\u4e2d\u5177\u6709\u76f8\u4f3c\u7684\u89d2\u8272\u3002\u8be5\u65b9\u6cd5\u901a\u8fc7\u6784\u5efa\u57fa\u56e0\u5171\u8868\u8fbe\u7f51\u7edc\uff0c\u5c06\u9ad8\u5ea6\u76f8\u5173\u7684\u57fa\u56e0\u805a\u5408\u6210\u5171\u8868\u8fbe\u6a21\u5757\uff0c\u5e76\u901a\u8fc7\u6a21\u5757\u95f4\u548c\u6a21\u5757\u5185\u7684\u8fde\u63a5\u5f3a\u5ea6\u6765\u9274\u5b9a\u5173\u952e\u57fa\u56e0\u3002WGCNA\u8fd8\u4f7f\u7528\u7cfb\u7edf\u751f\u7269\u5b66\u548c\u7f51\u7edc\u7406\u8bba\u7684\u539f\u7406\u6765\u63ed\u793a\u57fa\u56e0\u8c03\u63a7\u7f51\u7edc\u7684\u529f\u80fd\u548c\u673a\u5236\u3002<\/p>\n<p>\u5e94\u7528\u9886\u57df\uff1a<\/p>\n<p>WGCNA\u5e7f\u6cdb\u5e94\u7528\u4e8e\u751f\u7269\u5b66\u7814\u7a76\u7684\u591a\u4e2a\u9886\u57df\u3002\u5728\u764c\u75c7\u7814\u7a76\u4e2d\uff0c\u7814\u7a76\u4eba\u5458\u5229\u7528WGCNA\u5206\u6790\u80bf\u7624\u7ec4\u7ec7\u548c\u6b63\u5e38\u7ec4\u7ec7\u7684\u57fa\u56e0\u8868\u8fbe\u6570\u636e\uff0c\u53d1\u73b0\u4e86\u4e0e\u764c\u75c7\u76f8\u5173\u7684\u5171\u8868\u8fbe\u6a21\u5757\u548c\u5173\u952e\u8c03\u63a7\u57fa\u56e0\u3002\u5728\u690d\u7269\u7814\u7a76\u4e2d\uff0cWGCNA\u5e2e\u52a9\u63ed\u793a\u4e86\u690d\u7269\u53d1\u80b2\u548c\u6297\u9006\u6027\u7684\u57fa\u56e0\u8c03\u63a7\u7f51\u7edc\u3002\u6b64\u5916\uff0cWGCNA\u5728\u795e\u7ecf\u79d1\u5b66\u3001\u514d\u75ab\u5b66\u3001\u4ee3\u8c22\u7ec4\u5b66\u7b49\u9886\u57df\u4e5f\u6709\u5e7f\u6cdb\u5e94\u7528\u3002<\/p>\n<p>\u5206\u6790\u6b65\u9aa4\uff1a<\/p>\n<p>\u4f7f\u7528WGCNA\u8fdb\u884c\u57fa\u56e0\u5171\u8868\u8fbe\u7f51\u7edc\u5206\u6790\u901a\u5e38\u5305\u62ec\u4ee5\u4e0b\u6b65\u9aa4\uff1a1\uff09\u6570\u636e\u9884\u5904\u7406\uff0c\u5305\u62ec\u6570\u636e\u6e05\u6d17\u3001\u6807\u51c6\u5316\u548c\u9009\u62e9\u611f\u5174\u8da3\u7684\u57fa\u56e0\u96c6\uff1b2\uff09\u6784\u5efa\u76f8\u5173\u7cfb\u6570\u77e9\u9635\uff0c\u8ba1\u7b97\u57fa\u56e0\u95f4\u7684\u76f8\u5173\u6027\uff1b3\uff09\u6784\u5efa\u57fa\u56e0\u5171\u8868\u8fbe\u7f51\u7edc\uff0c\u901a\u8fc7\u9009\u62e9\u5408\u9002\u7684\u76f8\u4f3c\u6027\u5ea6\u91cf\u548c\u8fde\u63a5\u9608\u503c\uff1b4\uff09\u6a21\u5757\u53d1\u73b0\uff0c\u5c06\u9ad8\u5ea6\u76f8\u5173\u7684\u57fa\u56e0\u805a\u5408\u6210\u5171\u8868\u8fbe\u6a21\u5757\uff1b5\uff09\u6a21\u5757\u7684\u529f\u80fd\u6ce8\u91ca\u548c\u8c03\u63a7\u57fa\u56e0\u7684\u8bc6\u522b\uff1b6\uff09\u7f51\u7edc\u53ef\u89c6\u5316\u548c\u529f\u80fd\u5206\u6790\u3002<\/p>\n<p>\u4e0b\u9762\u6211\u4eec\u4ee5\u809d\u764c\u6570\u636e\u4e3a\u4f8b\u8fdb\u884c\u5206\u6790\uff1a<\/p>\n<p>\u6ce8\uff1a\u8fd9\u91cc\u7684&#8221;LiverFemale3600.csv&#8221;,\u201dClinicalTraits.csv\u201d\u662f\u81ea\u884c\u51c6\u5907\u7684\u672c\u5730\u6587\u4ef6\uff0c\u5c0f\u679c\u7ed9\u5927\u5bb6\u9644\u5728\u6700\u540e\u3002<\/p>\n<p>\u3002Step1 \u6570\u636e\u8f93\u5165\u3001\u6e05\u6d17\u548c\u9884\u5904\u7406<\/p>\n<p># 1.1 \u8f7d\u5165\u6570\u636e<\/p>\n<p>workingDir = &#8220;D:\/wanglab\/life\/ziyuan\/WGCNA\/&#8221;;<\/p>\n<p>setwd(workingDir);<\/p>\n<p># Load the WGCNA package<\/p>\n<p>library(WGCNA);<\/p>\n<p># The following setting is important, do not omit.<\/p>\n<p>options(stringsAsFactors = FALSE);<\/p>\n<p>#Read in the female liver data set<\/p>\n<p>femData = read.csv(&#8220;LiverFemale3600.csv&#8221;);<\/p>\n<p># Take a quick look at what is in the data set:<\/p>\n<p>dim(femData);<\/p>\n<p>names(femData);<\/p>\n<p>#1.2\u521b\u5efa\u884c\u4e3a\u6837\u672c\uff0c\u5217\u4e3a\u57fa\u56e0\u7684\u8868\u8fbe\u77e9\u9635<\/p>\n<p>datExpr0 = as.data.frame(t(femData[, -c(1:8)]));<\/p>\n<p>names(datExpr0) = femData$substanceBXH;<\/p>\n<p>rownames(datExpr0) = names(femData)[-c(1:8)];<\/p>\n<p>### 1.3\u5224\u65ad\u6570\u636e\u8d28\u91cf&#8211;\u7f3a\u5931\u503c<\/p>\n<p>gsg = goodSamplesGenes(datExpr0, verbose = 3);<\/p>\n<p>gsg$allOK<\/p>\n<p>if (!gsg$allOK)<\/p>\n<p>{<\/p>\n<p># Optionally, print the gene and sample names that were removed:<\/p>\n<p>if (sum(!gsg$goodGenes)&gt;0)<\/p>\n<p>printFlush(paste(&#8220;Removing genes:&#8221;, paste(names(datExpr0)[!gsg$goodGenes], collapse = &#8220;, &#8220;)));<\/p>\n<p>if (sum(!gsg$goodSamples)&gt;0)<\/p>\n<p>printFlush(paste(&#8220;Removing samples:&#8221;, paste(rownames(datExpr0)[!gsg$goodSamples], collapse = &#8220;, &#8220;)));<\/p>\n<p># Remove the offending genes and samples from the data:<\/p>\n<p>datExpr0 = datExpr0[gsg$goodSamples, gsg$goodGenes]<\/p>\n<p>}<\/p>\n<p>### 1.4\u7ed8\u5236\u6837\u54c1\u7684\u7cfb\u7edf\u805a\u7c7b\u6811<\/p>\n<p>sampleTree = hclust(dist(datExpr0), method = &#8220;average&#8221;);<\/p>\n<p># Plot the sample tree: Open a graphic output window of size 12 by 9 inches<\/p>\n<p># The user should change the dimensions if the window is too large or too small.<\/p>\n<p>sizeGrWindow(12,9)<\/p>\n<p>#pdf(file = &#8220;Plots\/sampleClustering.pdf&#8221;, width = 12, height = 9);<\/p>\n<p>par(cex = 0.6);<\/p>\n<p>par(mar = c(0,4,2,0))<\/p>\n<p>plot(sampleTree, main = &#8220;Sample clustering to detect outliers&#8221;, sub=&#8221;&#8221;, xlab=&#8221;&#8221;, cex.lab = 1.5,<\/p>\n<p>cex.axis = 1.5, cex.main = 2)<\/p>\n<p># Plot a line to show the cut<\/p>\n<p>abline(h = 15, col = &#8220;red&#8221;);<\/p>\n<p><strong>\u7ed8\u5236\u6837\u672c\u6811\u805a\u7c7b\u6811<\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"479\" class=\"wp-image-25574\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-1.png?resize=640%2C479\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-1.png?w=1144 1144w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-1.png?resize=300%2C224 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-1.png?resize=1024%2C766 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-1.png?resize=768%2C575 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-1.png?resize=600%2C449 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>## 1.5\u82e5\u5b58\u5728\u663e\u8457\u79bb\u7fa4\u70b9\uff1b\u5254\u9664\u6389<\/p>\n<p># Determine cluster under the line<\/p>\n<p>clust = cutreeStatic(sampleTree, cutHeight = 15, minSize = 10)<\/p>\n<p>table(clust)<\/p>\n<p># clust 1 contains the samples we want to keep.<\/p>\n<p>keepSamples = (clust==1)<\/p>\n<p>datExpr = datExpr0[keepSamples, ]<\/p>\n<p>nGenes = ncol(datExpr)<\/p>\n<p>nSamples = nrow(datExpr)<\/p>\n<p>rownames(datExpr0)[!keepSamples]<\/p>\n<p>### 1.6\u8bfb\u5165\u4e34\u5e8a\u8868\u578b\u6570\u636e<\/p>\n<p>traitData = read.csv(&#8220;ClinicalTraits.csv&#8221;);<\/p>\n<p>dim(traitData)<\/p>\n<p>names(traitData)<\/p>\n<p># remove columns that hold information we do not need.<\/p>\n<p>allTraits = traitData[, -c(31, 16)];<\/p>\n<p>allTraits = allTraits[, c(2, 11:36) ];<\/p>\n<p>dim(allTraits)<\/p>\n<p>names(allTraits)<\/p>\n<p># Form a data frame analogous to expression data that will hold the clinical traits.<\/p>\n<p>femaleSamples = rownames(datExpr);<\/p>\n<p>traitRows = match(femaleSamples, allTraits$Mice);<\/p>\n<p>datTraits = allTraits[traitRows, -1];<\/p>\n<p>rownames(datTraits) = allTraits[traitRows, 1];<\/p>\n<p>collectGarbage();<\/p>\n<p>### 1.7\u518d\u6b21\u5bf9\u5220\u6389\u79bb\u7fa4\u503c\u7684<a id=\"post-25573-OLE_LINK3\"><\/a>\u6837\u672c\u8fdb\u884c\u805a\u7c7b<\/p>\n<p># Re-cluster samples<\/p>\n<p>sampleTree2 = hclust(dist(datExpr), method = &#8220;average&#8221;)<\/p>\n<p># Convert traits to a color representation: white means low, red means high, grey means missing entry<\/p>\n<p>traitColors = numbers2colors(datTraits, signed = FALSE);<\/p>\n<p># Plot the sample dendrogram and the colors underneath.<\/p>\n<p>plotDendroAndColors(sampleTree2, traitColors,<\/p>\n<p>groupLabels = names(datTraits),<\/p>\n<p>main = &#8220;Sample dendrogram and trait heatmap&#8221;)<\/p>\n<p><strong>\u7ed8\u5236\u6837\u672c\u6811\u805a\u7c7b\u6811\u548c\u8868\u578b\u70ed\u56fe<\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"332\" class=\"wp-image-25575\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-2.png?resize=640%2C332\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-2.png?w=1920 1920w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-2.png?resize=300%2C156 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-2.png?resize=1024%2C532 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-2.png?resize=768%2C399 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-2.png?resize=1536%2C798 1536w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-2.png?resize=600%2C312 600w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-2.png?w=1280 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>### 1.8\u4fdd\u5b58\u8868\u578b\u548c\u57fa\u56e0\u8868\u8fbe\u6570\u636e\uff0c\u4ee5\u4fbf\u540e\u7eed\u5206\u6790<\/p>\n<p>save(datExpr, datTraits, file = &#8220;FemaleLiver-01-dataInput.RData&#8221;)<\/p>\n<p><a id=\"post-25573-OLE_LINK1\"><\/a> Step2\u7f51\u7edc\u642d\u5efa\u53ca\u6a21\u5757\u68c0\u6d4b<\/p>\n<p><a id=\"post-25573-OLE_LINK4\"><\/a> ### 2.1 \u6311\u9009\u6700\u4f73\u9608\u503cpower<\/p>\n<p># Load the data saved in the first part<\/p>\n<p>lnames = load(file = &#8220;FemaleLiver-01-dataInput.RData&#8221;);<\/p>\n<p>#The variable lnames contains the names of loaded variables.<\/p>\n<p>lnames<\/p>\n<p># Choose a set of soft-thresholding powers<\/p>\n<p>powers = c(c(1:10), seq(from = 12, to=20, by=2))<\/p>\n<p># Call the network topology analysis function<\/p>\n<p>sft = pickSoftThreshold(datExpr, powerVector = powers, verbose = 5)<\/p>\n<p># Plot the results:<\/p>\n<p>sizeGrWindow(9, 5)<\/p>\n<p>par(mfrow = c(1,2));<\/p>\n<p>cex1 = 0.9;<\/p>\n<p># Scale-free topology fit index as a function of the soft-thresholding power<\/p>\n<p>plot(sft$fitIndices[,1], -sign(sft$fitIndices[,3])*sft$fitIndices[,2],<\/p>\n<p>xlab=&#8221;Soft Threshold (power)&#8221;,ylab=&#8221;Scale Free Topology Model Fit,signed R^2&#8243;,type=&#8221;n&#8221;,<\/p>\n<p>main = paste(&#8220;Scale independence&#8221;));<\/p>\n<p>text(sft$fitIndices[,1], -sign(sft$fitIndices[,3])*sft$fitIndices[,2],<\/p>\n<p>labels=powers,cex=cex1,col=&#8221;red&#8221;);<\/p>\n<p># this line corresponds to using an R^2 cut-off of h<\/p>\n<p>abline(h=0.90,col=&#8221;red&#8221;)<\/p>\n<p># Mean connectivity as a function of the soft-thresholding power<\/p>\n<p>plot(sft$fitIndices[,1], sft$fitIndices[,5],<\/p>\n<p>xlab=&#8221;Soft Threshold (power)&#8221;,ylab=&#8221;Mean Connectivity&#8221;, type=&#8221;n&#8221;,<\/p>\n<p>main = paste(&#8220;Mean connectivity&#8221;))<\/p>\n<p>text(sft$fitIndices[,1], sft$fitIndices[,5], labels=powers, cex=cex1,col=&#8221;red&#8221;)<\/p>\n<p><strong>\u6311\u9009\u6700\u4f73\u9608\u503cpower<\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"353\" class=\"wp-image-25576\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-3.png?resize=640%2C353\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-3.png?w=856 856w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-3.png?resize=300%2C165 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-3.png?resize=768%2C423 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-3.png?resize=600%2C331 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>power = sft$powerEstimate<\/p>\n<p>sft$powerEstimate<\/p>\n<p># \u82e5\u65e0\u5411\u7f51\u7edc\u5728power\u5c0f\u4e8e15\u6216\u6709\u5411\u7f51\u7edcpower\u5c0f\u4e8e30\u5185\uff0c\u6ca1\u6709\u4e00\u4e2apower\u503c\u4f7f<\/p>\n<p># \u65e0\u6807\u5ea6\u7f51\u7edc\u56fe\u8c31\u7ed3\u6784R^2\u8fbe\u52300.8\u4e14\u5e73\u5747\u8fde\u63a5\u5ea6\u5728100\u4ee5\u4e0b\uff0c\u53ef\u80fd\u662f\u7531\u4e8e<\/p>\n<p># \u90e8\u5206\u6837\u54c1\u4e0e\u5176\u4ed6\u6837\u54c1\u5dee\u522b\u592a\u5927\u3002\u8fd9\u53ef\u80fd\u7531\u6279\u6b21\u6548\u5e94\u3001\u6837\u54c1\u5f02\u8d28\u6027\u6216\u5b9e\u9a8c\u6761\u4ef6\u5bf9<\/p>\n<p># \u8868\u8fbe\u5f71\u54cd\u592a\u5927\u7b49\u9020\u6210\u3002\u53ef\u4ee5\u901a\u8fc7\u7ed8\u5236\u6837\u54c1\u805a\u7c7b\u67e5\u770b\u5206\u7ec4\u4fe1\u606f\u548c\u6709\u65e0\u5f02\u5e38\u6837\u54c1\u3002<\/p>\n<p># \u5982\u679c\u8fd9\u786e\u5b9e\u662f\u7531\u6709\u610f\u4e49\u7684\u751f\u7269\u53d8\u5316\u5f15\u8d77\u7684\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u7ecf\u9a8cpower\u503c\u3002<\/p>\n<p>if(is.na(power)){<\/p>\n<p># \u5b98\u65b9\u63a8\u8350 &#8220;signed&#8221; \u6216 &#8220;signed hybrid&#8221;<\/p>\n<p># \u4e3a\u4e0e\u539f\u6587\u6863\u4e00\u81f4\uff0c\u6545\u672a\u4fee\u6539<\/p>\n<p>type = &#8220;unsigned&#8221;<\/p>\n<p>nSamples=nrow(datExpr)<\/p>\n<p>power = ifelse(nSamples&lt;20, ifelse(type == &#8220;unsigned&#8221;, 9, 18),<\/p>\n<p>ifelse(nSamples&lt;30, ifelse(type == &#8220;unsigned&#8221;, 8, 16),<\/p>\n<p>ifelse(nSamples&lt;40, ifelse(type == &#8220;unsigned&#8221;, 7, 14),<\/p>\n<p>ifelse(type == &#8220;unsigned&#8221;, 6, 12))<\/p>\n<p>)<\/p>\n<p>)<\/p>\n<p>}<\/p>\n<p>### 2.2\u4e00\u6b65\u6cd5\u6784\u5efa\u52a0\u6743\u5171\u8868\u8fbe\u7f51\u7edc\uff0c\u8bc6\u522b\u57fa\u56e0\u6a21\u5757<\/p>\n<p>net = blockwiseModules(datExpr, power = power,<\/p>\n<p>TOMType = &#8220;unsigned&#8221;, minModuleSize = 30,<\/p>\n<p>reassignThreshold = 0, mergeCutHeight = 0.25,<\/p>\n<p>numericLabels = TRUE, pamRespectsDendro = FALSE,<\/p>\n<p>saveTOMs = TRUE,<\/p>\n<p>saveTOMFileBase = &#8220;femaleMouseTOM&#8221;,<\/p>\n<p>verbose = 3)<\/p>\n<p>### 2.4\u6a21\u5757\u53ef\u89c6\u5316\uff0c\u5c42\u7ea7\u805a\u7c7b\u6811\u5c55\u793a\u5404\u4e2a\u6a21\u5757<\/p>\n<p>sizeGrWindow(12, 9)<\/p>\n<p># Convert labels to colors for plotting<\/p>\n<p>mergedColors = labels2colors(net$colors)<\/p>\n<p># Plot the dendrogram and the module colors underneath<\/p>\n<p>plotDendroAndColors(net$dendrograms[[1]], mergedColors[net$blockGenes[[1]]],<\/p>\n<p>&#8220;Module colors&#8221;,<\/p>\n<p>dendroLabels = FALSE, hang = 0.03,<\/p>\n<p>addGuide = TRUE, guideHang = 0.05)<\/p>\n<p><strong>\u6a21\u5757\u5c42\u7ea7\u805a\u7c7b\u6811<\/strong> <img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"479\" class=\"wp-image-25577\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-4.png?resize=640%2C479\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-4.png?w=1144 1144w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-4.png?resize=300%2C224 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-4.png?resize=1024%2C766 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-4.png?resize=768%2C575 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-4.png?resize=600%2C449 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>### 2.5\u4fdd\u5b58\u7ed3\u679c<\/p>\n<p>moduleLabels = net$colors<\/p>\n<p>moduleColors = labels2colors(net$colors)<\/p>\n<p>MEs = net$MEs;<\/p>\n<p>geneTree = net$dendrograms[[1]];<\/p>\n<p>save(MEs, moduleLabels, moduleColors, geneTree,<\/p>\n<p>file = &#8220;FemaleLiver-02-networkConstruction-auto.RData&#8221;)<\/p>\n<p>Step3 <a id=\"post-25573-OLE_LINK5\"><\/a>\u6a21\u5757\u4e0e\u5916\u90e8\u4e34\u5e8a\u7279\u5f81\u90fd\u76f8\u5173\u5173\u7cfb<\/p>\n<p>## 3.1\u6570\u636e\u51c6\u5907<\/p>\n<p>load(file = &#8220;FemaleLiver-01-dataInput.RData&#8221;);<\/p>\n<p>load(file = &#8220;FemaleLiver-02-networkConstruction-auto.RData&#8221;);<\/p>\n<p># Define numbers of genes and samples<\/p>\n<p>nGenes = ncol(datExpr);<\/p>\n<p>nSamples = nrow(datExpr);<\/p>\n<p># Recalculate MEs with color labels<\/p>\n<p>MEs0 = moduleEigengenes(datExpr, moduleColors)$eigengenes<\/p>\n<p>MEs = orderMEs(MEs0)<\/p>\n<p>moduleTraitCor = cor(MEs, datTraits, use = &#8220;p&#8221;);<\/p>\n<p>moduleTraitPvalue = corPvalueStudent(moduleTraitCor, nSamples);<\/p>\n<p>## 3.2\u6a21\u5757\u4e0e\u8868\u578b\u7684\u76f8\u5173\u6027\u70ed\u56fe<\/p>\n<p>sizeGrWindow(10,6)<\/p>\n<p># Will display correlations and their p-values<\/p>\n<p>textMatrix = paste(signif(moduleTraitCor, 2), &#8220;\\n(&#8220;,<\/p>\n<p>signif(moduleTraitPvalue, 1), &#8220;)&#8221;, sep = &#8220;&#8221;);<\/p>\n<p>dim(textMatrix) = dim(moduleTraitCor)<\/p>\n<p>par(mar = c(6, 8.5, 3, 3));<\/p>\n<p># Display the correlation values within a heatmap plot<\/p>\n<p>labeledHeatmap(Matrix = moduleTraitCor,<\/p>\n<p>xLabels = names(datTraits),<\/p>\n<p>yLabels = names(MEs),<\/p>\n<p>ySymbols = names(MEs),<\/p>\n<p>colorLabels = FALSE,<\/p>\n<p>colors = greenWhiteRed(50),<\/p>\n<p>textMatrix = textMatrix,<\/p>\n<p>setStdMargins = FALSE,<\/p>\n<p>cex.text = 0.5,<\/p>\n<p>zlim = c(-1,1),<\/p>\n<p>main = paste(&#8220;Module-trait relationships&#8221;))<\/p>\n<p><strong>\u6a21\u5757\u4e0e\u8868\u578b\u7684\u76f8\u5173\u6027\u70ed\u56fe<\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"382\" class=\"wp-image-25578\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-5.png?resize=640%2C382\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-5.png?w=952 952w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-5.png?resize=300%2C179 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-5.png?resize=768%2C458 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/01\/word-image-25573-5.png?resize=600%2C358 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>\u6ce8\uff1a<\/p>\n<p># \u8bf7\u786e\u4fdd\u5c06\u8def\u5f84&#8221;LiverFemale3600.csv&#8221;,\u201dClinicalTraits.csv\u201d\u66ff\u6362\u4e3a\u5b9e\u9645\u6570\u636e\u96c6\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u5e76\u6839\u636e\u9700\u8981\u8c03\u6574\u6a21\u578b\u53c2\u6570\u548c\u5176\u4ed6\u914d\u7f6e\u3002<\/p>\n<p>\u5173\u4e8eWGCNA\u5206\u6790\uff0c\u5c0f\u679c\u5f3a\u70c8\u63a8\u8350\u5927\u5bb6\u4f7f\u7528\u4e91\u751f\u4fe1\u5e73\u53f0\uff08<a href=\"http:\/\/www.biocloudservice.com\/home.html\u3002\">http:\/\/www.biocloudservice.com\/home.html<\/a>\uff09\u8fdb\u884cWGCNA\u5206\u6790\u4ee5\u53ca\u5176\u4ed6\u751f\u4fe1\u5206\u6790\u4efb\u52a1\u3002\u4e91\u751f\u4fe1\u5e73\u53f0\u662f\u4e00\u4e2a\u5f3a\u5927\u800c\u6709\u8da3\u7684\u5728\u7ebf\u5de5\u5177\uff0c\u4e3a\u7528\u6237\u63d0\u4f9b\u4e86\u7b80\u5355\u3001\u5feb\u901f\u548c\u53ef\u89c6\u5316\u7684\u751f\u7269\u4fe1\u606f\u5b66\u5206\u6790\u4f53\u9a8c\u3002\u4f7f\u7528\u4e91\u751f\u4fe1\u5e73\u53f0\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u4e0a\u4f20\u548c\u5904\u7406\u57fa\u56e0\u8868\u8fbe\u6570\u636e\uff0c\u8fdb\u884cWGCNA\u5206\u6790\uff0c\u5e76\u83b7\u5f97\u8be6\u7ec6\u7684\u7ed3\u679c\u548c\u56fe\u8868\u5c55\u793a\u3002\u4f60\u53ef\u4ee5\u63a2\u7d22\u57fa\u56e0\u4e4b\u95f4\u7684\u5171\u8868\u8fbe\u7f51\u7edc\u3001\u53d1\u73b0\u5173\u952e\u6a21\u5757\u3001\u5206\u6790\u6a21\u5757\u4e0e\u4e34\u5e8a\u7279\u5f81\u7684\u76f8\u5173\u6027\u7b49\u3002\u540c\u65f6\uff0c\u4e91\u751f\u4fe1\u5e73\u53f0\u8fd8\u63d0\u4f9b\u4e86\u8bb8\u591a\u5176\u4ed6\u751f\u4fe1\u5206\u6790\u5de5\u5177\u548c\u529f\u80fd\uff0c\u5982\u5dee\u5f02\u8868\u8fbe\u5206\u6790\u3001\u529f\u80fd\u5bcc\u96c6\u5206\u6790\u3001\u57fa\u56e0\u8c03\u63a7\u7f51\u7edc\u5206\u6790\u7b49\uff0c\u5e2e\u52a9\u4f60\u66f4\u5168\u9762\u5730\u7406\u89e3\u548c\u89e3\u91ca\u4f60\u7684\u6570\u636e\u3002\u4f7f\u7528\u4e91\u751f\u4fe1\u5e73\u53f0\u8fdb\u884cWGCNA\u5206\u6790\u4e0d\u4ec5\u65b9\u4fbf\u5feb\u6377\uff0c\u8fd8\u80fd\u591f\u8282\u7701\u5927\u91cf\u7684\u8ba1\u7b97\u8d44\u6e90\u548c\u65f6\u95f4\u3002\u4f60\u53ef\u4ee5\u968f\u65f6\u968f\u5730\u8bbf\u95ee\u5e73\u53f0\uff0c\u65e0\u9700\u5b89\u88c5\u4efb\u4f55\u8f6f\u4ef6\uff0c\u76f4\u63a5\u5728\u6d4f\u89c8\u5668\u4e2d\u8fdb\u884c\u5206\u6790\u3002\u5e73\u53f0\u63d0\u4f9b\u53cb\u597d\u7684\u7528\u6237\u754c\u9762\u548c\u4ea4\u4e92\u5f0f\u64cd\u4f5c\uff0c\u4f7f\u5f97\u590d\u6742\u7684\u5206\u6790\u53d8\u5f97\u7b80\u5355\u6613\u61c2\u3002\u65e0\u8bba\u4f60\u662f\u751f\u7269\u5b66\u7814\u7a76\u8005\u3001\u751f\u7269\u4fe1\u606f\u5b66\u5bb6\u8fd8\u662f\u5b66\u751f\uff0c\u4e91\u751f\u4fe1\u5e73\u53f0\u90fd\u80fd\u6ee1\u8db3\u4f60\u7684\u5206\u6790\u9700\u6c42\uff0c\u5e76\u5e2e\u52a9\u4f60\u63a2\u7d22\u6570\u636e\u80cc\u540e\u7684\u5965\u79d8\u3002\u6240\u4ee5\uff0c\u8d76\u5feb\u6765\u4f53\u9a8c\u4e91\u751f\u4fe1\u5e73\u53f0\u5427\uff01\u8ba9\u751f\u4fe1\u5206\u6790\u53d8\u5f97\u66f4\u6709\u8da3\u3001\u66f4\u9ad8\u6548\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f15\u8a00\uff1a \u968f\u7740\u9ad8\u901a\u91cf\u6d4b\u5e8f\u6280\u672f\u7684\u5feb\u901f\u53d1\u5c55\uff0c\u6211\u4eec\u80fd\u591f\u83b7\u53d6\u5927\u91cf\u57fa\u56e0\u8868\u8fbe\u6570\u636e\uff0c\u8fd9\u4e3a\u6211\u4eec\u6df1\u5165\u7406\u89e3\u57fa\u56e0\u8c03\u63a7\u7f51\u7edc\u63d0\u4f9b\u4e86\u5de8\u5927\u7684\u673a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":""},"categories":[1],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/25573"}],"collection":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=25573"}],"version-history":[{"count":1,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/25573\/revisions"}],"predecessor-version":[{"id":25579,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/25573\/revisions\/25579"}],"wp:attachment":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=25573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=25573"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=25573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}