TRIBE
Reference
Quintero, I., & Landis, M. J. (2020). Interdependent phenotypic and biogeographic evolution driven by biotic interactions. Systematic biology, 69(4), 739-755. https://doi.org/10.1093/sysbio/syz082
Example
Open Julia and load the Tapestree package:
using TapestreeSpecify the path to the phylogenetic tree (in a format that ape::read.tree() can read):
finches_tree_file = joinpath(dirname(pathof(Tapestree)), "..", "data", "finches_rescaled.tre")Specify data. Data should be a .txt file where each row is a species, first the species name that matches the tree tip labels, second the phenotypic data and then the species presence in each area (0 if absent and 1 if present). Open finches_pca1.txt in the data folder to see an example.
finches_data_file = joinpath(dirname(pathof(Tapestree)), "..", "data", "finches_pca1.txt")Specify output file (homedir() is an alias to your home folder)
out_file = *(homedir(),"...")Run the tribe() (TRIBE: Trait and Range Interspecific Biogeographic Evolution) model:
tribe(finches_tree_file, finches_data_file, out_file)For optional (keyword) arguments, see below
Function Documentation
Tapestree.TRIBE.tribe — Functiontribe(tree_file ::String,
data_file ::String,
out_file ::String;
min_dt ::Float64 = 0.01,
niter ::Int64 = 50_000,
nburn ::Int64 = 50_000,
nthin ::Int64 = 500,
saveXY ::Tuple{Bool,Int64} = (false, 1_000),
saveDM ::Tuple{Bool,Int64} = (false, 1_000),
ωxprior ::NTuple{2,Float64} = (0.,10.),
ω1prior ::NTuple{2,Float64} = (0.,10.),
ω0prior ::NTuple{2,Float64} = (0.,10.),
σ²prior ::Float64 = 1e-1,
λprior ::Float64 = 1e-1,
weight ::NTuple{5,Float64} = (0.15,0.05,0.02,0.02,5e-3),
λ1i ::Float64 = 1.0,
λ0i ::Float64 = 0.5,
ωxi ::Float64 = 0.0,
ω1i ::Float64 = 0.0,
ω0i ::Float64 = 0.0,
fix_ωx ::Bool = false,
fix_ω1 ::Bool = false,
fix_ω0 ::Bool = false,
delim ::Char = ' ',
eol ::Char = '
',
screen_print::Int64 = 5)Run tribe model.
...
Arguments
tree_file::String: full path to tree file.data_file::String: full path to data file.out_file::String: full path to write MCMC output.min_dt::Float64 = 0.01: the percentage of tree height allowed for
discretization (lower values are more precise but take longer).
niter::Int64 = 50_000: the number of iterations.nburn::Int64 = 50_000: the number of iterations in the adaptive burn-in phase.nthin::Int64 = 500: the iteration sampling frequency.saveXY::Tuple{Bool,Int64} = (false, 1_000): first index to
save (or not) data augmented histories, second index for sampling frequency.
saveDM::Tuple{Bool,Int64} = (false, 1_000): a tuple of length 2: first is a boolean to save (or not) data augmented deterministic effects, second an integer for sampling frequency.ωxprior::NTuple{2,Float64} = (0.,10.): a tuple of length 2 for the normal prior of ωx, first the mean, second the variance.ω1prior::NTuple{2,Float64} = (0.,10.): a tuple of length 2 for the normal prior of ω1, first the mean, second the variance.ω0prior::NTuple{2,Float64} = (0.,10.): a tuple of length 2 for the normal prior of ω0, first the mean, second the variance.σ²prior::Float64 = 1e-1: a float for the mean of the exponential prior for σ².λprior::Float64 = 1e-1: a float for the mean of the exponential prior for both λs.weight::NTuple{5,Float64} = (0.15,0.05,0.02,0.02,5e-3): a tuple of length 5 specifying the probabilities to update σ², ωx, ω1 & ω0, and λ1 & λ0 respectively.λ1i::Float64 = 1.0: a float for the starting value for λ1.λ0i::Float64 = 0.5: a float for the starting value for λ0.ωxi::Float64 = 0.0: a float for the starting value for ωx.ω1i::Float64 = 0.0: a float for the starting value for ω1.ω0i::Float64 = 0.0: a float for the starting value for ω0.fix_ωx::Bool = false: a boolean to make inference without ωx.fix_ω1::Bool = false: a boolean to make inference without ω1.fix_ω0::Bool = false: a boolean to make inference without ω0.delim::Char= ' ': for ddlm.eol::Char= ' ': for ddlm.screen_print::Int64 = 5: seconds to wait to update screen log.
...
...
Returned values
- Array of the mcmc parameters.
...
tribe(tip_values::Dict{Int64,Float64},
tip_areas ::Dict{Int64,Array{Int64,1}},
tree ::rtree,
bts ::Array{Float64,1},
out_file ::String;
min_dt ::Float64 = 0.01,
niter ::Int64 = 500_000,
nburn ::Int64 = 500_000,
nthin ::Int64 = 1_000,
saveXY ::Tuple{Bool,Int64} = (false, 1_000),
saveDM ::Tuple{Bool,Int64} = (false, 1_000),
ωxprior ::NTuple{2,Float64} = (0.,10.),
ω1prior ::NTuple{2,Float64} = (0.,10.),
ω0prior ::NTuple{2,Float64} = (0.,10.),
σ²prior ::Float64 = 1e-1,
λprior ::Float64 = 1e-1,
weight ::NTuple{5,Float64} = (0.15,0.05,0.02,0.02,5e-3),
λ1i ::Float64 = 1.0,
λ0i ::Float64 = 0.4,
ωxi ::Float64 = 0.,
ω1i ::Float64 = 0.,
ω0i ::Float64 = 0.,
fix_ωx ::Bool = false,
fix_ω1 ::Bool = false,
fix_ω0 ::Bool = false,
delim ::Char = ' ',
eol ::Char = '
')Run tribe for simulations. Wrapper for all functions.
tribe(out_file::String;
niter ::Int64 = 500_000,
nburn ::Int64 = 500_000,
nthin ::Int64 = 1_000,
ωxprior ::NTuple{2,Float64} = (0.,10.),
ω1prior ::NTuple{2,Float64} = (0.,10.),
ω0prior ::NTuple{2,Float64} = (0.,10.),
σ²prior ::Float64 = 1e-1,
λprior ::Float64 = 1e-1,
weight ::NTuple{4,Float64} = (0.15,0.05,0.02,0.02),
σ²i ::Float64 = 1.,
ωxi ::Float64 = 0.,
ω1i ::Float64 = 0.01,
ω0i ::Float64 = 0.01,
λ1i ::Float64 = 1.0,
λ0i ::Float64 = 0.2,
fix_ωx ::Bool = false,
fix_ω1 ::Bool = false,
fix_ω0 ::Bool = false)Run tribe under the prior. Wrapper for all functions.
Tapestree.TRIBE.simulate_tribe — Functionsimulate_tribe(X_initial::Float64,
nareas ::Int64,
tree_file::String;
ωx = 0.0,
σ² = 0.5,
λ1 = 0.5,
λ0 = 0.2,
ω1 = 0.0,
ω0 = 0.0,
const_δt = 1e-4)Simulate tribe model.
...
Arguments
X_initial::Float64: trait starting value.nareas ::Int64: number of areas.tree_file::String: full path to tree file.ωx::Float64 = 0.0: simulated value of $ω_x$.σ²::Float64 = 0.5: simulated value of $σ^2$.ω1::Float64 = 0.0: simulated value of $ω_1$.ω0::Float64 = 0.0: simulated value of $ω_0$.λ1::Float64 = 0.5: simulated value of $λ_1$.λ0::Float64 = 0.2: simulated value of $λ_0$.const_δt = 1e-4: # delta t used to approximate the simulation (lower values
are more accurate but at a computation cost). ...