Skip to content

Commit

Permalink
Message updates (#201)
Browse files Browse the repository at this point in the history
Add message that indicates how many taxa have perfect matches to APC.
  • Loading branch information
ehwenk authored Apr 28, 2024
1 parent e4da0ba commit c272c2d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions R/align_taxa.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ align_taxa <- function(original_name,
# move all checked taxa to "checked"
taxa <- redistribute(taxa)

# messages if there is an saved list being added to
if (!is.null(output) && file.exists(output) && !all(taxa$tocheck$checked)) {
# check unknown taxa
message(
Expand All @@ -180,6 +181,23 @@ align_taxa <- function(original_name,
" taxa yet to be checked"
)
}

# otherwise if there are taxa that require checking add
# simple message that indicates number of perfect matches.
if (!all(taxa$tocheck$checked)) {

perfect_matches <- taxa$tocheck %>%
filter(original_name %in% resources$`APC list (accepted)`$canonical_name) %>%
distinct() %>%
nrow()

message(
" -> of these ",
crayon::blue(perfect_matches),
" names have a perfect match to a scientific name in the APC. Alignments being sought for remaining names."
)
}

# do the actual matching
taxa <-
match_taxa(taxa, resources, fuzzy_abs_dist, fuzzy_rel_dist, fuzzy_matches, imprecise_fuzzy_matches, APNI_matches, identifier) %>%
Expand Down

0 comments on commit c272c2d

Please sign in to comment.