de.unibi.techfak.jpredictor.clustering
Class MotifAlignment

java.lang.Object
  extended by de.unibi.techfak.jpredictor.clustering.RelationMeasure
      extended by de.unibi.techfak.jpredictor.clustering.MotifAlignment
All Implemented Interfaces:
Computable, java.lang.Comparable
Direct Known Subclasses:
MultiMotifAlignment, SingleMotifAlignment

public abstract class MotifAlignment
extends RelationMeasure

Class for generell alignment between two or more motifs. Since it should only be possible to align single motifs against each other and to align two multi motifs with the same length against each other, subsequent classes must provide methods to make sure of that.

Every alignment relies on a MatrixAlignment which must be given. It is used to align single motifs against each other. The method result() returns the optimal similarity/distance/likelyhood or whatever relation measure is given only after a full computation was done. Intermediate results can be obtained using


Field Summary
(package private)  MotifList ml
          The list of motifs to be aligned.
(package private)  int[] motifOrientation
          Stores the orientation of the motifs aligned after the alignment was computed.
 
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
MotifAlignment()
           
 
Method Summary
abstract  boolean add(Motif m)
           Adds a motif to this alignment class.
 void clear()
          Clears the list of motifs this class contains.
 Motif consensus()
          Calculates the consensus motif over the last two aligned ones.
abstract  Motif consensus(int normX, int normY)
           Calculates the consensus motif over the last two given ones, after they were properly aligned.
 int getOrientation(int motifNumber)
          Returns the orientation for the motifs.
 
Methods inherited from class de.unibi.techfak.jpredictor.clustering.RelationMeasure
atomicCombine, atomicCombine, atomicNormalize, compareTo, newInstance, optimum, optimum, result, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.unibi.techfak.jpredictor.clustering.Computable
compute
 

Field Detail

ml

MotifList ml
The list of motifs to be aligned. Note, that more than two motifs can be added to this alignment, but only the last two added ones are computed.


motifOrientation

int[] motifOrientation
Stores the orientation of the motifs aligned after the alignment was computed. Can be obtained through method getOrientation(int) . Zero values indicate that nothing was computed yet, valid return values are MotifSearcher.SEARCH_DIRECTION_PLUS and MotifSearcher.SEARCH_DIRECTION_MINUS.

See Also:
getOrientation(int), MotifSearcher.SEARCH_DIRECTION_PLUS, MotifSearcher.SEARCH_DIRECTION_MINUS
Constructor Detail

MotifAlignment

public MotifAlignment()
Method Detail

add

public abstract boolean add(Motif m)

Adds a motif to this alignment class. The motif is always appent to the existing motifs. Depending on the used alignment class other motifs are accepted.

It is recommended that implementing classes should not perform any time consuming operations here, but rather doing them in the compute() method.

Parameters:
m - The motif to appent to the list.
Returns:
true, if the motif was added, false otherwise, e.g. if the motif did not met the constraint, maybe a MultiMotif was given, where a single one was expected, or vice versa.
See Also:
MultiMotif, SequenceMotif, PSPMotif

clear

public void clear()
Clears the list of motifs this class contains. After doing this every call to compute() will fail, nevertheless, previously computed results will not be cleared.


getOrientation

public int getOrientation(int motifNumber)
                   throws java.lang.IndexOutOfBoundsException
Returns the orientation for the motifs. Valid values are MotifSearcher.SEARCH_DIRECTION_PLUS and MotifSearcher.SEARCH_DIRECTION_MINUS. Zero values mean that the alignment was not yet computed or is not yet finished.

Parameters:
motifNumber - The index of the motifs as they were added to this class. If the class aligns only two motifs valid indices are zero and one, since only the last two added motifs are aligned.
Returns:
The orientation of one of the motifs after the alignment.
Throws:
java.lang.IndexOutOfBoundsException - If motifNumber is less than zero or greater or equal the number of motifs aligned.
See Also:
MotifSearcher.SEARCH_DIRECTION_PLUS, MotifSearcher.SEARCH_DIRECTION_MINUS

consensus

public abstract Motif consensus(int normX,
                                int normY)

Calculates the consensus motif over the last two given ones, after they were properly aligned. Note that this method is not fail-save, since it may mix up newly added motifs with an alignment made on two motifs previously added. It depends on the implementing classes what type the returned motif is (PSPMotif or MultiMotif). The name of the returned motif is normally a combination of the two original motifs names.

The orientation (searchDirection) is copied from the motif added earlier.

Parameters:
normX - The normalization for the first motif.
normY - The normalization for the second motif.
Returns:
The consensus motif over the last two aligned motifs.

consensus

public Motif consensus()
Calculates the consensus motif over the last two aligned ones. Simply calls this.consensus(1,1).

Returns:
The consensus motif over the last two aligned motifs.
See Also:
consensus(int, int)