[Bioperl-l] Bio::Tree::IO "Collapse" function
    Lucia Peixoto 
    luciap at sas.upenn.edu
       
    Tue May 30 20:11:52 UTC 2006
    
    
  
Hi
OK that was silly, but what I have in my code is what you just wrote
But the problem is that if I write
$parent->add_Descendent($child)
it tells me that I am calling  the method "ass_Descendent" on an undefined value
(but I did define $parent before??)
So here it goes the code so far:
use Bio::TreeIO;
 my $in = new Bio::TreeIO(-file => 'Test2.tre',
                          -format => 'newick');
 my $out = new Bio::TreeIO(-file => '>mytree.out',
                           -format => 'newick');
 while( my $tree = $in->next_tree ) {
    foreach my $node ( grep { ! $_->is_Leaf() } $tree->get_nodes() ) {
    my $bootstrap=$node->_creation_id;
    if ($bootstrap < 70 ){
            my $parent = $node->ancestor;
            my @children=$node->get_all_Descendents;
            foreach my $child (@children){
                $parent->add_Descendent($child);
            }
........
eventually I'll add (once I assigned the children to the parent succesfully):
$tree->remove_Node($node);
        }
    }
    $out->write_tree($tree);
}
Quoting aaron.j.mackey at gsk.com:
> > foreach $child (@children){
> >          $parent=add_Descendent->$child;
> > }
>
> I think what you want is $parent->add_Descendent($child)
>
> -Aaron
>
Lucia Peixoto
Department of Biology,SAS
University of Pennsylvania
    
    
More information about the Bioperl-l
mailing list