FORESTER 1.92

forester.tools
Class SDIunrooted

java.lang.Object
  |
  +--forester.tools.SDIunrooted

public class SDIunrooted
extends java.lang.Object

Allows to infer duplications - speciations on a unrooted gene tree. It reroots the gene trees on each of its branches and performs SDIse on each of the resulting trees. Trees which minimize a certain criterion are returned as the "correctly" rooted ones. The criterions are:

Version:
1.400 -- last modified: 10/01/01
Author:
Christian M. Zmasek
See Also:
SDIse, SDI

Constructor Summary
SDIunrooted()
          Default contructor which creates an "empty" SDIunrooted object.
 
Method Summary
(package private)  Tree fastInfer(Tree gene_tree, Tree species_tree)
          This method is mainly to be used by the RIO classes as the returned tree is quite incomplete -- for improved time efficiency (number of external nodes of each Node are off, will have lost most annotations).
 int getCount()
          Returns the number of differently rooted trees which minimize the (rooting) "criterion" - as determined by method "infer".
 double getMinimalDiffInSubTreeHeights()
          Returns the (absolue value of the) minimal difference in tree heights of the two subtrees at the root (of the (re)rooted gene tree) - as determined by method "infer" - if minimize_height is set to true.
 int getMinimalDuplications()
          Returns the minimal number of duplications - as determined by method "infer".
 int getMinimalMappingCost()
          Returns the minimal mapping cost L - as determined by method "infer" - if minimize_mapping_cost is set to true.
 double getMinimalTreeHeight()
          Returns the minimal tree height - as determined by method "infer" - if minimize_height is set to true.
 long getTimeSumSDI()
          Returns the sum of times (in ms) needed to run method infer of class SDI.
 Tree[] infer(Tree gene_tree, Tree species_tree, boolean minimize_mapping_cost, boolean minimize_sum_of_dup, boolean minimize_height, boolean return_trees, int max_trees_to_return)
          Infers gene duplications on a possibly unrooted gene Tree gene_tree.
static void main(java.lang.String[] args)
          Main method for this class.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SDIunrooted

public SDIunrooted()
Default contructor which creates an "empty" SDIunrooted object.
Method Detail

getCount

public int getCount()
Returns the number of differently rooted trees which minimize the (rooting) "criterion" - as determined by method "infer".
Returns:
number of differently rooted trees which minimized the criterion
See Also:
#infer(Tree,Tree,boolean,boolean,boolean,boolean,int,boolean)

getMinimalDuplications

public int getMinimalDuplications()
Returns the minimal number of duplications - as determined by method "infer".

IMPORTANT: If the tree is not rooted by minimizing the sum of duplications or the mapping cost L, then this number is NOT NECESSARILY the MINIMAL number of duplications.

Returns:
(minimal) number of duplications
See Also:
#infer(Tree,Tree,boolean,boolean,boolean,boolean,int,boolean)

getMinimalMappingCost

public int getMinimalMappingCost()
Returns the minimal mapping cost L - as determined by method "infer" - if minimize_mapping_cost is set to true.

(Last modified: 11/07/00)

Returns:
the minimal mapping cost "L" -- IF calculated by "infer"
See Also:
#infer(Tree,Tree,boolean,boolean,boolean,boolean,int,boolean)

getMinimalTreeHeight

public double getMinimalTreeHeight()
Returns the minimal tree height - as determined by method "infer" - if minimize_height is set to true. IMPORTANT: If minimize_mapping_cost or minimize_sum_of_dup are also set to true, then this returns the minimal tree height of the trees which minimize the first criterion.

(Last modified: 01/12/00)

Returns:
the minimal tree height -- IF calculated by "infer"
See Also:
#infer(Tree,Tree,boolean,boolean,boolean,boolean,int,boolean)

getMinimalDiffInSubTreeHeights

public double getMinimalDiffInSubTreeHeights()
Returns the (absolue value of the) minimal difference in tree heights of the two subtrees at the root (of the (re)rooted gene tree) - as determined by method "infer" - if minimize_height is set to true.

If a tree is midpoint rooted this number is zero.

IMPORTANT: If minimize_mapping_cost or minimize_sum_of_dup are also set to true, then this returns the minimal difference in tree heights of the trees which minimize the first criterion, and is therefore not necessarily zero.

(Last modified: 01/22/00)

Returns:
the minimal difference in tree heights -- IF calculated by "infer"
See Also:
#infer(Tree,Tree,boolean,boolean,boolean,boolean,int,boolean)

getTimeSumSDI

public long getTimeSumSDI()
Returns the sum of times (in ms) needed to run method infer of class SDI. Final variable TIME needs to be set to true.
Returns:
sum of times (in ms) needed to run method infer of class SDI

infer

public Tree[] infer(Tree gene_tree,
                    Tree species_tree,
                    boolean minimize_mapping_cost,
                    boolean minimize_sum_of_dup,
                    boolean minimize_height,
                    boolean return_trees,
                    int max_trees_to_return)
             throws java.lang.Exception
Infers gene duplications on a possibly unrooted gene Tree gene_tree. The tree is rooted be minimizing either the sum of duplications, the mapping cost L, or the tree height (or combinations thereof). If return_trees is set to true, it returns an array of possibly more than one differently rooted Trees.
The maximal number of returned trees is set with max_trees_to_return.
Tree species_tree is a species Tree to which the gene Tree gene_tree is compared to.
If both minimize_sum_of_dup and minimize_mapping_cost are true, the tree is rooted by minimizing the mapping cost L.
If minimize_sum_of_dup, minimize_mapping_cost, and minimize_height are false tree gene_tree is assumed to be alreadty rooted and no attempts at rooting are made, and only one tree is returned.

Conditions:

(Last modified: 10/01/01)

Parameters:
gene_tree - a binary (except deepest node) gene Tree
species_tree - a rooted binary species Tree
minimize_mapping_cost - set to true to root by minimizing the mapping cost L (and also the sum of duplications)
minimize_sum_of_dup - set to true to root by minimizing the sum of duplications
minimize_height - set to true to root by minimizing the tree height - if minimize_mapping_cost is set to true or minimize_sum_of_dup is set to true, then out of the resulting trees with minimal mapping cost or minimal number of duplications the tree with the minimal height is chosen
return_trees - set to true to return Array of Trees, otherwise null is returned
max_trees_to_return - maximal number of Trees to return (=maximal size of returned Array) must be no lower than 1
Returns:
array of rooted Trees with duplication vs. speciation assigned if return_trees is set to true, null otherwise

fastInfer

Tree fastInfer(Tree gene_tree,
               Tree species_tree)
         throws java.lang.Exception
This method is mainly to be used by the RIO classes as the returned tree is quite incomplete -- for improved time efficiency (number of external nodes of each Node are off, will have lost most annotations). The gene Tree gene_tree is modified by this method.

It makes use of the fact that after each rerooting most of the mapping function does not need to be recalculated. If the root is only moved one branch at a time, the mapping function needs to be recalculated only for the new root and one of its children.

This method always roots by minimizing the sum of duplication, followed by selection of the tree with minimal height. It always uses SDIse.

(In order to be able to write the returned Tree to a file, method Tree.adjustNodeCount() must be called on it.)

Conditions:

(Last modified: 06/12/01)

Parameters:
gene_tree - a binary (except deepest node) gene Tree
species_tree - a rooted binary species Tree
Returns:
a rooted Tree with duplication vs. speciation assigned

main

public static void main(java.lang.String[] args)
Main method for this class.

(Last modified: 01/11/01)

Parameters:
[args[0] - -l to root by minimizing mapping cost L]
[args[0] - -d to root by minimizing sum of duplications]
[args[0] - -h to root by minimizing tree height]
[args[0] - -x use fast infer, always minimizes sum of duplications|height]
[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)

FORESTER 1.92