<?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; mysql</title>
	<atom:link href="http://www.bio-info-trainee.com/tag/mysql/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表达数据的多项应用之1&#8211;下载数据并且导入mysql</title>
		<link>http://www.bio-info-trainee.com/2179.html</link>
		<comments>http://www.bio-info-trainee.com/2179.html#comments</comments>
		<pubDate>Sun, 25 Dec 2016 15:53:42 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[cancer]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[TCGA]]></category>
		<category><![CDATA[表达数据]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=2179</guid>
		<description><![CDATA[这个TCGA表达数据的多项应用系列帖子是应群里朋友的要求来写的，你们也可以继续提 &#8230; <a href="http://www.bio-info-trainee.com/2179.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div>这个TCGA表达数据的多项应用系列帖子是应群里朋友的要求来写的，你们也可以继续提需求，我会接着写下去，其实从TCGA数据库里面下载到了数据之后，后面的所有分析都跟TCGA没有半毛钱关系了，大家要有这个想法，别三两句就问TCGA数据怎么分析，<a href="http://www.bio-info-trainee.com/?s=TCGA&amp;submit=Search" target="_blank">http://www.bio-info-trainee.com/?s=TCGA&amp;submit=Search</a> <span style="color: #ff0000;">本系列最后会形成一个shiny版本的交互式表达数据查询，处理，绘图，统计的网页APP。</span></div>
<div>我这里偷懒一下了，直接下载GEO里面的TCGA的表达数据，而不是去TCGA的官网里面下载：</div>
<div><a href="http://www.bio-info-trainee.com/1274.html">所有TCGA收集的mRNA表达数据集数据集-GSE62944</a></div>
<div>它处理了目前（大概是2015年6月）TCGA收集的所有癌症样本的mRNA表达数据，并且统一处理成了count和RPKM两种表达量形式。 GEO地址：<a href="http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE62944">http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE62944</a></div>
<p><span id="more-2179"></span></p>
<div>下载的文件，首先用R连接mysql把<span style="color: #ff0000;"><strong>RPKM形式的表达数据</strong></span>写到数据库啦!</div>
<div>
<div><a href="http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE62944">很明显，我们需要下载</a>正常样本和癌症样本的ID和组织对应表格，还有他们的RPKM矩阵，是压缩包格式的txt文档，然后用R语言链接mysql写入，至于为什么要写入的mysql，主要是因为R里面读取文件太慢了，而我后面的一系列表达数据的分析都是高频的，不可能每次都打开R，然后读取几个G的数据，大家看下面的表格就应该明白，我把正常组织样本的表达数据写到了一个表格里面，而把癌症根据tissue来分开存放，主要是因为mysql有最大列数限制，而我们这个GSE62944里面有近万的样本了。</div>
<div> <a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/12/14.png"><img class="alignnone size-full wp-image-2180" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/12/14.png" alt="1" width="701" height="606" /></a></div>
</div>
<div>
<div>数据下载就是在GEO的supplement里面找链接，写入到mysql，首先需要你自己安装了mysql，请看我在论坛写的教程：<a href="http://www.biotrainee.com/thread-389-1-1.html">http://www.biotrainee.com/thread-389-1-1.html</a></div>
<div><a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/12/22.png"><img class="alignnone size-full wp-image-2181" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/12/22.png" alt="2" width="579" height="268" /></a></div>
<div>
<div>可以看到R其实就是通过R的包来调用系统的mysql程序，往mysql里面写入数据，而我们的表达数据还比较大，所以会耗费半小时左右。</div>
<div>后面一系列的分析，都是基于此，所以你要想看懂后面的帖子，必须要用我的代码下载好数据，并导入到自己的mysql里面。(我代码在：<a href="https://github.com/jmzeng1314/myTCGA/blob/master/expression/mRNA/GSE62944/GSE62944data2mysql.R" target="_blank">https://github.com/jmzeng1314/myTCGA/blob/master/expression/mRNA/GSE62944/GSE62944data2mysql.R</a>)</div>
<div>作为一个合格的生信工程师，有些东西，你不得不学习，抱歉！</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/2179.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>
		<item>
		<title>用GEMINI来探索vcf格式的突变数据</title>
		<link>http://www.bio-info-trainee.com/1603.html</link>
		<comments>http://www.bio-info-trainee.com/1603.html#comments</comments>
		<pubDate>Thu, 05 May 2016 11:39:37 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[基础数据库]]></category>
		<category><![CDATA[基础软件]]></category>
		<category><![CDATA[gemini]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sneff]]></category>
		<category><![CDATA[vcf]]></category>
		<category><![CDATA[VEP]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=1603</guid>
		<description><![CDATA[第一次听说这个软件，是一个香港朋友推荐的：http://davetang.org &#8230; <a href="http://www.bio-info-trainee.com/1603.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>第一次听说这个软件，是一个香港朋友推荐的：<a href="http://davetang.org/muse/2016/01/13/getting-started-with-gemini/">http://davetang.org/muse/2016/01/13/getting-started-with-gemini/</a> 他写的很棒，但是我当初以为是一个类似于SQLite的数据库浏览模式，所以没在意。实际上，我现在仍然觉得这个软件没什么用！</p>
<p>软件官网有详细的介绍：<a href="https://gemini.readthedocs.io/en/latest/">https://gemini.readthedocs.io/en/latest/</a></p>
<p>而且提供丰富的教程：</p>
<p>We recommend that you follow these tutorials in order, as they introduce concepts that build upon one another.</p>
<ul>
<li>Introduction to GEMINI, basic variant querying and data exploration. <a href="https://speakerdeck.com/arq5x/an-introduction-and-tutorial-for-variant-exploration-with-gemini">html</a> <a href="https://s3.amazonaws.com/gemini-tutorials/Intro-To-Gemini.pdf">pdf</a></li>
<li>Identifying de novo mutations underlying Mendelian disease <a href="https://speakerdeck.com/arq5x/identifying-de-novo-mutations-with-gemini">html</a> <a href="https://s3.amazonaws.com/gemini-tutorials/Gemini-DeNovo-Tutorial.pdf">pdf</a></li>
<li>Identifying autosomal recessive variants underlying Mendelian disease <a href="https://speakerdeck.com/arq5x/identifying-recessive-candidates-with-gemini">html</a> <a href="https://s3.amazonaws.com/gemini-tutorials/Gemini-Recessive-Tutorial.pdf">pdf</a></li>
<li>Identifying autosomal dominant variants underlying Mendelian disease <a href="https://speakerdeck.com/arq5x/identifying-dominant-candidates-with-gemini">html</a> <a href="https://s3.amazonaws.com/gemini-tutorials/Gemini-Dominant-Tutorial.pdf">pdf</a></li>
<li>Other GEMINI tools <a href="https://speakerdeck.com/arq5x/other-gemini-tools">html</a> <a href="https://s3.amazonaws.com/gemini-tutorials/GEMINI-Other-Tools.pdf">pdf</a></li>
</ul>
<p>软件本身并不提供注释，虽然它的功能的确包括注释，号称可以利用(ENCODE tracks, UCSC tracks, OMIM, dbSNP, KEGG, and HPRD.)对你的突变位点注释，比如你输入1       861389  .       C       T       ，它告诉你这个突变发生在哪个基因，对蛋白改变如何？是否会产生某些疾病？</p>
<p>虽然它本身没有注释功能，但是它会调用snpEFF或者VEP进行注释，你需要自己先学习它们。</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/05/12.png"><img class="alignnone size-full wp-image-1604" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/05/12.png" alt="1" width="523" height="305" /></a></p>
<h1><span style="color: #ff0000;">软件安装：</span></h1>
<p>GEMINI是用python写的，有一个小脚本可以自动完成安装过程：</p>
<p>7.3K May  4 14:44 gemini_install.py</p>
<p>下载这个脚本，然后安装即可</p>
<p>wget https://github.com/arq5x/gemini/raw/master/gemini/scripts/gemini_install.py</p>
<p>python gemini_install.py $tools $data</p>
<p>PATH=$tools/bin:$data/anaconda/bin:$PATH</p>
<p>where <em>$tools</em> and <em>$data</em> are paths writable on your system.</p>
<p>我把$tools用的就是当前文件夹，$data也是当前文件夹下面的gemini文件夹。</p>
<p>这样就会在当前文件夹下面生成两个文件夹，bin是存储程序，gemini是存储数据用的，而且注意要把bin目录的全路径添加到环境变量！</p>
<h1><span style="color: #ff0000;">输入数据：</span></h1>
<p>我们可以直接下载软件作者提供的测试数据</p>
<p>首先是22号染色体的所有突变位点经过WEP注释的文件</p>
<p>然后是一个三口直接的突变ped格式数据</p>
<p>数据存放在亚马逊云，所有的教程pdf也在</p>
<p><a href="http://s3.amazonaws.com/gemini-tutorials">http://s3.amazonaws.com/gemini-tutorials</a></p>
<p>如果是你自己的vcf文件，需要自己用VEP注释一下</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/05/13.png"><img class="alignnone size-full wp-image-1606" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/05/13.png" alt="1" width="271" height="56" /></a></p>
<h1><span style="color: #ff0000;">运行命令：</span></h1>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/05/2.png"><img class="alignnone size-full wp-image-1605" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/05/2.png" alt="2" width="419" height="154" /></a></p>
<h1><span style="color: #ff0000;">结果解读：</span></h1>
<p>产生是chr22.db就是一个数据库格式的文件，但是需要用gemini 来进行查询，个人认为，并没有多大意思！</p>
<p>你只要熟悉mySQL等SQL语言，完全可以自己来！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/1603.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>生信数据库的schema如何构建</title>
		<link>http://www.bio-info-trainee.com/1518.html</link>
		<comments>http://www.bio-info-trainee.com/1518.html#comments</comments>
		<pubDate>Sat, 09 Apr 2016 12:31:35 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[基础数据库]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[数据库]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=1518</guid>
		<description><![CDATA[大家分析生物信息学数据的时候必不可少的步骤就是利用各种公共资源对自己的数据进行注 &#8230; <a href="http://www.bio-info-trainee.com/1518.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>大家分析生物信息学数据的时候必不可少的步骤就是利用各种公共资源对自己的数据进行注释。</p>
<p>这时候可能会用到mysql，把一些公共数据库本地化，方便使用，但是数据的下载已经存储到mysql等数据库中间会有很多值得玩味的事情。</p>
<p>我这里给大家指出一个还算比较标准的参考，就是bioconductor官方制作的数据库设计代码。</p>
<p>bioconductor官方注释方面的包(主要是各种ID的转换，KEGG或者GO这样的功能注释，基因信息注释，转录本，外显子起始终止等等)</p>
<blockquote><p>目前为止，bioconductor是3.3版本，<a href="https://www.bioconductor.org/packages/3.3/data/annotation/">共896个包</a></p></blockquote>
<p>大部分包都是以sqlite的数据库标准发布，所以建表语句是一样的。</p>
<p>所有代码见：<a href="https://github.com/Bioconductor-mirror/AnnotationDbi/blob/release-3.2/inst/DBschemas%20">https://github.com/Bioconductor-mirror/AnnotationDbi/blob/release-3.2/inst/DBschemas </a></p>
<p>部分代码如下：</p>
<blockquote><p>CREATE TABLE metadata (<br />
name VARCHAR(80) PRIMARY KEY,<br />
value VARCHAR(255)<br />
);<br />
CREATE TABLE go_ontology (<br />
ontology VARCHAR(9) PRIMARY KEY,               -- GO ontology (short label)<br />
term_type VARCHAR(18) NOT NULL UNIQUE          -- GO ontology (full label)<br />
);<br />
CREATE TABLE go_term (<br />
_id INTEGER PRIMARY KEY,<br />
go_id CHAR(10) NOT NULL UNIQUE,               -- GO ID<br />
term VARCHAR(255) NOT NULL,                   -- textual label for the GO term<br />
ontology VARCHAR(9) NOT NULL,                 -- REFERENCES go_ontology<br />
definition TEXT NULL,                         -- textual definition for the GO term<br />
FOREIGN KEY (ontology) REFERENCES go_ontology (ontology)<br />
);<br />
CREATE TABLE sqlite_stat1(tbl,idx,stat);<br />
CREATE TABLE go_obsolete (<br />
go_id CHAR(10) PRIMARY KEY,                   -- GO ID<br />
term VARCHAR(255) NOT NULL,                   -- textual label for the GO term<br />
ontology VARCHAR(9) NOT NULL,                 -- REFERENCES go_ontology<br />
definition TEXT NULL,                         -- textual definition for the GO term<br />
FOREIGN KEY (ontology) REFERENCES go_ontology (ontology)<br />
);</p></blockquote>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/1518.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>把bioconductor的gene mapping信息上传到mysql数据库</title>
		<link>http://www.bio-info-trainee.com/1417.html</link>
		<comments>http://www.bio-info-trainee.com/1417.html#comments</comments>
		<pubDate>Sun, 28 Feb 2016 02:46:10 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[基础数据库]]></category>
		<category><![CDATA[bioconductor]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=1417</guid>
		<description><![CDATA[在R语言里面的bioconductor系列包里面有一个物种注释信息包，其中人类是 &#8230; <a href="http://www.bio-info-trainee.com/1417.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div>
<div dir="ltr">
<div><span style="font-family: Times;">在R语言里面的bioconductor系列包里面有一个物种注释信息包，其中人类是org.Hs.eg.db</span></div>
<div><span style="font-family: Times;">里面有基于人的hg19基因组版本的大部分基因信息之间的转换数据！</span></div>
<div><span style="font-family: Times;">包括基因的entrez ID，symbol，name，locus，refseq，kegg pathway，GO ontology对应关系！</span></div>
<div><span style="font-family: Times;">但是它们散布在该包的各个数据结构里面！</span></div>
</div>
</div>
<div><span style="font-family: Times;">&gt; ls("package:org.Hs.eg.db")</span></div>
<div><span style="font-family: Times;"> [1] "org.Hs.eg"                "org.Hs.eg.db"            </span></div>
<div><span style="font-family: Times;"> [3] "org.Hs.eg_dbconn"         "org.Hs.eg_dbfile"        </span></div>
<div><span style="font-family: Times;"> [5] "org.Hs.eg_dbInfo"         "org.Hs.eg_dbschema"      </span></div>
<div><span style="font-family: Times;"> [7] "org.Hs.egACCNUM"          "org.Hs.egACCNUM2EG"      </span></div>
<div><span style="font-family: Times;"> [9] "org.Hs.egALIAS2EG"        "org.Hs.egCHR"            </span></div>
<div><span style="font-family: Times;">[11] "org.Hs.egCHRLENGTHS"      "org.Hs.egCHRLOC"         </span></div>
<div><span style="font-family: Times;">[13] "org.Hs.egCHRLOCEND"       "org.Hs.egENSEMBL"        </span></div>
<div><span style="font-family: Times;">[15] "org.Hs.egENSEMBL2EG"      "org.Hs.egENSEMBLPROT"    </span></div>
<div><span style="font-family: Times;">[17] "org.Hs.egENSEMBLPROT2EG"  "org.Hs.egENSEMBLTRANS"   </span></div>
<div><span style="font-family: Times;">[19] "org.Hs.egENSEMBLTRANS2EG" "org.Hs.egENZYME"         </span></div>
<div><span style="font-family: Times;">[21] "org.Hs.egENZYME2EG"       "org.Hs.egGENENAME"       </span></div>
<div><span style="font-family: Times;">[23] "org.Hs.egGO"              "org.Hs.egGO2ALLEGS"      </span></div>
<div><span style="font-family: Times;">[25] "org.Hs.egGO2EG"           "org.Hs.egMAP"            </span></div>
<div><span style="font-family: Times;">[27] "org.Hs.egMAP2EG"          "org.Hs.egMAPCOUNTS"      </span></div>
<div><span style="font-family: Times;">[29] "org.Hs.egOMIM"            "org.Hs.egOMIM2EG"        </span></div>
<div><span style="font-family: Times;">[31] "org.Hs.egORGANISM"        "org.Hs.egPATH"           </span></div>
<div><span style="font-family: Times;">[33] "org.Hs.egPATH2EG"         "org.Hs.egPFAM"           </span></div>
<div><span style="font-family: Times;">[35] "org.Hs.egPMID"            "org.Hs.egPMID2EG"        </span></div>
<div><span style="font-family: Times;">[37] "org.Hs.egPROSITE"         "org.Hs.egREFSEQ"         </span></div>
<div><span style="font-family: Times;">[39] "org.Hs.egREFSEQ2EG"       "org.Hs.egSYMBOL"         </span></div>
<div><span style="font-family: Times;">[41] "org.Hs.egSYMBOL2EG"       "org.Hs.egUCSCKG"         </span></div>
<div><span style="font-family: Times;">[43] "org.Hs.egUNIGENE"         "org.Hs.egUNIGENE2EG"     </span></div>
<div><span style="font-family: Times;">[45] "org.Hs.egUNIPROT"        </span></div>
<div><span style="font-family: Times;">&gt; </span></div>
<div><span style="font-family: Times;">其实比较重要的信息，我们需要把它们统一关联起来，做成一个表格，这样可以上传到数据库里面，做成网页，可视化展现，查找！</span></div>
<div>
<div dir="ltr">
<div><span style="font-family: Times;">suppressMessages(library(org.Hs.eg.db))</span></div>
<div><span style="font-family: Times;">all_EG=mappedkeys(org.Hs.egSYMBOL)</span></div>
<div><span style="font-family: Times;">###下面的表格最后是基于entrez ID而关联起来的！</span></div>
<div><span style="font-family: Times;">tmp=unlist(as.list(org.Hs.egSYMBOL))</span></div>
<div><span style="font-family: Times;">EG2Symbol=data.frame(EGID=names(tmp),symbol=as.character(tmp))</span></div>
<div><span style="font-family: Times;"> </span></div>
<div><span style="font-family: Times;">tmp=unlist(as.list(org.Hs.egENSEMBL))</span></div>
<div><span style="font-family: Times;">EG2ENSEMBL=data.frame(EGID=names(tmp),ENSEMBL=as.character(tmp))</span></div>
<div><span style="font-family: Times;"> </span></div>
<div><span style="font-family: Times;">tmp=unlist(as.list(org.Hs.egGENENAME))</span></div>
<div><span style="font-family: Times;">EG2name=data.frame(EGID=names(tmp),name=as.character(tmp))</span></div>
<div><span style="font-family: Times;"> </span></div>
<div><span style="font-family: Times;">tmp=unlist(as.list(org.Hs.egMAP))</span></div>
<div><span style="font-family: Times;">EG2MAP=data.frame(EGID=names(tmp),MAP=as.character(tmp))</span></div>
<div><span style="font-family: Times;">     </span></div>
<div><span style="font-family: Times;">###EG2GO and    using mySQL</span></div>
<div><span style="font-family: Times;">EG2path=as.list(org.Hs.egPATH)</span></div>
<div><span style="font-family: Times;">EG2path=lapply(EG2path, function(x) paste(x,collapse = ":"))</span></div>
<div><span style="font-family: Times;">tmp=unlist(EG2path)</span></div>
<div><span style="font-family: Times;">EG2path=data.frame(EGID=names(tmp),path=as.character(tmp))</span></div>
<div><span style="font-family: Times;"> </span></div>
<div><span style="font-family: Times;">#as.list(head(org.Hs.egGO2ALLEGS))</span></div>
<div><span style="font-family: Times;">GO2allEG=as.list(org.Hs.egGO2ALLEGS)</span></div>
<div><span style="font-family: Times;">tmp=unlist(GO2allEG)</span></div>
<div><span style="font-family: Times;">names(tmp)=substring(names(tmp),1,10) ## change GO:0000002.IMP to GO:0000002 </span></div>
<div><span style="font-family: Times;">EG2allGO &lt;- tapply(tmp,tmp,function(x){names(x)})</span></div>
<div><span style="font-family: Times;">EG2allGO=lapply(EG2allGO, function(x) paste(x,collapse = ":"))</span></div>
<div><span style="font-family: Times;">tmp=unlist(EG2allGO)</span></div>
<div><span style="font-family: Times;">EG2GO=data.frame(EGID=names(tmp),GO=as.character(tmp))</span></div>
<div><span style="font-family: Times;"> </span></div>
<div><span style="font-family: Times;">tmp=merge(EG2Symbol,EG2MAP,by='EGID',all=TRUE)</span></div>
<div><span style="font-family: Times;">tmp=merge(tmp,EG2ENSEMBL,by='EGID',all=TRUE)</span></div>
<div><span style="font-family: Times;">tmp=merge(tmp,EG2path,by='EGID',all=TRUE)</span></div>
<div><span style="font-family: Times;">tmp=merge(tmp,EG2name,by='EGID',all=TRUE)</span></div>
<div><span style="font-family: Times;">my_gene_mapping=merge(tmp,EG2GO,by='EGID',all=TRUE)</span></div>
<div><span style="font-family: Times;">##[1] "EGID"    "symbol"  "MAP"     "ENSEMBL" "path"    "name"    "GO"</span></div>
</div>
<div></div>
<div><a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/02/1.png"><img class="alignnone size-full wp-image-1418" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/02/1.png" alt="1" width="541" height="277" /></a></div>
<div>因为我用的merge的all=TRUE，所以最后记录会越来越多</div>
<div>最后的结果就是下面这样，各种ID转换都储存到了my_gene_mapping这个数据对象里面！</div>
<div>可以看到有些基因是没有ensemble数据库对应的ID的，非常多的基因没有被注释到KEGG通路数据库！</div>
<div>我这里如果一个基因对应多个通路，我用冒号连接起来了，成了一个字符串！在后面会有用！</div>
<div></div>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/02/21.png"><img class="alignnone size-full wp-image-1419" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/02/21.png" alt="2" width="834" height="291" /></a></div>
<div><span style="font-family: Times;">现在需要把它上传到数据库里面，这样我就可以用R的shiny可视化网页来查找数据库，做ID转换啦！！！</span></div>
<div>
<div><span style="font-family: Times;">suppressMessages(library(RMySQL))</span></div>
<div><span style="font-family: Times;">con &lt;- dbConnect(MySQL(), host="127.0.0.1", port=3306, user="root", password="11111111")</span></div>
<div><span style="font-family: Times;">dbSendQuery(con, "USE test")</span></div>
<div><span style="font-family: Times;">dbWriteTable(con,'my_gene_mapping',my_gene_mapping)</span></div>
<div><span style="font-family: Times;">dbDisconnect(con)</span></div>
</div>
<div><span style="font-family: Times;">然后就可以在自己的mysql里面看到它啦！！！ </span></div>
<div>其实 "org.Hs.egOMIM"  也很重要，不过我这里只是举个例子，就不深究了！</div>
<div>还有一点，就是那个pathway ID，因为我要以entrez ID为主键，所以把多个pathway给合并了！</div>
<div><span style="font-family: Times;">suppressMessages(library(org.Hs.eg.db))</span></div>
<div><span style="font-family: Times;">kegg2ID=toTable(org.Hs.egPATH)</span></div>
<div><span style="font-family: Times;">#[1] "gene_id" "path_id"</span></div>
<div><span style="font-family: Times;">dbWriteTable(con,'kegg2ID_bioconductor',kegg2ID,row.name=F,overwrite=T)</span></div>
<div><span style="font-family: Times;">go2id=toTable(org.Hs.egGO2ALLEGS)</span></div>
<div><span style="font-family: Times;">## gene_id      go_id Evidence Ontology</span></div>
<div><span style="font-family: Times;">dbWriteTable(con,'go2id_bioconductor',go2id,row.name=F,overwrite=T)</span></div>
<div><span style="font-family: Times;">dbDisconnect(con)</span></div>
<div>用这个代码，可以在数据库里面多创建两个表，会有用的！</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/1417.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>生物信息学学者学习mysql之路</title>
		<link>http://www.bio-info-trainee.com/1045.html</link>
		<comments>http://www.bio-info-trainee.com/1045.html#comments</comments>
		<pubDate>Fri, 16 Oct 2015 10:49:20 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[未分类]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[RMySQL]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=1045</guid>
		<description><![CDATA[我一直都知道mysql其实很有用的， 哪怕是在bioinformatics领域。 &#8230; <a href="http://www.bio-info-trainee.com/1045.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div>我一直都知道mysql其实很有用的， 哪怕是在bioinformatics领域。也断断续续的看过不少mysql教程，只是苦于没有机会应用。毕竟应用才是最好的学习方法，正好这些天需要用了，我就又梳理了一遍作为一个生物信息学学者，该如何学习mysql数据库。</div>
<div>先看中文教程：<a href="http://www.cnblogs.com/mr-wid/archive/2013/05/09/3068229.html">http://www.cnblogs.com/mr-wid/archive/2013/05/09/3068229.html</a></div>
<div>
<div>然后再搜搜一堆技巧</div>
<div><a href="https://dev.mysql.com/doc/refman/5.1/en/counting-rows.html">https://dev.mysql.com/doc/refman/5.1/en/counting-rows.html</a></div>
<div><a href="http://www.w3schools.com/sql/sql_func_count.asp">http://www.w3schools.com/sql/sql_func_count.asp</a></div>
<div><a href="https://dev.mysql.com/doc/refman/5.0/en/pattern-matching.html">https://dev.mysql.com/doc/refman/5.0/en/pattern-matching.html</a></div>
<div><a href="http://hahaxiao.techweb.com.cn/archives/477.html">http://hahaxiao.techweb.com.cn/archives/477.html</a></div>
<div>差不多就可以开始啦。</div>
<div>我们不拿数据库来做网页，所以需要的仅仅是查询公共数据库的数据，当然，一般人都会选择直接去网页可视化的查询，或者去ftp批量下载后自己写脚本来查询，我以前也是这样想的，所以感觉mysql没什么用，因为它能做的， 我写一个脚本都能做到。但是任何事物能发展到如此流行的程度毕竟还是有它的优点的。</div>
<div>而在我看来，mysql的优点就是，不需要存储大量的文件信息，随查随用，如果我们想把数据库备份到本地，就要建立一大堆的文件夹，存放各种refgene信息呀，entrez gene信息呀，转录本，外显子等等各个文件夹，每个文件夹下面还有一堆文件，而且还要分物种存储，总之就是很麻烦，但是在数据库就不一样啦。</div>
<div>比如我们可以连接UCSC的数据库 （前提是你的机器里面可以允许mysql这个命令，而且你可以联网）</div>
<div>mysql --user=genome --host=<a href="http://genome-mysql.cse.ucsc.edu/">genome-mysql.cse.ucsc.edu</a><span class="Apple-converted-space"> </span>-A</div>
<div>就这么简单， 你就用mysql远程登录了UCSC的数据库，可以show databases;或者use database hg19 ; 等等</div>
<div>里面有两百多个数据库，主要是多物种多版本，然后如果我们看hg19这个数据库，里面还有一万多个数据表，包含着hg19的全面信息。</div>
<div>还有很多其它的公共数据库可以练习<br />
来自于：<a href="https://www.biostars.org/p/474/#9095">https://www.biostars.org/p/474/#9095</a></p>
<p>for example, I would cite:</p>
<p>UCSC <a href="http://genome.ucsc.edu/FAQ/FAQdownloads#download29">http://genome.ucsc.edu/FAQ/FAQdownloads#download29</a><br />
ENSEMBL <a href="http://uswest.ensembl.org/info/data/mysql.html">http://uswest.ensembl.org/info/data/mysql.html</a><br />
GO <a href="http://www.geneontology.org/GO.database.shtml#mirrors">http://www.geneontology.org/GO.database.shtml#mirrors</a></p>
<p>1000 Genomes: since June 16, 2011: <a href="http://www.1000genomes.org/public-ensembl-mysql-instance">http://www.1000genomes.org/public-ensembl-mysql-instance</a></p>
<p>mysql -h mysql-db.1000genomes.org -u anonymous -P 4272</p>
<p>Flybase has direct access to its postgres chado database.<br />
<a href="http://flybase.org/forums/viewtopic.php?f=14&amp;t=114">http://flybase.org/forums/viewtopic.php?f=14&amp;t=114</a><br />
hostname: flybase.org port: 5432 username: flybase password: no password database name: flybase<br />
e.g. psql -h flybase.org -U flybase flybase</p>
<p>mysql -h database.nencki-genomics.org -u public<br />
mysql -h useastdb.ensembl.org -u anonymous -P 5306</p></div>
<div>你都可以登录进去看看里面有什么，也可以练习练习mysql的语法，但是增删改查种的查是可以用的</div>
<div></div>
<div>然后我们可以用R或者perl或者Python来连接数据库，也是蛮好用的， 我现在比较倾向于R</div>
<div>所以我就简单看了一下这个包的说明书，然后成功连接了</div>
<div>
<div>#Connect to the MySQL server using the command:</div>
<div>#mysql --user=genome --host=<a href="http://genome-mysql.cse.ucsc.edu/">genome-mysql.cse.ucsc.edu</a><span class="Apple-converted-space"> </span>-A</div>
<div>#The -A flag is optional but is recommended for speed</div>
<div>library(RMySQL)</div>
<div>my.host="<a href="http://genome-mysql.cse.ucsc.edu/">genome-mysql.cse.ucsc.edu</a>";</div>
<div>my.port="";</div>
<div>my.user="genome";</div>
<div>my.password="";</div>
<div>my.db="hg19";</div>
<div>#there are 203 databases,such as hg18,hg38,mm9,mm10,ce10</div>
<div>con &lt;- dbConnect(MySQL(), host=my.host, user=my.user,dbname=my.db)</div>
<div>dbListTables(con) # there are 11016 tables in this hg19 database;</div>
<p>是不是很简单呀，只有你认真的学习，其实这些应用的东西都还是蛮简单的。</p></div>
<div>下面这本书也比较好，就讲了R或者perl或者Python来连接数据库，很全面</p>
<div><a href="http://bioinformatics.risha.me/category/mysql/">http://bioinformatics.risha.me/category/mysql/</a></div>
</div>
<div>当然，如果想看mysql在bioinformatics方面的应用，下面还有很多学习资料</div>
<div><a href="http://www.biomedcentral.com/1471-2105/11/342">http://www.biomedcentral.com/1471-2105/11/342</a></p>
<div><a href="http://bioinformatics.oxfordjournals.org/content/28/14/1947.full.pdf">http://bioinformatics.oxfordjournals.org/content/28/14/1947.full.pdf</a></div>
<div><a href="https://rostlab.org/owiki/images/7/73/Protocol_goldberg.pdf">https://rostlab.org/owiki/images/7/73/Protocol_goldberg.pdf</a></div>
<div><a href="http://webdoc.nyumc.org/nyumc/files/sun-lab/attachments/CPBI.Ch9.Biol.DB.pdf">http://webdoc.nyumc.org/nyumc/files/sun-lab/attachments/CPBI.Ch9.Biol.DB.pdf</a></div>
<div><a href="http://www.bsi.umn.edu/resources/perl3.pdf">http://www.bsi.umn.edu/resources/perl3.pdf</a></div>
<div><a href="http://www.cs.toronto.edu/~leijiang/ta/mie453/tutorial/tut5/">http://www.cs.toronto.edu/~leijiang/ta/mie453/tutorial/tut5/</a></div>
<div></div>
<div>这个课程比较全面：Biological Databases in Bioinformatics (BioE 594)</div>
<div><a href="http://bioinformatics.bioe.uic.edu/online/BioE594_db.shtml">http://bioinformatics.bioe.uic.edu/online/BioE594_db.shtml</a></div>
<div></div>
</div>
<div>进阶版还可以看看具体事例，GO数据库的设计：<a href="http://geneontology.org/page/lead-database-schema">http://geneontology.org/page/lead-database-schema</a></div>
<div>从这个来看，python要比perl 好很多<a href="http://www.personal.psu.edu/iua1/courses/files/2010/week15.pdf">http://www.personal.psu.edu/iua1/courses/files/2010/week15.pdf</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/1045.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ubuntu服务器解决方案第九讲-mysql和apache的安装</title>
		<link>http://www.bio-info-trainee.com/575.html</link>
		<comments>http://www.bio-info-trainee.com/575.html#comments</comments>
		<pubDate>Wed, 01 Apr 2015 02:42:21 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[数据库]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=575</guid>
		<description><![CDATA[发现自己搞服务器遇到的困难还是蛮多的，所以记录了一下，给菜鸟们指个路。 ubun &#8230; <a href="http://www.bio-info-trainee.com/575.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>发现自己搞服务器遇到的困难还是蛮多的，所以记录了一下，给菜鸟们指个路。<br />
ubuntu对生信菜鸟来说是最好用的linux服务器，没有之一，因为它有apt-get。</p>
<p>很多时候大家的服务器可能并不是想联网，只是想玩一下，或者只是因为生信的某些软件要求数据库，所以大家可能会单独安装mysql，或者想学习perl的CGI模块，需要apache。</p>
<h2 style="text-align: center;"><b>ubuntu上安装mysql</b></h2>
<p>非常简单只需要几条命令就可以完成。</p>
<p>1. sudo apt-get install mysql-server</p>
<p>2. sudo apt-get install mysql-client</p>
<p>3.  sudo apt-get install libmysqlclient-dev</p>
<p>安装过程中会提示设置密码什么的，注意设置了不要忘了，安装完成之后可以使用如下命令来检查是否安装成功：</p>
<p>sudo netstat -tap | grep mysql</p>
<p>通过上述命令检查之后，如果看到有mysql 的socket处于 listen 状态则表示安装成功。</p>
<p>登陆mysql数据库可以通过如下命令：</p>
<p>mysql -u root -p</p>
<p>-u 表示选择登陆的用户名， -p 表示登陆的用户密码，上面命令输入之后会提示输入密码，此时输入密码就可以登录到mysql。</p>
<h2 style="text-align: center;"><a href="http://www.linuxidc.com/topicnews.aspx?tid=2">Ubuntu</a><b>上安装Apache</b></h2>
<p>在<a href="http://www.linuxidc.com/topicnews.aspx?tid=2">Ubuntu</a>上安装Apache，有两种方式：1 使用开发包的打包服务，例如使用apt-get命令；2 从源码构建Apache。本文章将详细描述这两种不同的安装方式。</p>
<p><b>方法一：使用开发包的打包服务——apt-get</b></p>
<p>安装apache，在命令行终端中输入一下命令：</p>
<p>$ sudo apt-get install apache2</p>
<p>安装完成后，重启apache服务，在命令行终端中输入一下命令：</p>
<p>$ sudo /etc/init.d/apache2 restart</p>
<p>可能会出现的问题1： NameVirtualHost *:80 has no VirtualHosts，</p>
<p>出现上述问题的原因：定义了多个NameVirtualHost，故将/etc/apache2/ports.conf中的NameVirtualHost *:80注释掉即可。</p>
<p>可能会出现的问题2： Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName</p>
<p>原因：</p>
<p>根据提示，无法可靠的确定服务器的有效域名，使用127.0.1.1作为服务器域名。应此，在下面的测试中，应该使用127.0.1.1，而不是127.0.0.1！</p>
<p>解决：</p>
<p>$ vim /etc/apache2/httpd.conf，在文件中添加：</p>
<p>ServerName localhost:80，再次重启apache2，就可以使用127.0.0.1来访问web服务器啦！</p>
<p>测试：</p>
<p>在浏览器里输入http://localhost或者是http://127.0.0.1，如果看到了It works!，那就说明Apache就成功的安装了，Apache的默认安装，会在/var下建立一个名为www的目录，这个就是Web目录了，所有要能 过浏览器访问的Web文件都要放到这个目录里。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/575.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
