ggtree icon indicating copy to clipboard operation
ggtree copied to clipboard

groupOTU fails with cryptic error

Open FabianRoger opened this issue 4 years ago • 3 comments

I try to colourize my TREE (Phylogenetic tree with 1846 tips and 1844 internal nodes.) by Phylum.

I follow the exact steps outlined here

It runs smoothly for the example with the iris data but on my data

p_TREE <- ggtree(TREE, layout = 'circular', branch.length='none') groupOTU(p_TREE, grp_tip)

fails with

Error in min(sapply(anc, length)) : invalid 'type' (list) of argument

grp_tip is a named list sorting the tip labels into groups, structured exactly as grp in the iris example.

notably

groupOTU(TREE, grp_tip, "species")+
aes(color=species) 

fails with Error in unique.default(x, nmax = nmax) : unique() applies only to vectors

I can't see what is different from my Tree and the example, wherefore I cannot post a repex. My appologies.

FabianRoger avatar Jun 12 '20 16:06 FabianRoger

you should provide a reproducible example.

GuangchuangYu avatar Sep 18 '20 03:09 GuangchuangYu

I have meet a similar but not exact same problem alike this. I found out this is because when treeio reads nexus files, a single quotation mark was added to the beginning and ending of tip.label which lead to a mismatch of tip.label and the group infomation.

wook2014 avatar Feb 23 '21 07:02 wook2014

With the hope it can help someone later: I got this error because I was using the wrong name for the sequence I wanted placed in my groups list (grp_tip here)...

AgatheJouet avatar Aug 30 '22 12:08 AgatheJouet