beast2 icon indicating copy to clipboard operation
beast2 copied to clipboard

Tree.printTranslate not robust

Open rbouckaert opened this issue 2 years ago • 1 comments

When node numbers get out of order (e.g. after resuming an MCMC run), it is possible that the printTranslate method misses a comma for the last node number but adds one behind the last number printed. This happens when the number of taxa exceeds 9999 because the node number is printed as String.format("\t\t%4d ", node.getNr() + taxaTranslationOffset). For bigger data sets we need 4 to be replaced by 6 for trees up to 999999 taxa.

rbouckaert avatar Aug 03 '23 03:08 rbouckaert

Looks like https://github.com/CompEvol/beast2/commit/e71bd4345d8a6b6ae143ceb4bd1ef09e744a1061 introduced incorrect Taxlabels block where numbers are added where they should not, e.g.:

#NEXUS

Begin taxa;
        Dimensions ntax=16;
                Taxlabels
                        1 Canis_adustus_a
                        2 Canis_adustus_b
                        3 Canis_anthus_a
                        4 Canis_anthus_b
                        5 Canis_latrans_a
                        6 Canis_latrans_b
                        7 Canis_lupus_a
                        8 Canis_lupus_b
                        9 Canis_mesomelas_a
                        10 Canis_mesomelas_b
                        11 Canis_simensis_a
                        12 Canis_simensis_b
                        13 Cuon_alpinus_a
                        14 Cuon_alpinus_b
                        15 Lycaon_pictus_a
                        16 Lycaon_pictus_b
                        ;
End;
Begin trees;
        Translate
                     1 Canis_adustus_a,
                     2 Canis_adustus_b,
                     3 Canis_anthus_a,
                     4 Canis_anthus_b,
                     5 Canis_latrans_a,
                     6 Canis_latrans_b,
                     7 Canis_lupus_a,
                     8 Canis_lupus_b,
                     9 Canis_mesomelas_a,
                    10 Canis_mesomelas_b,
                    11 Canis_simensis_a,
                    12 Canis_simensis_b,
                    13 Cuon_alpinus_a,
                    14 Cuon_alpinus_b,
                    15 Lycaon_pictus_a,
                    16 Lycaon_pictus_b
;
tree STATE_0 =...

should have no numbers in taxlabels block.

rbouckaert avatar Aug 13 '23 02:08 rbouckaert