View source: R/simul_bank_tree.R
simul_bank_tree | R Documentation |
This function simulates the bank of symbiont trees, used for running HOME, for a given number of host-switches.
simul_bank_tree(nb_ksi,name,
provided_tree=NULL,nb_tree=10000,
lambda=c(1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25),
seed=1)
nb_ksi |
a positive integer which represents the given number of host-switches to simulate on the host tree |
name |
the name of the run |
provided_tree |
optional - the host tree of your study. It can also be provided as saved in the working directory |
nb_tree |
a number of trees to simulate |
lambda |
a vector of integer values of number of switches to test during estimations |
seed |
a seed to assure the reproducibility |
The function prepare_data_HOME must be run before. See reference for more details.
The function outputs trees in the folder simulated_trees/ for each value of number of switches. Then, use the function fit_HOME to infer the results.
Benoit Perez-Lamarque
Perez-Lamarque B, Morlon H (2019). Characterizing symbiont inheritance during host-microbiota evolution: Application to the great apes gut microbiota. Molecular Ecology Resources 19:1659-1671.
sim_microbiota
,
prepare_data_HOME
,
output_results_HOME
,
model_selection_HOME
,
fit_HOME
,
HOME_model
# Some examples may take a little bit of time. Be patient!
# Simulate 3 microbial alignments on a host tree
# (1 is vertically transmitted, 1 is transmitted with 5 host-switches,
# and 1 is environmentally acquired)
name="example_simulation"
name_index=c("Simul_1","Simul_2","Simul_3")
path=getwd()
#sim_microbiota(name, name_index, simul=c(0,5,"indep"), n=10, mu=1, N=300, proportion_variant=0.1)
# Inference
# Prepare the data (format, substitution model...)
#for (i in 1:3){prepare_data_HOME(iter=i,name,name_index)}
# Simulate the bank of trees
#for (ksi in 1:length(seq(1,25))){simul_bank_tree(ksi,name,nb_tree=1000,
#lambda=seq(1,15),seed=1)}
# Infer the parameters
#for (i in 1:3){fit_HOME(index=name_index[i],name,nb_tree=1000,lambda=seq(1,25),nb_cores=1)}
# Plot the first outputs
#for (i in 1:3){output_results_HOME(iter=i,name,name_index,lambda=seq(1,25),
#nb_tree=1000,empirical=FALSE,randomize=FALSE,raref=FALSE)}
# Perform the model selection
#for (i in 1:3){model_selection_HOME(index=name_index[i],name,nb_tree=1000,
#lambda=seq(1,25),nb_cores=1,seed=1)}
# Plot the final outputs
#for (i in 1:3){output_results_HOME(iter=i,name,name_index,lambda=seq(1,25),nb_tree=1000,
#empirical=FALSE,randomize=TRUE,raref=FALSE)}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.