<?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; 癌种</title>
	<atom:link href="http://www.bio-info-trainee.com/tag/%e7%99%8c%e7%a7%8d/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>mysql的table居然有最大列限制</title>
		<link>http://www.bio-info-trainee.com/1988.html</link>
		<comments>http://www.bio-info-trainee.com/1988.html#comments</comments>
		<pubDate>Mon, 07 Nov 2016 12:19:33 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[基础软件]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[癌种]]></category>
		<category><![CDATA[网页]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=1988</guid>
		<description><![CDATA[想着把TCGA的RPKM值矩阵表格写入到mysql，然后做一个查询网页给生物学家 &#8230; <a href="http://www.bio-info-trainee.com/1988.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div>想着把TCGA的RPKM值矩阵表格写入到mysql，然后做一个查询网页给生物学家，我下载的是<a href="http://www.bio-info-trainee.com/1274.html">所有TCGA收集的mRNA表达数据集数据集-GSE62944</a> ，共9264个癌症样本，和741个正常组织的表达数据。当我想写入癌症表达矩阵的时候，报错了：</div>
<div>Error in .local(conn, statement, ...) :</div>
<div>could not run statement: Too many columns</div>
<div>简单搜索了一下，发现是mysql有最大列的限制，但是我不是很懂计算机，所以没太看明白该如何调整参数使得mysql列限制扩充：<a href="http://dev.mysql.com/doc/refman/5.7/en/column-count-limit.html">http://dev.mysql.com/doc/refman/5.7/en/column-count-limit.html</a> 所以就把癌症表达矩阵根据癌症拆分了，癌种数量如下：</div>
<p><span id="more-1988"></span></p>
<div>table(tumorCancerType2amples$CancerType)</div>
<div></div>
<div>ACC BLCA BRCA CESC COAD DLBC GBM HNSC KICH KIRC KIRP LAML LGG LIHC LUAD LUSC OV PRAD READ SKCM STAD THCA UCEC UCS</div>
<div>79 414 1119 306 483 48 170 504 66 542 291 178 532 374 541 502 430 502 167 472 420 513 554 57</div>
<div></div>
<div>分开写入mysql，下面给出解决方案及代码：</div>
<div></div>
<blockquote>
<div>tumorRPKM=read.table('GSM1536837_06_01_15_TCGA_24.tumor_Rsubread_FPKM.txt.gz',sep = '\t',stringsAsFactors = F,header = T)</div>
<div>colnames(tumorRPKM)[1]='geneSymbol'</div>
<div>rownames(tumorRPKM)=tumorRPKM$geneSymbol</div>
<div>tumorRPKM=tumorRPKM[,-1]</div>
<div>tumorRPKM=round( as.matrix(tumorRPKM),3)</div>
<div>tumorRPKM=as.data.frame(tumorRPKM)</div>
<div>tumorRPKM$geneSymbol = rownames(tumorRPKM)</div>
<div>#load(file = 'tumorRPKM.rData')</div>
<div>tumorCancerType2amples=read.table('GSE62944_06_01_15_TCGA_24_CancerType_Samples.txt',sep = '\t',stringsAsFactors = F)</div>
<div>colnames(tumorCancerType2amples)=c('sampleID','CancerType')</div>
<div>lapply(unique((tumorCancerType2amples$CancerType)), function(x){</div>
<div>#x='PRAD';</div>
<div>sampleList=tumorCancerType2amples[tumorCancerType2amples$CancerType==x,1]</div>
<div>sampleList=gsub("-",".", sampleList)</div>
<div>tmpMatrix=tumorRPKM[,c('geneSymbol',sampleList)]</div>
<div>dbWriteTable(con, paste('tumor',x,'RPKM',sep='_'), tmpMatrix, append=F,row.names=F)</div>
<div></div>
<div>})</div>
</blockquote>
<div>dbWriteTable这个函数，需要加载RMySQL，而且还需要连接好mysql数据库，不然你根本就看不懂的！</div>
<div>写入数据库如下：</div>
<div><img src="file:///C:/Users/jimmy1314/AppData/Local/YNote/data/jmzeng1314@163.com/37a5e2c5545348da8dfb48c791b8be99/clipboard.png" alt="" data-media-type="image" data-attr-org-src-id="8BE4BAC459CA49CC97F3871348380CEC" /></div>
<div><a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/11/tmp.png"><img class="alignnone size-full wp-image-1989" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/11/tmp.png" alt="tmp" width="418" height="559" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/1988.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
