java.lang.Object
org.biojava.nbio.alignment.template.AbstractScorer
org.biojava.nbio.alignment.template.AbstractMatrixAligner<S,C>
- Type Parameters:
S- each element of the alignmentProfileis of type SC- each element of a sequence is aCompoundof type C
- All Implemented Interfaces:
Aligner<S,,C> MatrixAligner<S,,C> Scorer
- Direct Known Subclasses:
AbstractPairwiseSequenceAligner,AbstractProfileProfileAligner
public abstract class AbstractMatrixAligner<S extends Sequence<C>,C extends Compound>
extends AbstractScorer
implements MatrixAligner<S,C>
Implements common code for an
Aligner which builds a score matrix during computation.- Author:
- Mark Chapman, Daniel Cameron
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<AlignerHelper.Anchor> protected intprotected GapPenaltyprotected intprotected intprotected intprotected int[][][]Dynamic programming score matrix The first dimension has the length of the first (query) sequence + 1 The second has the length of the second (target) sequence + 1 The third has length 1 for linear gap penalty and 3 for affine/constant gap (one each for match/substitution, deletion, insertion)protected longprotected int[]End position of the aligned sequence in the query and target respectivelyprotected int[]Start position of the aligned sequence in the query and target respectively -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBefore running an alignment, data must be sent in via calls tosetGapPenalty(GapPenalty)andsetSubstitutionMatrix(SubstitutionMatrix).protectedAbstractMatrixAligner(GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix) Prepares for an alignment.protectedAbstractMatrixAligner(GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix, boolean local) Prepares for an alignment. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidalign()Performs alignmentprotected abstract CompoundSet<C> longReturns the computation time needed for an alignment computed in nanoseconds.Returns the gap penalties.doubleReturns maximum possible score.doubleReturns minimum possible score.Returns the alignmentProfileproduced by this alignment algorithm.doublegetScore()Returns score resulting from algorithm.int[][][]Returns the entire score matrix built during alignment.Returns a depiction of the score matrix as aString.protected abstract int[]Returns the substitution matrix.protected abstract intgetSubstitutionScore(int queryColumn, int targetColumn) protected int[]getSubstitutionScoreVector(int queryColumn) Returns score for the alignment of the query column to all target columnsprotected int[]getSubstitutionScoreVector(int queryColumn, AlignerHelper.Subproblem subproblem) Returns score for the alignment of the query column to all target columnsbooleanisLocal()Returns whether alignment finds a region of similarity rather than aligning every compound.protected abstract booleanisReady()booleanReturns choice to cache the score matrix or to save memory by deleting score matrix after alignment.protected voidreset()Resets output fields; should be overridden to set max and minvoidsetGapPenalty(GapPenalty gapPenalty) Sets the gap penalties.protected abstract voidvoidsetStoringScoreMatrix(boolean storingScoreMatrix) Sets choice to cache the score matrix or to save memory by deleting score matrix after alignment.voidsetSubstitutionMatrix(SubstitutionMatrix<C> subMatrix) Sets the substitution matrix.Methods inherited from class org.biojava.nbio.alignment.template.AbstractScorer
getDistance, getDistance, getSimilarity, getSimilarityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.biojava.nbio.alignment.template.Scorer
getDistance, getDistance, getSimilarity, getSimilarity
-
Field Details
-
gapPenalty
-
anchors
-
cutsPerSection
-
profile
-
xyStart
Start position of the aligned sequence in the query and target respectively -
xyMax
End position of the aligned sequence in the query and target respectively -
max
-
min
-
score
-
scores
Dynamic programming score matrix The first dimension has the length of the first (query) sequence + 1 The second has the length of the second (target) sequence + 1 The third has length 1 for linear gap penalty and 3 for affine/constant gap (one each for match/substitution, deletion, insertion) -
time
-
-
Constructor Details
-
AbstractMatrixAligner
protected AbstractMatrixAligner()Before running an alignment, data must be sent in via calls tosetGapPenalty(GapPenalty)andsetSubstitutionMatrix(SubstitutionMatrix). -
AbstractMatrixAligner
Prepares for an alignment.- Parameters:
gapPenalty- the gap penalties used during alignmentsubMatrix- the set of substitution scores used during alignment
-
AbstractMatrixAligner
protected AbstractMatrixAligner(GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix, boolean local) Prepares for an alignment.- Parameters:
gapPenalty- the gap penalties used during alignmentsubMatrix- the set of substitution scores used during alignmentlocal- if true, find a region of similarity rather than aligning every compound
-
-
Method Details
-
getGapPenalty
Returns the gap penalties.- Returns:
- the gap penalties used during alignment
-
getSubstitutionMatrix
Returns the substitution matrix.- Returns:
- the set of substitution scores used during alignment
-
isLocal
Returns whether alignment finds a region of similarity rather than aligning every compound.- Returns:
- true if alignment finds a region of similarity rather than aligning every compound
-
isStoringScoreMatrix
Returns choice to cache the score matrix or to save memory by deleting score matrix after alignment.- Returns:
- choice to cache the score matrix
-
setGapPenalty
Sets the gap penalties.- Parameters:
gapPenalty- the gap penalties used during alignment
-
setSubstitutionMatrix
Sets the substitution matrix.- Parameters:
subMatrix- the set of substitution scores used during alignment
-
setStoringScoreMatrix
Sets choice to cache the score matrix or to save memory by deleting score matrix after alignment.- Parameters:
storingScoreMatrix- choice to cache the score matrix
-
getScoreMatrix
Description copied from interface:MatrixAlignerReturns the entire score matrix built during alignment. The first dimension has the length of the first (query) sequence + 1; the second has the length of the second (target) sequence + 1; the third has length equal to the number of scores stored per pairing of an element from eachSequence.- Specified by:
getScoreMatrixin interfaceMatrixAligner<S extends Sequence<C>,C extends Compound> - Returns:
- the score matrix
-
getScoreMatrixAsString
Description copied from interface:MatrixAlignerReturns a depiction of the score matrix as aString. This may include additional description such as labels for each dimension: element from query sequence, element from target sequence, and meaning of each score.- Specified by:
getScoreMatrixAsStringin interfaceMatrixAligner<S extends Sequence<C>,C extends Compound> - Returns:
- the score matrix as a character sequence
-
getComputationTime
Description copied from interface:AlignerReturns the computation time needed for an alignment computed in nanoseconds. -
getProfile
Description copied from interface:AlignerReturns the alignmentProfileproduced by this alignment algorithm. -
getMaxScore
Description copied from interface:ScorerReturns maximum possible score.- Specified by:
getMaxScorein interfaceScorer- Returns:
- maximum possible score
-
getMinScore
Description copied from interface:ScorerReturns minimum possible score.- Specified by:
getMinScorein interfaceScorer- Returns:
- minimum possible score
-
getScore
Description copied from interface:ScorerReturns score resulting from algorithm. This should normalize between 0 and 1 by calculating (Scorer.getScore()-Scorer.getMinScore()) / (Scorer.getMaxScore()-Scorer.getMinScore()). -
align
Performs alignment -
getSubstitutionScoreVector
Returns score for the alignment of the query column to all target columns- Parameters:
queryColumn-- Returns:
-
getSubstitutionScoreVector
Returns score for the alignment of the query column to all target columns- Parameters:
queryColumn-subproblem-- Returns:
-
reset
Resets output fields; should be overridden to set max and min -
getCompoundSet
-
getCompoundsOfQuery
-
getCompoundsOfTarget
-
getScoreMatrixDimensions
-
getSubstitutionScore
-
isReady
-
setProfile
-