一、引言:
本文介绍一个小工具,taxon-translation
, 使用场景:
需要将NCBI Taxonomy数据库的数字标识符转换成整个Lineage信息。
taxon-utils 仓库地址: https://github.com/jameslz/taxon-utils
二:应用
2.1 数据库格式化 taxon-db
taxon-db
程序将NCBI的Taxonomy数据库的 node.dmp
和 name.dmp
合并成一个文件。
执行方法:
taxon-db nodes.dmp names.dmp >ncbi.map
gzip ncbi.map
ncbi.map 也可以从 taxon-utils 仓库下载, ncbi.map.gz(版本为2017-09-15)链接。
2.1 数据库格式化 taxon-translate
taxon-translate
命令行接口比较简单:
$ taxon-translate
Usage: taxon-translate [options] <ncbi-map> <tab>
Options:
-c INT target col for taxon translate, default: 1
-v print version number
可以通过 -c
指定列进行翻译。
测试文件(test.tsv):
read_1 68 Lysobacter enzymogenes
第一列为序列名称, 第二列为NCBI Taxon ID, 第三列为科学命名。
对第二列进行翻译:
taxon-translate -c 2 ncbi.map.gz test.tsv
我们可以获得:
read_1 69 Lysobacter enzymogenes \
d:Bacteria;p:Proteobacteria;c:Gammaproteobacteria; \
o:Xanthomonadales;f:Xanthomonadaceae;g:Lysobacter;s:Lysobacter enzymogenes
很直接,很简单。
该程序每次都要将ncbi.map.gz
读入内存, 因此可以先将ncbi.map.gz
对于对应的数据结构序列化,然后直接内存映射,这样可以对taxon-translate
进一步优化。
本文材料为 BASE (Biostack Applied bioinformatic SEies ) 课程 Linux Command Line Tools for Life Scientists 材料, 版权归 上海逻捷信息科技有限公司 所有。
Last Update: 2017-11-22 5:56 PM