Average Nucleotide Identity (ANI) 计算

ANI概念

Average Nucleotide Identity (ANI) 是在核酸水平,两两基因组之间所有直系同源蛋白编码基因的相似性,常用于研究基因组之间的进化距离。相较于传统的 DNA-DNA hybridization (DDH),ANI指标计算简单省时。且ANI指标有助于构建结构性数据库,方便生物信息学者的后续研究。还有一种计算ANI的方法是基于俩俩基因组的共同同源蛋白编码基因的相似性。接下来介绍几款计算ANI的在线工具和本地软件(Jspecies 和 pyani)。

ANI在线工具

Kostas lab:http://enve-omics.ce.gatech.edu/ani/index

MicrobeTrakr 的 ANI Calculator:http://www.microbetrakr.org/ani/

Ezbiocloud:http://www.ezbiocloud.net/tools/ani

ANI本地软件

Jspecies

http://imedea.uib-csic.es/jspecies/  DOI: 10.1073/pnas.0906412106
Jspecies是可视化操作,用户体验简单。但输入基因组相对麻烦,不方便较多基因组之间的两两计算ANI。

Jspecies安装

  1. # install blast
  2. mkdir blast
  3. cd blast
  4. wget http://mirrors.vbi.vt.edu/mirrors/ftp.ncbi.nih.gov/blast/executables/legacy/2.2.26/blast-2.2.26-universal-macosx.tar.gz
  5. tar zxvf blast-2.2.26-universal-macosx.tar.gz -C /opt/biosoft
  6. # blast path: /opt/biosoft/blast-2.2.26/bin/blastall
  7. # formatdb path: /opt/biosoft/blast-2.2.26/bin/formatdb
  8. # fastacmd path: /opt/biosoft/blast-2.2.26/bin/fastacmd
  9. cd ..
  10. # install MUMmer
  11. mkdir MUMmer
  12. cd MUMmer
  13. wget https://sourceforge.net/projects/mummer/files/mummer/3.23/MUMmer3.23.tar.gz
  14. tar zxvf MUMmer3.23.tar.gz -C /opt/biosoft
  15. cd /opt/biosoft/MUMmer3.23
  16. make check
  17. make install
  18. # nucmer path: /opt/biosoft/MUMmer3.23/nucmer
  19. # install Jspecies
  20. mkdir /opt/biosoft/jspecies
  21. cd /opt/biosoft/jspecies
  22. wget http://imedea.uib-csic.es/jspecies/jars/jspecies1.2.1.jar
  23. java -jar -Xms1024m -Xmx1024m jspecies1.2.jar

Jspecies运行

  • 打开软件图形界面后,点击 Edit 下的 preferences,添加 blast、nucmer、formatdb、fastacmd路径;
  • 设置 ANIb (基于blast得到的ANI值)
  1. -X 空比对对应的下降值 [默认 150]
  2. -q 碱基错配罚分 [默认 -1]
  3. -F 是否过滤query序列的简单重复和低复杂度序列 [F]
  4. -e e-value [默认 1e-15]
  5. -a 运行线程数 [默认 2]
  6. Identity (%) >= 30
  7. Alignment (%) >= 70 #more than 30% overall sequence identity (recalculated to an identity along the entire sequence) over an alignable region of at least 70% of their length
  8. length 1020 #query序列被连续切割成1020bp的片段,然后将这些片段blastn比对到reference序列,比对的结果用于后续计算
  • ANIm (基于MUMmer得到的ANI值)参数
  1. -b 低得分区大于此值时,停止比对 [默认 200]
  2. -c 一簇匹配的序列最少需要有大于此长度的匹配。此值越大,则小的匹配越少 [默认 65]
  3. -g 在一簇匹配的序列中,两个邻近的matches之间的gap的最大阈值。此值越大,则越容易找到更大匹配区 [默认 90]
  4. -l single match的最小长度 [默认 20]
  • 导入数据并运行:File -> New  File -> Import FASTA(S) from files -> 选择 Tetra、ANIb、ANIm -> Start

ANI命令行软件

pyani

pyani是用于计算ANI的python3模块,其依赖包有numpy、scipy、matplotlib、biopython、pandas、seaborn。0.1.3.2及以上版本的其他依赖包不用另外安装,0.1.3.2以下版本 pip install -r requirements.txt 安装依赖包。pyani 包括average_nucleotide_identity.py (计算ANI) 和 genbank_get_genomes_by_taxon.py (从NCBI下载数据),并提供四种不同算法:

  • ANIm:使用 MUMmer (NUCmer) 比对序列
  • ANIb:使用 BLASTN+ to 比对序列的 1020nt 片段
  • ANIblastall:使用老版的 BLASTN 比对序列的 1020nt 片段
  • TETRA:计算每个序列的四核苷酸的频率

pyani安装

  1. # pip3 install
  2. pip3 install pyani
  3. echo "PATH=/home/linuxbrew/.linuxbrew/bin:$PATH" >> ~/.bashrc
  4. source ~/.bashrc
  5. # local install
  6. git clone git@github.com:widdowquinn/pyani.git
  7. cd pyani
  8. python3 setup.py install

pyani运行

  1. # example
  2. average_nucleotide_identity.py -i tests/test_ani_data/ -o tests/test_ANIm_output -m ANIm -g
  3. average_nucleotide_identity.py -i tests/test_ani_data/ -o tests/test_ANIb_output -m ANIb -g
  4. average_nucleotide_identity.py -i tests/test_ani_data/ -o tests/test_ANIblastall_output -m ANIblastall -g
  5. average_nucleotide_identity.py -i tests/test_ani_data/ -o tests/test_TETRA_output -m TETRA -g

pyani参数

  1. # required
  2. -i INDIRNAME, --indir INDIRNAME 输入文件所在目录
  3. -o OUTDIRNAME, --outdir OUTDIRNAME 输出结果目录
  4.  
  5. # optional
  6. -v, --verbose 输出详细结果
  7. -f, --force 强制文件的写入
  8. -s FRAGSIZE, --fragsize FRAGSIZE
  9. ANIb比对时序列的片段大小 [默认 1020]
  10. -l LOGFILE, --logfile LOGFILE
  11. 输出日志文件
  12. --skip_nucmer 跳过运行NUCmer
  13. --skip_blastn 跳过运行BLASTN
  14. --noclobber 不重做已存在文件
  15. --nocompress 不压缩或删除比较结果
  16. -g, --graphics 生成ANI的热图
  17. --gformat GFORMAT 图形文件输出格式 [pdf|png|jpg|svg] [默认 pdf,png,eps]
  18. --gmethod {mpl,seaborn} 图形输出方法 [默认 mpl]
  19. --labels LABELS 序列标记文件的路径
  20. --classes CLASSES 序列分类文件的路径
  21. -m {ANIm,ANIb,ANIblastall,TETRA}, --method {ANIm,ANIb,ANIblastall,TETRA}
  22. ANI比对方法 [默认 ANIm]
  23. --scheduler {multiprocessing,SGE}
  24. Job scheduler [默认 multiprocessing]
  25. --workers WORKERS 运行线程数 [默认 全部线程]
  26. --SGEgroupsize SGEGROUPSIZE
  27. SGE组中job [默认 10000]
  28. --SGEargs SGEARGS Additional arguments for qsub
  29. --maxmatch Override MUMmer to allow all NUCmer matches
  30. --nucmer_exe NUCMER_EXE
  31. NUCmer 程序路径
  32. --filter_exe FILTER_EXE
  33. delta-filter 程序路径
  34. --blastn_exe BLASTN_EXE
  35. BLASTN+ 程序路径
  36. --makeblastdb_exe MAKEBLASTDB_EXE
  37. BLAST+ makeblastdb 程序路径
  38. --blastall_exe BLASTALL_EXE
  39. BLASTALL 程序路径
  40. --formatdb_exe FORMATDB_EXE
  41. BLAST formatdb 程序路径
  42. --write_excel 输出Excel格式文件
  43. --rerender Rerender graphics output without recalculation
  44. --subsample SUBSAMPLE
  45. Subsample a percentage [0-1] or specific number (1-n)
  46. of input sequences
  47. --seed SEED Set random seed for reproducible subsampling.
  48. --jobprefix JOBPREFIX
  49. Prefix for SGE jobs (default ANI).

pyani自带绘图,若不满意,可以调用ggplot2绘制热图

  1. Rscript heatmap_ANI.R $OUTPUT/ANIb_percentage_identity.tab
  1. #!/usr/bin/env Rscript
  2. library("ggplot2")
  3. library("reshape")
  4.  
  5. userprefs <- commandArgs(trailingOnly = TRUE)
  6. file_name <- userprefs[1]
  7.  
  8. # read file
  9. data.ANI <- read.table(file_name)
  10.  
  11. # cluster and order matrix
  12. row.order <- hclust(dist(data.ANI))$order # clustering
  13. col.order <- hclust(dist(t(data.ANI)))$order
  14. dat_new <- data.ANI[row.order, col.order] # re-order matrix accoring to clustering
  15.  
  16. # melt to dataframe
  17. df_molten_dat <- melt(as.matrix(dat_new)) # reshape into dataframe
  18. names(df_molten_dat)[c(1:3)] <- c("shewanella1", "shewanella2", "ANI")
  19.  
  20. # make plot
  21. p1 <- ggplot(data = df_molten_dat,
  22. aes(x = shewanella1, y = shewanella2, fill = ANI)) +
  23. geom_raster() +
  24. scale_fill_distiller(palette = "RdYlBu", limits=c(0.8, 1)) +
  25. theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
  26. ggtitle("Shewanella ANI heatmap")+
  27. geom_text(aes(label = round(ANI, 2)))+
  28. theme(axis.title=element_text(size=16), strip.text.x=element_text(size=16),
  29. legend.title=element_text(size=15), legend.text=element_text(size=14),
  30. axis.text = element_text(size=14), title=element_text(size=20),
  31. strip.background=element_rect(fill=adjustcolor("lightgray",0.2))
  32. )
  33.  
  34. # export plot
  35. png("Heatmap_ANI_highres.png", width=15, height=15, units="in", pointsize=12, res=500)
  36. p1
  37. dev.off()

示例图效果

24种不同 shewanella 属菌种ANI比较热图

Average Nucleotide Identity (ANI) 计算

参考:

http://imedea.uib-csic.es/jspecies/

https://github.com/widdowquinn/pyani/

http://www.a-site.cn/article/300418.html

https://github.com/rprops/MetaG_lakeMI/wiki/

    • 山山 0

      写得好棒👍

    发表评论

    匿名网友

    拖动滑块以完成验证
    加载失败