Please use the File Dropper link for the R project file with data and codes:
OR
https://drive.google.com/drive/folders/1_AHbjNrgeyiGMhbh-StlqakjXmcSDHnM?usp=sharing
I have a phylogeny tree of the Eucalypt Clade (tree1) from Thornhill et al 2019
I have deleted some outgroup spp. and sp. synonyms :
#Deleting outgroups and synonyms
ToBEDeleted <- ToBEDeleted %>%
str_replace(" ","_")
tree1.Deleted <- ape::drop.tip(tree1,ToBEDeleted)
tree1.Deleted$tip.label %>%
length()
length(tree1$tip.label)
After that I tried to replace 5 tree tips using a df with their updated names
> renamed
tips abr
1 Eucalyptus_largiflorens Eucalyptus_bicolor
2 Eucalyptus_pilligaensis Eucalyptus_woollsiana
3 Eucalyptus_clelandii Eucalyptus_clelandiorum
4 Eucalyptus_brachycorys Eucalyptus_comitae-vallis
5 Eucalyptus_trivalvis Eucalyptus_trivalva
#Replacing synonyms
phylotools::sub.taxa.label(tree1.Deleted, renamed)
But I ran into this error:
> phylotools::sub.taxa.label(tree1.Deleted, renamed)
5 Names Eucalyptus_largiflorens Eucalyptus_pilligaensis Eucalyptus_clelandii Eucalyptus_brachycorys Eucalyptus_trivalvis in reference table
can not be found in the tree.
Phylogenetic tree with 624 tips and 686 internal nodes.
Tip labels:
NA, NA, NA, NA, NA, NA, ...
Rooted; includes branch lengths.
Warning message:
In phylotools::sub.taxa.label(tree1.Deleted, renamed) :
The number of tip labels in phylogenetic
tree differ from the reference table.
While the above error states that the tree tips are absent from the tree, a quick check below shows that the target tip names in the reference table matches 5 tip names int the tree.
tree1.Deleted$tip.label %>%
stringr::str_detect(paste(renamed$tips,collapse = "|")) %>%
summary()
> tree1.Deleted$tip.label %>%
+ stringr::str_detect(paste(renamed$tips,collapse = "|")) %>%
+ summary()
Mode FALSE TRUE
logical 682 5
Any advice on how to troubleshoot?
Many thanks
Hong
It's my mistake, the reference table argument should have the same number of rows as the total number of tree tips.