FORESTER 1.92

forester.tools
Class SDI

java.lang.Object
  |
  +--forester.tools.SDI
Direct Known Subclasses:
OE, SDIse

public abstract class SDI
extends java.lang.Object

Abstract class from with classes SDIse and OE inherit. SDIse implements our SDI algorithm. OE implements Eulenstein's algorithm for gene duplication inference.

Requires JDK 1.2 or greater.

Version:
1.012 -- last modified: 10/02/01
Author:
Christian M. Zmasek
See Also:
SDIse, OE

Constructor Summary
SDI(Tree gene_tree, Tree species_tree)
          Constructor which sets the gene tree and the species tree to be compared.
 
Method Summary
 int computeMappingCost()
          Computes the cost of mapping the gene tree gene_tree onto the species tree species_tree.
(package private)  void decreaseDuplications()
          Decreases the number of duplications by one.
 int getDuplications()
          Returns the number of duplications.
 Tree getGeneTree()
          Returns the gene tree.
 int getMappingCost()
          Returns the mapping cost L.
 Tree getSpeciesTree()
          Returns the species tree.
(package private)  void increaseDuplications()
          Increases the number of duplications by one.
abstract  int infer(boolean strip_species_tree)
          Infers for each Node of gene_tree (set in constructor) whether it represents a speciation or duplication event by calculating and interpreting the mapping function M.
(package private)  void linkExtNodesOfG()
          Calculates the mapping function for the external nodes of the gene tree: links (sets the field "link" of Node) each external Node of gene_tree to the external Node of species_tree which has the same species name.
static void main(java.lang.String[] args)
          A "main method" for SDI (Speciation versus Duplication Inference).
(package private)  void setDuplicationsToZero()
          Sets the number of duplications to 0.
static int stripTree(Tree reference, Tree to_be_stripped)
          Removes from Tree to_be_stripped all external Nodes which are associated with a species NOT found in Tree reference.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SDI

public SDI(Tree gene_tree,
           Tree species_tree)
    throws java.lang.Exception
Constructor which sets the gene tree and the species tree to be compared. species_tree is the species tree to which the gene tree gene_tree will be compared to - with method "infer(boolean)". The actual inference is accomplished with method "infer(boolean)". The mapping cost L can then be calculated with method "computeMappingCost()".

Conditions:

(Last modified: 01/11/01)

Parameters:
gene_tree - reference to a rooted binary gene Tree to which assign duplication vs speciation, must have species names in the species name fields for all external nodes
species_tree - reference to a rooted binary species Tree which might get stripped in the process, must have species names in the species name fields for all external nodes
See Also:
infer(boolean), computeMappingCost()
Method Detail

infer

public abstract int infer(boolean strip_species_tree)
                   throws java.lang.Exception
Infers for each Node of gene_tree (set in constructor) whether it represents a speciation or duplication event by calculating and interpreting the mapping function M. The most parsimonious sequence of speciation and duplication events is assumed.

(Last modified: 01/11/01)

Parameters:
strip_species_tree - set to true to remove from the species tree species not found in the gene tree prior to analysis
Returns:
number of duplications which have been assigned in gene_tree
See Also:
SDI(Tree,Tree)

computeMappingCost

public int computeMappingCost()
                       throws java.lang.Exception
Computes the cost of mapping the gene tree gene_tree onto the species tree species_tree. Before this method can be called, the mapping has to be calculated with method "infer(boolean)".

Reference. Zhang, L. (1997) On a Mirkin-Muchnik-Smith Conjecture for Comparing Molecular Phylogenies. Journal of Computational Biology 4 177-187.

(Last modified: 11/07/00)

Returns:
the mapping cost "L"

stripTree

public static int stripTree(Tree reference,
                            Tree to_be_stripped)
Removes from Tree to_be_stripped all external Nodes which are associated with a species NOT found in Tree reference.

(Last modified: 01/11/01)

Parameters:
reference - a reference Tree
to_be_stripped - Tree to be stripped
Returns:
number of external nodes removed from to_be_stripped

getGeneTree

public Tree getGeneTree()
Returns the gene tree.

(Last modified: 10/02/01)

Returns:
gene tree

getSpeciesTree

public Tree getSpeciesTree()
Returns the species tree.

(Last modified: 10/02/01)

Returns:
species tree

getMappingCost

public int getMappingCost()
Returns the mapping cost L.

(Last modified: 10/02/01)

Returns:
the mapping cost L

getDuplications

public int getDuplications()
Returns the number of duplications.

(Last modified: 10/02/01)

Returns:
number of duplications

setDuplicationsToZero

void setDuplicationsToZero()
Sets the number of duplications to 0.

(Last modified: 10/02/01)


increaseDuplications

void increaseDuplications()
Increases the number of duplications by one.

(Last modified: 10/02/01)


decreaseDuplications

void decreaseDuplications()
Decreases the number of duplications by one.

(Last modified: 10/02/01)


linkExtNodesOfG

void linkExtNodesOfG()
               throws java.lang.Exception
Calculates the mapping function for the external nodes of the gene tree: links (sets the field "link" of Node) each external Node of gene_tree to the external Node of species_tree which has the same species name.

(Last modified: 01/11/01)


main

public static void main(java.lang.String[] args)
A "main method" for SDI (Speciation versus Duplication Inference).

(Last modified: 01/11/01)

Parameters:
[args[0] - "-e" to use Eulenstein's algorithm instead of SDIse]
[args[0] - "-n" input trees are in New Hampshire format instead of NHX -- or gene tree is in NHX, but species information in gene tree is only present in the form of SWISS-PROT sequence names]
args[0or1] - species tree file name (in NHX format with species names in species name fields unless -n option is used)
args[1or2] - gene tree file name (in NHX format with species names in species name fields and sequence names in sequence name fields unless -n option is used)
[args[2or3] - output file name; default is "sdi_out.nhx"]

FORESTER 1.92