Generate sequence from Markov Model

Description

Simulate a single sequence based from a Markov Model. These are referred to as simulated sequences and used compute the background rates and False Discovery Rates.

Usage

1
2
## S3 method for class 'ms'
simulate(object, nsim, seed = NULL, pointer.only = FALSE, ...)

Arguments

object

Markov Model build.mm

nsim

Length of the sequence to simulate. Can be a vector, in which case multiple sequences of the specified length will be simulated.

seed

A random number seed. Either NULL (the default; do not re-seed random number generator), or an integer to be sent to set.seed.

pointer.only

If TRUE, keep sequence data stored in a C structure, otherwise it is automatically copied into an R object.

...

Not used; for S3 compatibility

Value

MS object containing a single sequence with nsim bases.

See Also

build.mm for details on Markov models, ms for details on MS objects

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
require("rtfbs")
exampleArchive <- system.file("extdata", "NRSF.zip", package="rtfbs")
seqFile <- "input.fas"
unzip(exampleArchive, seqFile)
# Read in FASTA file "input.fas" from the examples into an 
#   MS (multiple sequences) object
ms <- read.ms(seqFile);
# Build a 3rd order Markov Model to represent the sequences
#   in the MS object "ms".  The Model will be a list of
#   matrices  corrisponding in size to the order of the 
#   Markov Model
mm <- build.mm(ms, 3);
# Generate a sequence 1000 bases long using the supplied
#   Markov Model and random numbers
v <- simulate.ms(mm, 1000);