<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>生信菜鸟团 &#187; boxplot</title>
	<atom:link href="http://www.bio-info-trainee.com/tag/boxplot/feed" rel="self" type="application/rss+xml" />
	<link>http://www.bio-info-trainee.com</link>
	<description>欢迎去论坛biotrainee.com留言参与讨论，或者关注同名微信公众号biotrainee</description>
	<lastBuildDate>Sat, 28 Jun 2025 14:30:13 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.33</generator>
	<item>
		<title>TCGA表达数据的多项应用之2&#8211;对指定基因在不同癌种里面画boxplot,或者在所有的normal组织里面看表达量！</title>
		<link>http://www.bio-info-trainee.com/2190.html</link>
		<comments>http://www.bio-info-trainee.com/2190.html#comments</comments>
		<pubDate>Wed, 28 Dec 2016 01:55:07 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[cancer]]></category>
		<category><![CDATA[boxplot]]></category>
		<category><![CDATA[TCGA]]></category>
		<category><![CDATA[表达数据]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=2190</guid>
		<description><![CDATA[好像文章题目没有长度限制，太好了！本讲所实现的目标非常简单，如题，指定基因在不同 &#8230; <a href="http://www.bio-info-trainee.com/2190.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>好像文章题目没有长度限制，太好了！本讲所实现的目标非常简单，如题，指定基因在不同癌种里面画boxplot,或者在所有的normal组织里面看表达量！下面是一个具体的例子：</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/12/15.png"><img class="alignnone size-full wp-image-2191" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/12/15.png" alt="1" width="631" height="427" /></a></p>
<p>&nbsp;</p>
<p><span id="more-2190"></span></p>
<p>代码如下：</p>
<p>稍微懂一点R的小伙伴都看得出来，只需要手动修改指定的基因，然后指定的癌症种类，就可以来容易画上面的图了，但要完成这一步，必须把前面的那一步导入mysql数据库搞懂。</p>
<h1 class="entry-title"><a title="Permalink to TCGA表达数据的多项应用之1–下载数据并且导入mysql" href="http://www.bio-info-trainee.com/2179.html" rel="bookmark">TCGA表达数据的多项应用之1–下载数据并且导入mysql</a></h1>
<blockquote>
<div>rm(list=ls())</div>
<div></div>
<div><span style="color: #ff0000;"><strong>searchGene = 'VCX3B';</strong></span></div>
<div><span style="color: #ff0000;"><strong>searchTable1='tumor_gbm_rpkm';</strong></span></div>
<div><span style="color: #ff0000;"><strong>searchTable2='tumor_lgg_rpkm';</strong></span></div>
<div></div>
<div>library(RMySQL)</div>
<div>con &lt;- dbConnect(MySQL(), host="127.0.0.1", port=3306, user="root", password="11111111")</div>
<div>dbSendQuery(con, "USE gse62944")</div>
<div>dbListTables(con)</div>
<div>query = paste0(' select * from ', searchTable1 ,' where genesymbol = ',shQuote(searchGene)) ;</div>
<div>gbm=dbGetQuery(con,query)</div>
<div>query = paste0(' select * from ', searchTable2 ,' where genesymbol = ',shQuote(searchGene)) ;</div>
<div>lgg=dbGetQuery(con,query)</div>
<div></div>
<div>gbm=as.numeric(gbm[,-1]);gbm=data.frame(value=gbm,type='gbm')</div>
<div>lgg=as.numeric(lgg[,-1]);lgg=data.frame(value=lgg,type='lgg')</div>
<div>dat1= rbind(gbm,lgg)</div>
<div></div>
<div>boxplot( value ~  type, data = dat1, lwd = 2, ylab = 'value')</div>
<div>stripchart(value ~ type, vertical = TRUE, data = dat1,</div>
<div>           method = "jitter", add = TRUE, pch = 20, col = 'blue')</div>
</blockquote>
<div> 还有很多其它的应用，重点就是如何从sql里面提取数据并可视化而已</div>
<div><a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/12/23.png"><img class="alignnone size-full wp-image-2196" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/12/23.png" alt="2" width="629" height="495" /></a></div>
<div></div>
<div></div>
<div>
<div>比如上面那个在正常表达量矩阵里面查询，多种癌旁组织合并起来画图！</div>
<blockquote>
<div>sqlTable = 'normalrpkm';</div>
<div>sqlQuery=paste0(' select * from ', sqlTable ,' where genesymbol = ',shQuote(searchGene))</div>
<div>normalExpression=dbGetQuery(con,sqlQuery)</div>
<div>normalExpression= normalExpression[,-length(normalExpression)]</div>
<div>normalExpression = data.frame(sampleID=names(normalExpression),</div>
<div>                              values=as.numeric(normalExpression)</div>
<div>                              )</div>
<div>normalCancerType2amples=dbGetQuery(con,'select * from normalcancertype2amples')</div>
<div>normalCancerType2amples$sampleID=gsub("-",".", normalCancerType2amples$sampleID)</div>
<div>dat2 = merge(normalExpression,normalCancerType2amples,by='sampleID')</div>
<div></div>
<div>boxplot( values ~  CancerType, data = dat2, lwd = 2, ylab = 'values',las=2,main=searchGene)</div>
<div>stripchart(values ~ CancerType, vertical = TRUE, data = dat2,</div>
<div>           method = "jitter", add = TRUE, pch = 20, col = 'blue')</div>
</blockquote>
</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/2190.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
