{"id":183,"date":"2022-01-02T15:25:57","date_gmt":"2022-01-02T07:25:57","guid":{"rendered":"https:\/\/linguopeng.top\/?p=183"},"modified":"2022-01-02T15:30:57","modified_gmt":"2022-01-02T07:30:57","slug":"nc%e7%81%ab%e5%b1%b1%e5%9b%be","status":"publish","type":"post","link":"https:\/\/linguopeng.top\/?p=183","title":{"rendered":"NC\u706b\u5c71\u56fe"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>#Kruse T, Benz C, Garvanska DH, Lindqvist R, Mihalic F, Coscia F, Inturi R, Sayadi A, Simonetti L, Nilsson E, Ali #M, Kliche J, Moliner Morro A, Mund A, Andersson E, McInerney G, Mann M, Jemth P, Davey NE, \u00d6verby AK, Nilsson J, #Ivarsson Y. Large scale discovery of coronavirus-host factor protein interaction motifs reveals SARS-CoV-2 #specific mechanisms and vulnerabilities. Nat Commun. 2021 Nov 19;12(1):6761. doi: 10.1038\/s41467-021-26498-z. #PMID: 34799561; PMCID: PMC8605023.\n# \u52a0\u8f7dR\u5305\nlibrary(ggplot2)\nlibrary(tidyverse)\n\n#####################################\n# \u66f2\u7ebf\nfun1 &lt;- function(x){\n  input = c(seq(-x,-0.001,0.0001),seq(0.001,x,0.0001))\n  y = 1\/input\n  # \u5408\u5e76\u4e3adataframe\u683c\u5f0f\n  df = data.frame(x = input,y = y)\n}\n\n# \u751f\u6210\u66f2\u7ebf\u6570\u636e\ndf &lt;- fun1(5)\n\n# \u7ed8\u56fe\nggplot(df,aes(x = x,y = y)) +\n  geom_point(size = 1) +\n  theme_grey(base_size = 18) +\n  ylim(-250,250)\n\n######################################\n#\u5012\u5587\u53ed\u5f62\nfun2 &lt;- function(x){\n  input = seq(0.001,x,0.001)\n  y = 1\/abs(input)\n  # \u5408\u5e76\u4e3adataframe\u683c\u5f0f\n  df1 = data.frame(x = input,y = y)\n  df2 = data.frame(x = -(input),y = y)\n  # \u5408\u5e76\n  res &lt;- rbind(df1,df2)\n  return(res)\n}\n\n# \u751f\u6210\u66f2\u7ebf\u6570\u636e\ndf &lt;- fun2(5)\n\n# \u7ed8\u56fe\nggplot(df,aes(x = x,y = y)) +\n  geom_point(size = 1) +\n  theme_grey(base_size = 18) +\n  ylim(0,5)\n\n\n##############################\n# \u5e73\u79fb-log10 pvalue\nfun3 &lt;- function(x){\n  input = seq(0.001,x,0.001)\n  y = 1\/abs(input) + -log10(0.05)\n  # \u5408\u5e76\u4e3adataframe\u683c\u5f0f\n  df1 = data.frame(x = input,y = y)\n  df2 = data.frame(x = -(input),y = y)\n  # \u5408\u5e76\n  res &lt;- rbind(df1,df2)\n  return(res)\n}\n\n# \u751f\u6210\u66f2\u7ebf\u6570\u636e\ndf &lt;- fun3(5)\n\n# \u7ed8\u56fe\nggplot(df,aes(x = x,y = y)) +\n  geom_point(size = 1) +\n  theme_grey(base_size = 18) +\n  ylim(0,5)\n\n###########################################\n# \u52a0\u8f7d\u6570\u636e\nvoca &lt;- read.delim('.\/vocalnodata.txt',header = T)\n\n# \u67e5\u770b\u6570\u636e\nhead(voca,3)\n\n# \u6311\u9009\u9700\u8981\u6807\u8bb0\u7684\u57fa\u56e0\nfilter_data &lt;- voca %&gt;% filter(gene_name %in% c(\"NCAP MERS\",\"NCAP SARS\",\n                                                \"G3BP1\",\"G3BP2\"))\n\n# \u91cd\u547d\u540d\nfilter_data&#91;c(1,4),1] &lt;- c('MERS-CoV N (bait)','SARS-CoV-2 N (bait)')\n\n# \u6dfb\u52a0\u57fa\u56e0\u5206\u7ec4\nfilter_data$type &lt;- c('a','b','b','c')\n\n# \u67e5\u770b\u6570\u636e\nfilter_data\n\n# \u6dfb\u52a0\u66f2\u7ebf\u7684y\u8f74\nvoca$curve_y &lt;- ifelse(voca$log2FC &lt; 0,1\/abs(voca$log2FC) + -log10(0.05),\n                 1\/voca$log2FC + -log10(0.05))\n\n# \u7ed8\u5236\u706b\u5c71\u56fe\np &lt;- ggplot(voca,aes(x = log2FC,y = logPvalue)) +\n  # \u70b9\u56fe\u5c42\n  geom_point(size = 3,shape = 19,alpha = 0.2) +\n  theme_classic(base_size = 16) +\n  # \u4e3b\u9898\u7ec6\u8282\n  theme(axis.ticks.length = unit(0.3,'cm'),\n        aspect.ratio = 0.8) +\n  # y\u8f74\u663e\u793a\u8303\u56f4\u53ca\u523b\u5ea6\n  scale_x_continuous(breaks = seq(-8,8,2)) +\n  # xy\u8f74\u6807\u7b7e\n  xlab('Relative protein level\\n (SARS-CoV-2 N vs MERS-CoV N,log2)') +\n  ylab('T-test p-value (-log10)') +\n  # \u6dfb\u52a0\u6587\u5b57\u6ce8\u91ca\n  annotate(geom = 'text',x = -5,y = 7,\n           size = 5,\n           label = 'MERS-CoV N\\n specific') +\n  annotate(geom = 'text',x = 5,y = 7,\n           size = 5,\n           label = 'SARS-CoV-2 N\\n specific')\n\np\n\n# \u6dfb\u52a0\u66f2\u7ebf\u56fe\u5c42\np0 &lt;- p +\n  geom_line(aes(y = curve_y),\n            size = 1,lty = 'dashed',color = 'grey') +\n  # \u9650\u5236Y\u8f74\n  ylim(0,8)\n\np0\n\n# \u6dfb\u52a0\u57fa\u56e0\u6ce8\u91ca\np1 &lt;- p0 + \n  geom_point(data = filter_data,aes(x = log2FC,y = logPvalue,\n                                    color = type),\n             size = 5,show.legend = F)\n\np1\n\n# \u6dfb\u52a0\u57fa\u56e0\u540d,\u4fee\u6539\u989c\u8272\np1 + \n  geom_text(data = filter_data,aes(label = gene_name,color = type),\n            nudge_y = 0.3,nudge_x = 0,\n            size = 4.5,fontface = 'italic',\n            show.legend = F) +\n  # \u4fee\u6539\u989c\u8272\n  scale_color_manual(values = c('a'='#FFCA03','b'='#396EB0','c'='#F90716'))\n\n\n######################################################\n# \u7b2c\u4e8c\u79cd\u706b\u5c71\u56fe\n\n# \u8ba1\u7b97\u8bc4\u4f30y\u503c\u548cx\u503c\nvoca$estimate.p &lt;- 1\/abs(voca$log2FC) + -log10(0.05)\nvoca$estimate.log2fc &lt;- ifelse(voca$log2FC &lt; 0,1\/(voca$logPvalue + log10(0.05)),\n                               1\/(voca$logPvalue + log10(0.05)))\n\n# \u6309\u89c4\u5219\u5206\u7c7b\nvoca$regulation &lt;- ifelse(abs(voca$estimate.log2fc) &lt;= abs(voca$log2FC) &amp; voca$logPvalue &gt;= voca$estimate.p,\n                          ifelse(voca$estimate.log2fc &lt;= voca$log2FC,'UP','DOWN'),'None-Sig')\n\n# \u67e5\u770b\u57fa\u56e0\u60c5\u51b5\ntable(voca$regulation)\n\n\n##############################################3\n# \u7ed8\u56fe\n\nlibrary(ggnewscale)\n\n# \u56fe\u4f8b\u6392\u5e8f\nvoca$regulation &lt;- factor(voca$regulation,levels = c('UP','DOWN','None-Sig'))\n\n# \u7ed8\u56fe\np2 &lt;- ggplot(voca) +\n  geom_point(aes(x = log2FC,y = logPvalue,color = regulation),\n             size = 3,alpha = 0.5) +\n  theme_classic(base_size = 16) +\n  theme(axis.ticks.length = unit(0.3,'cm'),\n        aspect.ratio = 0.8) +\n  scale_x_continuous(breaks = seq(-8,8,2)) +\n  # \u5b9a\u4e49\u989c\u8272\n  scale_color_manual(values = c('UP'='red','None-Sig'='grey','DOWN'='#3E7C17')) +\n  xlab('Relative protein level\\n (SARS-CoV-2 N vs MERS-CoV N,log2)') +\n  ylab('T-test p-value (-log10)') +\n  annotate(geom = 'text',x = -5,y = 7,\n           size = 5,\n           label = 'MERS-CoV N\\n specific') +\n  annotate(geom = 'text',x = 5,y = 7,\n           size = 5,\n           label = 'SARS-CoV-2 N\\n specific') +\n  geom_line(data = df,aes(x = x,y = y),\n            size = 1,lty = 'dashed',color = 'grey') +\n  ylim(0,8)\n\np2\n\n# \u6dfb\u52a0\u57fa\u56e0\u540d\np2 +\n  new_scale_color() +\n  # \u6dfb\u52a0\u70b9\u56fe\u5c42\n  geom_point(data = filter_data,aes(x = log2FC,y = logPvalue,\n                                    color = type),\n             size = 5,show.legend = F) +\n  # \u4fee\u6539\u989c\u8272\n  scale_color_manual(values = c('a'='#FFCA03','b'='#396EB0','c'='#F90716')) +\n  # \u6dfb\u52a0\u540d\u5b57\n  geom_text(data = filter_data,aes(x = log2FC,y = logPvalue,\n                                   label = gene_name,color = type),\n            nudge_y = 0.3,nudge_x = 0,\n            size = 4.5,fontface = 'italic',\n            show.legend = F)\n  \n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/linguopeng.top\/wp-content\/uploads\/2022\/01\/Rplot05.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"722\" height=\"632\" data-original=\"https:\/\/linguopeng.top\/wp-content\/uploads\/2022\/01\/Rplot05.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-186\"\/><\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3],"class_list":["post-183","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-r"],"_links":{"self":[{"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/posts\/183","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linguopeng.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=183"}],"version-history":[{"count":2,"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/posts\/183\/revisions"}],"predecessor-version":[{"id":187,"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/posts\/183\/revisions\/187"}],"wp:attachment":[{"href":"https:\/\/linguopeng.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linguopeng.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=183"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linguopeng.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}