跟着Nature Genetics学数据分析~SNP数据计算距离
最近在看论文 Phased diploid genome assemblies and pan-genomes provide insights into the genetic history of apple domestication(高水平论文看起来还真是吃力!)看懂一点记一点吧。今天的笔记记录的是SNP数据计算距离矩阵,然后用距离矩阵构建进化树的过程。论文原文的方法部分写到:
A neighbor-joining phylogeny was constructed based on the P distance matrix calculated by VCF2Dis
这篇论文提供了vcf格式的SNP数据下载链接
Genome assemblies and annotated genes, nonreference genome sequences and annotated genes of the apple pan-genomes, and SNPs and SVs called from the genome resequencing data are also freely available at http://bioinfo.bti.cornell.edu/apple_genome.
那接下来我们就可以试一下了
首先是下载数据
wget ftp://bioinfo.bti.cornell.edu/pub/Apple_genome/variome/SNP.vcf.gz
这个数据集稍微有点大
接下来是计算距离矩阵
用到的工具是 VCF2Dis
工具对应的github主页
https://github.com/BGI-shenzhen/VCF2Dis
按照软件主页的帮助文档 下载安装,没有遇到问题

使用VCF2Dis这个软件计算距离矩阵
软件用起来也很简单,直接指定vcf格式的文件,压缩文件也可以
./VCF2Dis-1.43/bin/VCF2Dis -InPut SNP.vcf.gz -OutPut p_dis.mat
运行过程顺利,没有遇到报错
得到距离矩阵文件 p_dis.mat

这个软件的主页还很贴心写了如何利用距离矩阵构建NJ树的方法
为了省事就直接使用在线程序了
http://www.atgc-montpellier.fr/fastme/

很快就得到了结果

最后是用ggtree展示进化树
library(ggtree)
library(treeio)
tree<-read.newick("p_dis_mat_fastme-tree.nwk")
ggtree(tree,layout = "ape")+
geom_tiplab(size=2)

已经很接近论文里的结果了,接下来应该好好想想如何美化了

简单比较了一下,结果好像还差的挺多的
今天的内容就先到这里了
欢迎大家关注我的公众号
小明的数据分析笔记本