Bio-Phylo
view release on metacpan or search on metacpan
lib/Bio/Phylo/Manual.pod view on Meta::CPAN
value is C<undef>. Here you should take care how you test. For example:
if ( ! $node->get_parent ) {
$root = $node;
}
This works as expected - object references are always "true", so if
C<get_parent> returns "false", C<$node> has no parent - hence it must
be the root. However:
if ( ! $node->get_branch_length ) {
# is there really no branch length?
if ( defined $node->get_branch_length ) {
# perhaps there is, but of length 0.
}
}
...warrants caution. Zero is evaluated as false-but-defined.
=back
=head2 Exceptions
The Bio::Phylo modules throw exceptions that subclass L<Exception::Class>.
Exceptions are thrown when something I<exceptional> has happened. Not when the
value requested through an accessor method is undefined. If a node has no
parent, C<undef> is returned. Usually, you will encounter exceptions in
response to invalid input.
=over
=item Trying/Catching exceptions
If some method call returns an exception, wrap the call inside an C<eval>
block. The error now becomes non-fatal:
# try something:
eval { $node->set_branch_length('a bad value'); };
# handle exception, if any
if ($@) {
# do something, e.g.:
print $@->trace->as_string; # <- $@ is an object!
}
=item Stack traces
If an exception of a particular type is caught, you can print a stack trace
and find out what might have gone wrong starting from your script drilling
into the module code.
# exception caught.
if ( UNIVERSAL::isa( $@, 'Bio::Phylo::Util::Exceptions::BadNumber' ) ) {
# prints stack trace in addition to error
warn $@->error, "\n, $@->trace->as_string, "\n";
# further metadata from exception object
warn join ' ', $@->euid, $@->egid, $@->uid, $@->gid, $@->pid, $@->time;
exit;
}
As a new feature (from v.0.17 onwards) exceptions have become more descriptive,
with a generic explanation of what the thrown exception class typically means
added to the error message, and stack traces are printed out by default.
=item Exception types
Several exception classes are defined. The type of the thrown exception should
give you a hint as to what might be wrong. The types are specified in the
L<Bio::Phylo::Util::Exceptions> perldoc.
=back
=head1 TO DO
Below is a list of things that hopefully will be implemented in future
versions of Bio::Phylo.
=over
=item More DNA sequence methods
Such as $seq->complement;. This would imply larger constant translation
tables, including various tables for mtDNA and so on. Will probably be
implemented, must likely using BioPerl tools.
=item Databases
Implement/improve access to TreeBASE, TolWeb and other databases. This could
probably be done best using PhyloWS.
=item Tests
Test coverage is reasonable, but some of the newer features need to be exercised
more.
=item Interoperability with BioPerl
The eventual aim of the Bio::Phylo project is to glue together the phylogenetics
aspects of BioPerl (L<http://www.bioperl.org>), L<Bio::NEXUS>.
=back
=head1 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):
L<http://www.cpanforum.com/dist/Bio-Phylo>
=head1 BUGS
Please report any bugs or feature requests to C<< bug-bio-phylo@rt.cpan.org >>,
or through the web interface at
L<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.
( run in 1.155 second using v1.01-cache-2.11-cpan-22024b96cdf )