makeSeq: 'makeSeq' output a random DNA sequence.

Description Usage Arguments Value Examples

Description

makeSeq outputs a string that contains a random sequence of characters (A/C/G/T by default). By default the first three letters are "ATG" and the last three letters are a stop-codon ("TAA", "TAG" or "TGA"). The number of characters in the output is three times the len argument, i.e. it contains len codons. Note: the function does not set.seed(); according to current best-practice, functions should never change the state of the RNG since this is a global change. Instead, execute set.seed() with a parameter of your choice before the function call if you wish the sequence to be reproducible.

Usage

1
2
makeSeq(len, useInit = TRUE, useStop = TRUE, alphabet = c("A", "C",
  "G", "T"), p = rep(0.25, 4))

Arguments

len

(integer) number of codons in the returned string

useInit

(logical) make the first codon an initiation codon. Default is TRUE.

useStop

(logical) make the last codon a stop codon. Default is TRUE.

alphabet

(character vector) the elements that are randomly concatenated. Default is A/C/G/T.

p

(numeric vector) Probabilites for each character to occur. Default is equiprobable.

Value

(character) a single string

Examples

1
2
3
4
5
6
7
8
makeSeq(7)  # six amino acids (incl. start codon) and a stop codon
## Not run: 
  set.seed(112358)  # reproducible random
  makeSeq(7, p = c(0.2, 0.4, 0.4, 0.2))  # "ATGTATTTGTACCGGCGTTAA"
  set.seed(NULL)

## End(Not run)
gsub("T", "U", makeSeq(7)) # for RNA

hyginn/rptPlus documentation built on May 30, 2019, 2:11 p.m.