Skip to content

Bug in congeneric.merge #69

@jonesor

Description

@jonesor

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions