fr.orsay.lri.varna.models.treealign
Class ExampleDistance3

java.lang.Object
  extended by fr.orsay.lri.varna.models.treealign.ExampleDistance3
All Implemented Interfaces:
TreeAlignLabelDistanceAsymmetric<RNANodeValue2,RNANodeValue2>, TreeAlignLabelDistanceSymmetric<RNANodeValue2>

public class ExampleDistance3
extends Object
implements TreeAlignLabelDistanceSymmetric<RNANodeValue2>

Author:
Raphael Champeimont

Nested Class Summary
 class ExampleDistance3.SequenceAlignResult
           
 
Constructor Summary
ExampleDistance3()
           
 
Method Summary
 ExampleDistance3.SequenceAlignResult alignSequenceNodes(RNANodeValue2 v1, RNANodeValue2 v2)
          Align two sequences contained in nodes.
 ExampleDistance3.SequenceAlignResult alignSequences(char[] A, char[] B)
          Align sequences using the Needleman-Wunsch algorithm.
private  int[][] computeAlignment(double[][] F, int[][] decisions, char[] A, char[] B)
           
 double f(RNANodeValue2 v1, RNANodeValue2 v2)
          Returns the substitution cost between v1 and v2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExampleDistance3

public ExampleDistance3()
Method Detail

f

public double f(RNANodeValue2 v1,
                RNANodeValue2 v2)
Description copied from interface: TreeAlignLabelDistanceAsymmetric
Returns the substitution cost between v1 and v2. We use the convention that a null reference is a blank, ie. f(x, null) is the cost of deleting x and f(null, x) is the cost of inserting x. We won't use f(null, null). We suppose f is such that: f(x,x) = 0 0 <= f(x,y) < +infinity You may also want to have the triangle inequality, although the alignment algorithm does not require it: f(x,z) <= f(x,y) + f(y,z)

Specified by:
f in interface TreeAlignLabelDistanceAsymmetric<RNANodeValue2,RNANodeValue2>

alignSequenceNodes

public ExampleDistance3.SequenceAlignResult alignSequenceNodes(RNANodeValue2 v1,
                                                               RNANodeValue2 v2)
Align two sequences contained in nodes. Both nodes have to be non-single nodes, otherwise an RNANodeValue2WrongTypeException exception will be thrown.


alignSequences

public ExampleDistance3.SequenceAlignResult alignSequences(char[] A,
                                                           char[] B)
Align sequences using the Needleman-Wunsch algorithm. Time: O(A.length * B.length) Space: O(A.length * B.length) Space used by the returned object: O(A.length + B.length)


computeAlignment

private int[][] computeAlignment(double[][] F,
                                 int[][] decisions,
                                 char[] A,
                                 char[] B)