random_sequences: Create a Set of Random Sequences

View source: R/random_sequences.R

random_sequencesR Documentation

Create a Set of Random Sequences

Description

Creates a set of random DNA, RNA or AA sequences.

Usage

random_sequences(len, number=1, prob=NULL, type=c("DNA", "RNA", "AA"))

Arguments

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 oligonucleotideTransitions). 4 letters for DNA and RNA and 20 for AA (see DNA_BASES, RNA_BASES and the first 20 letters in AA_ALPHABET).

type

sequence type

Value

A XStringSet.

Author(s)

Michael Hahsler

Examples

### 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)

mhahsler/rMSA documentation built on May 24, 2024, 3:36 p.m.