HOME_model: HOst-Microbiota Evolution model

View source: R/HOME_model.R

HOME_modelR Documentation

HOst-Microbiota Evolution model

Description

This function runs HOME for all the different OTUs (called "index"") on the host tree.

Usage

HOME_model(name,name_index,nb_cores=1,seed=3,nb_tree=5000,
lambda=c(1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25),
raref=FALSE,empirical=TRUE,randomize=TRUE,nb_random=10,provided_tree=NULL,tolerance=0.05,
overwrite=TRUE,figure=FALSE,path=getwd(),path_alignment=getwd(),...)

Arguments

name

the name of the run

name_index

a vector with the names of the different symbionts (e.g. name of the OTUs)

provided_tree

optional - the host tree of your study. It can also be provided as saved in the working directory (see details).

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)

lambda

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

raref

if TRUE rarefactions on the number of trees are performed (i.e. to test if nb_tree is large enough)

empirical

a boolean indicating if the run is done on empirical data or on simulations (in the latter case, the output will be different)

randomize

a boolean indicating to perform or not the model selection testing independent evolutions (it takes time)

nb_random

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

path

optional - the path to the working directory (by default, the current working directory)

path_alignment

optional - the path toward the folder containing the different OTU alignments (by default, the working directory)

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).

figure

indicates whether it automatically outputs figures at the end of the run (default: FALSE).

...

optional - other arguments to be passed.

Details

Alignments must be provided in FASTA format and their name must be formatted "alignment_NAME_INDEX.fas" (match the name of the run and the name of the index of the alignment).

If you do not provide a host tree directly in the function, please provide the binary rooted ultrametric host tree (Newick format .tre) in the working directory. The name of the file name must be well-formated "host_tree_NAME.tre" (match the name of the run).

See reference for more details.

Value

The function gives all the results of HOME in separate files and figures (see inside folders results/ and figures/) and sum up all the results for each OTU in a HTML file (see in folder figures/). The function HOME_model contains the functions prepare_data_HOME, simul_bank_tree, fit_HOME, model_selection_HOME, and output_results_HOME that can be run succesively.

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

Examples

# Some examples may take a little bit of time. Be patient!


### ON SIMULATIONS

# Simulate 3 microbial alignments on a host tree
# (1 is vertically transmitted, 1 is transmitted with 5 host-switches,
#  and 1 is environmentally acquired)


sim_microbiota(name="example_simulation", name_index=c("Simul_1","Simul_2","Simul_3"),
simul=c(0,5,"indep"), n=10, mu=1,
N=300, proportion_variant=0.1)

# Run HOME (parameters estimations and model selections)

#HOME_model(name="example_simulation", name_index=c("Simul_1","Simul_2","Simul_3"),
#nb_tree=1000, lambda=seq(1,15), empirical=FALSE, nb_random=10)


### EMPIRICAL APPLICATION: example on the great apes microbiota

# Load the data
example_great_apes_microbiota(name="great_apes")

# Run HOME
#HOME_model(name="great_apes", name_index=c("OTU0001","OTU0002","OTU0003"), nb_tree=500,
#lambda=seq(1,25), nb_random=10)

# NB: this should be run on a larger number of tree!



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