1 /*********************************************************
2 * Copyright (C) 2005, BGI of Chinese Academy of Sciences
6 * Abstract: Definition of LPB93 and MLPB93 class.
9 * Author: Zhang Zhang (zhanghzhang@genomics.org.cn)
13 Li WH (1993) Unbiased estimation of the Rates of synonymous
14 and nonsynonymous substitution. J. Mol. Evol. 36:96-99.
16 Pamilo P, Bianchi NO (1993) Evolution of the Zfx and Zfy
17 genes: rates and interdependence between the genes. Mol. Biol.
20 Tzeng Y-H, Pan R, Li W-H (2004) Comparison of Three Methods
21 for Estimating Rates of Synonymous and Nonsynonymous Nucleotide
22 Substitutions. Mol. Biol. Evol. 21:2290-2298.
23 **********************************************************/
32 /* Similar to LWL85 except the formulas for calculating ka and ks*/
33 string
LPB93::Run(string seq1
, string seq2
) {
35 preProcess(seq1
, seq2
);
37 Ks
= B
[4] + (L
[2]*A
[2] + L
[4]*A
[4])/(L
[2] + L
[4]);
38 Ka
= A
[0] + (L
[0]*B
[0] + L
[2]*B
[2])/(L
[0] + L
[2]);
40 Sd
= L
[2]*A
[2] + L
[4]*K
[4];
41 Nd
= L
[2]*B
[2] + L
[0]*K
[0];
46 t
= (L
[0]*K
[0]+L
[2]*K
[2]+L
[4]*K
[4])/(L
[0]+L
[2]+L
[4]);
52 /*The difference between LPB93 and MLPB93 focuses on the definition of transition & transversion*/
57 /*For more detail see reference: Tzeng Y-H, Pan R, Li W-H (2004) Mol. Biol. Evol.*/
58 int MLPB93::TransitionTransversion(string codon1
, string codon2
, int pos
) {
60 //1:synonymous, 0:nonsynonymous, -1:uncalculate
63 //Ile: ATT, ATC, ATA; Met: ATA
64 if ((codon1
=="ATA" && codon2
=="ATG" && pos
==2)||(codon1
=="ATG" && codon2
=="ATA" && pos
==2)) {
67 if ((codon1
=="ATA" && (codon2
=="ATC"||codon2
=="ATT") && pos
==2) || ( (codon1
=="ATC"||codon1
=="ATT") && codon2
=="ATA" && pos
==2)) {
71 //Arg: CGA, CGG, AGA, AGG
72 if ((codon1
=="CGA" && codon2
=="AGA" && pos
==0)||(codon1
=="AGA" && codon2
=="CGA" && pos
==0)) {
75 if ((codon1
=="CGG" && codon2
=="AGG" && pos
==0)||(codon1
=="AGG" && codon2
=="CGG" && pos
==0)) {
79 //Synonymous: A<->G, C<->T
82 int sum
= convertChar(codon1
[pos
]) + convertChar(codon2
[pos
]);
89 int class1
=getCodonClass(codon1
,pos
);
90 int class2
=getCodonClass(codon2
,pos
);
92 Si_temp
[class1
] += 0.5;
93 Si_temp
[class2
] += 0.5;
96 Vi_temp
[class1
] += 0.5;
97 Vi_temp
[class2
] += 0.5;