simulate.dmm: Simulate a sequence under a drifting Markov model

View source: R/dmm.R

simulate.dmmR Documentation

Simulate a sequence under a drifting Markov model

Description

Simulate one or several sequences under a k-th order DMM (method of simulate).

Usage

## S3 method for class 'dmm'
simulate(
  object,
  nsim = 1,
  seed = NULL,
  output_file = NULL,
  model_size = NULL,
  ...
)

Arguments

object

An object of class dmm

nsim

Default=1. Number of sequences to simulate

seed

(Optional) Seed of the random number generator (passed to set.seed)

output_file

(Optional) File containing the simulated sequence(s) in FASTA format (e.g, "C:/.../SIM.txt")

model_size

Default=object$length. Length of the simulated sequence(s), at most object$length + 1

...

Not used

Details

The order first states are drawn according to the initial law object$init; then each state is drawn conditionally on the order previous states.

The former call simulate(x, output_file, model_size), with positional arguments, still works but is deprecated: name the arguments output_file and model_size.

Value

The vector of the simulated sequence, or a list of nsim vectors if nsim > 1

Author(s)

Annthomy Gilles, Alexandre Seiller

References

\insertRef

BaVe2018drimmR \insertRefVer08drimmR

See Also

fitdmm, getTransitionMatrix, getStationaryLaw

Examples

data(lambda, package = "drimmR")
dmm <- fitdmm(lambda, 1, 1, c('a','c','g','t'), init.estim = "freq", fit.method="sum")
simulate(dmm, model_size = 100, seed = 1)
simulate(dmm, nsim = 2, model_size = 50)

drimmR documentation built on Nov. 28, 2026, 1:08 a.m.