NAME

Bio::Phylo::Forest - Container for tree objects

SYNOPSIS

my $fac = Bio::Phylo::Factory->new;
my $forest = $fac->create_forest;
my $tree = $fac->create_tree;
$forest->insert($tree);
print $forest->to_nexus;

DESCRIPTION

The Bio::Phylo::Forest object models a set of trees. The object subclasses the Bio::Phylo::Listable object, so look there for more methods available to forest objects.

METHODS

CONSTRUCTOR

new()

Forest constructor.

Type : Constructor
Title : new
Usage : my $trees = Bio::Phylo::Forest->new;
Function: Instantiates a Bio::Phylo::Forest object.
Returns : A Bio::Phylo::Forest object.
Args : None required, though see the superclass
Bio::Phylo::Listable from which this
object inherits.

METHODS

insert()

Inserts trees in forest.

Type : Method
Title : insert
Usage : $trees->insert( $tree1, $tree2, ... );
Function: Inserts trees in forest.
Returns : A Bio::Phylo::Forest object.
Args : Trees
Comment : The last seen tree that is set as default
becomes the default for the entire forest
get_default_tree()

Gets the default tree in the forest.

Type : Method
Title : get_default_tree
Usage : my $tree = $trees->get_default_tree;
Function: Gets the default tree in the forest.
Returns : A Bio::Phylo::Forest::Tree object.
Args : None
Comment : If no default tree has been set,
returns first tree.
check_taxa()

Validates taxon links of nodes in invocant's trees.

Type : Method
Title : check_taxa
Usage : $trees->check_taxa;
Function: Validates the taxon links of the
nodes of the trees in $trees
Returns : A validated Bio::Phylo::Forest object.
Args : None
make_consensus()

Creates a consensus tree.

Type : Method
Title : make_consensus
Usage : my $tree = $obj->make_consensus
Function: Creates a consensus tree
Returns : $tree
Args : Optional:
-fraction => a fraction that specifies the cutoff frequency for including
bipartitions in the consensus. Default is 0.5 (MajRule)
-branches => 'frequency' or 'average', sets branch lengths to bipartition
frequency or average branch length in input trees
make_matrix()

Creates an MRP matrix object.

Type : Method
Title : make_matrix
Usage : my $matrix = $obj->make_matrix
Function: Creates an MRP matrix object
Returns : $matrix
Args : NONE
make_taxa()

Creates a taxa block from the objects contents if none exists yet.

Type : Method
Title : make_taxa
Usage : my $taxa = $obj->make_taxa
Function: Creates a taxa block from the objects contents if none exists yet.
Returns : $taxa
Args : NONE
to_newick()

Serializes invocant to newick string.

Type : Stringifier
Title : to_newick
Usage : my $string = $forest->to_newick;
Function: Turns the invocant forest object
into a newick string, one line per tree
Returns : SCALAR
Args : The same arguments as
Bio::Phylo::Forest::Tree::to_newick
to_nexus()

Serializer to nexus format.

Type : Format convertor
Title : to_nexus
Usage : my $data_block = $matrix->to_nexus;
Function: Converts matrix object into a nexus data block.
Returns : Nexus data block (SCALAR).
Args : Trees can be formatted using the same arguments as those
passed to Bio::Phylo::Unparsers::Newick. In addition, you
can provide:
# as per mesquite's inter-block linking system (default is false):
-links => 1 (to create a TITLE token, and a LINK token, if applicable)
# rooting is determined based on basal trichotomy. "token" means 'TREE' or 'UTREE'
# is used, "comment" means [&R] or [&U] is used, "nhx" means [%unrooted=on] or
# [%unrooted=off] if used, default is "comment"
-rooting => one of (token|comment|nhx)
# to map taxon names to indices (default is true)
-make_translate => 1 (autogenerate translation table, overrides -translate => {})
Comments:

SEE ALSO

Bio::Phylo::Listable

The forest object inherits from the Bio::Phylo::Listable object. The methods defined therein are applicable to forest objects.

Bio::Phylo::Taxa::TaxaLinker

The forest object inherits from the Bio::Phylo::Taxa::TaxaLinker object. The methods defined therein are applicable to forest objects.

Bio::Phylo::Manual

Also see the manual: Bio::Phylo::Manual and http://rutgervos.blogspot.com.

REVISION

$Id: Forest.pm 1489 2010-11-15 15:19:11Z rvos $