use strict;
use warnings;
use Bio::Phylo::IO;
my $newick = '(F:0.1)A;';
my $tree = Bio::Phylo::IO->parse( -string => $newick, -format => 'newick' )->first;
my $node = $tree->get_by_name('A');
my @sisters = @{$node->get_sisters};
generates the following error:
Can't call method "get_children" on an undefined value at /usr/local/share/perl/5.14.2/Bio/Phylo/Forest/NodeRole.pm line 758, <DATA> line 1.
I found that to fix this issue, the get_sisters() method of Bio::Phylo::Forest::Node,
sub get_sisters {
my $self = shift;
my $sisters = $self->get_parent->get_children;
return $sisters;
}
should be replaced by something like:
sub get_sisters {
my $self = shift;
my $sisters;
my $parent = $self->get_parent;
if ($parent) {
$sisters = $parent->get_children;
}
return $sisters;
}
Hi Rutger,
This code,
generates the following error:
I found that to fix this issue, the get_sisters() method of Bio::Phylo::Forest::Node,
should be replaced by something like:
Best,
Florent