S
- each element of the alignment Profile
is of type SC
- each element of an AlignedSequence
is a Compound
of type CAligner<S,C>
, MatrixAligner<S,C>
, Scorer
AbstractPairwiseSequenceAligner
, AbstractProfileProfileAligner
public abstract class AbstractMatrixAligner<S extends Sequence<C>,C extends Compound> extends AbstractScorer implements MatrixAligner<S,C>
Aligner
which builds a score matrix during computation.Modifier and Type | Field | Description |
---|---|---|
protected java.util.List<AlignerHelper.Anchor> |
anchors |
|
protected int |
cutsPerSection |
|
protected GapPenalty |
gapPenalty |
|
protected int |
max |
|
protected int |
min |
|
protected Profile<S,C> |
profile |
|
protected int |
score |
|
protected int[][][] |
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)
|
protected long |
time |
|
protected int[] |
xyMax |
End position of the aligned sequence in the query and target respectively
|
protected int[] |
xyStart |
Start position of the aligned sequence in the query and target respectively
|
Modifier | Constructor | Description |
---|---|---|
protected |
AbstractMatrixAligner() |
Before running an alignment, data must be sent in via calls to
setGapPenalty(GapPenalty) and
setSubstitutionMatrix(SubstitutionMatrix) . |
protected |
AbstractMatrixAligner(GapPenalty gapPenalty,
SubstitutionMatrix<C> subMatrix) |
Prepares for an alignment.
|
protected |
AbstractMatrixAligner(GapPenalty gapPenalty,
SubstitutionMatrix<C> subMatrix,
boolean local) |
Prepares for an alignment.
|
Modifier and Type | Method | Description |
---|---|---|
protected void |
align() |
Performs alignment
|
protected abstract CompoundSet<C> |
getCompoundSet() |
|
protected abstract java.util.List<C> |
getCompoundsOfQuery() |
|
protected abstract java.util.List<C> |
getCompoundsOfTarget() |
|
long |
getComputationTime() |
Returns the computation time needed for an alignment computed in nanoseconds.
|
GapPenalty |
getGapPenalty() |
Returns the gap penalties.
|
double |
getMaxScore() |
Returns maximum possible score.
|
double |
getMinScore() |
Returns minimum possible score.
|
Profile<S,C> |
getProfile() |
Returns the alignment
Profile produced by this alignment algorithm. |
double |
getScore() |
Returns score resulting from algorithm.
|
int[][][] |
getScoreMatrix() |
Returns the entire score matrix built during alignment.
|
java.lang.String |
getScoreMatrixAsString() |
Returns a depiction of the score matrix as a
String . |
protected abstract int[] |
getScoreMatrixDimensions() |
|
SubstitutionMatrix<C> |
getSubstitutionMatrix() |
Returns the substitution matrix.
|
protected abstract int |
getSubstitutionScore(int queryColumn,
int targetColumn) |
|
protected int[] |
getSubstitutionScoreVector(int queryColumn) |
Returns score for the alignment of the query column to all target columns
|
protected int[] |
getSubstitutionScoreVector(int queryColumn,
AlignerHelper.Subproblem subproblem) |
Returns score for the alignment of the query column to all target columns
|
boolean |
isLocal() |
Returns whether alignment finds a region of similarity rather than aligning every compound.
|
protected abstract boolean |
isReady() |
|
boolean |
isStoringScoreMatrix() |
Returns choice to cache the score matrix or to save memory by deleting score matrix after alignment.
|
protected void |
reset() |
Resets output fields; should be overridden to set max and min
|
void |
setGapPenalty(GapPenalty gapPenalty) |
Sets the gap penalties.
|
protected abstract void |
setProfile(java.util.List<AlignedSequence.Step> sx,
java.util.List<AlignedSequence.Step> sy) |
|
void |
setStoringScoreMatrix(boolean storingScoreMatrix) |
Sets choice to cache the score matrix or to save memory by deleting score matrix after alignment.
|
void |
setSubstitutionMatrix(SubstitutionMatrix<C> subMatrix) |
Sets the substitution matrix.
|
getDistance, getDistance, getSimilarity, getSimilarity
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDistance, getDistance, getSimilarity, getSimilarity
protected GapPenalty gapPenalty
protected java.util.List<AlignerHelper.Anchor> anchors
protected int cutsPerSection
protected int[] xyStart
protected int[] xyMax
protected int max
protected int min
protected int score
protected int[][][] scores
protected long time
protected AbstractMatrixAligner()
setGapPenalty(GapPenalty)
and
setSubstitutionMatrix(SubstitutionMatrix)
.protected AbstractMatrixAligner(GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix)
gapPenalty
- the gap penalties used during alignmentsubMatrix
- the set of substitution scores used during alignmentprotected AbstractMatrixAligner(GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix, boolean local)
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 compoundpublic GapPenalty getGapPenalty()
public SubstitutionMatrix<C> getSubstitutionMatrix()
public boolean isLocal()
public boolean isStoringScoreMatrix()
public void setGapPenalty(GapPenalty gapPenalty)
gapPenalty
- the gap penalties used during alignmentpublic void setSubstitutionMatrix(SubstitutionMatrix<C> subMatrix)
subMatrix
- the set of substitution scores used during alignmentpublic void setStoringScoreMatrix(boolean storingScoreMatrix)
storingScoreMatrix
- choice to cache the score matrixpublic int[][][] getScoreMatrix()
MatrixAligner
Sequence
.getScoreMatrix
in interface MatrixAligner<S extends Sequence<C>,C extends Compound>
public java.lang.String getScoreMatrixAsString()
MatrixAligner
String
. This may include additional description such as
labels for each dimension: element from query sequence, element from target sequence, and meaning of each score.getScoreMatrixAsString
in interface MatrixAligner<S extends Sequence<C>,C extends Compound>
public long getComputationTime()
Aligner
public Profile<S,C> getProfile()
Aligner
Profile
produced by this alignment algorithm.public double getMaxScore()
Scorer
getMaxScore
in interface Scorer
public double getMinScore()
Scorer
getMinScore
in interface Scorer
public double getScore()
Scorer
Scorer.getScore()
- Scorer.getMinScore()
) / (Scorer.getMaxScore()
- Scorer.getMinScore()
).protected void align()
protected int[] getSubstitutionScoreVector(int queryColumn)
queryColumn
- protected int[] getSubstitutionScoreVector(int queryColumn, AlignerHelper.Subproblem subproblem)
queryColumn
- subproblem
- protected void reset()
protected abstract CompoundSet<C> getCompoundSet()
protected abstract java.util.List<C> getCompoundsOfQuery()
protected abstract java.util.List<C> getCompoundsOfTarget()
protected abstract int[] getScoreMatrixDimensions()
protected abstract int getSubstitutionScore(int queryColumn, int targetColumn)
protected abstract boolean isReady()
protected abstract void setProfile(java.util.List<AlignedSequence.Step> sx, java.util.List<AlignedSequence.Step> sy)