[Bioperl-l] TreeIO and bootstrap values

Jason Stajich jason.stajich at gmail.com
Sun Dec 29 02:16:46 UTC 2013


Bootstrap is not a fixed newick field -
best thing is to set the internal ID to the bootstrap value, that is where it is read from when writing a newick tee.

replace $node->bootstrap( ... ) 
with
$node->id( ... );

Or use NHX format which has separate fields for bootstrap and ID.

There is also a connivence function which will copy IDs to the bootstrap field on the whole tree, (move_id_to_boostrap defined Bio::Tree::TreeFunctionsI) but there is not a corresponding reverse function that would move bootstrap to id at the moment, though it would be trivial to add this patch if you think it is useful enough.


On Dec 23, 2013, at 2:44 PM, Lee Katz <lskatz at gmail.com> wrote:

> Hi, I want to change the bootstrap values in my phylogeny to some
> artificial Fst values I created earlier in the script.  This subroutine
> seems to be doing the trick because Data::Dumper shows that the nodes and
> the tree have the new bootstraps.  However, the resulting Newick tree does
> not display them.  Can anyone help?  Thank you.
> 
> http://pastie.org/private/wtn0pqgjwrmpdswodok4mw#
> 
> sub printTree{
>  my($fst,$tree,$settings)=@_;
>  my $treeIn=new Bio::TreeIO(-file=>$tree)->next_tree;
>  my $out=Bio::TreeIO->new(-format=>"newick");
>  for my $node($treeIn->get_nodes){    # get all descendents of the
> node and alpha-sort them    my @d=sort{$a->id cmp $b->id}
> $node->each_Descendent;    next if(!@d);    # make a comma-separated
> key    my $key; $key.=$_->id."," for(@d);    $key=~s/,$//;    # next
> if that key isn't in $fst: not all $fst combos were calculated.
> next if(!$$fst{$key});    # apply the Fst with that key
> $node->bootstrap($$fst{$key});
>  }
> 
>  $out->write_tree($treeIn);
> }
> 
> 
> -- 
> Lee Katz, Ph.D.
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l





More information about the Bioperl-l mailing list