{"id":28854,"date":"2024-02-19T17:53:45","date_gmt":"2024-02-19T09:53:45","guid":{"rendered":"http:\/\/www.biocloudservice.com\/wordpress\/?p=28854"},"modified":"2024-02-19T17:53:46","modified_gmt":"2024-02-19T09:53:46","slug":"%e5%88%86%e7%b1%bb%e5%8f%98%e9%87%8f%e7%83%ad%e5%9b%be%e7%bb%98%e5%88%b6","status":"publish","type":"post","link":"http:\/\/www.biocloudservice.com\/wordpress\/?p=28854","title":{"rendered":"\u5206\u7c7b\u53d8\u91cf\u70ed\u56fe\u7ed8\u5236"},"content":{"rendered":"<p>\u4eca\u5929\u5c0f\u679c\u7ed8\u5236\u4e00\u4e0b\u5206\u7c7b\u53d8\u91cf\u53d8\u91cf\u70ed\u56fe\uff0c\u7ed8\u5236\u8be5\u56fe\u9700\u8981\u4e09\u4e2a\u8f93\u5165\u6587\u4ef6\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\u5b89\u88c5\u6240\u9700\u8981\u7684R\u5305<\/li>\n<\/ol>\n<p>BiocManager::install(\u201cComplexHeatmap\u201d)<\/p>\n<ol>\n<li>\u5bfc\u5165\u9700\u8981\u7684R\u5305<\/li>\n<\/ol>\n<p>library(ComplexHeatmap)<\/p>\n<ol>\n<li>\u5bfc\u5165\u6570\u636e<\/li>\n<\/ol>\n<p>#\u5dee\u5f02\u8868\u8fbe\u5206\u6790\u4e2d\u7684logFC<\/p>\n<p>logfc &lt;- read.csv(&#8220;logFc.csv&#8221;, row.names = 1)<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"146\" class=\"wp-image-28855\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129155507.jpeg?resize=640%2C146\" alt=\"Dingtalk_20230129155507\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129155507.jpeg?w=1267 1267w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129155507.jpeg?resize=300%2C68 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129155507.jpeg?resize=1024%2C234 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129155507.jpeg?resize=768%2C175 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129155507.jpeg?resize=600%2C137 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>#\u5dee\u5f02\u5206\u6790\u4e2d\u7684P\u503c<\/p>\n<p>p.val &lt;- read.csv(&#8220;PVal.csv&#8221;, row.names = 1)<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"184\" class=\"wp-image-28856\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129155918.jpeg?resize=640%2C184\" alt=\"Dingtalk_20230129155918\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129155918.jpeg?w=1087 1087w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129155918.jpeg?resize=300%2C86 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129155918.jpeg?resize=1024%2C294 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129155918.jpeg?resize=768%2C220 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129155918.jpeg?resize=600%2C172 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>#\u57fa\u56e0\u5206\u7ec4<\/p>\n<p>genetype &lt;- read.csv(&#8220;genetype.csv&#8221;)<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"284\" class=\"wp-image-28857\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129160103.jpeg?resize=640%2C284\" alt=\"Dingtalk_20230129160103\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129160103.jpeg?w=860 860w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129160103.jpeg?resize=300%2C133 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129160103.jpeg?resize=768%2C340 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129160103.jpeg?resize=600%2C266 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>3.\u4ee3\u7801\u5c55\u793a<\/p>\n<p>#\u4e3a\u786e\u4fdd\u70ed\u56fe\u57fa\u56e0\u7684\u987a\u5e8f\u548c\u5206\u7ec4\u6587\u4ef6\u7684\u987a\u5e8f\u662f\u4e00\u81f4\u7684<\/p>\n<p>#\u56e0\u6b64\u6309\u7167\u57fa\u56e0\u5206\u7ec4\u6587\u4ef6\u91cc\u7684\u987a\u5e8f\uff0c\u5bf9logfc\u548cp.val\u4e24\u4e2a\u6587\u4ef6\u6392\u5e8f<\/p>\n<p>logfcOrdered &lt;- logfc[genetype$gene,]<\/p>\n<p>p.valOrdered &lt;- p.val[genetype$gene,]<\/p>\n<p>## \u5bf9logfc\u8fdb\u884c\u5206\u7c7b<\/p>\n<p>logfcCat &lt;- apply(logfcOrdered, 2, function(x){<\/p>\n<p>cut(x, breaks = c(-Inf, -2, -1, 1, 2, Inf),<\/p>\n<p>labels = c(&#8220;&lt; -2&#8221;, &#8220;-2 &#8211; -1&#8221;, &#8220;-1 &#8211; 1&#8221;, &#8220;1 &#8211; 2&#8221;, &#8220;&gt; 2&#8221;))<\/p>\n<p>})<\/p>\n<p>rownames(logfcCat) &lt;- rownames(logfcOrdered)<\/p>\n<p>## \u786e\u4fdd\u4e24\u4e2a\u6570\u636e\u96c6\u7684\u5217\u540d\u548c\u884c\u540d\u987a\u5e8f\u4e00\u81f4<\/p>\n<p>if(!identical(rownames(logfcCat), rownames(p.valOrdered))) p.valOrdered &lt;- p.valOrdered[rownames(logfcCat),]<\/p>\n<p>if(!identical(colnames(logfcCat), colnames(p.valOrdered))) p.valOrdered &lt;- p.valOrdered[colnames(logfcCat)]<\/p>\n<p>## \u628aP&gt; 0.05\u7684\u6570\u636e\u6807\u8bb0\u4e3a P &gt; 0.05<\/p>\n<p>logfcCat[p.valOrdered &gt;= 0.05] &lt;- &#8220;P &gt;= 0.05&#8221;<\/p>\n<p>## \u6bcf\u4e2a\u5206\u7c7b\u5b9a\u4e49\u4e00\u4e2a\u989c\u8272<\/p>\n<p>col_cat &lt;- c(&#8220;&gt; 2&#8221; = &#8220;#A80C3A&#8221;, &#8220;1 &#8211; 2&#8221; = &#8220;#ED5E57&#8221;, &#8220;-1 &#8211; 1&#8221; = &#8220;#DDD3D2&#8221;,<\/p>\n<p>&#8220;-2 &#8211; -1&#8221; = &#8220;#6B9AB7&#8221;, &#8220;&lt; -2&#8221; = &#8220;#2F5B89&#8221;, &#8220;P &gt;= 0.05&#8221; = &#8220;white&#8221;)<\/p>\n<p>cell_fun &lt;- function(logfc, dataP, logfcCutoff = 1, PCutoff = 0.05,<\/p>\n<p>darkcol = &#8220;black&#8221;, lightcol = &#8220;white&#8221;, digit = 2, fontsize = 6){<\/p>\n<p>function(j, i, x, y, width, height, fill){<\/p>\n<p>if(abs(logfc[i,j]) &gt; logfcCutoff &amp; dataP[i,j] &lt; PCutoff){<\/p>\n<p>grid.text(round(logfc, digit)[i, j], x, y,<\/p>\n<p>gp = gpar(fontsize = fontsize, col = lightcol))<\/p>\n<p>}else{<\/p>\n<p>grid.text(round(logfc, digit)[i, j], x, y,<\/p>\n<p>gp = gpar(fontsize = fontsize, col = darkcol))<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>## \u5b9a\u4e49\u6ce8\u91ca\u4fe1\u606f<\/p>\n<p>row_an &lt;- HeatmapAnnotation(type = genetype$type, ##\u6ce8\u91ca\u4fe1\u606f\u7684\u5185\u5bb9<\/p>\n<p>show_annotation_name = F, ## \u662f\u5426\u663e\u793a\u6ce8\u91ca\u7684\u6807\u9898<\/p>\n<p>col = list(type = an_col), ## \u6ce8\u91ca\u4fe1\u606f\u7684\u989c\u8272<\/p>\n<p>show_legend = T, ## \u662f\u5426\u663e\u793a\u6ce8\u91ca\u4fe1\u606f\u7684\u8bf4\u660e<\/p>\n<p>annotation_legend_param = list(title = &#8220;MMP Subtype&#8221;), ## \u6ce8\u91ca\u4fe1\u606f\u56fe\u4f8b\u7684\u6807\u9898<\/p>\n<p>which = &#8220;row&#8221;) #\u5bf9\u884c\u6216\u8005\u5217\u8fdb\u884c\u6ce8\u91ca<\/p>\n<p>pdf(&#8220;rankHeatmap.pdf&#8221;, width = 8, height = 4)<\/p>\n<p>Heatmap(matrix = logfcCat,<\/p>\n<p>name = &#8220;logFC&#8221;, #\u4e3b\u8981\u56fe\u4f8b\u7684\u6807\u9898<\/p>\n<p>rect_gp = gpar(col = &#8220;NA&#8221;, lwd = 1), #\u4e0d\u753b\u8fb9\u6846\uff0c\u6216\u8005\u7528col = &#8220;grey&#8221;\u753b\u7070\u8272\u8fb9\u6846<\/p>\n<p>col = col_cat, #\u70ed\u56fe\u989c\u8272<\/p>\n<p>row_names_side = &#8220;left&#8221;,<\/p>\n<p>cell_fun = cell_fun(logfcOrdered, p.valOrdered),<\/p>\n<p>row_names_gp = gpar(fontsize = 8), #\u57fa\u56e0\u540d\u5b57\u53f7<\/p>\n<p>column_names_gp = gpar(fontsize = 8), #\u80bf\u7624\u7c7b\u578b\u5b57\u53f7<\/p>\n<p>column_names_rot = 45, #\u80bf\u7624\u7c7b\u578b\u544845\u5ea6<\/p>\n<p>left_annotation = row_an) #\u5de6\u4fa7\u57fa\u56e0\u5206\u7c7b\uff0c\u5982\u679c\u4e0d\u753b\uff0c\u5c31\u7b5b\u6389\u8fd9\u4e2a\u53c2\u6570<\/p>\n<p>dev.off()<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"326\" class=\"wp-image-28858\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129161403.jpeg?resize=640%2C326\" alt=\"Dingtalk_20230129161403\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129161403.jpeg?w=1234 1234w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129161403.jpeg?resize=300%2C153 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129161403.jpeg?resize=1024%2C522 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129161403.jpeg?resize=768%2C391 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/dingtalk_20230129161403.jpeg?resize=600%2C306 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>\u6700\u7ec8\u5c0f\u679c\u7ed8\u5236\u51fa\u4e86\u5206\u7c7b\u53d8\u91cf\u70ed\u56fe\uff0c\u770b\u8d77\u6765\u6548\u679c\u4e0d\u9519\uff0c\u6709\u9700\u8981\u7684\u53ef\u4ee5\u501f\u9274\u5b66\u4e60\u5965\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u5c0f\u679c\u7ed8\u5236\u4e00\u4e0b\u5206\u7c7b\u53d8\u91cf\u53d8\u91cf\u70ed\u56fe\uff0c\u7ed8\u5236\u8be5\u56fe\u9700\u8981\u4e09\u4e2a\u8f93\u5165\u6587\u4ef6\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a \u5b89\u88c5\u6240\u9700\u8981\u7684R\u5305 BiocManage [&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\/28854"}],"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=28854"}],"version-history":[{"count":1,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/28854\/revisions"}],"predecessor-version":[{"id":28859,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/28854\/revisions\/28859"}],"wp:attachment":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=28854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=28854"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=28854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}