BUILT-IN MATHEMATICA SYMBOL

# SequenceAlignment

SequenceAlignment[s1, s2]
finds an optimal alignment of sequences of elements in the strings or lists and , and yields a list of successive matching and differing sequences.

## Details and OptionsDetails and Options

• SequenceAlignment[s1, s2] gives a list of the form where each is either a single string or sequence of list elements u, representing a matching segment, or a pair , representing segments that differ between the .
• SequenceAlignment by default finds a global Needleman-Wunsch alignment of the complete strings or lists and .
• With the option setting Method->"Local", it finds a local Smith-Waterman alignment.
• For sufficiently similar strings or lists, local and global alignment methods give the same result.
• The following options can be given:
•  GapPenalty 0 additional cost for each alignment gap IgnoreCase False whether to ignore case of letters in strings MergeDifferences True whether to combine adjacent differences Method "Global" alignment algorithm to be used SimilarityRules Automatic rules for similarities between elements
• SequenceAlignment attempts to find an alignment that maximizes the total similarity score.
• With the default setting , each match between two elements contributes 1 to the total similarity score, while each mismatch, insertion, or deletion contributes -1.
• Various named similarity matrices are supported, as specified in the notes for SimilarityRules.

## ExamplesExamplesopen allclose all

### Basic Examples (2)Basic Examples (2)

Globally align two similar strings:

 Out[1]=

Global alignment of two strings:

 Out[1]=

Local alignment of the same strings:

 Out[2]=