Computes the best global pairwise alignment.
An Align object that stores the alignment. The number of rows must be 2 and the sequences must have already been set.
Horizontal gapped sequence in alignment matrix.
Vertical gapped sequence in alignment matrix.
String of Fragment objects. The sequence with id
Alignment Graph object to store the alignment in.
Types: Alignment Graph
A StringSet containing two sequences.
The scoring scheme to use for the alignment. Note that the user is responsible for ensuring that the scoring scheme is compatible with
The AlignConfig to use for the alignment.
Optional lower diagonal.
Optional upper diagonal.
The Tag for picking the alignment algorithm.
There exist multiple overloads for this function with four configuration dimensions.
First, you can select whether begin and end gaps are free in either sequence using
Second, you can select the type of the target storing the alignment. This can be either an Align object, two Gaps objects, a Alignment Graph, or a string of Fragment objects. Align objects provide an interface to tabular alignments with the restriction of all rows having the same type. Using two Gaps objects has the advantage that you an align sequences with different types, for example DnaString and Dna5String. Alignment Graphs provide a graph-based representation of segment-based colinear alignments. Using Fragment strings is useful for collecting many pairwise alignments, for example in the construction of Alignment Graphs for multiple-sequence alignments (MSA).
Third, you can optionally give a band for the alignment using
lowerDiag and upperDiag.
The center diagonal has index 0, the ith diagonal below has index -i, the ith above has index i.
Fourth, you can select the algorithm to use with
This can be one of NeedlemanWunsch and Gotoh.
The Needleman-Wunsch algorithm supports scoring schemes with linear gap costs only while Gotoh's algorithm also allows affine gap costs.
The available alignment algorithms all have some restrictions. Gotoh's algorithm can handle arbitrary substitution and affine gap scores. Needleman-Wunsch is limited to linear gap scores. The implementation of Hirschberg's algorithm is further limited that it does not support
alignConfig objects or banding.
The implementation of the Myers-Hirschberg algorithm further limits this to only support edit distance (as scores, matches are scored with 0, mismatches are scored with -1).
The examples below show some common use cases.
Global alignment of two sequences using an Align object and the Needleman-Wunsch algorithm. The Needleman-Wunsch algorithm is automatically selected since the scoring scheme uses linear gap costs.
Global banded alignment of two sequences using two Gaps objects and the Gotoh algorithm. The Gotoh algorithm is automatically selected since the scoring scheme uses affine gap costs.
SeqAn - Sequence Analysis Library - www.seqan.de