[Bioperl-l] Can't locate object method "is_compatible" via package "Bio::Tree::Tree"

viping vipingjo at gmail.com
Thu Jan 17 03:48:36 EST 2008


Hi Everyone£¬

I'm using ActivePerl-5.8.8.822-MSWin32-x86-280952 + bioperl-1.5.2 + Windows XP SP2.
When running example codes(attched below as t.pl) within Bio\Tree\Compatible.pm , I got this error:

Can't locate object method "is_compatible" via package "Bio::Tree::Tree"

I replaced "$t1->is_compatible($t2)" with "is_compatible Bio::Tree::Compatible ($t1,$t2)", the error changed:
Can't locate object method "get_nodes" via package "Bio::Tree::Compatible" at i:/Perl/site/lib/Bio/Tree/Compatible.pm line 252, <GEN1> line 1.

I modified Compatible.pm, changed code for "get_nodes" like this "get_nodes Bio::Tree::Tree($self);", new error arised :
Can't use string ("Bio::Tree::Tree") as a HASH ref while "strict refs" in use at i:/Perl/site/lib/Bio\Tree\Tree.pm line 198, <GEN1> line 1.

I gived up. Any help will be deeply appreciated.




# this is the example script in Bio::Tree::Compatible£ºt.pl
  use Bio::Tree::Compatible;
  use Bio::TreeIO;
  my $input = new Bio::TreeIO('-format' => 'newick',
                              '-file'   => 'input.tre');
  my $t1 = $input->next_tree;
  my $t2 = $input->next_tree;

  my ($incompat, $ilabels, $inodes) = $t1->is_compatible($t2);
  if ($incompat) {
    my %cluster1 = %{ $t1->cluster_representation };
    my %cluster2 = %{ $t2->cluster_representation };
    print "incompatible trees\n";
    if (scalar(@$ilabels)) {
      foreach my $label (@$ilabels) {
        my $node1 = $t1->find_node(-id => $label);
        my $node2 = $t2->find_node(-id => $label);
        my @c1 = sort @{ $cluster1{$node1} };
        my @c2 = sort @{ $cluster2{$node2} };
        print "label $label";
        print " cluster"; map { print " ",$_ } @c1;
        print " cluster"; map { print " ",$_ } @c2; print "\n";
      }
    }
    if (scalar(@$inodes)) {
      while (@$inodes) {
        my $node1 = shift @$inodes;
        my $node2 = shift @$inodes;
        my @c1 = sort @{ $cluster1{$node1} };
        my @c2 = sort @{ $cluster2{$node2} };
        print "cluster"; map { print " ",$_ } @c1;
        print " properly intersects cluster";
        map { print " ",$_ } @c2; print "\n";
      }
    }
  } else {
    print "compatible trees\n";
  }

__END__;

# this is the file 'input.tre':
(((A,B)C,D),(E,F,G));
((A,B)H,E,(J,(K)G)I);

# this is the full messages I got running like this: "perl.exe -w t.pl"
Subroutine new redefined at i:/Perl/site/lib/Bio\Tree\Tree.pm line 96.
Subroutine nodelete redefined at i:/Perl/site/lib/Bio\Tree\Tree.pm line 145.
Subroutine get_nodes redefined at i:/Perl/site/lib/Bio\Tree\Tree.pm line 162.
Subroutine get_root_node redefined at i:/Perl/site/lib/Bio\Tree\Tree.pm line 196.
Subroutine set_root_node redefined at i:/Perl/site/lib/Bio\Tree\Tree.pm line 211.
Subroutine total_branch_length redefined at i:/Perl/site/lib/Bio\Tree\Tree.pm line 235.
Subroutine id redefined at i:/Perl/site/lib/Bio\Tree\Tree.pm line 257.
Subroutine score redefined at i:/Perl/site/lib/Bio\Tree\Tree.pm line 278.
Subroutine cleanup_tree redefined at i:/Perl/site/lib/Bio\Tree\Tree.pm line 314.
Subroutine new redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 100.
Subroutine add_Descendent redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 152.
Subroutine each_Descendent redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 190.
Subroutine remove_Descendent redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 252.
Subroutine remove_all_Descendents redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 300.
Subroutine ancestor redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 334.
Subroutine branch_length redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 375.
Subroutine bootstrap redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 399.
Subroutine description redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 420.
Subroutine id redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 449.
Subroutine internal_id redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 491.
Subroutine _creation_id redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 505.
Subroutine is_Leaf redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 526.
Subroutine height redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 552.
Subroutine invalidate_height redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 577.
Subroutine add_tag_value redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 597.
Subroutine remove_tag redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 617.
Subroutine remove_all_tags redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 637.
Subroutine get_all_tags redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 653.
Subroutine get_tag_values redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 669.
Subroutine has_tag redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 685.
Subroutine node_cleanup redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 690.
Subroutine reverse_edge redefined at i:/Perl/site/lib/Bio\Tree\Node.pm line 717.
Can't locate object method "is_compatible" via package "Bio::Tree::Tree" at Z:\bp\t.pl line 8, <GEN0> line 2.




More information about the Bioperl-l mailing list