美文网首页
Dsuite ABBA_BABA分析操作案例

Dsuite ABBA_BABA分析操作案例

作者: Miss_Jiang | 来源:发表于2021-05-20 22:16 被阅读0次

# 官网说明书:https://github.com/millanek/Dsuite

########## 1 Installation

# 注意操作系统环境配置:GCC的版本 >=4.9.0 。GCC的安装与升级,参考:https://www.cnblogs.com/jixiaohua/p/11732225.html

git clone https://github.com/millanek/Dsuite.git

cd Dsuite

make

vi ~/.bashrc

# export PATH=/pub/software/Dsuite/Build:$PATH #你的安装目录

source ~/.bashrc

Dsuite -h #查看帮助

########## 2 Input files

#(1)vcf文件,可以包含SNPs和Indels的多等位基因位点,但必须是biallelic。

#(2)个体或种群名录SETS.txt

# 想用多少用多少个体,如果中途希望取子集研究,只需要把不需要的个体用xxx替代就行。

# 在Dtrios命令中至少要指定一个outgroup。

# 在Dquartets中不要有outgroup,因为这个命令会自动分组,探索所有可能的patterns。

cat SETS.txt #文件格式如下

Ind1    Species1

Ind2    Species1

Ind3    Species2

Ind4    Species2

Ind5    Species3

Ind6    Outgroup

Ind7    Outgroup

Ind8    xxx

...    ...

IndN    Species_n

########## 3 Optional files

#(1)Newick格式的树。 树应具有与物种/种群名称相对应的叶子标签。 分支长度可以存在,但不使用。 若要使用Fbranch,树必须使用Outgroup置根。 例子:

#(Species2,(Species1,(Species3,Species4)));

#(Species2:6.0,(Species1:5.0,(Species3:3.0,Species4:4.0)));

#(2)用于Dinvestigate的test_trios.txt文件。 每行三个种群/物种,以制表符按P1 P2 P3的顺序分隔:

Species1    Species2    Species3

Species1    Species4    Species2

...  ...        ...

########## 4 Piped VCF input #本案例中没有用到

# 可以从另一个程序(例如bcftools)将基因型数据“输送”到Dsuite Dtrios或Dsuite Dquartets中,从而允许自定义过滤VCF文件。

# 只需使用stdin关键字代替VCF文件名即可。

# 还必须通过-l选项为Dsuite程序提供已过滤的VCF中的行数。

# 例如,要在所有样本中对VCF进行过滤,以使其总最小深度至少为1000,则可以使用以下命令:

NUMLINES=$(bcftools view -i 'INFO/DP>1000' INPUT_FILE.vcf.gz | wc -l)  # to get NUMLINES

bcftools view -i 'INFO/DP>1000' INPUT_FILE.vcf.gz | Dsuite Dtrios -l $NUMLINES stdin SETS.txt

########## 5 Commands (v0.4):  Dsuite Dtrios

# Dsuite Dtrios - Calculate the D (ABBA-BABA) and f4-ratio statistics for all possible trios of populations/species

# Usage: Dsuite Dtrios [OPTIONS] INPUT_FILE.vcf SETS.txt

Dsuite Dtrios -t tree.nwk -c snp.flt.vcf SETS.txt 

# -t  指定树结构

# -c 不需要生成用于合并的文件"_combine.txt"和"_combine_stderr.txt"

# SETS.txt  为指定的3个类群和Outgroup

### Dtrios的 Output

(1) SETS_BBAA.txt #结果文件,支持BBAA模式,p < 0.01

P1 P2 P3 Dstatistic Z-score p-value f4-ratio BBAA ABBA BABA

Species1 Species2 Species3 0.0363449 3.95771 3.7836e-05 0.0222077 439626 439435 408612

(2) SETS_Dmin.txt

(3) SETS_tree.txt #与SETS_BBAA.txt内容相同

########## 6 Commands (v0.4):  Dsuite Dquartets #推荐使用,一次性计算出所有组合的可能性,从中选取合理的部分

# Calculate the D (ABBA/BABA) and f4-ratio (f_G) statistics for all quartets of species in the dataset (there is no outgroup)

# Usage: Dsuite Dquartets [OPTIONS] INPUT_FILE.vcf SETS.txt

Dsuite Dquartets -t tree.nwk snp.flt.vcf SETS.txt 

# SETS.txt中没有outgroup,第二列为各个样品的物种或分组名,个体名称与snp.flt.vcf 中一致

# tree.nwk 树上叶子的名称为SETS.txt中的物种或分组名

### Dquartets的 Output

(1) SETS_quartets_BBAA.txt #结果文件

cat SETS_quartets_BBAA.txt 

# 查看结果,结果会显示每个组合的P1 P2 P3 P4,the D statistics,Zscore,unadjusted p-values,the f4-ratios,以及BBAA、BABA和ABBA patterns的数量。

(2) SETS_quartets_combine.txt  和 SETS_quartets_combine_stderr.txt  #用于合并,本案例不需要

(3) SETS_quartets_Dmin.txt 和 SETS_quartets_quartets_tree.txt  #与SETS_quartets_BBAA.txt中的内容一样

#结果的进一步解读和绘图,待续。。。

相关文章

网友评论

      本文标题:Dsuite ABBA_BABA分析操作案例

      本文链接:https://www.haomeiwen.com/subject/gscgjltx.html