Skip to content

Supporting node_labels in as_nexus via translate #3435

Closed

Description

@kaathewisegit

Nexus files support a translate directive in the trees block, which allows mapping short sample ids to full names. BEAST uses them, for example:

Begin trees;
	Translate
		   1 Gorilla,
		   2 Homo_sapiens,
		   3 Hylobates,
		   4 Lemur_catta,
		   5 M._fascicularis,
		   6 M._mulatta,
		   7 M._sylvanus,
		   8 Macaca_fuscata,
		   9 Pan,
		  10 Pongo,
		  11 Saimiri_sciureus,
		  12 Tarsius_syrichta
;
tree TREE1 = ((((((1:8.539364784844837,(2:5.97056745117597,9:5.97056745117597):2.5687973336688668):12.369406882406174,10:20.90877166725101):5.9847286187282265,3:26.893500285979236):21.11768348386113,((5:6.112091996272027,(6:1.9410612498662478,8:1.9410612498662478):4.171030746405778):4.238726956087251,7:10.350818952359278):37.66036481748109):17.830130560055792,11:65.84131432989616):20.354509510375422,(4:63.14102590761508,12:63.14102590761508):23.0547979326565):0.0;

Would tskit be open to adding this functionality to the as_nexus method? It could be implemented with a node_labels parameter (same as in as_newick). If it's present as_nexus would output a translation table for node ids present in node_labels

Activity

  1. jeromekelleher commented on Mar 16, 2026

    @jeromekelleher
    Member

    Welcome @kaathewisegit 👋 I think this would be a useful addition and we'd very much welcome a PR along these lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions