登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

云之南

风声,雨声,读书声,声声入耳;家事,国事,天下事,事事关心

 
 
 

日志

 
 
关于我

专业背景:计算机科学 研究方向与兴趣: JavaEE-Web软件开发, 生物信息学, 数据挖掘与机器学习, 智能信息系统 目前工作: 基因组, 转录组, NGS高通量数据分析, 生物数据挖掘, 植物系统发育和比较进化基因组学

【原】BLAST2GO  

2011-01-11 13:58:42|  分类: 生信分析软件 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

http://www.blast2go.org

安装MYSQL,JAVA

 

建数据库:

/*
Blast2GO Database Additional Tables Version 2.2.3
*/

/*
create database b2g
*/
create database if not exists `b2g`;
GRANT SELECT ON b2g.* TO 'blast2go'@'%' IDENTIFIED BY 'blast4it';

use b2g;

/*

建表
Table structure for gene_info
`description` text, #这个字段原文件中有错误,下面我进行了修改。
*/

drop table if exists `gene_info`;
CREATE TABLE `gene_info` (
  `tax_id` int(11) NOT NULL default '0',
  `GeneID` int(11) NOT NULL default '0',
  `Symbol` varchar(16) NOT NULL default '',
  `LocusTag` varchar(16) NOT NULL default '',
  `Synonyms` varchar(16) NOT NULL default '',
  `dbXrefs` varchar(16) NOT NULL default '',
  `chromosome` varchar(16) NOT NULL default '',
  `map_location` varchar(16) NOT NULL default '',
  `description` text NOT NULL,
  `type_of_gene` varchar(16) NOT NULL default '',
  `Symbol_from_nomenclature_authority` varchar(16) NOT NULL default '',
  `Full_name_from_nomenclature_authority` varchar(16) NOT NULL default '',
  `Nomenclature_status` varchar(16) NOT NULL default '',
  `Other_designations` varchar(16) NOT NULL default '',
  `Modification_date` varchar(16) NOT NULL default '',
  KEY `index gi` (`GeneID`),
  KEY `index symbol` (`Symbol`)
) TYPE=MyISAM;

/*
Table structure for gene2accession
*/

drop table if exists `gene2accession`;
CREATE TABLE `gene2accession` (
`tax_id` int(11) NOT NULL default '0',
`GeneID` int(11) NOT NULL default '0',
`status` varchar(16) NOT NULL default '',
`RNA_nucleotide_accession` varchar(16) NOT NULL default '',
`RNA_nucleotide_gi` varchar(16) NOT NULL default '',
`protein_accession` varchar(16) NOT NULL default '',
`protein_gi` varchar(16) NOT NULL default '',
`genomic_nucleotide_accession` varchar(255) NOT NULL default '',
`genomic_nucleotide_gi` varchar(16) NOT NULL default '',
`start_position` varchar(16) NOT NULL default '',
`end_positon` varchar(16) NOT NULL default '',
`orientation` varchar(16) NOT NULL default '',
`assembly` varchar(16) NOT NULL default '',
KEY `index gi` (`GeneID`),
KEY `index accession` (`protein_accession`)
) TYPE=MyISAM;


/*
Table structure for gi2uniprot
*/

drop table if exists `gi2uniprot`;
CREATE TABLE `gi2uniprot` (
  `gi` varchar(16) NOT NULL default '',
  `uniprot` varchar(16) NOT NULL default '',
  PRIMARY KEY  (`gi`,`uniprot`),
  KEY `index gi` (`gi`),
  KEY `index uniprot` (`uniprot`)
) TYPE=MyISAM;

导入数据:

win系统下安装:
mysql -hlocalhost -uroot -pzhaolei203203  b2g < go_201009-assocdb-data
mysql -hlocalhost -uroot -pzhaolei203203  b2g -e"LOAD DATA LOCAL INFILE '"/gene2accession"' INTO TABLE gene2accession FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n';"

mysql -hlocalhost -uroot -pzhaolei203203  b2g -e"LOAD DATA LOCAL INFILE '"/gene_info"' INTO TABLE gene_info FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n';"


mysqlimport -hlocalhost -uroot -pzhaolei203203  --fields-terminated-by="\t" b2g "/gene2accession"
mysqlimport -hlocalhost -uroot -pzhaolei203203  --fields-terminated-by="\t" b2g "/gene_info"

 

linux系统下安装:
mysql -hlocalhost -uroot -pzhaolei203203  b2g < go_201009-assocdb-data
mysql -hlocalhost -uroot -pzhaolei203203  b2g -e"LOAD DATA LOCAL INFILE '"/gene2accession"' INTO TABLE gene2accession FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n';"

mysql -hlocalhost -uroot -pzhaolei203203  b2g -e"LOAD DATA LOCAL INFILE '"/gene_info"' INTO TABLE gene_info FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n';"


mysqlimport -hlocalhost -uroot -pzhaolei203203  --fields-terminated-by="\t" b2g /home/SCE/zhaolei/software/mysql/bin/gene2accession
mysqlimport -hlocalhost -uroot -pzhaolei203203  --fields-terminated-by="\t" b2g /home/SCE/zhaolei/software/mysql/bin/gene_info

java -cp /home/SCE/zhaolei/software/b2g4pipe/blast2go.jar:/home/SCE/zhaolei/software/b2g4pipe/ext/mysql-connector-java-3.0.11-stable-bin.jar es.blast2go.prog.util.ImportPIR idmapping.tb   localhost b2g root ""

运行GUI,修改成自己的本地数据库。

 

Blast2GO 本地化方法及注意事项

http://whybiocc.blog.163.com/blog/static/580358972010102231246886/

1.    准备工作

  下载Mysql数据库并安装:http://www.mysql.com/downloads/mysql/ 。下个Essentials版本的就可以了。然后装上。(出问题自己解决)

  下载所需的数据文件:

http://archive.geneontology.org/latest-full/go_201309-assocdb-data.gz

ftp://ftp.ncbi.nlm.nih.gov/gene/DATA/gene_info.gz

ftp://ftp.ncbi.nlm.nih.gov/gene/DATA/gene2accession.gz

ftp://ftp.pir.georgetown.edu/databases/idmapping/idmapping.tb.gz

以上数据均下载最新的。

 下载local_b2g_db_tutorial_0609.zip. blast2go的网站上下载。

2.    本地化构建

 更改数据存放目录

因为要导入的数据很大,不要默认安装,最好要安装到一个空间比较大的盘上,如果默认安装Mysql数据库的话,所以要改变一下Mysql 的数据存储目录。

查看路径:mysql > show variables like “%dir%”; 在这个命令的结果中会看到datadir的路径,下边就是将这个路径改到别的位置。

改变路径:

停止mysql服务:net stop mysql; 更改my.ini中的datadir信息,并将原来的data目录copy到更改以后的路径中;重启服务:net start mysql.

 创建数据库和表

local_b2g_db_tutorial_0609 中有个b2g_db.sql文件,该文件是用来构建b2g数据库和建立相应表的文件,可以直接导入到mysql 中。

原始的这个文件有几个错误,要改一下:

1)         原始第9行:GRANT * , 改为 GRANT ALL.

2)         原始第10行:添加 use b2g;

3)         原始第26行:’description’ text NOT NULL default ‘’, default ‘’去掉。

这样,这个文件就可以直接导入了。

导入:sh> mysql –uroot –p password < c:/b2g_db.sql

这样在原来的mysql数据库中就多了一个b2g的数据库,同时这个库中还有三个表。自己查看一下,同时查看一下现在的数据存放目录是否改变了。

导入数据:

下边要导入已经下载好的4个数据文件。先都解压了,数据还是比较大的。

1)         导入go_<YYYYMM>-assocdb-data数据(压缩包1.18G,解压后7.45G)

进入mysql:

sh> mysql b2g –s –b –uroot –p

-s : silent mode: produce less out and speed up

-b : suppress the beep when errors occur

然后 mysql> source c:/go_****-assocdb-data

时间很长,等吧。

  导入gene2accession

mysql> load data local infile “path/gene2accession” into table gene2accession;

OK, 无错误

  导入gene_info

Mysql> load data local infile “path/geneinfo” into table gene_info;

OK,无错误

 导入PIR file(idmapping),这个是做蛋白质比对的 http://pir.georgetown.edu/,如果只做GO的话,可以不导入。

这个需要通过blast2go界面进行导入。Blast2go下的Tools-> DB configuration, 改变db-host, name, password,一般变为localhost, root , ***,然后选择 tools-> import PIR mapping to a local B2G-DB,导入。

3.    总结

这里导入的数据仅仅解决了mapping的步骤,其他的步骤还需要通过网络,并没有本地化,mapping的速度是最慢的,本地化后会快很多。

  检测是否构建成功:在blast2go的主界面中点击绿色的箭头,出现图形说明数据库已经建好了。

4.    可能出现的错误

  Network Connection Problem Premature EOF.过早结束。这个错误可能是由于杀毒软件造成的,关掉杀毒软件试试。不想关的话,放宽一下杀毒软件的过滤条件试试。

  Blast2goblast步骤需要多作几次,直到最后两次的miss blast一样为止,一般不存在blast结果的序列还是很少的。如果你没有大型的服务器,个人觉得通过NCBI blast反而比自己本地blast要快。

  富集分析:有时不报错,但是长时间不出结果,可能是杀毒软件的问题,关掉就很快出结果了。如果P值全为1,也这么做,试试看了。

  Could not create the java virtual machine的问题,可能是启动的blast2go需要的内存太多,设定一个小的内存使用量就可以了。

  Blast2go 会自动覆盖重复记录。会用后边的记录覆盖前边的记录。如果前面导入的结果为20hit,后面相同记录为19hit,那么最终的结果为19hit.所以再比对nrswissprot的时候,应该分开计算结果,然后再合并。

 Blast2go导入本地blast结果文件,受到序列条目和文件大小的限制,3000条序列一个文件是可以的(测试过),占内存很严重。文件大小在100M左右是可以的。

 用独立的blast程序比对swissprot数据库出现问题,xml结果中hit-id不正确,导致blast2go无法识别,可能是formatdb时出现了错误,自己检查一下。

  一般GO 分类中,biological process的节点很多,在blast2go中,这步出图的时候总是容易卡死,需要改变一下blast2go配置文件中图形节点的最大值,改大点应该可以出来。

5.    建议

  富集分析做barchart的时候,用p-value比较好,可以在图形中显示over under。不推荐用FDR

  Blast2go出来的分类饼图是不包括unknown类别的,个人建议用blast2go出来的数据重新画一个分布饼图,将unknown类放进去。

  blast的时候HSP的长度最好设定一下。



命令行的

http://www.blast2go.org/tut

Format and blast a fasta-file and import results into Blast2GO
Tips to format a database so that the results can than later be imported to blast2go without problems. The important thing here is to adapt the fasta sequence descriptions in a way that they can be parsed without problems. additionlly you will have to run “formatdb” with the ”-o T” and ·-a F” option.

1. Download a fasta file of your choice and unzip it.

2. Have a look at the IDs and make sure that the IDs you want to use for the GO-Mapping are at the second possiton like this ”>ref|myid|seq definition”.

3. For example if you want to blast against the GO-lite database you could the following command:

RefSeq IDs

cat go_20091108-seqdb.fasta | sed s/^.*RefSeq:/\>ref\|/ | sed s/[[:blank:]].*$//g > go_20091108-seqdb_refseq.fastaUniprot IDs

cat go_20091108-seqdb.fasta | sed s/^.*Uniprot:/\>ref\|/ | sed s/[[:blank:]].*$//g > go_20091108-seqdb_refseq.fasta
4. Than you will have to format you fasta file to be used by the blast programm. Here you should draw special attention to the -o and -a flag.

./formatdb -p T -o T -a F -i go_20091108-seqdb_refseq.fasta -n go_refseqids
5. Now you can BLAST against this database. These parameters would simulate b2G default parameters. We use this command on a dual core mashine (-a 2)

./blastall -a 2 -b 20 -v 20 -p blastx -e 0.001 -m 7 -d go_refseqids -i data_example.fasta -o results.xml
6. Finally import your xml-file (results.xml) into Blast2GO and visualize serveral Blast results to see if the accession appear in the right place.
7. Now you can proceed to the mapping step as usual.

 

Usage:
 java <-Xms64m -Xmx512m> -jar blast2go.jar <parameters>
 Example: java -Xms256m -Xmx512m -jar blast2go.jar -in BlastResults.xml -v -a -out MyAnnot
 java -Xms256m -Xmx512m -jar blast2go.jar -prop b2gPipe.properties -in E:/all_unigene_blast_swissport.xml -v -a -out all_unigene_blast_swissport
 
 The parameters "Xms" and "Xmx" indicate the min and max java
 memory heap size in MB. It is recomended to use these parameters in
 projects with more than 2000 Seqs.
 
Parameters:

-in <input-file>
 XML file with (ncbi-style) blast results

-out <outputfile>
 Name of the output file; if not given, name will be the same as the
 input file with appended extensions (optional: default=input-file + extension)
 
-prop <property-file> 
 File containing the application settings(optional: default=b2gPipe.properties)
 Application and annotation parameters have to be defined in the
 "b2gPipe.properties" file which has to be in the same directory as
 the blast2go.jar executable or like indicated by this parameter.

-v
 prints application messages to the console

-a
 generates a B2G annotation file  (.annot)

-d
 generates a B2G project file (.dat)
 IMPORTANT: DONT USE WITH MANY SEQUENCES (>10000)

Requirements:
 - Java Runtime Environment (JRE), Version > 1.5
 - Internet - Connection
 - min: 512 MB RAM

Comments on Blast XML input files:
File in the format like "E" are not recommended. The rest is OK.

  评论这张
 
阅读(3682)| 评论(2)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018