X
- The class for entries of the Dynamic Programming Matrix.R
- The result class.public abstract class AbstractGapAlignmentAlgorithm<X extends AlignmentMatrixEntry,R> extends Object implements GapAlignmentAlgorithm<R>
Constructor and Description |
---|
AbstractGapAlignmentAlgorithm(AlignmentSpecification alignmentSpecification,
Class<X> entryClass,
Class<R> resultClass) |
Modifier and Type | Method and Description |
---|---|
R |
calculateAlignment(Sequence a,
Sequence b)
This calculates the alignment between the Sequences a and b and returns
it as an instance of the result class for this algorithm.
|
static double[] |
calculateDeletionCosts(Node a,
AlignmentSpecification specification)
This calculates the non-weighted costs for deleting the single values in
node a.
|
static double[] |
calculateInsertionCosts(Node b,
AlignmentSpecification specification)
This calculates the non-weighted costs for inserting the single values of
node b.
|
static double[] |
calculateReplacementCosts(Node a,
Node b,
AlignmentSpecification specification)
This calculates the non-weighted costs for replacing the single values in
node a by the values in node b.
|
abstract X |
createDelInitial(X delOld,
int i,
double delLocal)
This method should not be called from outside!
|
static <X> X[] |
createGenericArray(int size,
Class<X> arrClass)
This circumvents Javas rule against generic array cration by using
reflection.
|
static <X> X[][] |
createGenericMatrix(int m,
int n,
Class<X> entryClass)
This circumvents Javas rule against generic array cration by using
reflection.
|
abstract X |
createInitial()
This method should not be called from outside!
|
abstract X |
createInsInitial(X insOld,
int j,
double insLocal)
This method should not be called from outside!
|
abstract X |
createNewEntry(X delOld,
X insOld,
X repOld,
int i,
int j,
double delLocal,
double insLocal,
double repLocal)
This method should not be called from outside!
|
Class<X> |
getEntryClass()
Returns the class of matrix entries.
|
X[][] |
getLastAlignmentMatrix()
The last matrix that was calculated using this algorithm.
|
Class<R> |
getResultClass()
This method shall return the class of the alignment result.
|
AlignmentSpecification |
getSpecification()
This should return the specification that is used for this Algorithm.
|
double |
getWeightThreshold() |
void |
setWeightThreshold(double weightThreshold)
Set a weight threshold (between 0 and 1) that determines which keywords
should be ignored during calculation because their weight is negligible.
|
abstract R |
transformToResult(X[][] alignmentMatrix,
Sequence a,
Sequence b)
This method should not be called from outside!
|
public AbstractGapAlignmentAlgorithm(AlignmentSpecification alignmentSpecification, Class<X> entryClass, Class<R> resultClass)
public Class<X> getEntryClass()
public Class<R> getResultClass()
getResultClass
in interface AlignmentAlgorithm<R>
public X[][] getLastAlignmentMatrix()
public void setWeightThreshold(double weightThreshold)
weightThreshold
- a weight threshold (between 0 and 1)public double getWeightThreshold()
public AlignmentSpecification getSpecification()
getSpecification
in interface AlignmentAlgorithm<R>
public R calculateAlignment(Sequence a, Sequence b)
calculateAlignment
in interface AlignmentAlgorithm<R>
a
- The first sequence.b
- The second sequence.public abstract X createInitial()
public abstract X createDelInitial(X delOld, int i, double delLocal)
delOld
- the matrix entry (i,0)i
- i+1delLocal
- the local deletion cost, defined as the weighted sum over
all comparator deletion costs.public abstract X createInsInitial(X insOld, int j, double insLocal)
insOld
- the matrix entry (0,j+1)j
- j+1insLocal
- the local insertion cost, defined as the weighted sum
over all comparator insertion costs.public abstract X createNewEntry(X delOld, X insOld, X repOld, int i, int j, double delLocal, double insLocal, double repLocal)
delOld
- the matrix entry (i,j+1)insOld
- the matrix entry (i+1,j)repOld
- the matrix entry (i,j)i
- i+1j
- j+1delLocal
- the local deletion cost, defined as the weighted sum over
all comparator deletion costs.insLocal
- the local insertion cost, defined as the weighted sum
over all comparator insertion costs.repLocal
- the local replacement cost, defined as the weighted sum
over all comparator replacement costs.public abstract R transformToResult(X[][] alignmentMatrix, Sequence a, Sequence b)
alignmentMatrix
- the alignment matrix.a
- the first sequence.b
- th second sequence.public static double[] calculateReplacementCosts(Node a, Node b, AlignmentSpecification specification)
a
- The node from the left sequence.b
- The node from the right sequence.specification
- The AlignmentSpecification that shall be used (and
is compatible with the nodes content).public static double[] calculateDeletionCosts(Node a, AlignmentSpecification specification)
a
- The node from the left sequence.specification
- The AlignmentSpecification that shall be used (and
is compatible with the nodes content).public static double[] calculateInsertionCosts(Node b, AlignmentSpecification specification)
b
- The node from the right sequence.specification
- The AlignmentSpecification that shall be used (and
is compatible with the nodes content).public static <X> X[] createGenericArray(int size, Class<X> arrClass)
X
- the type of the new array.size
- the size of the new array.arrClass
- the class of the new array elements.public static <X> X[][] createGenericMatrix(int m, int n, Class<X> entryClass)
X
- the type of the new array.m
- the number of rows of the result matrix.n
- the number of columns of the result matrix.entryClass
- the class of the generic class.Copyright (C) 2013, 2014 Benjamin Paaßen, Charlie Krüger, Georg Zentgraf, AG Theoretical Computer Science, Centre of Excellence Cognitive Interaction Technology (CITEC), University of Bielefeld, licensed under the AGPL v. 3: http://openresearch.cit-ec.de/projects/tcs