\name{rseq}
\alias{rseq}
\title{Random generation of DNA sequence according to ZOOPS or TCM model}
\description{
  This function randomly generates a number of DNA sequences that
  contain a given motif accordint to the ZOOPS or TCM model. In the
  ZOOPS model, each sequence contains one or zero occurrences of the
  motif. In the TCM model, each sequence may contain an arbitrary number
  of motif occurrences.
  
}
\usage{
rseq(numSeqs, seqLength, rate, pwm, transMats,
     model="ZOOPS", posOnly=FALSE)
}
\arguments{
  \item{numSeqs}{ \code{numeric} The number of sequences to be generated}
  \item{seqLength}{ \code{numeric} The length of each sequence. This may
  be either a single number, in which case that number is taken to be
  the common length of all sequence, or a vector of sequence lengths.}
  \item{rate}{ \code{numeric} In the ZOOPS model, this is the proportion
    of sequences containg a motif occurrence. In the TCM model, this the
    rate parameter lambda with which motifs are inserted into the sequences.}    
  \item{pwm}{ \code{numeric} Position-weight matrix of the motif to be inserted.}
  \item{transMats}{The transition matrices to use for the
    background Markov model. This is a list of matrices, with the first
    matrix given the transition probabilities for the 0th order Markov
    model, the second matrix giving the transition probabilities for a
    1st order Markov model, and so on.}
  \item{model}{Either "ZOOPS" or "TCM"}
  \item{posOnly}{\code{logical} If TRUE, motifs are inserted only in the
    forwards orientation. Otherwise, motifs are inserted in either of
    the two possible orientations with equal probabilities.}
}
\details{

}
\value{
  \item{seqs}{A list with one element for each sequence in the file. The
     elements  are in two parts, one the description and the second a
     character string of the biological sequence.}
   \item{motifs}{An "align" object summarizing the positions of the
    inserted motif occurrences.}
   \item{empPWM}{An object of class \code{pwm} representing the position
     weight matrix obtained by aligning the inserted motifs.}
  
}

\references{ }
\author{Oliver Bembom, \email{bembom@berkeley.edu}}
\note{}

\seealso{}
\examples{
## generate 20 sequences according to ZOOPS model
## with an expected number of 10 sequences containing a
## motif

data(motifPWM)
data(transMats)
res <- rseq(20, 250, 0.5, motifPWM, transMats,"ZOOPS")
}
\keyword{misc}