Globally align two sequences using Needleman-Wunsch algorithm
Score
= nwalign(Seq1
,Seq2
)
[Score, Alignment
] = nwalign(Seq1,Seq2
)
[Score, Alignment, Start
]
= nwalign(Seq1,Seq2
)
... = nwalign(Seq1
,Seq2
,
...'Alphabet', AlphabetValue
, ...)
... = nwalign(Seq1
,Seq2
,
...'ScoringMatrix', ScoringMatrixValue
,
...)
... = nwalign(Seq1
,Seq2
,
...'Scale', ScaleValue
, ...)
... = nwalign(Seq1
,Seq2
,
...'GapOpen', GapOpenValue
, ...)
... = nwalign(Seq1
,Seq2
,
...'ExtendGap', ExtendGapValue
, ...)
... = nwalign(Seq1
,Seq2
,
...'Glocal', GlocalValue
, ...)
... = nwalign(Seq1
,Seq2
,
...'Showscore', ShowscoreValue
, ...)
Seq1 , Seq2 | Amino acid or nucleotide sequences. Enter any of the following: Tip For help with letter and integer representations of amino acids and nucleotides, see Amino Acid Lookup or Nucleotide Lookup. |
AlphabetValue | Character vector or string specifying the type of sequence. Choices are
'AA' (default) or
'NT' . |
ScoringMatrixValue | Either of the following:
Note If you need to compile |
ScaleValue | Positive value that specifies a scale factor that is applied to the output score. For example, if the output
score is initially determined in bits, and you enter Default is Note If the Tip Before comparing alignment scores from multiple alignments,
ensure the scores are in the same units. You can use the |
GapOpenValue | Positive value specifying the penalty for opening a gap in
the alignment. Default is 8 . |
ExtendGapValue | Positive value specifying the penalty for extending a gap using the affine gap penalty scheme. Note If you specify this value, |
GlocalValue | Controls the return of a semiglobal or “glocal”
alignment. In a semiglobal alignment, gap penalties at the end of
the sequences are null. Choices are true or false (default). |
ShowscoreValue | Controls the display of the scoring space and the winning path
of the alignment. Choices are true or false (default). |
Score | Optimal global alignment score in bits. |
Alignment | 3-by-N character array showing the two sequences, Seq1 and Seq2 ,
in the first and third rows, and symbols representing the optimal
global alignment for them in the second row. |
Start | 2-by-1 vector of indices indicating the starting point in each
sequence for the alignment. Because this is a global alignment, Start is
always [1;1] . |
returns
the optimal global alignment score in bits. The scale factor used
to calculate the score is provided by the scoring matrix. Score
= nwalign(Seq1
,Seq2
)
[
returns
a 3-by-N character array showing the two sequences, Score, Alignment
] = nwalign(Seq1,Seq2
)Seq1
and Seq2
,
in the first and third rows, and symbols representing the optimal
global alignment for them in the second row. The symbol |
indicates
amino acids or nucleotides that match exactly. The symbol :
indicates
amino acids or nucleotides that are related as defined by the scoring
matrix (nonmatches with a zero or positive scoring matrix value).
[
returns
a 2-by-1 vector of indices indicating the starting point in each sequence
for the alignment. Because this is a global alignment, Score, Alignment, Start
]
= nwalign(Seq1,Seq2
)Start
is
always [1;1]
.
... = nwalign(
calls Seq1
,Seq2
,
...'PropertyName
', PropertyValue
, ...)nwalign
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:
... = nwalign(
specifies
the type of sequences. Choices are Seq1
,Seq2
,
...'Alphabet', AlphabetValue
, ...)'AA'
(default)
or 'NT'
.
... = nwalign(
specifies the scoring matrix to use for the global
alignment. Default is:Seq1
,Seq2
,
...'ScoringMatrix', ScoringMatrixValue
,
...)
'BLOSUM50'
— When AlphabetValue
equals 'AA'
'NUC44'
— When AlphabetValue
equals 'NT'
... = nwalign(
specifies
a scale factor that is applied to the output score, thereby controlling
the units of the output score. Choices are any positive value.Seq1
,Seq2
,
...'Scale', ScaleValue
, ...)
... = nwalign(
specifies
the penalty for opening a gap in the alignment. Choices are any positive
value. Default is Seq1
,Seq2
,
...'GapOpen', GapOpenValue
, ...)8
.
... = nwalign(
specifies
the penalty for extending a gap using the affine gap penalty scheme.
Choices are any positive value. Seq1
,Seq2
,
...'ExtendGap', ExtendGapValue
, ...)
... = nwalign(
controls
the return of a semiglobal or “glocal” alignment. In
a semiglobal alignment, gap penalties at the end of the sequences
are null. Choices are Seq1
,Seq2
,
...'Glocal', GlocalValue
, ...)true
or false
(default).
... = nwalign(
controls
the display of the scoring space and winning path of the alignment.
Choices are Seq1
,Seq2
,
...'Showscore', ShowscoreValue
, ...)true
or false
(default).
The scoring space is a heat map displaying the best scores for
all the partial alignments of two sequences. The color of each (n1,n2
)
coordinate in the scoring space represents the best score for the
pairing of subsequences Seq1(1:n1)
and Seq2(1:n2)
,
where n1
is a position in Seq1
and n2
is
a position in Seq2
. The best score for a pairing
of specific subsequences is determined by scoring all possible alignments
of the subsequences by summing matches and gap penalties.
The winning path is represented by black dots in the scoring
space, and it illustrates the pairing of positions in the optimal
global alignment. The color of the last point (lower right) of the
winning path represents the optimal global alignment score for the
two sequences and is the Score
output returned
by nwalign
.
Note
The scoring space visually indicates if there are potential alternate winning paths, which is useful when aligning sequences with big gaps. Visual patterns in the scoring space can also indicate a possible sequence rearrangement.
Globally align two amino acid sequences using the BLOSUM50
(default)
scoring matrix and the default values for the GapOpen
and ExtendGap
properties.
Return the optimal global alignment score in bits and the alignment
character array.
[Score, Alignment] = nwalign('VSPAGMASGYD','IPGKASYD') Score = 7.3333 Alignment = VSPAGMASGYD : | | || || I-P-GKAS-YD
Globally align two amino acid sequences specifying
the PAM250
scoring matrix and a gap open penalty
of 5
.
[Score, Alignment] = nwalign('IGRHRYHIGG','SRYIGRG',... 'scoringmatrix','pam250',... 'gapopen',5) Score = 2.3333 Alignment = IGRHRYHIG-G : || || | -S--RY-IGRG
Globally align two amino acid sequences returning
the Score
in nat units (nats) by specifying
a scale factor of log(2)
.
[Score, Alignment] = nwalign('HEAGAWGHEE','PAWHEAE','Scale',log(2)) Score = 0.2310 Alignment = HEAGAWGHE-E || || | --P-AW-HEAE
[1] Durbin, R., Eddy, S., Krogh, A., and Mitchison, G. (1998). Biological Sequence Analysis (Cambridge University Press).
aa2int
| aminolookup
| baselookup
| blosum
| dayhoff
| gonnet
| int2aa
| int2nt
| localalign
| multialign
| nt2aa
| nt2int
| nuc44
| pam
| profalign
| seqdotplot
| showalignment
| swalign