NAME

Bio::Phylo - Phylogenetic analysis using perl.

SYNOPSIS

# verbosity goes from 0, only fatal messages, to 4: everything from
# fatal -> error -> warning -> info -> debug (which is a lot)
use Bio::Phylo verbose => 1;

DESCRIPTION

This is the base class for the Bio::Phylo OO package. In this file, methods are defined that are performed by other objects in the Bio::Phylo release, i.e. objects that inherit from this class.

For general information on how to use Bio::Phylo, consult the manual (Bio::Phylo::Manual); for information on using Bio::Phylo in combination with Bioperl (http://www.bioperl.org) and Bio::Nexus (http://search.cpan.org/~tjhladish/Bio-NEXUS), consult the object compatibility document (Bio::ObjectCompat).

If you come here because you are trying to debug a problem you run into in using Bio::Phylo, you may be interested in the "exceptions" system as discussed in Bio::Phylo::Util::Exceptions. In addition, you may find the logging system that is discussed below of use.

Documentation on the various scripts included in this release is embedded in their respective source files, which, like all perldoc can be viewed in various ways using the nroff-like formatter perldoc <filename> or using one of the many pod2* convertors such as pod2text, pod2html, pod2latex and so on. In addition, the scripts generally have a -h or --help or -? option.

METHODS

CONSTRUCTOR

new()

The Bio::Phylo root object itself, and thus its constructor, is rarely, if ever, used directly. Rather, all other objects in this package inherit its methods, and call its constructor internally. The arguments shown here can thus also be passed to any of the child classes' constructors, which will pass them on up the inheritance tree. Generally, constructors in Bio::Phylo subclasses can process as arguments all methods that have set_* in their names. The arguments are named for the methods, but "set_" has been replaced with a dash "-", e.g. the method "set_name" becomes the argument "-name" in the constructor.

Type    : Constructor
Title   : new
Usage   : my $phylo = Bio::Phylo->new;
Function: Instantiates Bio::Phylo object
Returns : a Bio::Phylo object
Args    : -name    => (object name)
          -desc    => (object description)
          -score   => (numerical score)
          -generic => (generic key/value pair, hash ref)

MUTATORS

set_name()
Type    : Mutator
Title   : set_name
Usage   : $obj->set_name($name);
Function: Assigns an object's name.
Returns : Modified object.
Args    : Argument must be a string, will be single 
          quoted if it contains [;|,|:\(|\)] 
          or spaces. Preceding and trailing spaces
          will be removed.
set_desc()
Type    : Mutator
Title   : set_desc
Usage   : $obj->set_desc($desc);
Function: Assigns an object's description.
Returns : Modified object.
Args    : Argument must be a string.
set_score()
Type    : Mutator
Title   : set_score
Usage   : $obj->set_score($score);
Function: Assigns an object's numerical score.
Returns : Modified object.
Args    : Argument must be any of
          perl's number formats, or undefined
          to reset score.
set_generic()
Type    : Mutator
Title   : set_generic
Usage   : $obj->set_generic( %generic );
Function: Assigns generic key/value pairs to the invocant.
Returns : Modified object.
Args    : Valid arguments constitute:

          * key/value pairs, for example:
            $obj->set_generic( '-lnl' => 0.87565 );

          * or a hash ref, for example:
            $obj->set_generic( { '-lnl' => 0.87565 } );

          * or nothing, to reset the stored hash, e.g.
               $obj->set_generic( );

ACCESSORS

get_name()
Type    : Accessor
Title   : get_name
Usage   : my $name = $obj->get_name;
Function: Returns the object's name.
Returns : A string
Args    : None
get_internal_name()
Type    : Accessor
Title   : get_internal_name
Usage   : my $name = $obj->get_internal_name;
Function: Returns the object's name (if none was set, the name
          is a combination of the $obj's class and its UID).
Returns : A string
Args    : None
get_desc()
Type    : Accessor
Title   : get_desc
Usage   : my $desc = $obj->get_desc;
Function: Returns the object's description (if any).
Returns : A string
Args    : None
get_score()
Type    : Accessor
Title   : get_score
Usage   : my $score = $obj->get_score;
Function: Returns the object's numerical score (if any).
Returns : A number
Args    : None
get_generic()
Type    : Accessor
Title   : get_generic
Usage   : my $value = $obj->get_generic($key);
          or
          my %hash = %{ $obj->get_generic() };
Function: Returns the object's generic data. If an
          argument is used, it is considered a key
          for which the associated value is returned.
          Without arguments, a reference to the whole
          hash is returned.
Returns : A string or hash reference.
Args    : None
get_id()
Type    : Accessor
Title   : get_id
Usage   : my $id = $obj->get_id;
Function: Returns the object's unique ID
Returns : INT
Args    : None

PACKAGE METHODS

get()

All objects in the package subclass the Bio::Phylo object, and so, for example, you can do $node->get('get_branch_length'); instead of $node->get_branch_length. This is a useful feature for listable objects especially, as they have the get_by_value method, which allows you to retrieve, for instance, a list of nodes whose branch length exceeds a certain value. That method (and get_by_regular_expression) uses this $obj->get method.

Type    : Accessor
Title   : get
Usage   : my $treename = $tree->get('get_name');
Function: Alternative syntax for safely accessing
          any of the object data; useful for
          interpolating runtime $vars.
Returns : (context dependent)
Args    : a SCALAR variable, e.g. $var = 'get_name';
debug()
Type    : logging method
Title   : debug
Usage   : $object->debug( "debugging message" );
Function: prints debugging message, depending on verbosity
Returns : invocant
Args    : logging message
info()
Type    : logging method
Title   : info
Usage   : $object->info( "info message" );
Function: prints info message, depending on verbosity
Returns : invocant
Args    : logging message
warn()
Type    : logging method
Title   : warn
Usage   : $object->warn( "warning message" );
Function: prints warning message, depending on verbosity
Returns : invocant
Args    : logging message
error()
Type    : logging method
Title   : error
Usage   : $object->error( "error message" );
Function: prints error message, depending on verbosity
Returns : invocant
Args    : logging message
fatal()
Type    : logging method
Title   : fatal
Usage   : $object->fatal( "fatal message" );
Function: prints fatal message, depending on verbosity
Returns : invocant
Args    : logging message
clone()
Type    : Utility method
Title   : clone
Usage   : my $clone = $object->clone;
Function: Creates a copy of the invocant object.
Returns : A copy of the invocant.
Args    : none.
Comments: Currently not implemented
VERBOSE()

Getter and setter for the verbose level. This comes in five levels: 0 = only fatal messages (though, when something fatal happens, you'll most likely get an exception object), 1 = errors (hopefully recoverable), 2 = warnings (recoverable), 3 = info (useful diagnostics), 4 = debug (every method call)

Type    : Accessor
Title   : VERBOSE()
Usage   : Bio::Phylo->VERBOSE( -level => $level )
Function: Sets/gets verbose level
Returns : Verbose level
Args    : 0 <= $level && $level <= 4
Comments:
CITATION()
Type    : Accessor
Title   : CITATION
Usage   : $phylo->CITATION;
Function: Returns suggested citation.
Returns : Returns suggested citation.
Args    : None
Comments:
VERSION()
Type    : Accessor
Title   : VERSION
Usage   : $phylo->VERSION;
Function: Returns version number
          (including SVN revision number).
Alias   :
Returns : SCALAR
Args    : NONE
Comments:

DESTRUCTOR

DESTROY()
Type    : Destructor
Title   : DESTROY
Usage   : $phylo->DESTROY
Function: Destroys Phylo object
Alias   :
Returns : TRUE
Args    : none
Comments: You don't really need this,
          it is called automatically when
          the object goes out of scope.

SEE ALSO

Also see the manual: Bio::Phylo::Manual.

FORUM

CPAN hosts a discussion forum for Bio::Phylo. If you have trouble using this module the discussion forum is a good place to start posting questions (NOT bug reports, see below): http://www.cpanforum.com/dist/Bio-Phylo

BUGS

Please report any bugs or feature requests to bug-bio-phylo@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Bio-Phylo. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. Be sure to include the following in your request or comment, so that I know what version you're using:

$Id: Phylo.pm 4196 2007-07-12 03:04:01Z rvosa $

AUTHOR

Rutger Vos,

email: mailto://rvosa@sfu.ca
web page: http://www.sfu.ca/~rvosa/

ACKNOWLEDGEMENTS

The author would like to thank Jason Stajich for many ideas borrowed from BioPerl http://www.bioperl.org, and CIPRES http://www.phylo.org and FAB* http://www.sfu.ca/~fabstar for comments and requests.

COPYRIGHT & LICENSE

Copyright 2005 Rutger Vos, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.