treeio
treeio copied to clipboard
Issue with loading MCC tree from BEAST v 1.10.4
I am having an issue when loading and trying to plot one of my MCC trees from a BEASTv1.10.4 run. Here is the link to my R code: https://gist.github.com/taylorpaisie/0c8b07d81003419d94426bfe814ea4ff
Here is the link to the tree I am trying to load and plot: https://gist.github.com/taylorpaisie/bc8b55df56a1730abeda49eb82d6bf1e
The warning message I receive when reading the BEAST tree with 'read.beast()' is:
Warning message: In matrix(x, ncol = 2, byrow = TRUE) : data length [163] is not a sub-multiple or multiple of the number of rows [82]
Then when I use the 'ggtree' command in my script, my R session aborts completely. Any idea what could be causing this error?

There should be something wrong with your file.
ape::read.nexus() will parse the file with only tree structure by ignoring annotation.
It throws the same issue and can't draw the tree.
There is a space in one of the taxon labels of the nexus file, which is causing read.nexus to not read the labels correctly.
Changing line 51 of your nexus from
'MF574563.1 _COL_2015'
to
'MF574563.1_COL_2015'
and line 137 from
46 'MF574563.1 _COL_2015',
to
46 'MF574563.1_COL_2015',
should make the file readable.
I'm not sure if spaces in labels is allowed by the nexus format. If so, this is a bug in ape::read.nexus.
As the labels are single-quoted, they should be supported IMO. Maybe we should include @emmanuelparadis to the discussion of this issue.
I think this issue should be fixed by this request, the problem is like @brj1 said, I had submitted the request to solve the problem, so the development version of ape should work.