I worry that this really won't be best solved in Bio::TreeIO tree modules
which are really written around streaming trees through not writing into a
compact format which pretty much requires having the whole set of trees in
There are other efforts like Bio::Nexus (http://sourceforge.net/projects/bionexus/)
which could solve it better as it is intended to deal with the Nexus format
more completely, what we handle in Bio::TreeIO .
But that isn't to say someone couldn't try and work on it for Bio::TreeIO
parser. I personally have no bandwidth for this at the moment but maybe it
can be written into a project idea for the bioperl wiki to recruit someone
to work on it.
On Sep 17, 2013, at 1:21 PM, nylander wrote:
> Dear Jason,
> Unfortunately, this issue is perhaps a bit more complicated than just
> omitting the nexus header ('#NEXUS') after the first tree is printed. As
> soungalo pointed out, both the header AND the translation table is
> for every tree. This makes the output file larger than (perhaps)
> Optimally (and I think this is what soungalo wanted), the output should
> contain only a single translation table, and all trees should be written
> the same tree block (cf. the output from phylogenetic MCMC software
> PhyloBayes, etc). This is only possible if all trees contain the same tip
> labels. Hence, all trees needs to be checked before the trees can be
> in a single tree block. As implemented now, each translation table is
> created by parsing the order of tip labels in each individual tree. This
> makes sense if the trees might differ in size and/or labels. But again,
> we have many thousands of trees with the same set of tip labels,
> the translation table should be avoided.
> I know that an efficient and "optimal" (see above) nexus tree writer is
> wanted by many, but I'm unsure how much effort that is involved in order
> handle the multi tree issue.
> View this message in context: http://bioperl.996286.n3.nabble.com/Converting-newick-to-nexus-tp17013p17153.html
> Sent from the Bioperl-L mailing list archive at Nabble.com.
> Bioperl-l mailing list
> [email protected]