Skip to content

Commit

Permalink
Update update_taxonomy.R
Browse files Browse the repository at this point in the history
requested changes made

(before this tests passing - but didn't wait for final one)
  • Loading branch information
ehwenk committed Jan 22, 2024
1 parent 55818ed commit f314b57
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions R/update_taxonomy.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ update_taxonomy <- function(aligned_data,
dplyr::bind_rows(taxa_blank) %>%
dplyr::mutate(
suggested_name = ifelse(is.na(suggested_name), aligned_name, suggested_name),
#suggested_name = ifelse(is.na(suggested_name), original_name, suggested_name), #should be removed
update_reason = ifelse(taxonomic_status_aligned == "accepted", "aligned name accepted by APC", update_reason),
taxonomic_status = ifelse(is.na(taxonomic_status), "unknown", taxonomic_status),
taxonomic_dataset = ifelse(stringr::str_detect(taxonomic_dataset, "APC"), "APC", taxonomic_dataset),
Expand Down Expand Up @@ -276,8 +275,8 @@ update_taxonomy_APC_genus <- function(data, resources) {
taxon_ID_genus = resources$genera_all$taxon_ID[match(accepted_name_usage_ID, resources$genera_all$accepted_name_usage_ID)],
# genus names in `aligned_name` that are not APC-accepted need to be updated to their current name in `suggested_name`
aligned_minus_genus = ifelse(is.na(genus_accepted), NA, stringr::str_replace(aligned_name, extract_genus(aligned_name), "")),
suggested_name = ifelse(taxonomic_status == "genus accepted", paste0(genus_accepted, aligned_minus_genus), NA),
suggested_name = ifelse(taxonomic_status != "genus accepted", aligned_name, suggested_name),
# if there is an APC-accepted genus, replace whatever the initial genus was with the accepted genus, otherwise the suggested name is the aligned name
suggested_name = ifelse(taxonomic_status == "genus accepted", paste0(genus_accepted, aligned_minus_genus), aligned_name),
# indicate taxonomic_status of the genus name in `aligned_name` and why it needed to be updated for the `suggested_name`
genus_update_reason = as.character(my_order),
genus = genus_accepted,
Expand Down

0 comments on commit f314b57

Please sign in to comment.