randseq
Generate random sequence from finite alphabet
Description
creates a random sequence with a length specified by
Seq
= randseq(SeqLength
)SeqLength
.
specifies options using one or more name-value arguments in addition to the input arguments
in previous syntaxes. Each name-value argument is case insensitive.Seq
= randseq(___,Name=Value
)
Examples
Generate Random DNA Sequence with Length of 20
This example shows how to generate a random DNA sequence with SeqLength
of 20.
randseq(20)
ans = 'TTATGACGTTATTCTACTTT'
Generate Random RNA Sequence with Length of 20
This example shows how to generate a random RNA sequence with SeqLength
of 20.
randseq(20,'Alphabet','rna')
ans = 'UUAUGACGUUAUUCUACUUU'
Generate Random Protein Sequence with Length of 20
This example shows how to generate a random protein sequence with SeqLength
of 20.
randseq(20,'Alphabet','amino')
ans = 'TYNYMRQLVVDVVITNHYSV'
Input Arguments
SeqLength
— Number of nucleotides or amino acids
integer
Number of nucleotides or amino acids in the random sequence, specified as an Integer.
Example: 20
Data Types: single
| double
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: Alphabet='rna'
Alphabet
— Sequence alphabet
'dna'
(default) | 'rna'
| 'amino'
| 'AA'
Sequence alphabet, specified as a character vector or string.
Example: Alphabet='rna'
Data Types: char
| string
Weights
— Weighted random sequence
vector
Weighted random sequence, specified as a vector. randseq
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
The ith element of the nucleotide alphabet is given by
int2nt(i)
.The ith element of the amino acid alphabet is given by
int2aa(i)
.
Example: Weights='1*20'
Data Types: double
| uint8
FromStructure
— Weighted random sequence using output structures
struct
Weighted random sequence using output structures from the basecount
, dimercount
, codoncount
, or aacount
functions.
Example: FromStructure=count
, where count
is the output structure from the aacount
function.
Case
— Letter case in sequence
'upper'
(default) | 'upper'
Letter case in sequence, specified as 'upper'
or
'upper'
. randseq
uses this argument if
DataType
is 'char'
.
Example: Case='lower'
Data Types: char
| string
DataType
— Data type for sequence array
'char'
(default) | 'uint8'
| 'double'
Data type for sequence array, specified as a char
,
uint8
, or double
.
Example: DataType='uint8'
Data Types: char
| double
| uint8
Output Arguments
Seq
— Random sequence
character vector (default) | uint8 | double
Random sequence, returned according to the value of
DataType
.
Version History
Introduced before R2006a
See Also
hmmgenerate
| randsample
| rand
| randperm
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)