edu.rit.compbio.phyl
Class LeastSquaresBranchLengths

java.lang.Object
  extended by edu.rit.compbio.phyl.LeastSquaresBranchLengths

public class LeastSquaresBranchLengths
extends Object

Class LeastSquaresBranchLengths provides methods for computing least squares branch lengths in a DnaSequenceTree.


Method Summary
static double solve(DnaSequenceTree tree, Distance dcalc)
          Find the least squares branch lengths for the given DNA sequence tree.
static double squaredError(DnaSequenceTree tree, Distance dcalc)
          Compute the squared error in the given DNA sequence tree's branch lengths.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

squaredError

public static double squaredError(DnaSequenceTree tree,
                                  Distance dcalc)
Compute the squared error in the given DNA sequence tree's branch lengths. When squaredError() is called:

This method computes the distance between each pair of DNA sequences using the given dcalc object (the "direct distance"); computes the distance between each pair of DNA sequences by adding up the branch lengths along the path through the tree between the sequences (the "tree distance"); and returns the sum of the squares of the differences between the direct distance and the tree distance for each pair of DNA sequences.

Parameters:
tree - DNA sequence tree.
dcalc - Object to calculate distances between DNA sequences.
Returns:
Squared error.

solve

public static double solve(DnaSequenceTree tree,
                           Distance dcalc)
Find the least squares branch lengths for the given DNA sequence tree. When squaredError() is called, every tip node in the tree must be associated with a DNA sequence of the same length.

This method calculates the branch lengths such that the squared error, as defined in the squaredError() method, is minimized. Each node of the tree is associated with the calculated branch length. The squared error is returned.

This method uses a nonnegative linear least squares solver (class edu.rit.numeric.NonNegativeLeastSquares) to calculate the branch lengths. Thus, all branch lengths will be nonnegative; some may be 0.

Parameters:
tree - DNA sequence tree.
dcalc - Object to calculate distances between DNA sequences.
Returns:
Squared error.


Copyright © 2005-2012 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.