View source: R/random_sequences.R
| random_sequences | R Documentation | 
Creates a set of random DNA, RNA or AA sequences.
random_sequences(len, number=1, prob=NULL, type=c("DNA", "RNA", "AA"))
len | 
 sequence length  | 
number | 
 number of sequences in the set  | 
prob | 
 a named vector with letter probabilities or a transition
probability matrix (as produced by
  | 
type | 
 sequence type  | 
A XStringSet.
Michael Hahsler
### create random sequences (using given letter frequencies)
seqs <- random_sequences(100, number=10, prob=c(a=.5, c=.3, g=.1, t=.1))
seqs
### check letter frequencies
summary(oligonucleotideFrequency(seqs, width=1, as.prob=TRUE))
### creating random sequences using a random dinocleodite transition matrix
prob <-  matrix(runif(16), nrow=4, ncol=4, dimnames=list(DNA_BASES, DNA_BASES))
prob <- prob/rowSums(prob)
seqs <- random_sequences(100, number=10, prob=prob)
seqs
### check dinocleodite transition probabilities
prob
oligonucleotideTransitions(seqs, as.prob=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.