random_sq {tidysq}R Documentation

Generate random sequences

Description

Generates an sq object with specified number of sequences of given length and alphabet.

Usage

random_sq(n, len, alphabet, sd = NULL, use_gap = FALSE)

Arguments

n

[integer(1)]
A number of sequences to generate - must be non-negative.

len

[integer(1)]
Length of each sequence if sd not specified and mean length of sequences if sd specified - must be non-negative.

alphabet

[character]
If provided value is a single string, it will be interpreted as type (see details). If provided value has length greater than one, it will be treated as atypical alphabet for sq object and sq type will be atp.

sd

[integer(1)]
If specified, gives standard deviation of length of generated sequences - must be non-negative.

use_gap

[logical(1)]
If TRUE, sequences will be generated with random gaps inside (commonly denoted as "-").

Details

Letter '*' is not used in generating ami sequences. If parameter sd is passed, then all generated negative values are replaced with 0s.

Value

An object of class sq with type as specified.

See Also

Functions from input module: import_sq(), read_fasta(), sq()

Examples

# Setting seed for reproducibility
set.seed(16)

# Generating random sequences
random_sq(10, 10, "ami_bsc")
random_sq(25, 18, "rna_bsc", sd = 6)
random_sq(50, 8, "dna_ext", sd = 3)
random_sq(6, 100, "ami_bsc", use_gap = TRUE)

# Passing whole alphabet instead of type
random_sq(4, 12, c("Pro", "Gly", "Ala", "Met", "Cys"))

# Generating empty sequences (why would anyone though)
random_sq(8, 0, "rna_ext")


[Package tidysq version 1.1.3 Index]