model_selection_HOME: Perform the model selections of HOME

View source: R/model_selection_HOME.R

model_selection_HOMER Documentation

Perform the model selections of HOME

Description

This function performs the model selections of HOME testing the null hypotheses of strict vertical transmission and independent evolution.

Usage

model_selection_HOME(index,name,nb_tree=10000,
lambda=c(1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25),
nb_cores=1,seed=1,nb_random=10,tolerance=0.05,overwrite=TRUE,...)

Arguments

index

the name of the particular index from name_index (e.g. name of one OTU)

name

the name of the run

nb_tree

a number of tree for Monte Carlo estimation of the number of switches (a low value will give inaccurate results whereas a high value will increase the computation time)

nb_random

a integer value of the number of randomizations (R) to perform during the model selection testing independent evolutions

lambda

a vector of integer values of number of switches to test during estimations

seed

a seed to assure the reproducibility

nb_cores

a number of cores to run the analyses (ideally, it should be equal to the length of lambda for an optimal speed)

tol

the desired accuracy of the optimize function (to estimate mu). A low value will give a more accurate estimate, but will take more computational time.

overwrite

indicates whether the any previous results should be overwritten by the current run (default: TRUE).

...

optional - other arguments to be passed.

Details

The functions prepare_data_HOME, simul_bank_tree, and fit_HOME must be run before. See reference for more details.

Value

The function outputs different files. Use the function output_results_HOME to interpret them.

Author(s)

Benoit Perez-Lamarque

References

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.

See Also

sim_microbiota, prepare_data_HOME, simul_bank_tree, output_results_HOME, fit_HOME, HOME_model

Examples

# 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,25),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)}

BPerezLamarque/HOME documentation built on May 17, 2023, 7:02 a.m.