randseq

Generate random sequence from finite alphabet

Syntax

Seq = randseq(Length, 'PropertyName', PropertyValue)

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

Arguments

Length

 

AlphabetValue

Property to select the alphabet for the sequence. Enter 'dna', 'rna', or 'amino'. The default value is 'dna'.

WeightsValue

Property to specify a weighted random sequence.

FromStructureValue

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

CaseValue

Property to select the case of letters in a sequence when Alphabet is 'char'. Values are'upper' or 'lower'. The default value is 'upper'.

DataTypeValue

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

Creates a sequence as an array of DataType. The default data type is 'char'.

Description

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

randseq(..., '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).

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

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

randseq(...,'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

MATLAB functions rand, randperm, permute, datatypes


© 1994-2005 The MathWorks, Inc.