Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Bio-Phylo CPAN distribution.

Report information
The Basics
Id: 51602
Status: resolved
Priority: 0/
Queue: Bio-Phylo

People
Owner: rutgeraldo [...] gmail.com
Requestors: smcbotelho [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Dear Rutger Vos, I am exploring the package Bio::Phylo for the manipulation of my phylogenetic trees. To understand how to prune a tree based on a specific regular expression and write the output to newick format, I used some examples you provided. use Bio::Phylo::IO 'parse'; use strict; my $string="((A:0.33139,B:0.29208):0.04409,(C:0.28550,D:0.28440):0.03647,(E:0.35068,F:0.38974):0.03419);"; my $tree = parse( -format => 'newick', -string => $string )->first; my $tips = $tree->get_by_regular_expression( -value => 'get_name', -match => qr/^(?:A|B)$/, ); $tree->keep_tips($tips); print $tree->to_newick; When I try to run the above script I get the message "Can't call method "get_parent" on an undefined value at /usr/local/perl/5.8.8/lib/site_perl/5.8.8/Bio/Phylo/Forest/Tree.pm" As you mentioned, $tips is an array reference holding node 'A' and node 'B' and keep_tips accepts an array ref of taxon names. I try to find out what might be going on, without success, but maybe I am not getting something about the output of get_by_regular_expression. @tips=('A,'B'); $tree->keep_tips(\@tips); print $tree->to_newick; If instead of using get_by_regular_expression, I simply write as above it works fine. Best regards Sandra Botelho
Dear Sandra Botelho, I have resolved the issue. The problem was that in the failing case the input as an array reference of node objects. The keep_tips method (wrongly) assumed its input can only be an array reference of node names, not node objects. This has now been corrected. I will upload a corrected version of Bio::Phylo to CPAN later today. Thank you very much for your feedback, good luck with your research! Rutger Vos On Tue Nov 17 10:07:03 2009, smcbotelho wrote: Show quoted text
> Dear Rutger Vos, > > I am exploring the package Bio::Phylo for the manipulation of my > phylogenetic trees. To understand how to prune a tree based on a > specific regular expression and write the output to newick format, I > used some examples you provided. > > use Bio::Phylo::IO 'parse'; > use strict; > > my >
$string="((A:0.33139,B:0.29208):0.04409,(C:0.28550,D:0.28440):0.036 47,(E:0.35068,F:0.38974):0.03419);"; Show quoted text
> > my $tree = parse( > -format => 'newick', > -string => $string > )->first; > > > my $tips = $tree->get_by_regular_expression( > -value => 'get_name', > -match => qr/^(?:A|B)$/, > ); > > $tree->keep_tips($tips); > print $tree->to_newick; > > > When I try to run the above script I get the message "Can't call > method "get_parent" on an undefined value at > /usr/local/perl/5.8.8/lib/site_perl/5.8.8/Bio/Phylo/Forest/Tree.pm" > > As you mentioned, $tips is an array reference holding node 'A' and > node 'B' and keep_tips accepts an array ref of taxon names. I try to > find out what might be going on, without success, but maybe I am
not Show quoted text
> getting something about the output of get_by_regular_expression. > > @tips=('A,'B'); > $tree->keep_tips(\@tips); > print $tree->to_newick; > > If instead of using get_by_regular_expression, I simply write as above > it works fine. > > Best regards > > Sandra Botelho