Class AnchoredPairwiseSequenceAligner<S extends org.biojava.nbio.core.sequence.template.Sequence<C>,​C extends org.biojava.nbio.core.sequence.template.Compound>

  • Type Parameters:
    S - each Sequence of the alignment pair is of type S
    C - each element of an AlignedSequence is a Compound of type C
    All Implemented Interfaces:
    Aligner<S,​C>, MatrixAligner<S,​C>, PairwiseSequenceAligner<S,​C>, PairwiseSequenceScorer<S,​C>, Scorer
    Direct Known Subclasses:
    GuanUberbacher, NeedlemanWunsch

    public class AnchoredPairwiseSequenceAligner<S extends org.biojava.nbio.core.sequence.template.Sequence<C>,​C extends org.biojava.nbio.core.sequence.template.Compound>
    extends AbstractPairwiseSequenceAligner<S,​C>
    This algorithm uses a divide-and-conquer approach to find optimal pairwise global sequence alignments (from the first until the last Compound of each Sequence) with the restriction that any alignment produced will connect the query sequence to the target sequence at the anchors. This class performs such global sequence comparisons efficiently by dynamic programming with a space requirement reduced from quadratic (a multiple of query sequence length times target sequence length) to only linear (a multiple of query sequence length). The counterpoint to this reduction in space complexity is a modest (a multiple < 2) increase in time.
    Author:
    Mark Chapman, Daniel Cameron
    • Constructor Detail

      • AnchoredPairwiseSequenceAligner

        public AnchoredPairwiseSequenceAligner​(S query,
                                               S target,
                                               GapPenalty gapPenalty,
                                               org.biojava.nbio.core.alignment.template.SubstitutionMatrix<C> subMatrix)
        Prepares for a pairwise global sequence alignment.
        Parameters:
        query - the first Sequence of the pair to align
        target - the second Sequence of the pair to align
        gapPenalty - the gap penalties used during alignment
        subMatrix - the set of substitution scores used during alignment
        cutsPerSection - the number of cuts added to each section during each pass
      • AnchoredPairwiseSequenceAligner

        public AnchoredPairwiseSequenceAligner​(S query,
                                               S target,
                                               GapPenalty gapPenalty,
                                               org.biojava.nbio.core.alignment.template.SubstitutionMatrix<C> subMatrix,
                                               int[] anchors)
        Prepares for a pairwise global sequence alignment.
        Parameters:
        query - the first Sequence of the pair to align
        target - the second Sequence of the pair to align
        gapPenalty - the gap penalties used during alignment
        subMatrix - the set of substitution scores used during alignment
        cutsPerSection - the number of cuts added to each section during each pass
        anchors - the initial list of anchors
    • Method Detail

      • getAnchors

        public int[] getAnchors()
        Returns the list of anchors. The populated elements correspond to query compounds with a connection established to a target compound.
        Returns:
        the list of anchors
      • setAnchors

        public void setAnchors​(int[] anchors)
        Sets the starting list of anchors before running the alignment routine.
        Parameters:
        anchors - list of points that are tied to the given indices in the target
      • addAnchor

        public void addAnchor​(int queryIndex,
                              int targetIndex)
        Adds an additional anchor to the set of anchored compounds
        Parameters:
        queryIndex - 0-based index of query sequence compound
        targetIndex - 0-base index of target sequence compound to anchor to
      • setProfile

        protected void setProfile​(List<org.biojava.nbio.core.alignment.template.AlignedSequence.Step> sx,
                                  List<org.biojava.nbio.core.alignment.template.AlignedSequence.Step> sy)
        Specified by:
        setProfile in class AbstractMatrixAligner<S extends org.biojava.nbio.core.sequence.template.Sequence<C>,​C extends org.biojava.nbio.core.sequence.template.Compound>