[Bioperl-l] Posterior (and other values) from BEAST/treeannotator/FigTree tree nodes

Greg Baillie gb7 at sanger.ac.uk
Thu Jul 8 10:24:14 EDT 2010

Hi Jason.

I'm trying to get access to the posterior probability value, rate, etc, 
that are stored within open-square-bracket-ampersand and 
close-square-bracket ([&<here>]) blocks in the tree string. It appears 
that this information is stripped out during the parsing of the tree 
string (I have tried to get it from the $node->bootstrap()).

I'm having trouble identifying the module that parses the tree string - 
I thought I might be able to modify that. Any suggestions where I might 
find the appropriate code?

In the meantime, I'll look at the Bio::Phylo modules (as per Chris' 
suggestion) to see if they have a way of handling that info.



Jason Stajich wrote:
> Hi -
> Is this just that you have internal nodes labeled with the 
> bootstrap/posterior value? If so you just want the node ids for the 
> internal nodes then.  The semantics of what is encoded in the internal 
> nodes is not forced by the nexus format so it assumes they are ids by 
> default.
> You can call $tree->move_id_to_bootstrap
> to migrate the ids of internal nodes to the bootstrap option.
> you can also use the -internal_node_id => 'bootstrap' option when 
> initializing TreeIO objects too:
> =head2 new
>  Title   : new
>  Usage   : my $obj = Bio::TreeIO->new();
>  Function: Builds a new Bio::TreeIO object
>  Returns : Bio::TreeIO
>  Args    : a hash.  useful keys:
>    -format : Specify the format of the file.  Supported formats:
>      newick             Newick tree format
>      nexus              Nexus tree format
>      nhx                NHX tree format
>      svggraph           SVG graphical representation of tree
>      tabtree            ASCII text representation of tree
>      lintree            lintree output format
>    -internal_node_id : what is stored in the internal node ids,
>                        bootstrap values or ids, coded as
>                        'bootstrap' or 'id'
> -jason
> Greg Baillie wrote, On 7/7/10 7:41 AM:
>> Hi.
>> I'm trying to extract information (eg. posterior values) from nodes 
>> of trees generated using BEAST/treeannotator/FigTree.
>> The trees, which are in nexus format, seem to load OK, but when I 
>> iterate through the nodes looking for posterior values (/if ( 
>> $node->has_tag('posterior') ) {.../), none of the nodes seem to have 
>> posteriors.
>> In fact, none of the nodes have any tags (/my @tags = 
>> $node->get_all_tags(); print join ',', @tags/). And when I dump an 
>> entire tree using Data::Dumper, there is no sign of any of the node 
>> values.
>> Does TreeIO handle these values? If so, should I be looking somewhere 
>> other than the tags for the values?
>> Thanks.
>> Greg. 

 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 

More information about the Bioperl-l mailing list