[Bioperl-l] nexus add_tree, get_trees, write tree in write_aln

Chris Fields cjfields at uiuc.edu
Thu Nov 9 09:13:09 EST 2006

On Nov 9, 2006, at 7:55 AM, Nathan Haigh wrote:

> Albert Vilella wrote:
>> Hi,
>> I am musing on how to add trees to the AlignIO::Nexus objects.
>> In PAML we have this "add_tree" method, and "get_rst_trees", which we
>> could also apply to this case.
>> I also would like to hear some feedback on how to write_aln nexus
>> files that contain one or more trees in the object instance. Do we
>> want this by default? Only if a "with_trees" parameter is set?
>> Cheers,
>>     Albert.
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> Hi Albert,
> I don't know if you are aware of this resource, so here it is:
> http://search.cpan.org/search?query=bio%3A%3Anexus&mode=all
> I would suggest that if there are trees in the object instance, then
> write_aln should print them by default and then have a "no_trees"  
> option.
> Nath

Another option is to store them in the SimpleAlign object as a queue  
of Tree objects.  Stockholm format allows trees in the annotation  
section, so it makes sense that if some alignments contain this data  
then we should have a way of parsing and storing it, as long as we  
read/write support the particular tree format.

Something like:

my $aln = $alnin->next_aln();

# iterate...

while (my $tree = $aln->next_tree()) {

# or SimpleAlign-like

for my $tree ($aln->each_tree()) {

# all trees

@trees = $aln->each_tree();


Christopher Fields
Postdoctoral Researcher
Lab of Dr. Robert Switzer
Dept of Biochemistry
University of Illinois Urbana-Champaign

More information about the Bioperl-l mailing list