NAME
Bio::Tree::RandomFactory - TreeFactory for generating Random Trees
SYNOPSIS
use Bio::Tree::RandomFactory
my @taxonnames;
my $factory = Bio::Tree::RandomFactory->new( -taxa => \@taxonnames,
-maxcount => 10);
# or for anonymous samples
my $factory = Bio::Tree::RandomFactory->new( -num_taxa => 6,
-maxcount => 50);
my $tree = $factory->next_tree;
DESCRIPTION
Builds a random tree every time next_tree is called or up to -maxcount times.
This module was originally written for Coalescent simulations see Bio::PopGen::Simulation::Coalescent. I've left the next_tree method intact although it is not generating random trees in the phylogenetic sense. I would be happy for someone to provide alternative implementations which can be used here. As written it will generate random topologies but the branch lengths are built from assumptions in the coalescent and are not appropriate for phylogenetic analyses.
This algorithm is based on the make_tree algorithm from Richard Hudson 1990.
Hudson, R. R. 1990. Gene genealogies and the coalescent process. Pp. 1-44 in D. Futuyma and J. Antonovics, eds. Oxford surveys in evolutionary biology. Vol. 7. Oxford University Press, New York
Sanderson, M ...
FEEDBACK
Mailing Lists
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.
Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web:
https://redmine.open-bio.org/projects/bioperl/
AUTHOR - Jason Stajich
Email jason-AT-bioperl.org
CONTRIBUTORS
Matthew Hahn, <matthew.hahn@duke.edu> Mike Sanderson
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
new
Title : new
Usage : my $factory = Bio::Tree::RandomFactory->new(-samples => \@samples,
-maxcount=> $N);
Function: Initializes a Bio::Tree::RandomFactory object
Returns : Bio::Tree::RandomFactory
Args : -nodetype => Type of Nodes to create [default Bio::Tree::Node]
-maxcount => [optional] Maximum num trees to create
-randtype => Type of random trees so far support
- yule/backward_yule/BY [default]
- forward_yule/FY
- birthdeath_forward/BDF
- birthdeath_backwards/BDB
ONE of the following must be specified
-taxa => $arrayref of taxa names
-num_taxa => integer indicating number of taxa in the tree
next_tree
Title : next_tree
Usage : my $tree = $factory->next_tree
Function: Returns a random tree based on the initialized number of nodes
NOTE: if maxcount is not specified on initialization or
set to a valid integer, subsequent calls to next_tree will
continue to return random trees and never return undef
Returns : Bio::Tree::TreeI object
Args : none
maxcount
Title : maxcount
Usage : $obj->maxcount($newval)
Function:
Returns : Maxcount value
Args : newvalue (optional)
reset_tree_count
Title : reset_tree_count
Usage : $factory->reset_tree_count;
Function: Reset the tree counter
Returns : none
Args : none
taxa
Title : taxa
Usage : $obj->taxa($newval)
Function: Set the leaf node names
Returns : value of taxa
Args : Arrayref of Taxon names
num_taxa
Title : num_taxa
Usage : $obj->num_taxa($newval)
Function: Get the number of Taxa
Returns : value of num_taxa
Args : none
random
Title : random
Usage : my $rfloat = $node->random($size)
Function: Generates a random number between 0 and $size
This is abstracted so that someone can override and provide their
own special RNG. This is expected to be a uniform RNG.
Returns : Floating point random
Args : $maximum size for random number (defaults to 1)
random_tree_method
Title : random_tree_method
Usage : $obj->random_tree_method($newval)
Function:
Example :
Returns : value of random_tree_method (a scalar)
Args : on set, new value (a scalar or undef, optional)
nodetype
Title : nodetype
Usage : $obj->nodetype($newval)
Function:
Example :
Returns : value of nodetype (a scalar)
Args : on set, new value (a scalar or undef, optional)