graemetlloyd/Claddis

safe_taxonomic_reinsertion fail when genus_species_extra name is present

Opened this issue · 0 comments

I ran into an issue reinserting safely removed taxa when multiple individuals of a species are present in the STR tree (e.g Genus_species, Genus_species_area2). This is because lines 16 use gsub to replace the senior name with (junior_name, senior_name). I suggest wrapping the pattern in \b \b to indicate an exact match is required for the senior name. e.g.

pattern = paste("\b",str_taxa[match(single_position_taxa[i], str_taxa[, "junior"]), "senior"],"\b",sep="")

This prevents the wrong tip being replaced