It is in DendroPy 4, by specifying "``translate_tree_taxa=True`` to the
"``write()``" or "``as_string()``" method::
>>> import dendropy
>>> tree = dendropy.Tree.get(data="(A,(B,(C,(D,E))));",
schema="newick")
>>> print(tree.as_string("nexus", translate_tree_taxa=True))
#NEXUS
BEGIN TAXA;
DIMENSIONS NTAX=5;
TAXLABELS
A
B
C
D
E
;
END;
BEGIN TREES;
Translate
1 A,
2 B,
3 C,
4 D,
5 E
;
TREE 1 = (1,(2,(3,(4,5))));
END;
DendroPy 4 is going to be publically released in the next 24-48 hrs, but
you can check out the current revision on GitHub to get the current
development snapshot if you want.
-- jeet
On 6/4/15 2:45 PM, Jason Ladner wrote:
> Was this function ever implemented? And if so, how can I use it?
>
> Thanks.
>
> On Thursday, November 15, 2012 at 3:34:17 PM UTC-5, Michael Dunn wrote:
>
> Thanks Jeet. I've written some code myself to do this, and submitted
> a pull request for review on GitHub.
>
>
> On 14 November 2012 20:29, Jeet Sukumaran <
jeetsu...@gmail.com
> <javascript:>> wrote:
>
> Not at present. It should be straightforward to implement, though.
> Submit an issue on GitHub, and hopefully we'll get around to
> incorporating this in the next release.
>
> On Nov 11, 11:25 am, Michael Dunn <
misha.d...@gmail.com> wrote:
> > Is it possible to write a tree to nexus format with a
> translation table?
> > i.e.
> >
> > begin trees;
> > translate
> > 1 T1,
> > 2 T2,
> > 3 T3,
> > 4 T4;
> > TREE 0 = ((1,2),(3,4));
> > end;
> >
> > instead of
> >
> > begin trees;
> > TREE 0 = ((T1,T2),(T3,T4));
> > end;
> >
> > I've looked in the docs, and in the source, but can't see
> where this might
> > be done. The nexus reader copes with translate tables fine.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "DendroPy Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
dendropy-user...@googlegroups.com
> <mailto:
dendropy-user...@googlegroups.com>.
> For more options, visit
https://groups.google.com/d/optout.
--
--------------------------------------
Jeet Sukumaran
--------------------------------------
jeetsu...@gmail.com
--------------------------------------
Blog/Personal Pages:
http://jeetworks.org/
GitHub Repositories:
http://github.com/jeetsukumaran
Photographs (as stream):
http://www.flickr.com/photos/jeetsukumaran/
Photographs (by galleries):
http://www.flickr.com/photos/jeetsukumaran/sets/
--------------------------------------