YuLab-SMU / ggtree

:christmas_tree:Visualization and annotation of phylogenetic trees
https://yulab-smu.top/treedata-book/
821 stars 172 forks source link

Issue with linear tree with only one parent and one #597

Open haochenz96 opened 6 months ago

haochenz96 commented 6 months ago

Prerequisites

Hello! Thanks for making this amazing tool. While it has worked great so far, I noticed that the ggtree() plotting function cannot work for an extreme case with only one node. Here's the NHX tree I am trying to plot:

((SUB_NODE_1[&&NHX:dist=33.83333333333333:clone_size=937:name=SUB_NODE_1:n_germline_snp_lohs=0:somatic_snv_gains=KRAS p.G12D:somatic_snv_lohs=])[&&NHX:dist=561.6666666666666:clone_size=97:name=1:n_germline_snp_lohs=11:somatic_snv_gains=SMAD4 p.G508D|RNF43 p.L109P:somatic_snv_lohs=SMAD4 p.G508D]);

After converting the NHX tree into a ggtree, the tree table looks like:

Screenshot 2024-01-18 at 12 35 36 PM

and the error is:

> ggtree(tree)
Error in x[, 1] : incorrect number of dimensions

I was wondering if there is any simple fix to this? Thank you in advance.