fn() reAlignment
Perform realignment on a FragmentStore object.

Defined in <seqan/realign.h>
Signature void reAlignment(store, contigID, realignmentMethod, bandwidth, includeReference[, windowBegin, windowEnd][, debug][, printTiming]);


store The FragmentStore to perform realignment for.
realignmentMethod The realignment algorithm to use, 1 for affine gap costs, 0 for linear gap costs, affine gap costs are recommended, unsigned.
contigID Identifier of the contig to realign, unsigned
bandwidth Bandwidth to use in the pairwise DP alignment algorithms unsigned.
includeReference A bool, if true then the reference will be included as a pseudo-read to increase stability in case of indels. See section "Including the Reference" for details.
windowBegin Optional unsigned window begin for windowed alignment, default: 0, i.e. no windowing. Also see section "Windowed Realignment" below.
windowEnd Optional unsigned window end for windowed alignment, default: 0, i.e. no windowing. Also see section "Windowed Realignment" below.
debug Optional bool to enable verbose logging, default: false.
printTiming Optional bool to enable printing of times, default: false.

Detailed Description

This function implements a variant of the Anson-Myers algorithm to refine the multi-read alignments. The algorithm works in a round-robin fashion:

First, the profile sequence is created for the multi-read alignment. The algorithm then works in round.

In each round, each read alignment is selected, removed from the profile and then aligned against the profile using a DP algorithm. For this alignment, a region of bandwidth / 2 positions around the previous alignment locus is chosen and aligned using a bandwidth of bandwidth in the DP alignment algorithm. The profile is then updated with the resulting pairwise alignment. This is iterated until the global alignment score does not improve.

In the end, the reference sequence of the given contig is replaced by the consensus of the multi-read alignment.

Including the Reference

You can choose to include the reference sequence of the selected contig as a pseudo-read. In this case, the reference sequence of the selected contig will be added as an additional read and also a read alignment will be created for it. The appended pseudo-read will have the highest read ID in the store.

Windowed Realignment

Sometimes, it is useful to just realign a part of the fragment store. This can be done by using the parameters windowBegin and windowEnd. This refers to view positions in the current multi-read alignment. Set both to 0 (also the default) to disalbe windowed realignment.


  • Anson, Eric L., and Eugene W. Myers. "ReAligner: a program for refining DNA sequence multi-alignments." Journal of Computational Biology 4.3 (1997): 369-383.