I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2006-12-14 21:44:30-08 by nnahar
Example for module Bio::Phylo::Unparsers::Mrp
Hello everyone, I was wondering if someone could point me to an example as to how to use the Bio::Phylo::Unparsers::Mrp module. I have a set of phylogenetic trees and I want to generate an MRP matrix from them. Please let me know. Thank you for your help. Regards, nnahar
Direct Responses: 3796 | Write a response
Posted on 2006-12-14 22:59:20-08 by rvosa in response to 3790
Re: Example for module Bio::Phylo::Unparsers::Mrp
Hi nnahar, things ought to work correctly like this:
use Bio::Phylo::IO qw(parse unparse); # some way to generate a forest object: my $trees = '((A,B),C);((A,C),B);'; my $forest = parse( -format => 'newick', -string => $trees ); # write out to MRP: print unparse( -format => 'mrp', -phylo => $forest );

...but unfortunately I made a bit of a blunder in the Bio::Phylo::set_name method. The method is now (v.0.15) as follows:
sub set_name { my ( $self, $name ) = @_; my $ref = ref $self; if ( $name && $name !~ m/^['"][^'"]*['"]$/ && $name =~ m/(?:;|,|:|\(|\)|\s)/ ) { Bio::Phylo::Util::Exceptions::BadString->throw( error => "\"$name\" is a bad name format for $ref names" ); } else { $name[ $self->get_id ] = $name =~ s/^\s*(.*?)\s*$/$1/; } return $self; }

...but there is something wrong with this line:
$name[ $self->get_id ] = $name =~ s/^\s*(.*?)\s*$/$1/;

...which you can correct by hand by replacing that line inside the else block with the following:
$name =~ s/^\s*(.*?)\s*$/$1/; $name[ $self->get_id ] = $name;

My apologies for trying to be too clever by half. This should fix it though. Best wishes, Rutger
Direct Responses: Write a response