randseq - Generate random sequence from finite alphabet

Syntax

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, ...)

Arguments

SeqLengthNumber of amino acids or nucleotides in random sequence .
AlphabetValue

Property to select the alphabet for the sequence. Enter 'dna'(default), 'rna', or 'amino'.

WeightsValue

Property to specify a weighted random sequence.

FromStructureValue

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

CaseValue

Property to select the case of letters in a sequence whenAlphabet is 'char'. Values are'upper' (default) or 'lower'.

DataTypeValue

Property to select the data type for a sequence. Values are 'char'(default) for letter sequences, and 'uint8' or 'double' for numeric sequences.

Creates a sequence as an array of DataType.

Description

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 quotes 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.

Examples

Generate a random DNA sequence.

randseq(20)

ans =
TAGCTGGCCAAGCGAGCTTG

Generate a random RNA sequence.

randseq(20,'alphabet','rna')

ans = 
GCUGCGGCGGUUGUAUCCUG

Generate a random protein sequence.

randseq(20,'alphabet','amino')

ans =
DYKMCLYEFGMFGHFTGHKK

See Also

Statistics Toolbox™ functions: hmmgenerate, randsample

MATLAB® functions: rand, randperm

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS