{"id":316,"date":"2018-04-11T15:43:54","date_gmt":"2018-04-11T07:43:54","guid":{"rendered":"http:\/\/www.wuchangsong.com\/?p=316"},"modified":"2019-11-10T16:17:50","modified_gmt":"2019-11-10T08:17:50","slug":"%e7%bb%98%e5%88%b6%e7%9b%92%e5%bd%a2%e5%9b%be","status":"publish","type":"post","link":"http:\/\/www.wuchangsong.com\/?p=316","title":{"rendered":"\u7ed8\u5236\u76d2\u5f62\u56fe"},"content":{"rendered":"<p>\u8f93\u5165\u8868\u8fbe\u77e9\u9635\u6570\u636e\u6587\u4ef6<\/p>\n<pre>library(ggplot2)\r\nlibrary(reshape2)\r\nexprSet &lt;- read.table(file = \"COS_deseq_counts_normalized.txt\", sep = \"\\t\", header = T)\r\ngroup_list &lt;- factor(c(rep(\"COS0\",3),rep(\"COS1\",3),rep(\"COS3\",3),rep(\"COS6\",3),rep(\"COS12\",3)), levels = c(\"COS0\", \"COS1\",\"COS3\",\"COS6\",\"COS12\"))\r\nexprSet_L=melt(exprSet)\r\ncolnames(exprSet_L)=c('Gene_ID','sample','value')\r\nexprSet_L$group=rep(group_list,each=nrow(exprSet))\r\n#\u4ee5sample\u4f5c\u4e3ax\u8f74\uff0cgroup\u4f5c\u4e3a\u586b\u5145\u989c\u8272\r\nggplot(exprSet,aes(x=sample,y=value,fill=group)) + geom_boxplot()\r\n#\u4ee5group\u4f5c\u4e3ax\u8f74\uff0csample\u4f5c\u4e3a\u586b\u5145\u989c\u8272\r\n#ggplot(exprSet,aes(x=group,y=value,fill=sample)) + geom_boxplot()\r\n# \u4fee\u6539sample\u540d\u79f0\r\nexprSet_L$sample=paste(exprSet_L$group,exprSet_L$sample,sep=\"-\")\r\nggplot(exprSet_L,aes(x=sample,y=value,fill=group)) + geom_boxplot()\r\n# \u79bb\u7fa4\u70b9\u7684\u5927\u5c0f\r\ncvbox=ggplot(exprSet_L,aes(x=sample,y=value,fill=group))+geom_boxplot(outlier.size=0)\r\n#outlier.size=-1 \uff0c\u70b9\u5c06\u5f7b\u5e95\u6d88\u5931\r\n# \u4fee\u6539x\u8f74\u5b57\u7b26\u65b9\u5411\r\ncvbox+theme(axis.text.x=element_text(angle=90,vjust=0.5,hjust=1))\r\n# \u4fee\u6539\u56fe\u4f8b\u4f4d\u7f6e\u548c\u4e3b\u9898\r\ncvbox+theme_bw()+theme(axis.text.x=element_text(angle=90,vjust=0.5,hjust=1),legend.position=\"top\")\r\n# geom_jitter()\uff1a\u4e3a\u56fe\u5f62\u8bbe\u7f6e\u6296\u52a8\uff0c\u9632\u6b62\u76f8\u540c\u70b9\u91cd\u53e0\r\ncvbox+theme_bw()+theme(axis.text.x=element_text(angle=90,vjust=0.5,hjust=1),legend.position=\"top\") + geom_jitter()\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8f93\u5165\u8868\u8fbe\u77e9\u9635\u6570\u636e\u6587\u4ef6 library(ggplot2) library(reshape2) exprSet &lt;- read.table(file = &#8220;COS_deseq_counts_normalized.txt&#8221;, sep = &#8220;\\t&#8221;, header = T) group_list &lt;- factor(c(rep(&#8220;COS0&#8221;,3),rep(&#8220;COS1&#8221;,3),rep(&#8220;COS3&#8221;,3),rep(&#8220;COS6&#8221;,3),rep(&#8220;COS12&#8221;,3)), levels = c(&#8220;COS0&#8221;, &#8220;COS1&#8243;,&#8221;COS3&#8243;,&#8221;COS6&#8243;,&#8221;COS12&#8243;)) exprSet_L=melt(exprSet) colnames(exprSet_L)=c(&#8216;Gene_ID&#8217;,&#8217;sample&#8217;,&#8217;value&#8217;) exprSet_L$group=rep(group_list,each=nrow(exprSet)) #\u4ee5sample\u4f5c\u4e3ax\u8f74\uff0cgroup\u4f5c\u4e3a\u586b\u5145\u989c\u8272 ggplot(exprSet,aes(x=sample,y=value,fill=group)) + geom_boxplot() #\u4ee5group\u4f5c\u4e3ax\u8f74\uff0csample\u4f5c\u4e3a\u586b\u5145\u989c\u8272 #ggplot(exprSet,aes(x=group,y=value,fill=sample)) + geom_boxplot() # \u4fee\u6539sample\u540d\u79f0 exprSet_L$sample=paste(exprSet_L$group,exprSet_L$sample,sep=&#8221;-&#8220;) ggplot(exprSet_L,aes(x=sample,y=value,fill=group)) + geom_boxplot() # \u79bb\u7fa4\u70b9\u7684\u5927\u5c0f cvbox=ggplot(exprSet_L,aes(x=sample,y=value,fill=group))+geom_boxplot(outlier.size=0) #outlier.size=-1 \uff0c\u70b9\u5c06\u5f7b\u5e95\u6d88\u5931 # \u4fee\u6539x\u8f74\u5b57\u7b26\u65b9\u5411 cvbox+theme(axis.text.x=element_text(angle=90,vjust=0.5,hjust=1)) # \u4fee\u6539\u56fe\u4f8b\u4f4d\u7f6e\u548c\u4e3b\u9898 cvbox+theme_bw()+theme(axis.text.x=element_text(angle=90,vjust=0.5,hjust=1),legend.position=&#8221;top&#8221;) # geom_jitter()\uff1a\u4e3a\u56fe\u5f62\u8bbe\u7f6e\u6296\u52a8\uff0c\u9632\u6b62\u76f8\u540c\u70b9\u91cd\u53e0 cvbox+theme_bw()+theme(axis.text.x=element_text(angle=90,vjust=0.5,hjust=1),legend.position=&#8221;top&#8221;) + geom_jitter()<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"_links":{"self":[{"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/posts\/316"}],"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=316"}],"version-history":[{"count":2,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/posts\/316\/revisions"}],"predecessor-version":[{"id":402,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/posts\/316\/revisions\/402"}],"wp:attachment":[{"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=316"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}