ggtree
ggtree copied to clipboard
groupOTU fails with cryptic error
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.
you should provide a reproducible example.
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.
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)...