Useful function to extract microbiomes from RITHMS output
get_microbiomes.Rd
The gets functions use the output of holo_simu()
to extract the information of interest from a given generation.
get_microbiomes
extract the microbiome abundance matrix from a generation object, with or without CLR transformation or transposition.
Arguments
- data
List corresponding to one generation, as returned by
holo_simu()
. Containing simulation output.- transpose
Logical; if
TRUE
, transpose the microbiome matrix (OTUs in rows, individuals in columns).- CLR
Logical; if
TRUE
, applies a CLR transformation to the abundance data. This transformation requirestranspose = TRUE
.
Value
A data.frame
containing the microbiome abundances of individuals. Default, individuals are in rows and OTUs in columns. Change transpose
parameter if needed.
Examples
if (FALSE) { # \dontrun{
library(magrittr)
library(purrr)
data("Deru")
ToyData <- Deru
taxa_assign_g <- assign_taxa(founder_object = ToyData)
generations_simu <- holo_simu(h2 = 0.25, b2 = 0.25, founder_object = ToyData,
n_clust = taxa_assign_g, n_ind = 500,
verbose = FALSE, seed = 1234)
# Extract microbiome matrix for G1 generation
G1_microbiome <- get_microbiomes(generations_simu$G1)
# Extract with transposition
G1_t_microbiome <- get_microbiomes(generations_simu$G1, transpose = TRUE)
# Extract with CLR transformation
G1_CLR_microbiome <- get_microbiomes(generations_simu$G1, transpose = TRUE, CLR = TRUE)
# Extract all microbiome matrices of all generations
# substract metadata
microbiomes <- generations_simu[-1] %>% map(get_microbiomes)
} # }