The congeneric.merge function includes partial matches, but I think it should only allow exact matches.
For example, in the following example, I would like to add the species "Aster_B" to the existing "Aster_alpinus". However, the grep command matches both "Aster" and "Asterostigma".
tree <- read.tree(text="((Aster_alpinus:1,Asterostigma_lividum:1):1, Aster_lanceolata:2):1;")
plot(tree)
tree <- pez::congeneric.merge(tree=tree, species=c("Aster_B"))
plot(tree)
The fix is simple - replace line 34 of build.phy with the following:
matches <- unique(grep(paste0("^",genus,split), tree$tip.label, value=TRUE))
I can submit a pull request if you prefer.
The
congeneric.mergefunction includes partial matches, but I think it should only allow exact matches.For example, in the following example, I would like to add the species "Aster_B" to the existing "Aster_alpinus". However, the
grepcommand matches both "Aster" and "Asterostigma".The fix is simple - replace line 34 of
build.phywith the following:matches <- unique(grep(paste0("^",genus,split), tree$tip.label, value=TRUE))I can submit a pull request if you prefer.