create_sequences {universalmotif} | R Documentation

## Create random sequences.

### Description

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

### Usage

    create_sequences(alphabet = "DNA", seqnum = 100, seqlen = 100, freqs,
      progress = FALSE, BP = FALSE, nthreads = 1,
      rng.seed = sample.int(1e+09, 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.
`progress` | `logical(1)` Deprecated. Does nothing.
`BP` | `logical(1)` Deprecated. See `nthreads`.
`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

    ## 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("!@#$ ")

[Package universalmotif version 1.4.10 Index]