mirror of
https://github.com/msberends/AMR.git
synced 2024-12-25 06:46:11 +01:00
(v1.4.0.9030) as.mo() fix for known lab codes
This commit is contained in:
parent
4c114ff4b4
commit
e03b3c96d3
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 1.4.0.9029
|
||||
Date: 2020-12-01
|
||||
Version: 1.4.0.9030
|
||||
Date: 2020-12-03
|
||||
Title: Antimicrobial Resistance Analysis
|
||||
Authors@R: c(
|
||||
person(role = c("aut", "cre"),
|
||||
|
6
NEWS.md
6
NEWS.md
@ -1,5 +1,5 @@
|
||||
# AMR 1.4.0.9029
|
||||
## <small>Last updated: 1 December 2020</small>
|
||||
# AMR 1.4.0.9030
|
||||
## <small>Last updated: 3 December 2020</small>
|
||||
|
||||
### New
|
||||
* Function `is_new_episode()` to determine patient episodes which are not necessarily based on microorganisms. It also supports grouped variables with e.g. `mutate()`, `filter()` and `summarise()` of the `dplyr` package:
|
||||
@ -30,6 +30,8 @@
|
||||
* Fix for using parameter `reference_df` in `as.mo()` and `mo_*()` functions that contain old microbial codes (from previous package versions)
|
||||
* Fix for using `as.rsi()` on a data.frame in older R versions
|
||||
* `as.rsi()` on a data.frame will not print a message anymore if the values are already clean R/SI values
|
||||
* Fixed a bug where `mo_uncertainties()` would not return the results based on the MO matching score
|
||||
* Fixed a bug where `as.mo()` would not return results for known laboratory codes for microorganisms
|
||||
|
||||
### Other
|
||||
* All messages and warnings thrown by this package now break sentences on whole words
|
||||
|
@ -146,7 +146,7 @@ search_type_in_df <- function(x, type, info = TRUE) {
|
||||
# WHONET support
|
||||
found <- sort(colnames(x)[colnames(x) %like% "^(specimen date|specimen_date|spec_date)"])[1]
|
||||
if (!any(class(pm_pull(x, found)) %in% c("Date", "POSIXct"))) {
|
||||
stop(font_red(paste0("ERROR: Found column `", font_bold(found), "` to be used as input for `col_", type,
|
||||
stop(font_red(paste0("Found column '", font_bold(found), "' to be used as input for `col_", type,
|
||||
"`, but this column contains no valid dates. Transform its values to valid dates first.")),
|
||||
call. = FALSE)
|
||||
}
|
||||
@ -178,7 +178,7 @@ search_type_in_df <- function(x, type, info = TRUE) {
|
||||
if (!is.null(found)) {
|
||||
# this column should contain logicals
|
||||
if (!is.logical(x[, found, drop = TRUE])) {
|
||||
message_("Column `", font_bold(found), "` found as input for `col_", type,
|
||||
message_("Column '", font_bold(found), "' found as input for `col_", type,
|
||||
"`, but this column does not contain 'logical' values (TRUE/FALSE) and was ignored.",
|
||||
add_fn = font_red)
|
||||
found <- NULL
|
||||
@ -187,7 +187,7 @@ search_type_in_df <- function(x, type, info = TRUE) {
|
||||
}
|
||||
|
||||
if (!is.null(found) & info == TRUE) {
|
||||
msg <- paste0("Using column `", font_bold(found), "` as input for `col_", type, "`.")
|
||||
msg <- paste0("Using column '", found, "' as input for `col_", type, "`.")
|
||||
if (type %in% c("keyantibiotics", "specimen")) {
|
||||
msg <- paste(msg, "Use", font_bold(paste0("col_", type), "= FALSE"), "to prevent this.")
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ eucast_rules <- function(x,
|
||||
if (ab_missing(AMP) & !ab_missing(AMX)) {
|
||||
# ampicillin column is missing, but amoxicillin is available
|
||||
if (info == TRUE) {
|
||||
message_("Using column `", font_bold(AMX), "` as input for ampicillin since many EUCAST rules depend on it.")
|
||||
message_("Using column '", font_bold(AMX), "' as input for ampicillin since many EUCAST rules depend on it.")
|
||||
}
|
||||
AMP <- AMX
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ first_isolate <- function(x,
|
||||
# WHONET support
|
||||
x$patient_id <- paste(x$`First name`, x$`Last name`, x$Sex)
|
||||
col_patient_id <- "patient_id"
|
||||
message_("Using combined columns `", font_bold("First name"), "`, `", font_bold("Last name"), "` and `", font_bold("Sex"), "` as input for `col_patient_id`")
|
||||
message_("Using combined columns '", font_bold("First name"), "', '", font_bold("Last name"), "' and '", font_bold("Sex"), "' as input for `col_patient_id`")
|
||||
} else {
|
||||
col_patient_id <- search_type_in_df(x = x, type = "patient_id")
|
||||
}
|
||||
|
@ -44,7 +44,7 @@
|
||||
#' # [1] "tetr"
|
||||
#'
|
||||
#' guess_ab_col(df, "J01AA07", verbose = TRUE)
|
||||
#' # NOTE: Using column `tetr` as input for `J01AA07` (tetracycline).
|
||||
#' # NOTE: Using column 'tetr' as input for J01AA07 (tetracycline).
|
||||
#' # [1] "tetr"
|
||||
#'
|
||||
#' # WHONET codes
|
||||
@ -94,16 +94,16 @@ guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE) {
|
||||
|
||||
if (length(ab_result) == 0) {
|
||||
if (verbose == TRUE) {
|
||||
message_("No column found as input for `", search_string,
|
||||
"` (", ab_name(search_string, language = NULL, tolower = TRUE), ").",
|
||||
message_("No column found as input for ", search_string,
|
||||
" (", ab_name(search_string, language = NULL, tolower = TRUE), ").",
|
||||
add_fn = font_black,
|
||||
as_note = FALSE)
|
||||
}
|
||||
return(NULL)
|
||||
} else {
|
||||
if (verbose == TRUE) {
|
||||
message_("Using column `", font_bold(ab_result), "` as input for `", search_string,
|
||||
"` (", ab_name(search_string, language = NULL, tolower = TRUE), ").")
|
||||
message_("Using column '", font_bold(ab_result), "' as input for ", search_string,
|
||||
" (", ab_name(search_string, language = NULL, tolower = TRUE), ").")
|
||||
}
|
||||
return(ab_result)
|
||||
}
|
||||
@ -204,12 +204,12 @@ get_column_abx <- function(x,
|
||||
|
||||
for (i in seq_len(length(x))) {
|
||||
if (info == TRUE & verbose == TRUE & !names(x[i]) %in% names(duplicates)) {
|
||||
message_("Using column `", font_bold(x[i]), "` as input for `", names(x)[i],
|
||||
"` (", ab_name(names(x)[i], tolower = TRUE, language = NULL), ").")
|
||||
message_("Using column '", font_bold(x[i]), "' as input for ", names(x)[i],
|
||||
" (", ab_name(names(x)[i], tolower = TRUE, language = NULL), ").")
|
||||
}
|
||||
if (info == TRUE & names(x[i]) %in% names(duplicates)) {
|
||||
warning_(paste0("Using column `", font_bold(x[i]), "` as input for `", names(x)[i],
|
||||
"` (", ab_name(names(x)[i], tolower = TRUE, language = NULL),
|
||||
warning_(paste0("Using column '", font_bold(x[i]), "' as input for ", names(x)[i],
|
||||
" (", ab_name(names(x)[i], tolower = TRUE, language = NULL),
|
||||
"), although it was matched for multiple antibiotics or columns."),
|
||||
add_fn = font_red,
|
||||
call = FALSE,
|
||||
|
58
R/mo.R
58
R/mo.R
@ -636,9 +636,7 @@ exec_as.mo <- function(x,
|
||||
}
|
||||
|
||||
# WHONET and other common LIS codes ----
|
||||
found <- lookup(code %in% toupper(c(x_backup_untouched[i], x_backup[i], x_backup_without_spp[i])),
|
||||
column = "mo",
|
||||
haystack = microorganisms.codes)
|
||||
found <- microorganisms.codes[which(microorganisms.codes$code %in% toupper(c(x_backup_untouched[i], x_backup[i], x_backup_without_spp[i]))), "mo", drop = TRUE][1L]
|
||||
if (!is.na(found)) {
|
||||
x[i] <- lookup(mo == found)
|
||||
next
|
||||
@ -893,10 +891,12 @@ exec_as.mo <- function(x,
|
||||
}
|
||||
|
||||
# try any match keeping spaces ----
|
||||
found <- lookup(fullname_lower %like_case% d.x_withspaces_start_end,
|
||||
haystack = data_to_check)
|
||||
if (!is.na(found) & nchar(g.x_backup_without_spp) >= 6) {
|
||||
return(found[1L])
|
||||
if (nchar(g.x_backup_without_spp) >= 6) {
|
||||
found <- lookup(fullname_lower %like_case% d.x_withspaces_start_end,
|
||||
haystack = data_to_check)
|
||||
if (!is.na(found)) {
|
||||
return(found[1L])
|
||||
}
|
||||
}
|
||||
|
||||
# try any match keeping spaces, not ending with $ ----
|
||||
@ -905,10 +905,12 @@ exec_as.mo <- function(x,
|
||||
if (!is.na(found)) {
|
||||
return(found[1L])
|
||||
}
|
||||
found <- lookup(fullname_lower %like_case% e.x_withspaces_start_only,
|
||||
haystack = data_to_check)
|
||||
if (!is.na(found) & nchar(g.x_backup_without_spp) >= 6) {
|
||||
return(found[1L])
|
||||
if (nchar(g.x_backup_without_spp) >= 6) {
|
||||
found <- lookup(fullname_lower %like_case% e.x_withspaces_start_only,
|
||||
haystack = data_to_check)
|
||||
if (!is.na(found)) {
|
||||
return(found[1L])
|
||||
}
|
||||
}
|
||||
|
||||
# try any match keeping spaces, not start with ^ ----
|
||||
@ -919,14 +921,16 @@ exec_as.mo <- function(x,
|
||||
}
|
||||
|
||||
# try a trimmed version
|
||||
found <- lookup(fullname_lower %like_case% b.x_trimmed |
|
||||
fullname_lower %like_case% c.x_trimmed_without_group,
|
||||
haystack = data_to_check)
|
||||
if (!is.na(found) & nchar(g.x_backup_without_spp) >= 6) {
|
||||
return(found[1L])
|
||||
if (nchar(g.x_backup_without_spp) >= 6) {
|
||||
found <- lookup(fullname_lower %like_case% b.x_trimmed |
|
||||
fullname_lower %like_case% c.x_trimmed_without_group,
|
||||
haystack = data_to_check)
|
||||
if (!is.na(found)) {
|
||||
return(found[1L])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# try splitting of characters in the middle and then find ID ----
|
||||
# only when text length is 6 or lower
|
||||
# like esco = E. coli, klpn = K. pneumoniae, stau = S. aureus, staaur = S. aureus
|
||||
@ -1313,14 +1317,16 @@ exec_as.mo <- function(x,
|
||||
if (isTRUE(debug)) {
|
||||
message("Running '", f.x_withspaces_end_only, "'")
|
||||
}
|
||||
found <- lookup(fullname_lower %like_case% f.x_withspaces_end_only, column = "mo")
|
||||
if (!is.na(found) & nchar(g.x_backup_without_spp) >= 6) {
|
||||
found_result <- lookup(mo == found)
|
||||
uncertainties <<- rbind(uncertainties,
|
||||
attr(found, which = "uncertainties", exact = TRUE),
|
||||
stringsAsFactors = FALSE)
|
||||
found <- lookup(mo == found)
|
||||
return(found)
|
||||
if (nchar(g.x_backup_without_spp) >= 6) {
|
||||
found <- lookup(fullname_lower %like_case% f.x_withspaces_end_only, column = "mo")
|
||||
if (!is.na(found)) {
|
||||
found_result <- lookup(mo == found)
|
||||
uncertainties <<- rbind(uncertainties,
|
||||
attr(found, which = "uncertainties", exact = TRUE),
|
||||
stringsAsFactors = FALSE)
|
||||
found <- lookup(mo == found)
|
||||
return(found)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -383,9 +383,10 @@ mo_is_intrinsic_resistant <- function(x, ab, language = get_locale(), ...) {
|
||||
ab <- rep(ab, length(x))
|
||||
}
|
||||
if (length(x) != length(ab)) {
|
||||
stop_("length of 'x' and 'ab' must be equal, or one of them must be of length 1.")
|
||||
stop_("length of `x` and `ab` must be equal, or one of them must be of length 1.")
|
||||
}
|
||||
|
||||
# this saves about 50% in calculation time
|
||||
intrinsic_to_check <- intrinsic_resistant[which(intrinsic_resistant$microorganism %in% x |
|
||||
intrinsic_resistant$antibiotic %in% ab), , drop = FALSE]
|
||||
paste(x, ab) %in% paste(intrinsic_to_check$microorganism, intrinsic_to_check$antibiotic)
|
||||
@ -618,12 +619,12 @@ find_mo_col <- function(fn) {
|
||||
mo <- suppressMessages(search_type_in_df(df, "mo"))
|
||||
}, silent = TRUE)
|
||||
if (!is.null(df) && !is.null(mo) && is.data.frame(df)) {
|
||||
message_("Using column `", font_bold(mo), "` as input for ", fn, "()")
|
||||
message_("Using column '", font_bold(mo), "' as input for ", fn, "()")
|
||||
return(df[, mo, drop = TRUE])
|
||||
} else {
|
||||
stop_("Argument 'x' is missing and no column with info about microorganisms could be found.", call = -2)
|
||||
stop_("Argument `x` is missing and no column with info about microorganisms could be found.", call = -2)
|
||||
}
|
||||
} else {
|
||||
stop_("Argument 'x' is missing.", call = -2)
|
||||
stop_("Argument `x` is missing.", call = -2)
|
||||
}
|
||||
}
|
||||
|
4
R/rsi.R
4
R/rsi.R
@ -1087,11 +1087,11 @@ check_reference_data <- function(reference_data) {
|
||||
class_rsi <- sapply(rsi_translation, function(x) paste0("<", class(x), ">", collapse = " and "))
|
||||
class_ref <- sapply(reference_data, function(x) paste0("<", class(x), ">", collapse = " and "))
|
||||
if (!all(names(class_rsi) == names(class_ref))) {
|
||||
stop_("'reference_data' must have the same column names as the 'rsi_translation' data set.", call = -2)
|
||||
stop_("`reference_data` must have the same column names as the 'rsi_translation' data set.", call = -2)
|
||||
}
|
||||
if (!all(class_rsi == class_ref)) {
|
||||
class_rsi[class_rsi != class_ref][1]
|
||||
stop_("'reference_data' must be the same structure as the 'rsi_translation' data set. Column '", names(class_ref[class_rsi != class_ref][1]), "' is of class ", class_ref[class_rsi != class_ref][1], ", but should be of class ", class_rsi[class_rsi != class_ref][1], ".", call = -2)
|
||||
stop_("`reference_data` must be the same structure as the 'rsi_translation' data set. Column '", names(class_ref[class_rsi != class_ref][1]), "' is of class ", class_ref[class_rsi != class_ref][1], ", but should be of class ", class_rsi[class_rsi != class_ref][1], ".", call = -2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -187,8 +187,7 @@
|
||||
|
||||
|
||||
|
||||
</header><script src="benchmarks_files/accessible-code-block-0.0.1/empty-anchor.js"></script><link href="benchmarks_files/anchor-sections-1.0/anchor-sections.css" rel="stylesheet">
|
||||
<script src="benchmarks_files/anchor-sections-1.0/anchor-sections.js"></script><div class="row">
|
||||
</header><script src="benchmarks_files/header-attrs-2.4/header-attrs.js"></script><script src="benchmarks_files/accessible-code-block-0.0.1/empty-anchor.js"></script><div class="row">
|
||||
<div class="col-md-9 contents">
|
||||
<div class="page-header toc-ignore">
|
||||
<h1 data-toc-skip>Benchmarks</h1>
|
||||
@ -228,20 +227,20 @@
|
||||
times <span class="op">=</span> <span class="fl">10</span><span class="op">)</span>
|
||||
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><span class="op">(</span><span class="va">S.aureus</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">2</span><span class="op">)</span>
|
||||
<span class="co"># Unit: milliseconds</span>
|
||||
<span class="co"># expr min lq mean median uq max</span>
|
||||
<span class="co"># as.mo("sau") 26.0 26.0 50.0 26.0 26.0 180</span>
|
||||
<span class="co"># as.mo("stau") 430.0 430.0 470.0 440.0 490.0 630</span>
|
||||
<span class="co"># as.mo("STAU") 430.0 440.0 470.0 500.0 500.0 500</span>
|
||||
<span class="co"># as.mo("staaur") 26.0 26.0 32.0 26.0 26.0 76</span>
|
||||
<span class="co"># as.mo("STAAUR") 26.0 26.0 44.0 26.0 81.0 83</span>
|
||||
<span class="co"># as.mo("S. aureus") 60.0 60.0 77.0 61.0 110.0 120</span>
|
||||
<span class="co"># as.mo("S aureus") 60.0 61.0 94.0 110.0 120.0 120</span>
|
||||
<span class="co"># as.mo("Staphylococcus aureus") 4.1 4.1 9.6 4.1 4.2 59</span>
|
||||
<span class="co"># as.mo("Staphylococcus aureus (MRSA)") 2200.0 2200.0 2200.0 2200.0 2300.0 2300</span>
|
||||
<span class="co"># as.mo("Sthafilokkockus aaureuz") 760.0 800.0 810.0 800.0 810.0 840</span>
|
||||
<span class="co"># as.mo("MRSA") 26.0 26.0 37.0 26.0 26.0 83</span>
|
||||
<span class="co"># as.mo("VISA") 42.0 42.0 59.0 42.0 92.0 97</span>
|
||||
<span class="co"># as.mo("VRSA") 42.0 42.0 68.0 67.0 92.0 97</span>
|
||||
<span class="co"># expr min lq mean median uq max</span>
|
||||
<span class="co"># as.mo("sau") 11.0 12 16.0 14.0 15.0 40.0</span>
|
||||
<span class="co"># as.mo("stau") 110.0 120 140.0 140.0 150.0 160.0</span>
|
||||
<span class="co"># as.mo("STAU") 110.0 120 140.0 140.0 140.0 150.0</span>
|
||||
<span class="co"># as.mo("staaur") 12.0 13 20.0 15.0 16.0 45.0</span>
|
||||
<span class="co"># as.mo("STAAUR") 15.0 15 26.0 16.0 41.0 58.0</span>
|
||||
<span class="co"># as.mo("S. aureus") 31.0 35 50.0 59.0 62.0 65.0</span>
|
||||
<span class="co"># as.mo("S aureus") 27.0 33 59.0 59.0 62.0 160.0</span>
|
||||
<span class="co"># as.mo("Staphylococcus aureus") 1.9 2 2.4 2.4 2.7 2.9</span>
|
||||
<span class="co"># as.mo("Staphylococcus aureus (MRSA)") 910.0 960 980.0 970.0 1000.0 1100.0</span>
|
||||
<span class="co"># as.mo("Sthafilokkockus aaureuz") 400.0 410 430.0 420.0 440.0 560.0</span>
|
||||
<span class="co"># as.mo("MRSA") 12.0 13 19.0 15.0 15.0 42.0</span>
|
||||
<span class="co"># as.mo("VISA") 20.0 22 31.0 24.0 47.0 54.0</span>
|
||||
<span class="co"># as.mo("VRSA") 22.0 23 35.0 24.0 52.0 56.0</span>
|
||||
<span class="co"># neval</span>
|
||||
<span class="co"># 10</span>
|
||||
<span class="co"># 10</span>
|
||||
@ -285,8 +284,8 @@
|
||||
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
||||
<span class="co"># Unit: milliseconds</span>
|
||||
<span class="co"># expr min lq mean median uq max neval</span>
|
||||
<span class="co"># mo_name(x) 308 326 399 331 370 676 10</span></pre></div>
|
||||
<p>So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.331 seconds. You only lose time on your unique input values.</p>
|
||||
<span class="co"># mo_name(x) 165 176 223 202 274 318 10</span></pre></div>
|
||||
<p>So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.202 seconds. You only lose time on your unique input values.</p>
|
||||
</div>
|
||||
<div id="precalculated-results" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
@ -299,11 +298,11 @@
|
||||
times <span class="op">=</span> <span class="fl">10</span><span class="op">)</span>
|
||||
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
||||
<span class="co"># Unit: milliseconds</span>
|
||||
<span class="co"># expr min lq mean median uq max neval</span>
|
||||
<span class="co"># A 16.20 16.20 18.60 17.90 18.90 28.00 10</span>
|
||||
<span class="co"># B 50.90 51.10 57.70 51.20 53.10 108.00 10</span>
|
||||
<span class="co"># C 3.58 3.72 4.03 4.06 4.14 4.91 10</span></pre></div>
|
||||
<p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0041 seconds - it doesn’t even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
|
||||
<span class="co"># expr min lq mean median uq max neval</span>
|
||||
<span class="co"># A 7.83 8.05 9.56 9.43 10.90 12.90 10</span>
|
||||
<span class="co"># B 23.50 24.40 30.20 25.50 26.80 74.50 10</span>
|
||||
<span class="co"># C 2.00 2.19 2.42 2.41 2.56 3.06 10</span></pre></div>
|
||||
<p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0024 seconds - it doesn’t even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="downlit">
|
||||
<span class="va">run_it</span> <span class="op"><-</span> <span class="fu">microbenchmark</span><span class="op">(</span>A <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_species</a></span><span class="op">(</span><span class="st">"aureus"</span><span class="op">)</span>,
|
||||
B <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="st">"Staphylococcus"</span><span class="op">)</span>,
|
||||
@ -317,14 +316,14 @@
|
||||
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
||||
<span class="co"># Unit: milliseconds</span>
|
||||
<span class="co"># expr min lq mean median uq max neval</span>
|
||||
<span class="co"># A 3.62 3.62 3.66 3.64 3.67 3.80 10</span>
|
||||
<span class="co"># B 3.57 3.59 3.68 3.64 3.72 4.01 10</span>
|
||||
<span class="co"># C 3.63 3.64 3.65 3.64 3.67 3.71 10</span>
|
||||
<span class="co"># D 3.57 3.58 3.62 3.61 3.67 3.69 10</span>
|
||||
<span class="co"># E 3.56 3.57 3.60 3.59 3.60 3.68 10</span>
|
||||
<span class="co"># F 3.55 3.58 3.73 3.65 3.85 4.01 10</span>
|
||||
<span class="co"># G 3.54 3.56 3.62 3.58 3.61 3.93 10</span>
|
||||
<span class="co"># H 3.53 3.57 3.59 3.58 3.63 3.66 10</span></pre></div>
|
||||
<span class="co"># A 1.69 1.75 1.90 1.86 2.00 2.25 10</span>
|
||||
<span class="co"># B 1.69 1.72 1.86 1.79 1.87 2.43 10</span>
|
||||
<span class="co"># C 1.67 1.75 1.89 1.81 1.93 2.67 10</span>
|
||||
<span class="co"># D 1.64 1.73 1.87 1.87 1.94 2.23 10</span>
|
||||
<span class="co"># E 1.65 1.75 1.90 1.83 1.92 2.35 10</span>
|
||||
<span class="co"># F 1.70 1.75 1.87 1.85 1.93 2.20 10</span>
|
||||
<span class="co"># G 1.73 1.83 1.93 1.93 2.01 2.25 10</span>
|
||||
<span class="co"># H 1.65 1.73 1.85 1.77 2.06 2.11 10</span></pre></div>
|
||||
<p>Of course, when running <code><a href="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> 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.</p>
|
||||
</div>
|
||||
<div id="results-in-other-languages" class="section level3">
|
||||
@ -351,14 +350,14 @@
|
||||
times <span class="op">=</span> <span class="fl">100</span><span class="op">)</span>
|
||||
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">4</span><span class="op">)</span>
|
||||
<span class="co"># Unit: milliseconds</span>
|
||||
<span class="co"># expr min lq mean median uq max neval</span>
|
||||
<span class="co"># en 35.85 36.13 41.92 36.29 36.84 318.20 100</span>
|
||||
<span class="co"># de 42.37 42.67 45.11 42.91 43.19 95.04 100</span>
|
||||
<span class="co"># nl 70.13 70.65 75.92 70.95 71.50 140.20 100</span>
|
||||
<span class="co"># es 42.16 42.46 46.88 42.64 43.20 95.37 100</span>
|
||||
<span class="co"># it 41.85 42.24 46.84 42.40 42.84 95.92 100</span>
|
||||
<span class="co"># fr 42.13 42.53 48.41 42.71 43.27 95.21 100</span>
|
||||
<span class="co"># pt 42.25 42.47 48.56 42.71 43.12 96.60 100</span></pre></div>
|
||||
<span class="co"># expr min lq mean median uq max neval</span>
|
||||
<span class="co"># en 16.23 16.62 21.00 17.00 18.51 59.06 100</span>
|
||||
<span class="co"># de 19.27 19.96 22.73 20.36 21.08 69.70 100</span>
|
||||
<span class="co"># nl 31.40 32.54 38.76 33.16 35.34 82.43 100</span>
|
||||
<span class="co"># es 19.36 19.75 23.61 20.26 20.88 67.39 100</span>
|
||||
<span class="co"># it 19.24 19.64 21.23 20.00 20.72 62.92 100</span>
|
||||
<span class="co"># fr 19.19 19.82 25.12 20.16 21.49 70.00 100</span>
|
||||
<span class="co"># pt 19.18 19.64 22.44 20.23 21.47 60.56 100</span></pre></div>
|
||||
<p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 69 KiB |
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -236,13 +236,13 @@
|
||||
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||
</div>
|
||||
|
||||
<div id="amr-1409029" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.4.0.9029">
|
||||
<a href="#amr-1409029" class="anchor"></a>AMR 1.4.0.9029<small> Unreleased </small>
|
||||
<div id="amr-1409030" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.4.0.9030">
|
||||
<a href="#amr-1409030" class="anchor"></a>AMR 1.4.0.9030<small> Unreleased </small>
|
||||
</h1>
|
||||
<div id="last-updated-1-december-2020" class="section level2">
|
||||
<div id="last-updated-3-december-2020" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#last-updated-1-december-2020" class="anchor"></a><small>Last updated: 1 December 2020</small>
|
||||
<a href="#last-updated-3-december-2020" class="anchor"></a><small>Last updated: 3 December 2020</small>
|
||||
</h2>
|
||||
<div id="new" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
@ -284,6 +284,8 @@
|
||||
<li>Fix for using <code><a href="../reference/as.rsi.html">as.rsi()</a></code> on a data.frame in older R versions</li>
|
||||
<li>
|
||||
<code><a href="../reference/as.rsi.html">as.rsi()</a></code> on a data.frame will not print a message anymore if the values are already clean R/SI values</li>
|
||||
<li>Fixed a bug where <code><a href="../reference/as.mo.html">mo_uncertainties()</a></code> would not return the results based on the MO matching score</li>
|
||||
<li>Fixed a bug where <code><a href="../reference/as.mo.html">as.mo()</a></code> would not return results for known laboratory codes for microorganisms</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="other" class="section level3">
|
||||
|
@ -12,7 +12,7 @@ articles:
|
||||
datasets: datasets.html
|
||||
resistance_predict: resistance_predict.html
|
||||
welcome_to_AMR: welcome_to_AMR.html
|
||||
last_built: 2020-12-01T15:59Z
|
||||
last_built: 2020-12-03T15:56Z
|
||||
urls:
|
||||
reference: https://msberends.github.io/AMR//reference
|
||||
article: https://msberends.github.io/AMR//articles
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -290,7 +290,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<span class='co'># [1] "tetr"</span>
|
||||
|
||||
<span class='fu'>guess_ab_col</span><span class='op'>(</span><span class='va'>df</span>, <span class='st'>"J01AA07"</span>, verbose <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
|
||||
<span class='co'># NOTE: Using column `tetr` as input for `J01AA07` (tetracycline).</span>
|
||||
<span class='co'># NOTE: Using column 'tetr' as input for J01AA07 (tetracycline).</span>
|
||||
<span class='co'># [1] "tetr"</span>
|
||||
|
||||
<span class='co'># WHONET codes</span>
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9029</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9030</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -45,7 +45,7 @@ guess_ab_col(df, "J01AA07") # ATC code of tetracycline
|
||||
# [1] "tetr"
|
||||
|
||||
guess_ab_col(df, "J01AA07", verbose = TRUE)
|
||||
# NOTE: Using column `tetr` as input for `J01AA07` (tetracycline).
|
||||
# NOTE: Using column 'tetr' as input for J01AA07 (tetracycline).
|
||||
# [1] "tetr"
|
||||
|
||||
# WHONET codes
|
||||
|
@ -40,6 +40,8 @@ test_that("data sets are valid", {
|
||||
expect_true(all(example_isolates$mo %in% microorganisms$mo))
|
||||
expect_true(all(microorganisms.translation$mo_new %in% microorganisms$mo))
|
||||
expect_true(all(rsi_translation$mo %in% microorganisms$mo))
|
||||
expect_true(all(intrinsic_resistant$microorganism %in% microorganisms$fullname)) # also important for mo_is_intrinsic_resistant()
|
||||
expect_true(all(intrinsic_resistant$antibiotic %in% antibiotics$name))
|
||||
expect_false(any(is.na(microorganisms.codes$code)))
|
||||
expect_false(any(is.na(microorganisms.codes$mo)))
|
||||
expect_false(any(microorganisms.translation$mo_old %in% microorganisms$mo))
|
||||
|
Loading…
Reference in New Issue
Block a user