codml site models

codml 位点模型 (Site model) 假设蛋白质氨基酸序列或密码子序列中不同位点受到的选择压力不同,可以通过 model = 0和多个Nssites 参数来实现这种情况下dn ds 的计算,进行正选择分析。

相应家族CDS序列提取和对齐

OrthoFinder 已经对不同物种的氨基酸序列进行Orthologs 和Paralogs 的分类,利用Orthogroups/Orthogroups.txt对目标家族和相应基因的 cds 序列文件进行索引并抽取构成ogs.fa 核苷酸序列文件,每个ogs.fa文件只包含该家族的cds序列。

通过prank 进行比对,必要时可以用gblocks 进行过滤,PAL2NAL.pl将蛋白质的多序列联配结果转换为编码序列的多序列联配,并去除多序列联配中产生的空位(gap),将fasta 格式转换为phily 格式,同时用raxml 进行进化树重构,至此codml 所需文件就构建完成。

#  extracting cds fasta of each OG id
multfa2OG.py --OGs OGS --multfa cds.fa --path results

# alignmented nucleotide sequence and makeing tree
mkdir -p PAML/Prank
mkdir -p PAML/Pal2Nal
mkdir -p PAML/NucTree

prank -d="${ogs}.fa" -translate -F -o=PAML/Prank/${ogs} 
pal2nal.pl PAML/Prank/${ogs}.best.pep.fas PAML/Prank/${ogs}.best.nuc.fas -output fasta -nogap -nomismatch > PAML/Pal2Nal/${ogs}.nuc.fa

cd PAML/NucTree 
raxmlHPC-PTHREADS -f a -m GTRGAMMA -T 2 -x $RANDOM -N 100 -n ${ogs}.tree -s ../../raxmlPAML/Pal2Nal/${ogs}.nuc.fa -p $RANDOM

# makeing Phylip fasta
mkdir -p PAML/Phylip
python3 fasta2phylip.py --input Pal2Nal/${ogs}.nuc.fa --output Phylip/${ogs}.nuc.fa.paml

# codeml.ctl
noisy = 1
verbose = 0
runmode = 0
seqtype = 1
CodonFreq = 2
model = 0
NSsites = 0 1 2 7 8
fix_omega = 0
omega = 1

结果处理

正选择的相关信息:

The first compares M1a (NearlyNeutral) and M2a (PositiveSelection), while the second compares M7 (beta) and M8 (beta&ω). M1a (NearlyNeutral) and M2a (PositiveSelection) are slight modifications of models M1 (neutral) and M2 (selection) in (Nielsen and Yang 1998).

一半来说,提取结果文件m1, m2, m7, m8 模型的lnL数据,通过自由度为2的卡方检验是更为常见的做法。

names(codeml_out) <- c("Ogs", "m1_ln1", "m2_lnl", "m7_lnl", "m8_lnl")

compare_models <- function(lnl1, lnl2){
  likelihood = 2*(abs(lnl2 - lnl1))
  p = 1 - pchisq(likelihood, df = 2)
  return(p)
}

# M1 (neutral) vs M2 (selection)
## alternative hypothesis: true selection happened.
# M7 (beta) vs M8 (beta& w)
# The M1a-M2a comparison appears to be more stringent than the M7-M8 comparison.
m2_p_pos = compare_models(codeml_out$m1_ln1, codeml_out$m2_lnl)
m8_p_pos = compare_models(codeml_out$m7_lnl, codeml_out$m8_lnl)

padj_M2vsM1 = p.adjust(m2_p_pos, "BH", length(m2_p_pos))
padj_M8vsM7 = p.adjust(m8_p_pos, "BH", length(m8_p_pos))

你可能感兴趣的:(codml site models)