Likelihood

There are several prior distributions for tree structures implemented in this package. Also there is a function which calculates the likelihood of a tree given a model using Felsensteins algorithm.

Likelihood Calculator functionality

Prior

MCPhylo.TreeDistribution — Type
TreeDistribution(length_distr::LengthDistribution, topology_distr::TopologyDistribution)

Wrapper struct for the TreeDistribution. Contains a length distribution and a topology distribution. Can be constructed with no arguments, one of the distributions, or both of them. Fallbacks are UniformBranchLength for the length distribution & and UniformTopology for the topology distribution.

source

Branch length distributions

MCPhylo.CompoundDirichlet — Type
CompoundDirichlet(alpha::Float64, a::Float64, beta::Float64, c::Float64, nterm::Float64)

This structure implememts the CompoundDirichlet distribution described in Zhang, Rannala and Yang 2012. (DOI:10.1093/sysbio/sys030)

source
MCPhylo.exponentialBL — Type
exponentialBL(scale::Float64) <: ContinuousUnivariateDistribution

This structure implememts an exponential prior on the branch lengths of a tree.

source
MCPhylo.BirthDeath — Type

Strict Molecular Clock - BirthDeath Implemented following Yang & Rannala 1997 doi.org/10.1093/oxfordjournals.molbev.a025811

source

Topology distributions

MCPhylo.UniformConstrained — Type
UniformConstrained(
    constraint_dict::Dict{Symbol, 
                          Union{Vector{Vector{S}}, Vector{Tuple{Vector{S}, Vector{S}}}}
                          } where S <: AbstractString)

Wrapper struct for the topology distribution. Contains a dictionary with constraints. Empty constructor results in an empty dictionary as a fallback.

source

Gamma Rates

MCPhylo.discrete_gamma_rates — Function
function discrete_gamma_rates(α::T, β::S,k::Int64; method::Symbol=:mean, sig::Int64=1)::Array{Float64} where {T<:Real, S<:Real}

This function calculates the rates of the discretized gamma distribution. It returns a vector of either the mean or the median weights in each category, such that each category is of equal proportion.

See: Yang, 1994, Maximum likelihood phylogenetic estimation from DNA sequences with variable rates over sites: Approximate methods. (https://doi.org/10.1007/BF00160154)

source

Substitution Models

MCPhylo.JC — Function
JC(base_freq::Vector{Float64},
    SubstitutionRates::Vector{Float64})::Tuple{Array{Float64,2}, Array{Float64,1}, Array{Float64,2}}

Calculate the eigenvalue decomposition of the Q matrix of the Jukes-Cantor model. The SubstitutionRates are ignored, and just for call stability.

The function returns the Eigenvectors, Eigenvalues and inverse of eigenvectors.

source
MCPhylo.Restriction — Function
Restriction(base_freq::Vector{Float64},
            SubstitutionRates::Vector{Float64})::Tuple{Array{Float64,2}, Array{Float64,1}, Array{Float64,2}}

Calculate the eigenvalue decomposition of the Q matrix of the restriction site model. The SubstitutionRates are ignored, and just for call stability.

The function returns the Eigenvectors, Eigenvalues, inverse of eigenvectors and the scale factor for expected number changes per site

source
MCPhylo.freeK — Function
function freeK(base_freq::Vector{Float64},SubstitutionRates::AbstractArray)::Tuple{Array{N,2}, Array{N,1}, Array{N,2}, M} where {N <: Number, M <: Number}

FreeK model of substitution.

source
MCPhylo.GTR — Function
GTR(base_freq::Vector{Float64},
    SubstitutionRates::Vector{Float64})::Tuple{Array{Float64,2}, Array{Float64,1}, Array{Float64,2}}

Calculate the eigenvalue decomposition of the Q matrix of the General Time Reversible model.

The function returns the Eigenvectors, Eigenvalues and inverse of eigenvectors.

source