NAME

Bio::NEXUS::TreesBlock - Represents TREES block of a NEXUS file

SYNOPSIS

if ( $type =~ /trees/i ) {
    $block_object = new Bio::NEXUS::TreesBlock( $block_type, $block, $verbose );
}

DESCRIPTION

If a NEXUS block is a Trees Block, this module parses the block and stores the tree data.

FEEDBACK

All feedback (bugs, feature enhancements, etc.) are all greatly appreciated.

AUTHORS

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

VERSION

$Revision: 1.63 $

METHODS

new

Title   : new
Usage   : block_object = new Bio::NEXUS::TreesBlock($block_type, $commands, $verbose );
Function: Creates a new Bio::NEXUS::TreesBlock object and automatically reads the file
Returns : Bio::NEXUS::TreesBlock object
Args    : type (string), the commands/comments to parse (array ref), and a verbose flag (0 or 1; optional)

treetype

Title   : treetype
Usage   : $block->treetype('Bio::NEXUS::Tree');
Function: sets a tree type class to instantiate on parse
Returns : none
Args    : a tree class

nodetype

Title   : nodetype
Usage   : $block->nodetype('Bio::NEXUS::Node');
Function: sets a node type class to instantiate on parse
Returns : none
Args    : a node class

clone

Title   : clone
Usage   : my $newblock = $block->clone();
Function: clone a block object (shallow)
Returns : Block object
Args    : none

set_trees

Title   : set_trees
Usage   : $block->set_trees($trees);
Function: Sets the list of trees (Bio::NEXUS::Tree objects) 
Returns : none
Args    : ref to array of Bio::NEXUS::Tree objects

add_tree

Title   : add_tree
Usage   : $block->add_tree($tree);
Function: Add trees (Bio::NEXUS::Tree object) 
Returns : none
Args    : a Bio::NEXUS::Tree object

add_tree_from_newick

Title   : add_tree_from_newick
Usage   : $block->add_tree_from_newick($newick_tree, $tree_name);
Function: Add a tree (Bio::NEXUS::Tree object)
Returns : none
Args    : a tree string in newick format and a name for the tree (scalars)

get_trees

Title   : get_trees
Usage   : $block->get_trees();
Function: Gets the list of trees (Bio::NEXUS::Tree objects) and returns it
Returns : ref to array of Bio::NEXUS::Tree objects
Args    : none

get_tree

Title   : get_tree
Usage   : $block->get_tree($treename);
Function: Gets the first tree (Bio::NEXUS::Tree object) that matches the name given or the first tree if $treename is not specified. If no tree matches, returns undef.
Returns : a Bio::NEXUS::Tree object
Args    : tree name or none

set_translate

Title   : set_translate
Usage   : $block->set_translate($translate);
Function: Sets the hash of translates for nodes names 
Returns : none
Args    : hash of translates

translate

Title   : translate
Usage   : $self->translate($num);
Function: Translates a number with its associated name.
Returns : integer or string
Args    : integer
Method  : Returns the name associated with that number's translated name.
          If it can't find an association, returns the number.

reroot_tree

Title   : reroot_tree
Usage   : $block->reroot_tree($outgroup,$root_position, $treename);
Function: Reroot a tree using an OTU as new outgroup.
Returns : none
Args    : outgroup name, the distance before the root position and tree name

reroot_all_trees

Title   : reroot_all_trees
Usage   : $block->reroot_all_trees($outgroup, $root_position);
Function: Reroot all the trees in the treesblock tree. use an OTU as new outgroup
Returns : none
Args    : outgroup name and root position 

rename_otus

Title   : rename_otus
Usage   : $block->rename_otus(\%translation);
Function: Renames nodes based on a translation hash
Returns : none
Args    : hash containing translation (e.g., { old_name => new_name} )
Comments: nodes not included in translation hash are unaffected

select_otus

Name    : select_otus
Usage   : $nexus->select_otus(\@otunames);
Function: select a subset of OTUs
Returns : a new nexus object 
Args    : a ref to array of OTU names

add_otu_clone

Title   : add_otu_clone
Usage   : ...
Function: ...
Returns : ...
Args    : ...

select_tree

Name    : select_tree
Usage   : $nexus->select_tree($treename);
Function: select a tree
Returns : a new nexus object 
Args    : a tree name

select_subtree

Name    : select_subtree
Usage   : $nexus->select_subtree($inodename);
Function: select a subtree
Returns : a new nexus object 
Args    : an internal node name for subtree to be selected

exclude_subtree

Name    : exclude_subtree
Usage   : $nexus->exclude_subtree($inodename);
Function: remove a subtree
Returns : a new nexus object 
Args    : an internal node for subtree to be removed

equals

Name    : equals
Usage   : $nexus->equals($another);
Function: compare if two NEXUS objects are equal
Returns : boolean 
Args    : a NEXUS object