nwalign

Globally align two sequences using the Needleman-Wunsch algorithm

Syntax

nwalign(Seq1, Seq2,
        'PropertyName', PropertyValue...)
[Score, Alignment] =nwalign(Seq1, Seq2)
[Score, Alignment, Start] = nwalign(Seq1, Seq2)

nwalign(..., 'ScoringMatrix', ScoringMatrixValue)
swalign(..., 'Scale', ScaleValue)
nwalign(..., 'GapOpen', GapOpenValue)
nwalign(..., 'ExtendGap', ExtendGapValue)
nwalign(..., 'Alphabet', AlphabetVlaue)
swalign(..., 'Showscore', ShowscoreValue)

Arguments

Seq1, Seq2

Nucleotide or amino acid sequences. Enter a character string or a structure with the field Sequence.

Alphabet

Property to select the type of sequence. Value is either'AA' or 'NT'. The default value is 'AA'.

ScoringMatrix

Enter the name of a scoring matrix. Values are 'PAM40', 'PAM250', DAYHOFF, GONNET, 'BLOSUM30' increasing by 5 to 'BLOSUM90', 'BLOSUM62', or 'BLOSUM100'.

The default value when AlphabetValue = 'aa' is 'BLOSUM50', while the default value when AlphabetValue = 'nt' is nuc44.

ScaleProperty to specify a scaling factor for a scoring matrix.

GapOpen

Property to specify the penalty for opening a gap. The default value is 8.

ExtendedGap

Property to specify the penalty for extending a gap. If ExtendGap is not specified, then the default value is equal to GapOpen.

ShowscoreProperty to control displaying the scoring space and the winning path. Enter either true or false. The default value is false.

Description

nwalign(Seq1, Seq2, 'PropertyName', PropertyValue...) returns the alignment score in bits for the optimal alignment. The scale factor used to calculate the score is provided by the scoring matrix information. If this is not defined, then nwalign returns the raw score.

[Score, Alignment] = nwalign(Seq1, Seq2) returns a string showing an optimal global alignment for the sequences. Amino acids that match are indicated with the symbol |, while related amino acids (nonmatches with a positive scoring matrix value) are indicated with the symbol :. Units for Score are bits.

[Score, Alignment, Start] = nwalign(Seq1, Seq2) returns a 2x1 vector with the starting point indices indicating the starting point of the alignment in the two sequences. Note: This output is for consistency with swalign, but because this is a global alignment, the starting position is always [1;1].

nwalign(..., 'Alphabet', AlphabetValue) selects the amino acid or nucleotide alphabet for sequences.

nwalign(..., 'ScoringMatrix', ScoringMatirxValue) selects the scoring matrix to use for the alignment.

swalign(..., 'Scale', ScaleValue) specifies the scale factor of the scoring matrix to return the score using arbitrary units. If the scoring matrix also provides a scale factor, then both are used.

nwalign(..., 'GapOpen', GapOpenValue) specifies the penalty for opening a gap in the alignment.

nwalign(..., 'ExtendGap', ExtendGapValue) specifies the penalty for extending a gap in the alignment. If ExtendGap is not specified, then extensions to gaps are scored with the same value as GapOpen.

nwalign(..., 'Showscore', ShowscoreValue) displays the scoring space and the winning path.

Examples

Globally align two amino acid sequences.

[Score, Alignment] = nwalign('VSPAGMASGYD','IPGKASYD')

Score =
    7.3333

Alignment =
VSPAGMASGYD
: | | || ||
I-P-GKAS-YD

Select scoring matrix and gap penalty.

[Score, Alignment] = nwalign('IGRHRYHIGG','SRYIGRG',...
                             'scoringmatrix','pam250',...
                             'gapopen',5)

Score =
    2.3333
Alignment =

IGRHRYHIG-G
 :  || || |
-S--RY-IGRG

See Also

Bioinformatics Toolbox functions blosum, dayhoff, gonnet, nt2aa, showalignment, swalign


© 1994-2005 The MathWorks, Inc.