# 1 Introduction

miaSim implements tools for microbiome data simulation based on the microsim .

Microbiome time series simulation can be obtained by generalized Lotka-Volterra model,simulateGLV, and Self-Organized Instability (SOI), simulateSOI. Hubbell’s Neutral model, simulateHubbell is used to determine the species abundance matrix.

The resulting abundance matrix from these three simulation models can be implemented to SummarizedExperiment object or TreeSummarizedExperiment object by using convertToSE.

powerlawA and randomA give interaction matrix of species generated by normal distribution and uniform distribution, respectively. These matrices can be used in the simulation model examples.

simulationTimes generates lists of time series that can be specified as simulation time and time points to keep in simulated time.

# 2 Installation

### 2.0.1 Bioc-release

if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")

# 3 Models for simulating microbiome data sets

simulateGLV is the generalized Lotka-Volterra simulation model fitted to time-series estimates microbial population dynamics and relative rates of interaction. The model relies on interaction matrix that represents interaction heterogeneity between species. This interaction matrix can be generated with powerlawA or randomA functions depending on the distribution method.

The function powerlawA uses normal distribution to create interaction matrix.

The function randomA uses uniform distribution to create interaction matrix.

The number of species specified in the interaction matrix must be the same amount as the species used in the simulateGLV and simulateSOI models. simulateGLV and simulateRicker functions both use the generalized Lotka-Volterra model.

Time series is added to simulateGLV with simulationTimes function where the time points can be kept and extracted from simulation time as a separate list.

simulateHubbell includes the Hubbell Neutral simulation model which explains the diversity and relative abundance of species in ecological communities. This model is based on the community dynamics; migration, births and deaths. Loss in society is either replaced by migration or birth.

Similarly, simulateHubbellRates also uses the Hubbell Neutral model.Migration is determined by the metacommunity and replacement by birth is measure by growth rates. The time between events is the determinant of replacement.

The Self-Organised Instability (SOI) model can be found in simulateSOI and it generates time series for communities and accelerates stochastic simulation.

Stochastic logistic model is used in simulateStochasticLogistic to determine dead and alive counts in community.

The consumer resource community simulation model simulateConsumerResource requires the use of the randomE function, which returns a matrix containing the production rates and consumption rates of each species. The resulting matrix is used as a determination of resource consumption efficiency.

The community simulations result in abundance matrix that can be stored in SummarizedExperiment [@SE] class object. Other fields, such as rowData containing information about the samples, and colData, consisting of sample metadata describing the samples, can be added to the SummarizedExperiment class object. This can be done by conversion function convertToSE.

Also, the TreeSummarizedExperiment class object can be created using the required hierarchical information in addition to the SummarizedExperiment class object. It can also be reached through convertToSE.

For further details:

After converting to SummarizedExperiment or
TreeSummarizedExperiment the models can be used with: various visualization functions under miaViz, many analysis tools that are available under mia and time series analysis tools under miaTime.

miaViz installation

mia installation

HubbellSE population density can be plotted with plotAbundanceDensity function from miaViz.

More examples on SummarizedExperiment object manipulation and analysis can be found at https://microbiome.github.io/OMA/ .

# 4 Session info

sessionInfo()
## R version 4.2.0 RC (2022-04-21 r82226)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.4 LTS
##
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.16-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.16-bioc/R/lib/libRlapack.so
##
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
##  [3] LC_TIME=en_GB              LC_COLLATE=C
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base
##
## other attached packages:
## [1] BiocStyle_2.25.0
##
## loaded via a namespace (and not attached):
##  [1] bookdown_0.26       digest_0.6.29       R6_2.5.1
##  [4] jsonlite_1.8.0      magrittr_2.0.3      evaluate_0.15
##  [7] stringi_1.7.6       rlang_1.0.2         cli_3.3.0
## [10] jquerylib_0.1.4     bslib_0.3.1         rmarkdown_2.14
## [13] tools_4.2.0         stringr_1.4.0       xfun_0.30
## [16] yaml_2.3.5          fastmap_1.1.0       compiler_4.2.0
## [19] BiocManager_1.30.17 htmltools_0.5.2     knitr_1.38
## [22] sass_0.4.1