import { Sequence } from './SeqNode'; import { AffineGapAlignment, AlignmentResult, AlignType, DynamicTable, GapsParams, LinearGapAlignment, Position, SimilarityFunction, Triple, TripleTable } from './types'; /** * Generic sequence aligner * * @param alignType: string, defining type of alignment. There are four alignment types: * - `global` (i.e. Needlman-Wunch or more precisely a variant of David Sankoff algorithm * see Sankoff, D. (1972). "Matching sequences under deletion-insertion constraints". * Proceedings of the National Academy of Sciences of the United States of America. 69 (1): 4–6 * ) * - `local` (i.e. Smith-Waterman algorithm) * - `semi-global` alignment * - `end-gap-free` alignment * @todo to implement overlap alignment such as the following pattern: * +++++++******-------- * -------******======== * - is the gap and +,*,= are the symbols/characters * which is roughly performed by assigning 0 to the first column and take the max score in the last row of the dynamic table * * @description After reading multiple articles and implementations, I came to a conclusion that there were inconsistencies * in many of the implementations and/or the formulation of the dynamic programming recursion -- especially * for the affine gap penalty case. Interestingly -- after figuring out that -- I found a paper discussing/reporting * the same frustration I witnessed. * * ` Are all global alignment algorithms and implementations correct? `__ * * This article should be THE reference paper for debugging/verifying alignment implementation -- especially for affine gap penalty. */ export declare class Aligner { alignType: AlignType; seq1: Sequence; seq2: Sequence; alignment?: LinearGapAlignment | AffineGapAlignment; similarityFunction: SimilarityFunction; constructor(alignType: AlignType); setAlignType(alignType: AlignType): void; setSimilarityFunction(similarityFunction: SimilarityFunction): void; align(seq1: Sequence, seq2: Sequence, gapsParams: GapsParams): void; protected fillDynamicAndPointerTables(vec: Triple, dynamic_table: DynamicTable, pointer_table: TripleTable, pos: Position, main_dtable?: boolean): void; retrieveAlignments(numPaths?: number): AlignmentResult; protected retrieveAlignmentsLinear(linearGapAlignment: LinearGapAlignment, num_paths?: number): AlignmentResult; private build_coord_graph_linear; private retrieveAlignmentsAffine; private build_coord_graph_affine; private buildAlignments; private traversePath; private getAlignmentPair; }