[Bioperl-l] Tree structure modification problems
Babenko, Vladimir
babenko at ncbi.nlm.nih.gov
Sun Jul 27 20:01:36 EDT 2003
Hi;
I'm messed up with the problem of tree modification;
The tree is:
current ancestor tree is
(YGR088w:200.0,((YDR256c:200.0,SPCC757.07:200.0):173.0,((At1g20620:200.0
,(At1g20630:200.0,At4g35090:200.0):165.0):200.0,((Hs4557014:200.0,(72938
63:200.0,7297446:200.0):200.0):197.0,(CE22478:200.0,(CE22476:200.0,CE224
77:200.0):200.0):200.0):197.0):200.0):200.0);
I'd like to remove a node (leaf from the tree) with script:
use Bio::TreeIO;
use Bio::Tree::TreeFunctionsI;
my $tempio=Bio::TreeIO->new(-file=>shift ||die "no tree file
provided",
-format=>'newick');
my $out=Bio::TreeIO->new(-format=>'newick');
my $tree=$tempio->next_tree();
print "number of nodes is ",scalar($tree->get_nodes),"\n";
my ($node, at dum) =$tree->find_node('SPCC75707');
print "node ",$node->id," found\n";
my $anc=$node->ancestor;
$anc->remove_Descendent($node);
print "current tree is \n";
$out->write_tree($tree);
The output is:
number of nodes is 23
node SPCC757.07 found
current tree is
(YGR088w:200.0);
While manually contracting the tree mentioned above to the form:
(YGR088w:200.0,(YDR256c:200.0,SPCC75707:200.0):155.0);
I'm getting apparently good output while running the script on
modified tree:
(YGR088w:200.0,YDR256c:355);
So something should be wrong with the tree structure, but could not
deduce what...
Using BioPerl v1.2...
Thanks,
Vladimir
P.S. PVH (Peter van Heusden) got a baby in Cape Town on July 27 ;-))
More information about the Bioperl-l
mailing list