diff --git a/DESCRIPTION b/DESCRIPTION index ee7860ad..99727499 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.5.0.9022 +Version: 1.5.0.9023 Date: 2021-02-21 Title: Antimicrobial Resistance Data Analysis Authors@R: c( diff --git a/NEWS.md b/NEWS.md index 1e70ba86..063832d2 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.5.0.9022 +# AMR 1.5.0.9023 ## Last updated: 21 February 2021 ### New diff --git a/R/globals.R b/R/globals.R index b47f70d5..557a7a69 100755 --- a/R/globals.R +++ b/R/globals.R @@ -26,6 +26,7 @@ globalVariables(c(".rowid", "ab", "ab_txt", + "affect_mo_name", "angle", "antibiotic", "antibiotics", diff --git a/R/mo.R b/R/mo.R index 6dadfff8..2187c776 100755 --- a/R/mo.R +++ b/R/mo.R @@ -766,21 +766,24 @@ exec_as.mo <- function(x, # Streptococci, like GBS = Group B Streptococci (B_STRPT_GRPB) x[i] <- lookup(mo == toupper(gsub("g([abcdfghk])s", "B_STRPT_GRP\\1", - x_backup_without_spp[i])), uncertainty = -1) + x_backup_without_spp[i], + perl = TRUE)), uncertainty = -1) next } if (x_backup_without_spp[i] %like_case% "(streptococ|streptokok).* [abcdfghk]$") { # Streptococci in different languages, like "estreptococos grupo B" x[i] <- lookup(mo == toupper(gsub(".*(streptococ|streptokok|estreptococ).* ([abcdfghk])$", "B_STRPT_GRP\\2", - x_backup_without_spp[i])), uncertainty = -1) + x_backup_without_spp[i], + perl = TRUE)), uncertainty = -1) next } if (x_backup_without_spp[i] %like_case% "group [abcdfghk] (streptococ|streptokok|estreptococ)") { # Streptococci in different languages, like "Group A Streptococci" x[i] <- lookup(mo == toupper(gsub(".*group ([abcdfghk]) (streptococ|streptokok|estreptococ).*", "B_STRPT_GRP\\1", - x_backup_without_spp[i])), uncertainty = -1) + x_backup_without_spp[i], + perl = TRUE)), uncertainty = -1) next } if (x_backup_without_spp[i] %like_case% "haemoly.*strep") { @@ -843,7 +846,7 @@ exec_as.mo <- function(x, # Salmonella Group A to Z, just return S. species for now x[i] <- lookup(genus == "Salmonella", uncertainty = -1) next - } else if (grepl("[sS]almonella [A-Z][a-z]+ ?.*", x_backup[i], ignore.case = FALSE) & + } else if (x_backup[i] %like_case% "[sS]almonella [A-Z][a-z]+ ?.*" & !x_backup[i] %like% "t[iy](ph|f)[iy]") { # Salmonella with capital letter species like "Salmonella Goettingen" - they're all S. enterica # except for S. typhi, S. paratyphi, S. typhimurium @@ -1108,7 +1111,7 @@ exec_as.mo <- function(x, cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (3) look for genus only, part of name\n")) } if (nchar(g.x_backup_without_spp) > 4 & !b.x_trimmed %like_case% " ") { - if (!grepl("^[A-Z][a-z]+", b.x_trimmed, ignore.case = FALSE)) { + if (!b.x_trimmed %like_case% "^[A-Z][a-z]+") { if (isTRUE(debug)) { message("Running '", paste(b.x_trimmed, "species"), "'") } @@ -1852,7 +1855,7 @@ print.mo_uncertainties <- function(x, ...) { width = 0.98 * getOption("width")), collapse = "") # after strwrap, make taxonomic names italic - candidates <- gsub("([A-Za-z]+)", font_italic("\\1"), candidates) + candidates <- gsub("([A-Za-z]+)", font_italic("\\1"), candidates, perl = TRUE) candidates <- gsub(paste(font_italic(c("Also", "matched"), collapse = NULL), collapse = " "), "Also matched", candidates, fixed = TRUE) diff --git a/R/mo_property.R b/R/mo_property.R index e506e8eb..c6133f5b 100755 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -723,12 +723,6 @@ mo_validate <- function(x, property, language, ...) { x <- exec_as.mo(x, property = property, initial_search = FALSE, language = language, ...) } else if (!all(x %in% MO_lookup[, property, drop = TRUE]) | has_Becker_or_Lancefield) { - accepted_args <- names(as.list(args("as.mo"))) - accepted_args <- accepted_args[!accepted_args %in% c("", "...", "x", "property")] - stop_if(!all(names(dots) %in% names(as.list(args("as.mo")))), - "invalid argument(s): ", vector_and(names(dots)[!names(dots) %in% names(as.list(args("as.mo")))], quotes = "'"), - ".\nAccepted arguments are ", vector_and(accepted_args, quotes = "'"), ".", - call = FALSE) x <- exec_as.mo(x, property = property, language = language, ...) } diff --git a/data-raw/AMR_latest.tar.gz b/data-raw/AMR_latest.tar.gz index 1fe5637c..58c5a1f4 100644 Binary files a/data-raw/AMR_latest.tar.gz and b/data-raw/AMR_latest.tar.gz differ diff --git a/docs/404.html b/docs/404.html index 406e4f83..0614e287 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@
diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index df38b9f5..ea526df4 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ diff --git a/docs/articles/benchmarks.html b/docs/articles/benchmarks.html index 215fa0a6..fbfbfb39 100644 --- a/docs/articles/benchmarks.html +++ b/docs/articles/benchmarks.html @@ -39,7 +39,7 @@ @@ -192,7 +192,6 @@vignettes/benchmarks.Rmd
benchmarks.Rmd
In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 100 milliseconds, this is only 10 input values per second. It is clear that accepted taxonomic names are extremely fast, but some variations can take up to 500-1000 times as much time.
To improve performance, two important calculations take almost no time at all: repetitive results and already precalculated results.
@@ -291,8 +270,8 @@ print(run_it, unit = "ms", signif = 3) # Unit: milliseconds # expr min lq mean median uq max neval -# mo_name(x) 125 144 182 171 186 298 10 -So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.171 seconds. You only lose time on your unique input values.
+# mo_name(x) 137 146 178 172 193 282 10 +So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.172 seconds. You only lose time on your unique input values.
So going from mo_name("Staphylococcus aureus")
to "Staphylococcus aureus"
takes 0.0017 seconds - it doesn’t even start calculating if the result would be the same as the expected resulting value. That goes for all helper functions:
So going from mo_name("Staphylococcus aureus")
to "Staphylococcus aureus"
takes 0.0019 seconds - it doesn’t even start calculating if the result would be the same as the expected resulting value. That goes for all helper functions:
run_it <- microbenchmark(A = mo_species("aureus"),
B = mo_genus("Staphylococcus"),
@@ -322,15 +301,15 @@
times = 10)
print(run_it, unit = "ms", signif = 3)
# Unit: milliseconds
-# expr min lq mean median uq max neval
-# A 1.63 1.92 1.99 2.01 2.11 2.29 10
-# B 1.67 1.89 2.01 1.96 2.12 2.62 10
-# C 1.86 1.87 1.96 1.97 2.04 2.13 10
-# D 1.63 1.82 1.90 1.94 2.00 2.06 10
-# E 1.60 1.94 3.05 1.97 2.24 12.60 10
-# F 1.66 1.90 2.18 1.95 2.01 4.33 10
-# G 1.84 1.89 1.99 1.98 2.02 2.24 10
-# H 1.79 1.95 2.08 2.06 2.25 2.36 10
Of course, when running mo_phylum("Firmicutes")
the function has zero knowledge about the actual microorganism, namely S. aureus. But since the result would be "Firmicutes"
anyway, there is no point in calculating the result. And because this package ‘knows’ all phyla of all known bacteria (according to the Catalogue of Life), it can just return the initial value immediately.
Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.
diff --git a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png index 16afa08a..c643f012 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/articles/index.html b/docs/articles/index.html index 7db7b25e..ec8d95b2 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ diff --git a/docs/authors.html b/docs/authors.html index 404d5bf5..29ad2cfc 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ diff --git a/docs/index.html b/docs/index.html index c66e627b..d631d734 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ diff --git a/docs/news/index.html b/docs/news/index.html index 106b13c4..5388f298 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ @@ -236,9 +236,9 @@ Source:NEWS.md
-