Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
75 lines (65 sloc) 2.3 KB
;; The grammar.
(grammar
(name JukesCantor-parametric)
;; Transformation rules. These follow the pattern for a null model with rate matrix X.
(transform (from (S)) (to (X S*)))
(transform (from (S*)) (to (S)) (prob 1))
(transform (from (S*)) (to ()) (prob 1))
(update-rules 0)
;; The overall replacement rate, R.
;; The actual observed substitution rate is 0.75*R
;; (because 1/4 of replacements are to the original nucleotide,
;; therefore they don't correspond to observable substitutions)
(rate
(R 1.3333)
)
;; Rate matrix
(chain
;; The state of this chain is a single nucleotide X.
(terminal (X))
;; Treat initial probabilities and mutation rates as functions, not variables.
(update-policy parametric)
;; initial probability distribution
(initial (state (a)) (prob .25))
(initial (state (c)) (prob .25))
(initial (state (g)) (prob .25))
(initial (state (t)) (prob .25))
;; mutation rates
(mutate (from (a)) (to (a)) (rate .25 * R))
(mutate (from (a)) (to (c)) (rate .25 * R))
(mutate (from (a)) (to (g)) (rate .25 * R))
(mutate (from (a)) (to (t)) (rate .25 * R))
(mutate (from (c)) (to (a)) (rate .25 * R))
(mutate (from (c)) (to (c)) (rate .25 * R))
(mutate (from (c)) (to (g)) (rate .25 * R))
(mutate (from (c)) (to (t)) (rate .25 * R))
(mutate (from (g)) (to (a)) (rate .25 * R))
(mutate (from (g)) (to (c)) (rate .25 * R))
(mutate (from (g)) (to (g)) (rate .25 * R))
(mutate (from (g)) (to (t)) (rate .25 * R))
(mutate (from (t)) (to (a)) (rate .25 * R))
(mutate (from (t)) (to (c)) (rate .25 * R))
(mutate (from (t)) (to (g)) (rate .25 * R))
(mutate (from (t)) (to (t)) (rate .25 * R))
) ;; end chain X
) ;; end grammar
;; Standard DNA alphabet
(alphabet
(name DNA)
(token (a c g t))
(complement (t g c a))
(extend (to n) (from a) (from c) (from g) (from t))
(extend (to x) (from a) (from c) (from g) (from t))
(extend (to u) (from t))
(extend (to r) (from a) (from g))
(extend (to y) (from c) (from t))
(extend (to m) (from a) (from c))
(extend (to k) (from g) (from t))
(extend (to s) (from c) (from g))
(extend (to w) (from a) (from t))
(extend (to h) (from a) (from c) (from t))
(extend (to b) (from c) (from g) (from t))
(extend (to v) (from a) (from c) (from g))
(extend (to d) (from a) (from g) (from t))
(wildcard *)
) ;; end alphabet DNA