create_sequences: Create random sequences.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/create_sequences.R

Description

Generate random sequences from any set of characters, represented as XStringSet objects.

Usage

1
2
create_sequences(alphabet = "DNA", seqnum = 100, seqlen = 100, freqs,
  nthreads = 1, rng.seed = sample.int(10000, 1))

Arguments

alphabet

character(1) One of c('DNA', 'RNA', 'AA'), or a string of characters to be used as the alphabet.

seqnum

numeric(1) Number of sequences to generate.

seqlen

numeric(1) Length of random sequences.

freqs

numeric A named vector of probabilities. The length of the vector must be the power of the number of letters in the sequence alphabet.

nthreads

numeric(1) Run create_sequences() in parallel with nthreads threads. nthreads = 0 uses all available threads. Note that no speed up will occur for jobs with seqnum = 1.

rng.seed

numeric(1) Set random number generator seed. Since sequence creation can occur simultaneously in multiple threads using C++, it cannot communicate with the regular R random number generator state and thus requires an independent seed. Each individual sequence creation instance is given the following seed: rng.seed * index. The default is to pick a random number as chosen by sample(), which effectively is make create_sequences() dependent on the R RNG state.

Value

XStringSet The returned sequences are unnamed.

Author(s)

Benjamin Jean-Marie Tremblay, b2tremblay@uwaterloo.ca

See Also

create_motif(), shuffle_sequences()

Examples

1
2
3
4
5
6
## Create DNA sequences with slightly increased AT content:
sequences <- create_sequences(freqs = c(A=0.3, C=0.2, G=0.2, T=0.3))
## Create custom sequences:
sequences.QWER <- create_sequences("QWER")
## You can include non-alphabet characters are well, even spaces:
sequences.custom <- create_sequences("!@#$ ")

universalmotif documentation built on April 8, 2021, 6 p.m.