NR数据库的物种注释

NR数据库的物种注释

1.创建NR子库

为什么要创建nr或nt数据库的子库,因为这两个库数据量巨大,若只专注某个领域而非全部,则在对自身领域进行注释时就会耗费大量时间,为了节省时间,就需要在原来nr/nt数据库的基础上构建相对的子库。

构建方法如下:

  • 方法一:从NCBI官网下载相应物种的Accession ID

在2017年之后的nr/nt数据库变成不再支持gi号搜索的。所以我们不可以根据gi号来分离并构建对应的子库,那么我们就需要查看新版本的nr/nt库的序列的id特征,发现他们变成了accession id,那么我们就可以采取对应的方式来分离子库了。

  1. Download the prebuilt nr database (在ncbi上下载最新的nr/nt数据库),and use makeblastdb build prot database makeblastdb -in nr -dbtype prot -parse_seqids -hash_index -out nr -logfile log.txt

  2. Search the Entrez Protein database **with query:**query id[ORGN],即你所要建子库相应的txid号。[NCBI][https://www.ncbi.nlm.nih.gov/protein/]

在这里插入图片描述

  1. Select “Send to File” and choose format “accession list”然后在send to 位置选择accession list 导出相应的accession list文件“ sequence.seq

NR数据库的物种注释_第1张图片

  1. Use the list of GIs from the previous step with the blastdb_aliastool to build an aliased blastdb of just your organism (takes several seconds), eg:blastdb_aliastool -seqidlist sequence.seq -db nr -out nr_plant -title nr_plant

  2. Search against your new (aliased) database:blastx -query query.fa -db nr_plant

搜索时的==[ORGN]==是必须加上的,因为其代表整个团体,若不加上只能搜到其txid所代表的那一个物种。

  • 方法二:使用taxonkit工具从taxanomy文件中提取
  1. 首先要下载taxonkit工具,[下载网址][http://bioinf.shenwei.me/taxonkit/download/],linux系统下直接解压使用,再将Taxonkit添加进环境变量sudo cp taxonkit /usr/local/bin/

    ​ 再将从NCBI官网上下载的taxanomy文件中的names.dmpnodes.dmp文件复制到用户目录的隐藏文件夹.taxonkit中,命令如下:

cp names.dmp ~/.taxonkit
cp nodes.dmp ~/.taxonkit

​ 之后便可以正常使用了。此时还需要从NCBI官网上下载NCBI的accession与taxid的对应关系文件[prot.accession2taxid.gz][ftp://ftp.ncbi.nih.gov/pub/taxonomy/accession2taxid/prot.accession2taxid.gz]。

  1. 使用TaxonKit提取特定taxons下的所有taxid,命令如下:
 taxonkit list --ids 33090 --indent "" > plant.taxid.txt
 wc -l plant.taxid.txt

​ 此时–ids的参数33090是代表整个植物届的最大的parent id,–indent ""是将所列出的taxid左边的空格去除,,以左对齐排列。

  1. 使用csvtk在prot.accession2taxid.gz文件中提取plant.taxid所有的accession
zcat prot.accession2taxid.gz |csvtk -t grep -f taxid -P plant.taxid.txt |csvtk -t cut -f accession.version >plant.taxid.acc.txt

csvtk参数含义可以到csvtk usage查询,[csvtk功能介绍][http://bioinf.shenwei.me/csvtk/usage/].

  1. 利用获取到的plant.taxid.acc.txt文件创建nr子库
blastdb_aliastool -gilist plant.taxid.acc.txt -db nr -out nr_plant -title nr_plant
  1. 如果是想提取特定物种(比如植物)下的所有NR序列
 blastdbcmd -db nr -entry all -outfmt "%a\t%T" |csvtk -t grep -f 2 -P plant.taxid.acc.txt |csvtk -t cut -f 1 |blastdbcmd -db nr -entry_batch - -out nr.plant.fa

两种方法的比较:
方法一更加适合创建较大物种范围的nr子库,即细菌,真菌,植物届等等,速度较快,且方便。

方法二适用于创建多个较小物种集合的nr子库,不需要到NCBI上反复查询,可以写成脚本的形式。

2.txid的查询

常见txid号

Name txid Search id Scope
Bacteria 2 txid2[ORGN] 细菌
Fungi 4751 txid4751[ORGN] 真菌
Eukaryota 2759 txid2759[ORGN] 真核生物
Vertebrata 7742 txid7742[ORGN] 脊椎动物门
Viridiplantae 33090 txid33090[ORGN] 植物界

若不知我们研究物种分类的txid号,则可以通过以下方法查询:通过物种分类中一个已知物种名,例如研究真菌,知晓酿酒酵母的物种名,saccharomyces cerevisiae,知道酿酒酵母属于真菌。

  1. 选择NCBI数据库的Taxanomy,输入saccharomyces cerevisiae,搜索。

NR数据库的物种注释_第2张图片

  1. 点击进入后,选择Lineage中的fungi,再点击Fungi。

NR数据库的物种注释_第3张图片
NR数据库的物种注释_第4张图片

  1. 从Fungi的界面可以看到其txid号为4751.

NR数据库的物种注释_第5张图片

资料来源:

NR子库构建:

http://www.biotrainee.com/thread-1818-1-1.html

http://www.bioinfo-scrounger.com/

txid号查询:http://blog.sina.com.cn/s/blog_14ece68cc0102vx90.html

你可能感兴趣的:(生信基础概念,big,data)