perl - bioperl package Bio::Tree::Tree can't locate object method as_text -
i'm trying use as_text method bio::tree::tree message: can't locate object method as_text via package bio::tree::tree i'm using example here
note tried other methods in same package , worked normally.
my $input = new bio::treeio(-file => "bintree.nw", -format => "newick"); $tree = $input->next_tree; $tree_as_string = $tree->as_text($format); print $tree_as_string; the print dumper($input) give result:
$var1 = bless( { '_bootstrap_style' => 'traditional', '_handler' => bless( { '_treelevel' => 0, '_currentnodes' => [], '_lastitem' => { 'tree' => 0, 'current' => [], 'id' => 0, 'node' => 0, 'leaf' => 0 }, 'nodetype' => 'bio::tree::node', '_root_verbose' => 0, 'treetype' => 'bio::tree::tree', '_currentitems' => [], '_nodect' => [ undef, 2, 0, 0, 0, 0, 0, 0, 0 ] }, 'bio::treeio::treeeventbuilder' ), '_file' => 'bintree.nw', 'newline_each_node' => undef, 'internal_node_id' => 'id', '_root_cleanup_methods' => [ sub { "dummy" } ], '_flush_on_write' => 1, '_filehandle' => \*symbol::gen0, '_root_verbose' => 0, '_print_tree_count' => 0 }, 'bio::treeio::newick' ); here print dumper ($tree)
is there mistake ? or it's bug ? in advance
your code not working because have not set variable $format anything, bio::treeio class cannot find class load format. try code (it works me):
#!/usr/bin/env perl use strict; use warnings; use bio::treeio; $usage = "$0 treefile\n"; $infile = shift or die $usage; $treeio = bio::treeio->new(-file => $infile, -format => 'newick'); print $treeio->next_tree->as_text('newick'); edit: here version using tree input:
#!/usr/bin/env perl use strict; use warnings; use bio::treeio; $treeio = bio::treeio->new(-fh => \*data, -format => 'newick'); print $treeio->next_tree->as_text('newick'); __data__ (((a:5,b:5)90:2,c:4)25:3,d:10); if run code, prints tree, expected.
$ perl so18645089.pl (((a:5,b:5)90:2,c:4)25:3,d:10); i'm using bioperl 1.6.901, latest version (and version documentation on cpan describes). version 1.6.0 old (>5 years) , not on cpan anymore. bet if upgrade, troubles disappear.
Comments
Post a Comment