NAME

Bio::NEXUS::Tree - provides a few functions for trees

SYNOPSIS

new Bio::NEXUS::Tree;

DESCRIPTION

Provides a few useful functions for trees.

FEEDBACK

All feedback (bugs, feature enhancements, etc.) are all greatly appreciated. There are no mailing lists at this time for the Bio::NEXUS::Tree module, so send all relevant contributions to Dr. Weigang Qiu (weigang@genectr.hunter.cuny.edu).

AUTHORS

Eugene Melamud (melamud@carb.nist.gov)
Thomas Hladish (tjhladish at yahoo)
Weigang Qiu (weigang@genectr.hunter.cuny.edu)
Chengzhi Liang (liangc@umbi.umd.edu)
Peter Yang (pyang@rice.edu)

METHODS

new

Title   : new
Usage   : $tree = new Bio::NEXUS::Tree();
Function: Creates a new Bio::NEXUS::Tree object
Returns : Bio::NEXUS::Tree object
Args    : none

clone

Name    : clone
Usage   : my $new_tree = $self->clone();
Function: clone a Bio::NEXUS::Tree (self) object. All the nodes are also cloned. 
Returns : new Bio::NEXUS::Tree object
Args    : none

set_rootnode

Title   : set_rootnode
Usage   : $tree->set_rootnode($newnode);
Function: Sets the root node to a new node
Returns : none
Args    : root node (Bio::NEXUS::Node object)

get_rootnode

Title   : get_rootnode
Usage   : $node = $tree->get_rootnode();
Function: Returns the tree root node 
Returns : root node (Bio::NEXUS::Node object)
Args    : none

set_name

Title   : set_name
Usage   : $tree->set_name($name);
Function: Sets the tree name
Returns : none
Args    : name (string)

get_name

Title   : get_name
Usage   : $name = $tree->get_name();
Function: Returns the tree's name
Returns : name (string) or undef if name doesn't exist
Args    : none

set_as_default

Title   : set_as_default
Usage   : $tree->set_as_default();
Function: assigns is_default variable for this object to 1. (default : 0)
Returns : none
Args    : none

is_default

Title   : is_default
Usage   : $is_default_tree = $tree->is_default();
Function: check whether the tree is assigned as the default.
Returns : 0 (false) or 1 (true)
Args    : none

set_as_unrooted

Title   : set_as_unrooted
Usage   : $tree->set_as_unrooted();
Function: assigns is_unrooted variable for this object to 1. (default : 0)
Returns : none
Args    : none

is_rooted

Title   : is_rooted
Usage   : $is_rooted_tree = $tree->is_rooted();
Function: Check whether the tree is rooted.
Returns : 0 (false) or 1 (true)
Args    : none

determine_cladogram

Title   : determine_cladogram
Usage   : $tree->determine_cladogram();
Function: Determine if a tree is a cladogram or not (that is, whether branch lengths are present)
Returns : none
Args    : none

is_cladogram

Title   : is_cladogram
Usage   : &dothis() if $tree->is_cladogram();
Function: Returns whether tree is a cladogram or not
Returns : 0 (no) or 1 (yes)
Args    : none

as_string

Title   : as_string
Usage   : $treestring = $tree->as_string();
Function: Returns the tree as a string
Returns : tree string (string)
Args    : none

as_string_inodes_nameless

Title   : as_string_inodes_nameless
Usage   : $treestring = $tree->as_string_inodes_nameless();
Function: Returns the tree as a string without internal node names
Returns : tree string (string)
Args    : none

get_nodes

Title   : get_nodes
Usage   : @nodes = @{$tree->get_nodes()};
Function: Returns the list of ALL nodes in the tree
Returns : reference to array of nodes (Bio::NEXUS::Node objects)
Args    : none

get_node_names

Title   : get_node_names
Usage   : @otu_names = @{$tree->get_node_names()};
Function: Returns the list of names of otus (terminal nodes)
Returns : array ref of node names
Args    : none

get_distances

Title   : get_distances
Usage   : %distances = %{$tree->get_distances()};
Function: Finds the distances from the root node for all OTUs
Returns : reference to a hash of OTU names as keys and distances as values
Args    : none

get_tree_length

Title   : get_tree_length
Usage   : $tre_length  = $self->get_tree_length;
Function: Gets the total branch lengths in the tree.
Returns : total branch length
Args    : none

get_support_values

Title   : get_support_values
Usage   : %bootstraps = %{$tree->get_support_values()};
Function: Finds all branch support values for all OTUs
Returns : reference to a hash where OTU names are keys and branch support values are values
Args    : none

set_depth

Title   : set_depth
Usage   : $tree->set_depth();
Function: Sets depth of root node
Returns : none
Args    : none

get_depth

Title   : get_depth
Usage   : %depth=%{$tree->get_depth()};
Function: Get depth in tree of all OTUs and internal nodes
Returns : reference to hash with keys = node names and values = depth
Args    : none

max_depth

Title   : max_depth
Usage   : $maxdepth=%{$tree->max_depth()};
Function: Get maximum depth of tree
Returns : integer indicating maximum depth
Args    : none

find

Title   : find
Usage   : $node = $tree->find($name);
Function: Finds the first occurrence of a node called 'name' in the tree
Returns : Bio::NEXUS::Node object
Args    : name (string)

find_all

Title   : find_all
Usage   : @nodes = @{ $tree->find_all($name) };
Function: find all occurrences of nodes called 'name' in the tree
Returns : Bio::NEXUS::Node objects
Args    : name (string)

prune

Name    : prune
Usage   : $tree->prune($OTUlist);
Function: Removes everything from the tree except for OTUs specified in $OTUlist
Returns : none
Args    : list of OTUs (string)

equals

Name    : equals
Usage   : $tree->equals($another_tree);
Function: compare if two trees are equivalent in topology
Returns : 1 if equal or 0 if not
Args    : another Bio::NEXUS::Tree object

reroot

Name    : reroot
Usage   : $tree = $tree->reroot($outgroup_name);
Function: re-root a tree with a node as outgroup
Returns : 
Args    : the node name to be used as new outgroup

select_subtree

Name    : select_subtree
Usage   : $new_tree_obj = $self->select_subtree($node_name);
Function: selects the subtree (the given node and all its children) from the tree object.
Returns : new Bio::NEXUS::Tree object
Args    : Node name

exclude_subtree

Name    : exclude_subtree
Usage   : $new_tree_obj = $self->exclude_subtree($node_name);
Function: removes the given node and all its children from the tree object.
Returns : new Bio::NEXUS::Tree object
Args    : Node name