|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.unibi.techfak.jpredictor.clustering.RelationMeasure
de.unibi.techfak.jpredictor.clustering.MatrixRelationMeasure
de.unibi.techfak.jpredictor.clustering.MatrixAlignment
public class MatrixAlignment
Class for aligning two matrices. There's no need for both matrices
to be of the same size (length). It depends on the used
MatrixSimilarity, whether the arrays must be of equal
length. An alignment of two matrices means, that the first matrix is
shifted against the second and for every shift value the relation
measure is calculated. The shift value for the most optimal relation
measure is taken as result.
At the beginning or the end of both matrices an array representing a gap must be provided by the user. Example: when dealing with nucleotide strings represented as position specific probability matrices the gap vector is usually the 'N' array: { 0.25, 0.25, 0.25, 0.25 }, which means every atomic nucleotide A,C,G,T has the same probability of 25% to occur at that position. Despite the gaps at the beginning and the end of both matrices the alignment is called gapless, since no gaps are inserted into the matrices.
Usage is like this:
MatrixAlignment ma = new MatrixAlignment( new MatrixLoglikelihood (
new LikelihoodMeasure() ) );
ma.add( firstMatrix );
ma.add( secondMatrix );
ma.compute();
ma.result(); // returns the best relation measure
ma.getShiftValue(); // returns how both matrices are aligned
// to obtain such an result
.
For an alignment of two matrices to function a matrix relation measure
must be given. This measure is to be optimized.
| Field Summary | |
|---|---|
(package private) double[] |
gaparray
The array representing a gap. |
(package private) MatrixSimilarity |
ms
Tells how both matrices are to be related to each other. |
(package private) int |
shiftValue
After the aligment was computed, the shift value tells how the first is shifted against the second. |
| Fields inherited from class de.unibi.techfak.jpredictor.clustering.MatrixRelationMeasure |
|---|
matrixList |
| Fields inherited from class de.unibi.techfak.jpredictor.clustering.RelationMeasure |
|---|
computationResult |
| Fields inherited from interface de.unibi.techfak.jpredictor.clustering.Computable |
|---|
COMPUTATION_FAILED, COMPUTATION_PENDING, COMPUTATION_SUCCESS, COMPUTATION_WAITING |
| Constructor Summary | |
|---|---|
MatrixAlignment(MatrixSimilarity ms,
double[] gaparray)
Constructs this class with a relation measure between matrices and an array representing a gap. |
|
| Method Summary | |
|---|---|
double |
atomicCombine(double rel0,
double rel1)
Two relations measures are combined to one result, which is not stored but returned. |
double |
atomicNormalize(double rel,
double norm)
A relations measures is normalized by a certain amount. |
int |
compute()
Uses all internal informations available and starts and controlls the computational process. |
double[][] |
getConsensus()
Calculates the average matrix over the last two given ones, after they were properly aligned. |
double[][] |
getConsensus(int normX,
int normY)
There are hard constraints for a consensus matrix to be calculated. |
int |
getShiftValue()
Returns the shift value. |
RelationMeasure |
newInstance()
Creates a copy of this relation measure as if it was newly instantiated through a call to the constructor. |
int |
optimum(double rel0,
double rel1)
Compares two relation measure results. |
java.lang.String |
toString()
Creates a short string of this relation measure and maybe some results if available. |
| Methods inherited from class de.unibi.techfak.jpredictor.clustering.MatrixRelationMeasure |
|---|
add, add, clear, length, lengthRow |
| Methods inherited from class de.unibi.techfak.jpredictor.clustering.RelationMeasure |
|---|
atomicCombine, compareTo, optimum, result |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
int shiftValue
Integer.MAX_VALUE.
MatrixSimilarity ms
double[] gaparray
| Constructor Detail |
|---|
public MatrixAlignment(MatrixSimilarity ms,
double[] gaparray)
throws java.lang.NullPointerException
VectorRelationMeasure
that can handle what the user provides.
ms - The relation measure between the two matrices to be aligned.gaparray - The array to be appent at the beginning and the end of
both matrices.
java.lang.NullPointerException - If mrm is null.| Method Detail |
|---|
public int getShiftValue()
Integer.MAX_VALUE indicates that
either no computation was done yet or that it failed.
public double[][] getConsensus(int normX,
int normY)
gaparray is non-null
it too must be of that size.
normX - The normalization for the first matrix.normY - The normalization for the second matrix.
public double[][] getConsensus()
getConsensus(int, int)
public int optimum(double rel0,
double rel1)
RelationMeasure
Compares two relation measure results. Returns -1, zero or 1, if the
first (rel0) measure is worse, equal, or better than the
second one (rel1). The terms worse and better depend on
the implementation of the RelationMeasure inheriting
this method. Usually, when dealing with distances, the lower the better.
On the other side, when dealing with likelihoods the higher the better.
Note, that it is possible to mix up optimization of different relation measures, e.g. distances and likelihoods, since this method works on any numbers.
optimum in class RelationMeasurerel0 - The first relation measure to be compared to the second.rel1 - The second relation measure to be compared to the first.
public int compute()
Computable
COMPUTATION_SUCCESS.Computable.COMPUTATION_SUCCESS,
Computable.COMPUTATION_FAILED
public double atomicCombine(double rel0,
double rel1)
RelationMeasureTwo relations measures are combined to one result, which is not stored but returned. This method provides a way to calculate the combined result, when the way how to do this is not known. For instance, distance relation measures normally sum up over single results while likelihood/probabilities are multiplied.
Note, that it is possible to mix up optimization of different relation measures, e.g. distances and likelihoods, since this method works on any numbers.
atomicCombine in class RelationMeasurerel0 - The first relation measure to be compared to the second.rel1 - The second relation measure to be compared to the first.
public double atomicNormalize(double rel,
double norm)
RelationMeasureA relations measures is normalized by a certain amount. This method provides a way to normalize a relation measure after numbers of them were combined. For instance, distance relation measures normally are normalized by dividing through the count, while likelihoods are rooted.
Note, that it is possible to mix up optimization of different relation measures, e.g. distances and likelihoods, since this method works on any numbers.
atomicNormalize in class RelationMeasurerel - The relation measure to be normalized.norm - The normalization value.
Double.NaN in case of error.public RelationMeasure newInstance()
RelationMeasure
newInstance in class RelationMeasurepublic java.lang.String toString()
RelationMeasure
toString in class RelationMeasure
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||