module ELynx.Data.MarkovProcess.Nucleotide
( jc,
f81,
hky,
gtr4,
)
where
import qualified Data.Vector.Storable as V
import ELynx.Data.Alphabet.Alphabet
import ELynx.Data.MarkovProcess.RateMatrix
import ELynx.Data.MarkovProcess.SubstitutionModel
import Numeric.LinearAlgebra hiding (normalize)
n :: Int
n :: Int
n = Int
4
jcExch :: ExchangeabilityMatrix
jcExch :: ExchangeabilityMatrix
jcExch =
(Int
n Int -> Int -> [R] -> ExchangeabilityMatrix
forall a. Storable a => Int -> Int -> [a] -> Matrix a
>< Int
n)
[ R
0.0,
R
1.0,
R
1.0,
R
1.0,
R
1.0,
R
0.0,
R
1.0,
R
1.0,
R
1.0,
R
1.0,
R
0.0,
R
1.0,
R
1.0,
R
1.0,
R
1.0,
R
0.0
]
uniformVec :: Vector Double
uniformVec :: Vector R
uniformVec = Int -> R -> Vector R
forall a. Storable a => Int -> a -> Vector a
V.replicate Int
n (R
1 R -> R -> R
forall a. Fractional a => a -> a -> a
/ Int -> R
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n)
jc :: SubstitutionModel
jc :: SubstitutionModel
jc = Alphabet
-> Name
-> [R]
-> Vector R
-> ExchangeabilityMatrix
-> SubstitutionModel
substitutionModel Alphabet
DNA Name
"JC" [] Vector R
uniformVec ExchangeabilityMatrix
jcExch
f81 :: StationaryDistribution -> SubstitutionModel
f81 :: Vector R -> SubstitutionModel
f81 Vector R
d = Alphabet
-> Name
-> [R]
-> Vector R
-> ExchangeabilityMatrix
-> SubstitutionModel
substitutionModel Alphabet
DNA Name
"F81" [] Vector R
d ExchangeabilityMatrix
jcExch
hkyExch :: Double -> ExchangeabilityMatrix
hkyExch :: R -> ExchangeabilityMatrix
hkyExch R
k =
(Int
n Int -> Int -> [R] -> ExchangeabilityMatrix
forall a. Storable a => Int -> Int -> [a] -> Matrix a
>< Int
n)
[R
0.0, R
1.0, R
k, R
1.0, R
1.0, R
0.0, R
1.0, R
k, R
k, R
1.0, R
0.0, R
1.0, R
1.0, R
k, R
1.0, R
0.0]
hky :: Double -> StationaryDistribution -> SubstitutionModel
hky :: R -> Vector R -> SubstitutionModel
hky R
k Vector R
d = Alphabet
-> Name
-> [R]
-> Vector R
-> ExchangeabilityMatrix
-> SubstitutionModel
substitutionModel Alphabet
DNA Name
"HKY" [R
k] Vector R
d ExchangeabilityMatrix
e where e :: ExchangeabilityMatrix
e = R -> ExchangeabilityMatrix
hkyExch R
k
gtr4 :: [Double] -> StationaryDistribution -> SubstitutionModel
gtr4 :: [R] -> Vector R -> SubstitutionModel
gtr4 [R]
es Vector R
d = Alphabet
-> Name
-> [R]
-> Vector R
-> ExchangeabilityMatrix
-> SubstitutionModel
substitutionModel Alphabet
DNA Name
"GTR" [R]
es Vector R
d ExchangeabilityMatrix
e
where
e :: ExchangeabilityMatrix
e = Int -> [R] -> ExchangeabilityMatrix
forall a.
(RealFrac a, Container Vector a) =>
Int -> [a] -> Matrix a
exchFromListUpper Int
n [R]
es