1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 11:11:54 +02:00

(v1.3.0.9015) as.mo() speedup for valid taxonomic names

This commit is contained in:
2020-09-03 20:59:21 +02:00
parent c4b87fe241
commit 68e9cb78e9
104 changed files with 542 additions and 529 deletions

View File

@ -40,6 +40,7 @@ globalVariables(c(".rowid",
"intrinsic_resistant",
"isolates",
"lang",
"language",
"lookup",
"microorganism",
"microorganisms",

7
R/mo.R
View File

@ -178,6 +178,13 @@ as.mo <- function(x,
...) {
check_dataset_integrity()
if (tryCatch(all(tolower(x) %in% MO_lookup$fullname_lower, na.rm = TRUE)
& isFALSE(Becker)
& isFALSE(Lancefield), error = function(e) FALSE)) {
# to improve speed, special case for taxonomically correct full names (case-insensitive)
return(MO_lookup[match(tolower(x), MO_lookup$fullname_lower), "mo", drop = TRUE])
}
# start off with replaced language-specific non-ASCII characters with ASCII characters
x <- parse_and_convert(x)

View File

@ -29,7 +29,7 @@
envir = asNamespace("AMR"))
assign(x = "LANGUAGES_SUPPORTED",
value = sort(c("en", unique(AMR:::translations_file$lang))),
value = sort(c("en", unique(translations_file$lang))),
envir = asNamespace("AMR"))
# support for tibble headers (type_sum) and tibble columns content (pillar_shaft)
@ -50,13 +50,13 @@
}
.onAttach <- function(...) {
if (!interactive() || stats::runif(1) > 0.1 || isTRUE(as.logical(Sys.getenv("AMR_silentstart", FALSE)))) {
if (!interactive() || stats::runif(1) > 0.1 || isTRUE(as.logical(getOption("AMR_silentstart", FALSE)))) {
return()
}
packageStartupMessage("Thank you for using the AMR package! ",
"If you have a minute, please anonymously fill in this short questionnaire to improve the package and its functionalities:",
"\nhttps://msberends.github.io/AMR/survey.html",
"\n[ prevent his notice with suppressPackageStartupMessages(library(AMR)) or use Sys.setenv(AMR_silentstart = TRUE) ]")
"\n[ prevent his notice with suppressPackageStartupMessages(library(AMR)) or use options(AMR_silentstart = TRUE) ]")
}
create_MO_lookup <- function() {