org.biojava3.alignment
Class GuideTree<S extends Sequence<C>,C extends Compound>

java.lang.Object
  extended by org.biojava3.alignment.GuideTree<S,C>
Type Parameters:
S - each Sequence in the tree is of type S
C - each element of a Sequence is a Compound of type C
All Implemented Interfaces:
Iterable<GuideTreeNode<S,C>>

public class GuideTree<S extends Sequence<C>,C extends Compound>
extends Object
implements Iterable<GuideTreeNode<S,C>>

Implements a data structure for a guide tree used during progressive multiple sequence alignment. Leaf GuideTree.Nodes correspond to single Sequences. Internal GuideTree.Nodes correspond to multiple sequence alignments. The root GuideTree.Node corresponds to the full multiple sequence alignment.

Author:
Mark Chapman

Nested Class Summary
 class GuideTree.Node
          Implements a data structure for the node in a guide tree used during progressive multiple sequence alignment.
 
Constructor Summary
GuideTree(List<S> sequences, List<PairwiseSequenceScorer<S,C>> scorers)
          Creates a guide tree for use during progressive multiple sequence alignment.
 
Method Summary
 int[] getAllPairsScores()
          Returns a sequence pair score for all Sequence pairs in the given List.
 double[][] getDistanceMatrix()
          Returns the distance matrix used to construct this guide tree.
 GuideTree.Node getRoot()
          Returns the root GuideTree.Node which corresponds to the full multiple sequence alignment.
 int[][] getScoreMatrix()
          Returns the similarity matrix used to construct this guide tree.
 List<S> getSequences()
          Returns the Sequences which make up the leaves of this tree.
 Iterator<GuideTreeNode<S,C>> iterator()
          Returns a post-order Iterator that traverses the tree from leaves to root.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GuideTree

public GuideTree(List<S> sequences,
                 List<PairwiseSequenceScorer<S,C>> scorers)
Creates a guide tree for use during progressive multiple sequence alignment.

Parameters:
sequences - the List of Sequences to align
scorers - list of sequence pair scorers, one for each pair of sequences given
Method Detail

getAllPairsScores

public int[] getAllPairsScores()
Returns a sequence pair score for all Sequence pairs in the given List.

Returns:
list of sequence pair scores

getDistanceMatrix

public double[][] getDistanceMatrix()
Returns the distance matrix used to construct this guide tree. The scores have been normalized.

Returns:
the distance matrix used to construct this guide tree

getRoot

public GuideTree.Node getRoot()
Returns the root GuideTree.Node which corresponds to the full multiple sequence alignment.

Returns:
the root node

getScoreMatrix

public int[][] getScoreMatrix()
Returns the similarity matrix used to construct this guide tree. The scores have not been normalized.

Returns:
the similarity matrix used to construct this guide tree

getSequences

public List<S> getSequences()
Returns the Sequences which make up the leaves of this tree.

Returns:
the sequences which make up the leaves of this tree

iterator

public Iterator<GuideTreeNode<S,C>> iterator()
Returns a post-order Iterator that traverses the tree from leaves to root.

Specified by:
iterator in interface Iterable<GuideTreeNode<S extends Sequence<C>,C extends Compound>>

toString

public String toString()
Overrides:
toString in class Object