Rev Language Reference


fnMutSel - Add mutation-selection balance to a rate matrix.

Constructs a rate matrix from scaled selection coefficients w[i] and mutation rate matrix mu(i,j). fnMutSel takes 61 scaled selection coefficients, one for each codon. This differs from fnMutSelAA, which takes 20 scaled selection coefficients, one for each amino acid. A substitution from allele i -> j can be decomposed into (1) all individuals initially have state i (2) a single individual mutates from i -> j, at rate mu(i,j) (3) the allele j goes to fixation Then the substitution rate Q is then given by Q(i,j) = mu(i,j) * Pr(j goes to fixation | i was fixed previously). The probability of fixation is determined by scaled selection coefficients: F[i] = 2*N*s[i] and the initial frequency 1/N of allele j.

Usage

fnMutSel(RateMatrix submodel, Real[] fitnesses)

Arguments

submodel : RateMatrix (pass by const reference)
Mutation rate matrix.
fitnesses : Real[] (pass by const reference)
Fitnesses.

Return Type

Example

er ~ dnDirichlet( v(1,1,1,1,1,1) )
nuc_pi ~ dnDirichlet( rep(2.0, 4) )
F ~ dnIID(61, dnNormal(0,1))
Q := fnMutSel(fnX3(fnGTR(er, nuc_pi) ), F)       # GTR + X3 + MutSel

# A mutation-selection balance model on RNA, with GTR mutation.
F2 ~ dnIID(16, dnNormal(0,1))
Q2 := fnMutSel(fnX2(fnGTR(er,nuc_pi) ), F2)      # GTR + X2 + MutSel

See Also