miaSim
Workflows
Standard Workflow
library(miaSim)
# 1. Generate species interaction matrix
A_normal <- powerlawA(n_species = 4, alpha = 3)
# 2. Simulate time series using generalized Lotka-Volterra (gLV) model
tse_glv <- simulateGLV(
n_species = 4,
A = A_normal,
t_start = 0,
t_store = 1000,
stochastic = FALSE,
norm = FALSE
)
# 3. Simulate community using Hubbell Neutral model
tse_hubbell <- simulateHubbell(
n_species = 8,
M = 10,
carrying_capacity = 1000,
k_events = 50,
migration_p = 0.02,
t_end = 100
)
Input/Output Note: Inputs are ecological parameters (species count, interaction matrices, carrying capacity); outputs are simulated abundance matrices stored in TreeSummarizedExperiment objects.
When to Use
- Simulating microbiome species abundance matrices and time series under varying ecological assumptions.
- Modeling population dynamics using the generalized Lotka-Volterra model (
simulateGLV) or its discrete version, the Ricker model (simulateRicker).
- Simulating neutral community dynamics with migration, births, and deaths using Hubbell's Neutral model (
simulateHubbell).
- Generating species interaction matrices with specific distributional assumptions using
powerlawA or randomA.
When NOT to Use
- For fitting ecological models to real-world experimental data (use parameter estimation packages instead).
- For simulating non-microbial networks that do not fit into the
TreeSummarizedExperiment data container.
Data Requirements
- Input parameters such as interaction matrices generated by
powerlawA or randomA.
- Outputs are structured as
TreeSummarizedExperiment objects containing simulated abundance matrices.
Key Parameters
- n_species: Number of species to include in the simulation or interaction matrix.
- alpha: Power-law exponent parameter used in
powerlawA.
- diagonal: Diagonal values of the interaction matrix in
randomA.
- connectance: Connectance of the interaction matrix in
randomA.
- carrying_capacity: Carrying capacity of the community in
simulateHubbell and simulateSOI.
- migration_p: Migration probability in
simulateHubbell and simulateHubbellRates.
- t_end: End time of the simulation.
- norm: Logical indicating whether to normalize the simulated abundances.
Best Practices
- Ensure the number of species specified in the interaction matrix matches the number of species used in the simulation models.
- Generate interaction matrices using
powerlawA or randomA before running models like GLV, SOI, or Ricker.
- Use
randomE to generate production and consumption rate matrices specifically for the consumer-resource model (simulateConsumerResource).
Common Pitfalls
- Specifying a different number of species in the interaction matrix than in the simulation model, which causes dimension mismatch errors. Ensure
n_species matches the dimensions of A.
Alternatives
micodymora: A Python package for microbiome simulation.
Citations
- Gao et al. 2023 (Case studies on microbiome simulation).
References
1---2name: miasim3description: miaSim4---56# miaSim78## Workflows910### Standard Workflow1112```r13library(miaSim)1415# 1. Generate species interaction matrix16A_normal <- powerlawA(n_species = 4, alpha = 3)1718# 2. Simulate time series using generalized Lotka-Volterra (gLV) model19tse_glv <- simulateGLV(20 n_species = 4, 21 A = A_normal, 22 t_start = 0, 23 t_store = 1000, 24 stochastic = FALSE, 25 norm = FALSE26)2728# 3. Simulate community using Hubbell Neutral model29tse_hubbell <- simulateHubbell(30 n_species = 8, 31 M = 10, 32 carrying_capacity = 1000, 33 k_events = 50, 34 migration_p = 0.02, 35 t_end = 10036)37```38**Input/Output Note:** Inputs are ecological parameters (species count, interaction matrices, carrying capacity); outputs are simulated abundance matrices stored in `TreeSummarizedExperiment` objects.3940## When to Use41- Simulating microbiome species abundance matrices and time series under varying ecological assumptions.42- Modeling population dynamics using the generalized Lotka-Volterra model (`simulateGLV`) or its discrete version, the Ricker model (`simulateRicker`).43- Simulating neutral community dynamics with migration, births, and deaths using Hubbell's Neutral model (`simulateHubbell`).44- Generating species interaction matrices with specific distributional assumptions using `powerlawA` or `randomA`.4546## When NOT to Use47- For fitting ecological models to real-world experimental data (use parameter estimation packages instead).48- For simulating non-microbial networks that do not fit into the `TreeSummarizedExperiment` data container.4950## Data Requirements51- Input parameters such as interaction matrices generated by `powerlawA` or `randomA`.52- Outputs are structured as `TreeSummarizedExperiment` objects containing simulated abundance matrices.5354## Key Parameters55- **n_species**: Number of species to include in the simulation or interaction matrix.56- **alpha**: Power-law exponent parameter used in `powerlawA`.57- **diagonal**: Diagonal values of the interaction matrix in `randomA`.58- **connectance**: Connectance of the interaction matrix in `randomA`.59- **carrying_capacity**: Carrying capacity of the community in `simulateHubbell` and `simulateSOI`.60- **migration_p**: Migration probability in `simulateHubbell` and `simulateHubbellRates`.61- **t_end**: End time of the simulation.62- **norm**: Logical indicating whether to normalize the simulated abundances.6364## Best Practices65- Ensure the number of species specified in the interaction matrix matches the number of species used in the simulation models.66- Generate interaction matrices using `powerlawA` or `randomA` before running models like GLV, SOI, or Ricker.67- Use `randomE` to generate production and consumption rate matrices specifically for the consumer-resource model (`simulateConsumerResource`).6869## Common Pitfalls70- Specifying a different number of species in the interaction matrix than in the simulation model, which causes dimension mismatch errors. Ensure `n_species` matches the dimensions of `A`.7172## Alternatives73- `micodymora`: A Python package for microbiome simulation.7475## Citations76- Gao et al. 2023 (Case studies on microbiome simulation).7778## References79- Homepage: bioconductor.org/packages/miaSim80- Vignette: https://bioconductor.org/packages/release/bioc/vignettes/miaSim/inst/doc/vignette.html