diff --git a/DESCRIPTION b/DESCRIPTION index d4bf4e90..61accc11 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.7.1.9062 -Date: 2021-12-06 +Version: 1.7.1.9063 +Date: 2021-12-09 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by diff --git a/NAMESPACE b/NAMESPACE index 891736ed..1f527a81 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -273,6 +273,7 @@ export(mo_is_gram_positive) export(mo_is_intrinsic_resistant) export(mo_is_yeast) export(mo_kingdom) +export(mo_lpsn) export(mo_matching_score) export(mo_name) export(mo_order) @@ -293,6 +294,7 @@ export(mo_url) export(mo_year) export(mrgn) export(n_rsi) +export(not_intrinsic_resistant) export(oxazolidinones) export(pca) export(penicillins) diff --git a/NEWS.md b/NEWS.md index 1073e04f..3634097c 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# `AMR` 1.7.1.9062 -## Last updated: 6 December 2021 +# `AMR` 1.7.1.9063 +## Last updated: 9 December 2021 ### Breaking changes * Removed `p_symbol()` and all `filter_*()` functions (except for `filter_first_isolate()`), which were all deprecated in a previous package version @@ -8,12 +8,13 @@ ### New * Support for EUCAST Intrinsic Resistance and Unusual Phenotypes v3.3 (October 2021), effective in the `eucast_rules()` function. This is now the default guideline (all other guidelines are still available). +* Support for Danish, and also added missing translations of all antimicrobial drugs in Italian, French and Portuguese * Function `set_ab_names()` to rename data set columns that resemble antimicrobial drugs. This allows for quickly renaming columns to official names, ATC codes, etc. Its second argument can be a tidyverse way of selecting: ```r example_isolates %>% set_ab_names(where(is.rsi)) example_isolates %>% set_ab_names(AMC:GEN, property = "atc") ``` -* Support for Danish, and also added missing translations of all antimicrobial drugs in Italian, French and Portuguese +* Function `mo_lpsn()` to retrieve the [LPSN](https://lpsn.dsmz.de) record ID ### Changed * Updated the bacterial taxonomy to 5 October 2021 (according to [LPSN](https://lpsn.dsmz.de)), including all 11 new staphylococcal species named since 1 January last year @@ -36,7 +37,9 @@ example_isolates[, ab_selector(oral_ddd > 1 & oral_units == "g")] # base R example_isolates %>% select(ab_selector(oral_ddd > 1 & oral_units == "g")) # dplyr ``` + * Added the selector `not_intrinsic_resistant()`, which only keeps antibiotic columns that are not intrinsic resistant for all microorganisms in a data set, based on the latest EUCAST guideline on intrinsic resistance. For example, if a data set contains only microorganism codes or names of *E. coli* and *K. pneumoniae* and contains a column "vancomycin", this column will be removed (or rather, unselected) using this function. * Fix for using selectors multiple times in one call (e.g., using them in `dplyr::filter()` and immediately after in `dplyr::select()`) + * Fix for using having multiple columns that are coerced to the same antibiotic agent * Added argument `only_treatable`, which defaults to `TRUE` and will exclude drugs that are only for laboratory tests and not for treating patients (such as imipenem/EDTA and gentamicin-high) * Fixed the Gram stain (`mo_gramstain()`) determination of the taxonomic class Negativicutes within the phylum of Firmicutes - they were considered Gram-positives because of their phylum but are actually Gram-negative. This impacts 137 taxonomic species, genera and families, such as *Negativicoccus* and *Veillonella*. * Dramatic speed improvement for `first_isolate()` diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R index 68224209..09001554 100755 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -194,7 +194,7 @@ check_dataset_integrity <- function() { data_in_globalenv <- ls(envir = globalenv()) overwritten <- data_in_pkg[data_in_pkg %in% data_in_globalenv] # exception for example_isolates - overwritten <- overwritten[overwritten != "example_isolates"] + overwritten <- overwritten[overwritten %unlike% "example_isolates"] if (length(overwritten) > 0) { if (length(overwritten) > 1) { plural <- c("s are", "", "s") diff --git a/R/ab_class_selectors.R b/R/ab_selectors.R similarity index 88% rename from R/ab_class_selectors.R rename to R/ab_selectors.R index f3e12d32..d54a170b 100644 --- a/R/ab_class_selectors.R +++ b/R/ab_selectors.R @@ -38,11 +38,6 @@ #' All columns in the data in which these functions are called will be searched for known antibiotic names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) according to the [antibiotics] data set. This means that a selector such as [aminoglycosides()] will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. #' #' The [ab_class()] function can be used to filter/select on a manually defined antibiotic class. It searches for results in the [antibiotics] data set within the columns `group`, `atc_group1` and `atc_group2`. -#' -#' The [ab_selector()] function can be used to internally filter the [antibiotics] data set on any results, see *Examples*. It allows for filtering on a (part of) a certain name, and/or a group name or even a minimum of DDDs for oral treatment. This function yields the highest flexibility, but is also the least user-friendly, since it requires a hard-coded filter to set. -#' -#' The [administrable_per_os()] and [administrable_iv()] functions also rely on the [antibiotics] data set - antibiotic columns will be matched where a DDD (defined daily dose) for resp. oral and IV treatment is available in the [antibiotics] data set. -#' #' @section Full list of supported (antibiotic) classes: #' #' `r paste0(" * ", na.omit(sapply(DEFINED_AB_GROUPS, function(ab) ifelse(tolower(gsub("^AB_", "", ab)) %in% ls(envir = asNamespace("AMR")), paste0("[", tolower(gsub("^AB_", "", ab)), "()] can select: \\cr ", vector_and(paste0(ab_name(eval(parse(text = ab), envir = asNamespace("AMR")), language = NULL, tolower = TRUE), " (", eval(parse(text = ab), envir = asNamespace("AMR")), ")"), quotes = FALSE, sort = TRUE)), character(0)), USE.NAMES = FALSE)), "\n", collapse = "")` @@ -105,6 +100,12 @@ #' # You can combine selectors with '&' to be more specific: #' example_isolates %>% #' select(penicillins() & administrable_per_os()) +#' +#' # get AMR for only drugs that matter - no intrinsic resistance: +#' example_isolates %>% +#' filter(mo_genus() %in% c("Escherichia", "Klebsiella")) %>% +#' group_by(hospital_id) %>% +#' summarise(across(not_intrinsic_resistant(), resistance)) #' #' # get susceptibility for antibiotics whose name contains "trim": #' example_isolates %>% @@ -167,6 +168,7 @@ ab_class <- function(ab_class, } #' @rdname antibiotic_class_selectors +#' @details The [ab_selector()] function can be used to internally filter the [antibiotics] data set on any results, see *Examples*. It allows for filtering on a (part of) a certain name, and/or a group name or even a minimum of DDDs for oral treatment. This function yields the highest flexibility, but is also the least user-friendly, since it requires a hard-coded filter to set. #' @export ab_selector <- function(filter, only_rsi_columns = FALSE, @@ -193,90 +195,6 @@ ab_selector <- function(filter, class = c("ab_selector", "character")) } -#' @rdname antibiotic_class_selectors -#' @export -administrable_per_os <- function(only_rsi_columns = FALSE, ...) { - meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1) - # get_current_data() has to run each time, for cases where e.g., filter() and select() are used in same call - # but it only takes a couple of milliseconds - vars_df <- get_current_data(arg_name = NA, call = -2) - # to improve speed, get_column_abx() will only run once when e.g. in a select or group call - ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns, sort = FALSE) - agents_all <- antibiotics[which(!is.na(antibiotics$oral_ddd)), "ab", drop = TRUE] - agents <- antibiotics[which(antibiotics$ab %in% ab_in_data & !is.na(antibiotics$oral_ddd)), "ab", drop = TRUE] - agents <- ab_in_data[ab_in_data %in% agents] - message_agent_names(function_name = "administrable_per_os", - agents = agents, - ab_group = "administrable_per_os", - examples = paste0(" (such as ", - vector_or(ab_name(sample(agents_all, - size = min(5, length(agents_all)), - replace = FALSE), - tolower = TRUE, - language = NULL), - quotes = FALSE), - ")")) - structure(unname(agents), - class = c("ab_selector", "character")) -} - -#' @rdname antibiotic_class_selectors -#' @export -administrable_iv <- function(only_rsi_columns = FALSE, ...) { - meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1) - # get_current_data() has to run each time, for cases where e.g., filter() and select() are used in same call - # but it only takes a couple of milliseconds - vars_df <- get_current_data(arg_name = NA, call = -2) - # to improve speed, get_column_abx() will only run once when e.g. in a select or group call - ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns, sort = FALSE) - agents_all <- antibiotics[which(!is.na(antibiotics$iv_ddd)), "ab", drop = TRUE] - agents <- antibiotics[which(antibiotics$ab %in% ab_in_data & !is.na(antibiotics$iv_ddd)), "ab", drop = TRUE] - agents <- ab_in_data[ab_in_data %in% agents] - message_agent_names(function_name = "administrable_iv", - agents = agents, - ab_group = "administrable_iv", - examples = "") - structure(unname(agents), - class = c("ab_selector", "character")) -} - -# nolint start -# #' @rdname antibiotic_class_selectors -# #' @export -# not_intrinsic_resistant <- function(mo, ..., only_rsi_columns = FALSE, ...) { -# meet_criteria(mo, allow_class = c("mo", "data.frame", "list", "character", "numeric", "integer", "factor"), has_length = 1, allow_NA = FALSE) -# meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1) -# -# x <- as.mo(mo, ...) -# wont_work <- intrinsic_resistant[which(intrinsic_resistant$microorganism == mo_name(x, language = NULL)), -# "antibiotic", -# drop = TRUE] -# -# # get_current_data() has to run each time, for cases where e.g., filter() and select() are used in same call -# # but it only takes a couple of milliseconds -# vars_df <- get_current_data(arg_name = NA, call = -2) -# # to improve speed, get_column_abx() will only run once when e.g. in a select or group call -# ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns, sort = FALSE) -# -# agents <- ab_in_data[!names(ab_in_data) %in% as.character(as.ab(wont_work))] -# -# # show used version number once per session (pkg_env will reload every session) -# if (message_not_thrown_before("intrinsic_resistant_version.ab", entire_session = TRUE)) { -# message_("Determining intrinsic resistance based on ", -# format_eucast_version_nr(3.2, markdown = FALSE), ". ", -# font_red("This note will be shown once per session.")) -# } -# -# message_agent_names(function_name = "not_intrinsic_resistant", -# agents = ab_in_data, -# ab_group = NULL, -# examples = "", -# call = mo_name(x, language = NULL)) -# -# agents -# } -# nolint end - #' @rdname antibiotic_class_selectors #' @export aminoglycosides <- function(only_rsi_columns = FALSE, only_treatable = TRUE, ...) { @@ -456,6 +374,94 @@ ureidopenicillins <- function(only_rsi_columns = FALSE, ...) { ab_select_exec("ureidopenicillins", only_rsi_columns = only_rsi_columns) } +#' @rdname antibiotic_class_selectors +#' @details The [administrable_per_os()] and [administrable_iv()] functions also rely on the [antibiotics] data set - antibiotic columns will be matched where a DDD (defined daily dose) for resp. oral and IV treatment is available in the [antibiotics] data set. +#' @export +administrable_per_os <- function(only_rsi_columns = FALSE, ...) { + meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1) + # get_current_data() has to run each time, for cases where e.g., filter() and select() are used in same call + # but it only takes a couple of milliseconds + vars_df <- get_current_data(arg_name = NA, call = -2) + # to improve speed, get_column_abx() will only run once when e.g. in a select or group call + ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns, sort = FALSE) + agents_all <- antibiotics[which(!is.na(antibiotics$oral_ddd)), "ab", drop = TRUE] + agents <- antibiotics[which(antibiotics$ab %in% ab_in_data & !is.na(antibiotics$oral_ddd)), "ab", drop = TRUE] + agents <- ab_in_data[ab_in_data %in% agents] + message_agent_names(function_name = "administrable_per_os", + agents = agents, + ab_group = "administrable_per_os", + examples = paste0(" (such as ", + vector_or(ab_name(sample(agents_all, + size = min(5, length(agents_all)), + replace = FALSE), + tolower = TRUE, + language = NULL), + quotes = FALSE), + ")")) + structure(unname(agents), + class = c("ab_selector", "character")) +} + +#' @rdname antibiotic_class_selectors +#' @export +administrable_iv <- function(only_rsi_columns = FALSE, ...) { + meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1) + # get_current_data() has to run each time, for cases where e.g., filter() and select() are used in same call + # but it only takes a couple of milliseconds + vars_df <- get_current_data(arg_name = NA, call = -2) + # to improve speed, get_column_abx() will only run once when e.g. in a select or group call + ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns, sort = FALSE) + agents_all <- antibiotics[which(!is.na(antibiotics$iv_ddd)), "ab", drop = TRUE] + agents <- antibiotics[which(antibiotics$ab %in% ab_in_data & !is.na(antibiotics$iv_ddd)), "ab", drop = TRUE] + agents <- ab_in_data[ab_in_data %in% agents] + message_agent_names(function_name = "administrable_iv", + agents = agents, + ab_group = "administrable_iv", + examples = "") + structure(unname(agents), + class = c("ab_selector", "character")) +} + +#' @rdname antibiotic_class_selectors +#' @inheritParams eucast_rules +#' @details The [not_intrinsic_resistant()] function can be used to only select antibiotic columns that pose no intrinsic resistance for the microorganisms in the data set. For example, if a data set contains only microorganism codes or names of *E. coli* and *K. pneumoniae* and contains a column "vancomycin", this column will be removed (or rather, unselected) using this function. It currently applies `r format_eucast_version_nr(names(EUCAST_VERSION_EXPERT_RULES[length(EUCAST_VERSION_EXPERT_RULES)]))` to determine intrinsic resistance, using the [eucast_rules()] function internally. Because of this determination, this function is quite slow in terms of performance. +#' @export +not_intrinsic_resistant <- function(only_rsi_columns = FALSE, col_mo = NULL, version_expertrules = 3.3, ...) { + meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1) + # get_current_data() has to run each time, for cases where e.g., filter() and select() are used in same call + # but it only takes a couple of milliseconds + vars_df <- get_current_data(arg_name = NA, call = -2) + # to improve speed, get_column_abx() will only run once when e.g. in a select or group call + ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns, sort = FALSE) + # intrinsic vars + vars_df_R <- tryCatch(sapply(eucast_rules(vars_df, + col_mo = col_mo, + version_expertrules = version_expertrules, + rules = "expert", + info = FALSE), + function(col) tryCatch(!any(is.na(col)) && all(col == "R"), + error = function(e) FALSE)), + error = function(e) stop_("in not_intrinsic_resistant(): ", e$message, call = FALSE)) + + agents <- ab_in_data[ab_in_data %in% names(vars_df_R[which(vars_df_R)])] + if (length(agents) > 0 && + message_not_thrown_before(paste0("not_intrinsic_resistant.", paste(sort(agents), collapse = "|")))) { + agents_formatted <- paste0("'", font_bold(agents, collapse = NULL), "'") + agents_names <- ab_name(names(agents), tolower = TRUE, language = NULL) + need_name <- generalise_antibiotic_name(agents) != generalise_antibiotic_name(agents_names) + agents_formatted[need_name] <- paste0(agents_formatted[need_name], " (", agents_names[need_name], ")") + message_("For `not_intrinsic_resistant()` removing ", + ifelse(length(agents) == 1, "column ", "columns "), + vector_and(agents_formatted, quotes = FALSE, sort = FALSE)) + } + + vars_df_R <- names(vars_df_R)[which(!vars_df_R)] + # find columns that are abx, but also intrinsic R + out <- unname(intersect(ab_in_data, vars_df_R)) + structure(out, + class = c("ab_selector", "character")) +} + ab_select_exec <- function(function_name, only_rsi_columns = FALSE, only_treatable = FALSE, @@ -465,7 +471,6 @@ ab_select_exec <- function(function_name, vars_df <- get_current_data(arg_name = NA, call = -3) # to improve speed, get_column_abx() will only run once when e.g. in a select or group call ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns, sort = FALSE) - # untreatable drugs untreatable <- antibiotics[which(antibiotics$name %like% "-high|EDTA|polysorbate"), "ab", drop = TRUE] if (only_treatable == TRUE & any(untreatable %in% names(ab_in_data))) { diff --git a/R/eucast_rules.R b/R/eucast_rules.R index 9f9a5dfe..5a691c03 100755 --- a/R/eucast_rules.R +++ b/R/eucast_rules.R @@ -59,7 +59,7 @@ format_eucast_version_nr <- function(version, markdown = TRUE) { #' @param verbose a [logical] to turn Verbose mode on and off (default is off). In Verbose mode, the function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way. Using Verbose mode takes a lot more time. #' @param version_breakpoints the version number to use for the EUCAST Clinical Breakpoints guideline. Can be either `r vector_or(names(EUCAST_VERSION_BREAKPOINTS), reverse = TRUE)`. #' @param version_expertrules the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either `r vector_or(names(EUCAST_VERSION_EXPERT_RULES), reverse = TRUE)`. -#' @param ampc_cephalosporin_resistance a [character] value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants, defaults to `NA`. Currently only works when `version_expertrules` is `3.2`; '*EUCAST Expert Rules v3.2 on Enterobacterales*' states that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these three agents. A value of `NA` (the default) for this argument will remove results for these three agents, while e.g. a value of `"R"` will make the results for these agents resistant. Use `NULL` or `FALSE` to not alter results for these three agents of AmpC de-repressed cephalosporin-resistant mutants. Using `TRUE` is equal to using `"R"`. \cr For *EUCAST Expert Rules* v3.2, this rule applies to: `r vector_and(gsub("[^a-zA-Z ]+", "", unlist(strsplit(EUCAST_RULES_DF[which(EUCAST_RULES_DF$reference.version == 3.2 & EUCAST_RULES_DF$reference.rule %like% "ampc"), "this_value"][1], "|", fixed = TRUE))), quotes = "*")`. +#' @param ampc_cephalosporin_resistance a [character] value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants, defaults to `NA`. Currently only works when `version_expertrules` is `3.2` and higher; these version of '*EUCAST Expert Rules on Enterobacterales*' state that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these three agents. A value of `NA` (the default) for this argument will remove results for these three agents, while e.g. a value of `"R"` will make the results for these agents resistant. Use `NULL` or `FALSE` to not alter results for these three agents of AmpC de-repressed cephalosporin-resistant mutants. Using `TRUE` is equal to using `"R"`. \cr For *EUCAST Expert Rules* v3.2, this rule applies to: `r vector_and(gsub("[^a-zA-Z ]+", "", unlist(strsplit(EUCAST_RULES_DF[which(EUCAST_RULES_DF$reference.version %in% c(3.2, 3.3) & EUCAST_RULES_DF$reference.rule %like% "ampc"), "this_value"][1], "|", fixed = TRUE))), quotes = "*")`. #' @param ... column name of an antibiotic, see section *Antibiotics* below #' @param ab any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()] #' @param administration route of administration, either `r vector_or(dosage$administration)` diff --git a/R/guess_ab_col.R b/R/guess_ab_col.R index 3646aa9b..3245f2e5 100755 --- a/R/guess_ab_col.R +++ b/R/guess_ab_col.R @@ -238,9 +238,10 @@ get_column_abx <- function(x, if (sort == TRUE) { out <- out[order(names(out), out)] } - duplicates <- c(out[duplicated(out)], out[duplicated(names(out))]) - duplicates <- duplicates[unique(names(duplicates))] - out <- c(out[!names(out) %in% names(duplicates)], duplicates) + # only keep the first hits, no duplicates + duplicates <- c(out[duplicated(names(out))], out[duplicated(unname(out))]) + out <- out[!duplicated(names(out))] + out <- out[!duplicated(unname(out))] if (sort == TRUE) { out <- out[order(names(out), out)] } diff --git a/R/mo_matching_score.R b/R/mo_matching_score.R index f2d1a40b..8044a3f9 100755 --- a/R/mo_matching_score.R +++ b/R/mo_matching_score.R @@ -27,7 +27,7 @@ #' #' This algorithm is used by [as.mo()] and all the [`mo_*`][mo_property()] functions to determine the most probable match of taxonomic records based on user input. #' @inheritSection lifecycle Stable Lifecycle -#' @author Matthijs S. Berends +#' @author Dr. Matthijs Berends #' @param x Any user input value(s) #' @param n A full taxonomic name, that exists in [`microorganisms$fullname`][microorganisms] #' @section Matching Score for Microorganisms: diff --git a/R/mo_property.R b/R/mo_property.R index 6bb821d2..be34e2d7 100755 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -96,6 +96,7 @@ #' mo_ref("E. coli") # "Castellani et al., 1919" #' mo_authors("E. coli") # "Castellani et al." #' mo_year("E. coli") # 1919 +#' mo_lpsn("E. coli") # 776057 (LPSN record ID) #' #' # abbreviations known in the field ----------------------------------------- #' mo_genus("MRSA") # "Staphylococcus" @@ -538,6 +539,19 @@ mo_year <- function(x, language = get_locale(), ...) { suppressWarnings(as.integer(x)) } +#' @rdname mo_property +#' @export +mo_lpsn <- function(x, language = get_locale(), ...) { + if (missing(x)) { + # this tries to find the data and an column + x <- find_mo_col(fn = "mo_rank") + } + meet_criteria(x, allow_NA = TRUE) + meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE) + + mo_validate(x = x, property = "species_id", language = language, ...) +} + #' @rdname mo_property #' @export mo_rank <- function(x, language = get_locale(), ...) { @@ -724,6 +738,8 @@ mo_validate <- function(x, property, language, ...) { if (property == "mo") { return(set_clean_class(x, new_class = c("mo", "character"))) + } else if (property == "species_id") { + return(as.double(x)) } else if (property == "snomed") { return(as.double(eval(parse(text = x)))) } else { diff --git a/data-raw/AMR_latest.tar.gz b/data-raw/AMR_latest.tar.gz index b7fc123b..ea89b2ff 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 6c90c8b9..d44adf85 100644 --- a/docs/404.html +++ b/docs/404.html @@ -43,7 +43,7 @@ AMR (for R) - 1.7.1.9062 + 1.7.1.9063 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 68699c48..68039a9e 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -17,7 +17,7 @@ AMR (for R) - 1.7.1.9062 + 1.7.1.9063 diff --git a/docs/articles/datasets.html b/docs/articles/datasets.html index 0b57eb46..63cf0e3f 100644 --- a/docs/articles/datasets.html +++ b/docs/articles/datasets.html @@ -44,7 +44,7 @@ AMR (for R) - 1.7.1.9062 + 1.7.1.9063 @@ -190,7 +190,7 @@ diff --git a/docs/extra.js b/docs/extra.js index 2efec1c9..c986cdae 100644 --- a/docs/extra.js +++ b/docs/extra.js @@ -97,20 +97,20 @@ $(document).ready(function() { x = x.replace(/Author, contributor/g, "Maintainer"); x = x.replace(/Author, thesis advisor/g, "Doctoral advisor"); x = x.replace(/Thesis advisor/g, "Doctoral advisor"); - x = x.replace("Matthijs", "Dr. Matthijs"); - x = x.replace("Christian", "Dr. Christian"); + x = x.replace("Matthijs", "Dr Matthijs"); + x = x.replace("Christian", "Dr Christian"); x = x.replace("Alex", "Prof. Alex"); x = x.replace("Bhanu", "Prof. Bhanu"); x = x.replace("Casper", "Prof. Casper"); - x = x.replace("Corinna", "Dr. Corinna"); + x = x.replace("Corinna", "Dr Corinna"); // others - x = x.replace("Bart", "Dr. Bart"); - x = x.replace("Sofia", "Dr. Sofia"); - x = x.replace("Dennis", "Dr. Dennis"); - x = x.replace("Judith", "Dr. Judith"); - x = x.replace("Gwen", "Dr. Gwen"); - x = x.replace("Anthony", "Dr. Anthony"); - x = x.replace("Rogier", "Dr. Rogier"); + x = x.replace("Bart", "Dr Bart"); + x = x.replace("Sofia", "Dr Sofia"); + x = x.replace("Dennis", "Dr Dennis"); + x = x.replace("Judith", "Dr Judith"); + x = x.replace("Gwen", "Dr Gwen"); + x = x.replace("Anthony", "Dr Anthony"); + x = x.replace("Rogier", "Dr Rogier"); } return(x); } diff --git a/docs/index.html b/docs/index.html index 055ea734..4af4fd44 100644 --- a/docs/index.html +++ b/docs/index.html @@ -47,7 +47,7 @@ AMR (for R) - 1.7.1.9062 + 1.7.1.9063 @@ -195,7 +195,7 @@ AMR (for R)
-

Update: The latest EUCAST guideline for intrinsic resistance (v3.3, October 2021) is now supported, and our taxonomy tables has been updated as well (LPSN, 5 October 2021).

+

Update: The latest EUCAST guideline for intrinsic resistance (v3.3, October 2021) is now supported, and our taxonomy tables has been updated as well (LPSN, 5 October 2021). A new version will be released after the EUCAST guideline for clinical breakpoints (v12.0, likely January 2022) are implemented, to be expected shortly after the official guideline release.

What is AMR (for R)? diff --git a/docs/news/index.html b/docs/news/index.html index 768c9af5..802ff96e 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ AMR (for R) - 1.7.1.9062 + 1.7.1.9063

@@ -157,20 +157,21 @@
- +
-

Last updated: 6 December 2021

+

Last updated: 9 December 2021

-

Breaking changes

+

Breaking changes

  • Removed p_symbol() and all filter_*() functions (except for filter_first_isolate()), which were all deprecated in a previous package version
  • Removed the key_antibiotics() and key_antibiotics_equal() functions, which were deprecated and superseded by key_antimicrobials() and antimicrobials_equal()
  • Removed all previously implemented ggplot2::ggplot() generics for classes <mic>, <disk>, <rsi> and <resistance_predict> as they did not follow the ggplot2 logic. They were replaced with ggplot2::autoplot() generics.
-

New

+

New

  • Support for EUCAST Intrinsic Resistance and Unusual Phenotypes v3.3 (October 2021), effective in the eucast_rules() function. This is now the default guideline (all other guidelines are still available).

  • +
  • Support for Danish, and also added missing translations of all antimicrobial drugs in Italian, French and Portuguese

  • Function set_ab_names() to rename data set columns that resemble antimicrobial drugs. This allows for quickly renaming columns to official names, ATC codes, etc. Its second argument can be a tidyverse way of selecting:

    @@ -178,10 +179,10 @@
     example_isolates %>% set_ab_names(where(is.rsi))
     example_isolates %>% set_ab_names(AMC:GEN, property = "atc")
  • -
  • Support for Danish, and also added missing translations of all antimicrobial drugs in Italian, French and Portuguese

  • +
  • Function mo_lpsn() to retrieve the LPSN record ID

-

Changed

+

Changed

  • Updated the bacterial taxonomy to 5 October 2021 (according to LPSN), including all 11 new staphylococcal species named since 1 January last year
  • The antibiotics data set now contains all ATC codes that are available through the WHOCC website, regardless of drugs being present in more than one ATC group. This means that:
    • Some drugs now contain multiple ATC codes (e.g., metronidazole contains 5)
    • @@ -210,7 +211,9 @@ example_isolates[, ab_selector(oral_ddd > 1 & oral_units == "g")] # base R example_isolates %>% select(ab_selector(oral_ddd > 1 & oral_units == "g")) # dplyr
+
  • Added the selector not_intrinsic_resistant(), which only keeps antibiotic columns that are not intrinsic resistant for all microorganisms in a data set, based on the latest EUCAST guideline on intrinsic resistance. For example, if a data set contains only microorganism codes or names of E. coli and K. pneumoniae and contains a column “vancomycin”, this column will be removed (or rather, unselected) using this function.

  • Fix for using selectors multiple times in one call (e.g., using them in dplyr::filter() and immediately after in dplyr::select())

  • +
  • Fix for using having multiple columns that are coerced to the same antibiotic agent

  • Added argument only_treatable, which defaults to TRUE and will exclude drugs that are only for laboratory tests and not for treating patients (such as imipenem/EDTA and gentamicin-high)

  • Fixed the Gram stain (mo_gramstain()) determination of the taxonomic class Negativicutes within the phylum of Firmicutes - they were considered Gram-positives because of their phylum but are actually Gram-negative. This impacts 137 taxonomic species, genera and families, such as Negativicoccus and Veillonella.
  • @@ -235,7 +238,7 @@
  • Improved plot legends for MICs and disk diffusion values
  • Improved speed of as.ab() and all ab_*() functions
  • -
  • Added fortify() extensions for plotting methods
  • +
  • Added fortify() extensions for plotting methods
  • NA values of the classes <mic>, <disk> and <rsi> are now exported objects of this package, e.g. NA_mic_ is an NA of class mic (just like the base R NA_character_ is an NA of class character)
  • The proportion_df(), count_df() and rsi_df() functions now return with the additional S3 class ‘rsi_df’ so they can be extended by other packages
  • @@ -247,7 +250,7 @@ get_episode() and is_new_episode() can now cope with NAs
    -

    Other

    +

    Other

    • This package is now being maintained by two epidemiologists and a data scientist from two different non-profit healthcare organisations. All functions in this package are now all considered to be stable. Updates to the AMR interpretation rules (such as by EUCAST and CLSI), the microbial taxonomy, and the antibiotic dosages will all be updated every 6 to 12 months from now on.
    @@ -293,7 +296,7 @@
  • The documentation of the first_isolate() and key_antimicrobials() functions has been completely rewritten.
  • Function betalactams() as additional antbiotic column selector and function filter_betalactams() as additional antbiotic column filter. The group of betalactams consists of all carbapenems, cephalosporins and penicillins.
  • -
  • A ggplot() method for resistance_predict() +
  • A ggplot() method for resistance_predict()
  • @@ -376,7 +379,7 @@ #> Filtering on oxazolidinones: value in column `LNZ` (linezolid) is either "R", "S" or "I"
  • Support for custom MDRO guidelines, using the new custom_mdro_guideline() function, please see mdro() for additional info

  • -
  • ggplot() generics for classes <mic> and <disk>

  • +
  • ggplot() generics for classes <mic> and <disk>

  • Function mo_is_yeast(), which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:

    @@ -427,7 +430,7 @@
     
    • Plotting of MIC and disk diffusion values now support interpretation colouring if you supply the microorganism and antimicrobial agent
    • All colours were updated to colour-blind friendly versions for values R, S and I for all plot methods (also applies to tibble printing)
    • Interpretation of MIC and disk diffusion values to R/SI will now be translated if the system language is German, Dutch or Spanish (see translate)
    • -
    • Plotting is now possible with base R using plot() and with ggplot2 using ggplot() on any vector of MIC and disk diffusion values
    • +
    • Plotting is now possible with base R using plot() and with ggplot2 using ggplot() on any vector of MIC and disk diffusion values
  • Updated SNOMED codes to US Edition of SNOMED CT from 1 September 2020 and added the source to the help page of the microorganisms data set
  • @@ -443,7 +446,7 @@ is.rsi.eligible() now detects if the column name resembles an antibiotic name or code and now returns TRUE immediately if the input contains any of the values “R”, “S” or “I”. This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.
  • Functions get_episode() and is_new_episode() now support less than a day as value for argument episode_days (e.g., to include one patient/test per hour)
  • Argument ampc_cephalosporin_resistance in eucast_rules() now also applies to value “I” (not only “S”)
  • -
  • Functions print() and summary() on a Principal Components Analysis object (pca()) now print additional group info if the original data was grouped using dplyr::group_by() +
  • Functions print() and summary() on a Principal Components Analysis object (pca()) now print additional group info if the original data was grouped using dplyr::group_by()
  • Improved speed and reliability of guess_ab_col(). As this also internally improves the reliability of first_isolate() and mdro(), this might have a slight impact on the results of those functions.
  • Fix for mo_name() when used in other languages than English
  • @@ -722,7 +725,7 @@

    Removed code dependency on all other R packages, making this package fully independent of the development process of others. This is a major code change, but will probably not be noticeable by most users.

    Making this package independent of especially the tidyverse (e.g. packages dplyr and tidyr) tremendously increases sustainability on the long term, since tidyverse functions change quite often. Good for users, but hard for package maintainers. Most of our functions are replaced with versions that only rely on base R, which keeps this package fully functional for many years to come, without requiring a lot of maintenance to keep up with other packages anymore. Another upside it that this package can now be used with all versions of R since R-3.0.0 (April 2013). Our package is being used in settings where the resources are very limited. Fewer dependencies on newer software is helpful for such settings.

    Negative effects of this change are:

    - -
  • Frequency tables (freq() function): +
  • Frequency tables (freq() function):