Documentation Center

  • Trial Software
  • Product Updates


Generate random sequence from finite alphabet


Seq = randseq(SeqLength)

Seq = randseq(SeqLength, ...'Alphabet', AlphabetValue, ...)
Seq = randseq(SeqLength, ...'Weights', WeightsValue, ...)
Seq = randseq(SeqLength, ...'FromStructure', FromStructureValue, ...)
Seq = randseq(SeqLength, ...'Case', CaseValue, ...)
Seq = randseq(SeqLength, ...'DataType', DataTypeValue, ...)


SeqLengthInteger that specifies the number of nucleotides or amino acids in the random sequence .

String that specifies the alphabet for the sequence. Choices are 'dna'(default), 'rna', or 'amino'.


Property to specify a weighted random sequence.


Property to specify a weighted random sequence using output structures from the functions from basecount, dimercount, codoncount, or aacount.


String that specifies the case of letters in a sequence when Alphabet is 'char'. Choices are'upper' (default) or 'lower'.


String that specifies the data type for a sequence. Choices are 'char'(default) for letter sequences, and 'uint8' or 'double' for numeric sequences.

Creates a sequence as an array of DataType.


Seq = randseq(SeqLength) creates a random sequence with a length specified by SeqLength.

Seq = randseq(SeqLength, ...'PropertyName', PropertyValue, ...) calls randseq with optional properties that use property name/property value pairs. You can specify one or more properties in any order. Each PropertyName must be enclosed in single quotation marks and is case insensitive. These property name/property value pairs are as follows:

Seq = randseq(SeqLength, ...'Alphabet', AlphabetValue, ...)
generates a sequence from a specific alphabet.

Seq = randseq(SeqLength, ...'Weights', WeightsValue, ...) creates a weighted random sequence where the ith letter of the sequence alphabet is selected with weight W(i). The weight vector is usually a probability vector or a frequency count vector. Note that the ith element of the nucleotide alphabet is given by int2nt(i), and the ith element of the amino acid alphabet is given by int2aa(i).

Seq = randseq(SeqLength, ...'FromStructure', FromStructureValue, ...) creates a weighted random sequence with weights given by the output structure from basecount, dimercount, codoncount, or aacount.

Seq = randseq(SeqLength, ...'Case', CaseValue, ...) specifies the case for a letter sequence.

Seq = randseq(SeqLength, ...'DataType', DataTypeValue, ...) specifies the data type for the sequence array.


Generate a random DNA sequence.


ans =

Generate a random RNA sequence.


ans = 

Generate a random protein sequence.


ans =

See Also

| | |

Was this topic helpful?