diff --git a/DESCRIPTION b/DESCRIPTION index 3cd96180..f2512355 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.7.1.9018 -Date: 2021-07-11 +Version: 1.7.1.9019 +Date: 2021-07-12 Title: Antimicrobial Resistance Data Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index e5f5d7f4..c3380f91 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# `AMR` 1.7.1.9018 -## Last updated: 11 July 2021 +# `AMR` 1.7.1.9019 +## Last updated: 12 July 2021 ### Changed * Antibiotic class selectors (see `ab_class()`) @@ -20,6 +20,7 @@ * `ab_name()` gained argument `snake_case`, which is useful for column renaming * Fix for legends created with `scale_rsi_colours()` when using `ggplot2` v3.3.4 or higher (this is bug ggplot2#4511, soon to be fixed) * Fix for minor translation errors +* Fix for the MIC interpretation of *Morganellaceae* (such as *Morganella* and *Proteus*) when using the EUCAST 2021 guideline # `AMR` 1.7.1 diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R index f326e956..bfd64d59 100755 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -400,6 +400,9 @@ word_wrap <- function(..., # format backticks msg <- gsub("(`.+?`)", font_grey_bg("\\1"), msg) + # clean introduced whitespace between fullstops + msg <- gsub("[.] +[.]", "..", msg) + msg } diff --git a/R/plot.R b/R/plot.R index c209a991..b04dd991 100644 --- a/R/plot.R +++ b/R/plot.R @@ -684,6 +684,7 @@ plot_prepare_table <- function(x, expand) { if (is.mic(x)) { if (expand == TRUE) { # expand range for MIC by adding factors of 2 from lowest to highest so all MICs in between also print + valid_lvls <- levels(x) extra_range <- max(x) / 2 while (min(extra_range) / 2 > min(x)) { extra_range <- c(min(extra_range) / 2, extra_range) @@ -692,7 +693,7 @@ plot_prepare_table <- function(x, expand) { extra_range <- rep(0, length(extra_range)) names(extra_range) <- nms x <- table(droplevels(x, as.mic = FALSE)) - extra_range <- extra_range[!names(extra_range) %in% names(x)] + extra_range <- extra_range[!names(extra_range) %in% names(x) & names(extra_range) %in% valid_lvls] x <- as.table(c(x, extra_range)) } else { x <- table(droplevels(x, as.mic = FALSE)) diff --git a/R/rsi.R b/R/rsi.R index 12982cdc..bb23ca0a 100755 --- a/R/rsi.R +++ b/R/rsi.R @@ -411,13 +411,18 @@ as.rsi.mic <- function(x, uti <- rep(uti, length(x)) } - message_("=> Interpreting MIC values of ", ifelse(isTRUE(list(...)$is_data.frame), "column ", ""), "'", font_bold(ab), "' (", - ifelse(ab_coerced != ab, paste0(ab_coerced, ", "), ""), - ab_name(ab_coerced, tolower = TRUE), ")", mo_var_found, + agent_formatted <- paste0("'", font_bold(ab), "'") + agent_name <- ab_name(ab_coerced, tolower = TRUE, language = NULL) + if (generalise_antibiotic_name(ab) != generalise_antibiotic_name(agent_name)) { + agent_formatted <- paste0(agent_formatted, " (", ab_coerced, ", ", agent_name, ")") + } + message_("=> Interpreting MIC values of ", ifelse(isTRUE(list(...)$is_data.frame), "column ", ""), + agent_formatted, + mo_var_found, " according to ", ifelse(identical(reference_data, AMR::rsi_translation), font_bold(guideline_coerced), "manually defined 'reference_data'"), - " ... ", + "... ", appendLF = FALSE, as_note = FALSE) @@ -500,13 +505,18 @@ as.rsi.disk <- function(x, uti <- rep(uti, length(x)) } - message_("=> Interpreting disk zones of ", ifelse(isTRUE(list(...)$is_data.frame), "column ", ""), "'", font_bold(ab), "' (", - ifelse(ab_coerced != ab, paste0(ab_coerced, ", "), ""), - ab_name(ab_coerced, tolower = TRUE), ")", mo_var_found, + agent_formatted <- paste0("'", font_bold(ab), "'") + agent_name <- ab_name(ab_coerced, tolower = TRUE, language = NULL) + if (generalise_antibiotic_name(ab) != generalise_antibiotic_name(agent_name)) { + agent_formatted <- paste0(agent_formatted, " (", ab_coerced, ", ", agent_name, ")") + } + message_("=> Interpreting disk zones of ", ifelse(isTRUE(list(...)$is_data.frame), "column ", ""), + agent_formatted, + mo_var_found, " according to ", ifelse(identical(reference_data, AMR::rsi_translation), font_bold(guideline_coerced), "manually defined 'reference_data'"), - " ... ", + "... ", appendLF = FALSE, as_note = FALSE) diff --git a/data-raw/AMR_latest.tar.gz b/data-raw/AMR_latest.tar.gz index e6a7acbc..3d20283c 100644 Binary files a/data-raw/AMR_latest.tar.gz and b/data-raw/AMR_latest.tar.gz differ diff --git a/data-raw/read_EUCAST.R b/data-raw/read_EUCAST.R index e2631349..dff5f0ab 100644 --- a/data-raw/read_EUCAST.R +++ b/data-raw/read_EUCAST.R @@ -118,7 +118,7 @@ read_EUCAST <- function(sheet, file, guideline_name) { seq(from = 41, to = 49, by = 1), seq(from = 81, to = 89, by = 1)) has_superscript <- function(x) { - # because due to floating point error 0.1252 is not in: + # because due to floating point error, 0.1252 is not in: # seq(from = 0.1251, to = 0.1259, by = 0.0001) sapply(x, function(x) any(near(x, MICs_with_trailing_superscript))) } @@ -242,3 +242,21 @@ for (i in 2:length(sheets_to_analyse)) { guideline_name = guideline_name)) , error = function(e) message(e$message)) } + +# 2021-07-12 fix for Morganellaceae (check other lines too next time) +morg <- rsi_translation %>% + as_tibble() %>% + filter(ab == "IPM", + guideline == "EUCAST 2021", + mo == as.mo("Enterobacterales")) %>% + mutate(mo = as.mo("Morganellaceae")) +morg[which(morg$method == "MIC"), "breakpoint_S"] <- 0.001 +morg[which(morg$method == "MIC"), "breakpoint_R"] <- 4 +morg[which(morg$method == "DISK"), "breakpoint_S"] <- 50 +morg[which(morg$method == "DISK"), "breakpoint_R"] <- 19 + +rsi_translation <- rsi_translation %>% + bind_rows(morg) %>% + bind_rows(morg %>% + mutate(guideline = "EUCAST 2020")) %>% + arrange(desc(guideline), ab, mo, method) diff --git a/data-raw/rsi.md5 b/data-raw/rsi.md5 index ee35a907..16915c4f 100644 --- a/data-raw/rsi.md5 +++ b/data-raw/rsi.md5 @@ -1 +1 @@ -1a7fe52f8185c9bb2c470712863d1887 +67a83b234f25a303c7944222bea47d73 diff --git a/data-raw/rsi_translation.dta b/data-raw/rsi_translation.dta index 18dc43a7..c0595a23 100644 Binary files a/data-raw/rsi_translation.dta and b/data-raw/rsi_translation.dta differ diff --git a/data-raw/rsi_translation.rds b/data-raw/rsi_translation.rds index 7c32865d..e8cce8d1 100644 Binary files a/data-raw/rsi_translation.rds and b/data-raw/rsi_translation.rds differ diff --git a/data-raw/rsi_translation.sas b/data-raw/rsi_translation.sas index 0662a4c0..a683e5f8 100644 Binary files a/data-raw/rsi_translation.sas and b/data-raw/rsi_translation.sas differ diff --git a/data-raw/rsi_translation.sav b/data-raw/rsi_translation.sav index ca4ad0cc..97c59d7b 100644 Binary files a/data-raw/rsi_translation.sav and b/data-raw/rsi_translation.sav differ diff --git a/data-raw/rsi_translation.txt b/data-raw/rsi_translation.txt index eed44c58..455ff139 100644 --- a/data-raw/rsi_translation.txt +++ b/data-raw/rsi_translation.txt @@ -754,6 +754,8 @@ "EUCAST 2021" "MIC" "Staphylococcus saccharolyticus" "Imipenem/relebactam" "Anaerobes, Grampositive" 2 2 FALSE "EUCAST 2021" "MIC" "Viridans Group Streptococcus (VGS)" "Imipenem/relebactam" "Viridans group streptococci" 2 2 FALSE "EUCAST 2021" "MIC" "(unknown name)" "Imipenem/relebactam" "PK PD breakpoints" 2 2 FALSE +"EUCAST 2021" "DISK" "Morganellaceae" "Imipenem" "Enterobacterales" "10ug" 50 19 FALSE +"EUCAST 2021" "MIC" "Morganellaceae" "Imipenem" "Enterobacterales" 0.001 4 FALSE "EUCAST 2021" "DISK" "Enterobacterales" "Imipenem" "Enterobacterales" "10ug" 22 19 FALSE "EUCAST 2021" "MIC" "Enterobacterales" "Imipenem" "Enterobacterales" 2 4 FALSE "EUCAST 2021" "DISK" "Acinetobacter" "Imipenem" "Acinetobacter" "10ug" 24 21 FALSE @@ -2542,6 +2544,8 @@ "EUCAST 2020" "MIC" "Staphylococcus saccharolyticus" "Imipenem/relebactam" "Anaerobes, Grampositive" 2 2 FALSE "EUCAST 2020" "MIC" "Viridans Group Streptococcus (VGS)" "Imipenem/relebactam" "Viridans group streptococci" 2 2 FALSE "EUCAST 2020" "MIC" "(unknown name)" "Imipenem/relebactam" "PK PD breakpoints" 2 2 FALSE +"EUCAST 2020" "DISK" "Morganellaceae" "Imipenem" "Enterobacterales" "10ug" 50 19 FALSE +"EUCAST 2020" "MIC" "Morganellaceae" "Imipenem" "Enterobacterales" 0.001 4 FALSE "EUCAST 2020" "DISK" "Enterobacterales" "Imipenem" "Enterobacterales" "10ug" 22 17 FALSE "EUCAST 2020" "MIC" "Enterobacterales" "Imipenem" "Enterobacterales" 2 4 FALSE "EUCAST 2020" "DISK" "Acinetobacter" "Imipenem" "Acinetobacter" "10ug" 24 21 FALSE diff --git a/data/rsi_translation.rda b/data/rsi_translation.rda index 01889a76..59c42e58 100644 Binary files a/data/rsi_translation.rda and b/data/rsi_translation.rda differ diff --git a/docs/404.html b/docs/404.html index 6eed235a..0fb27c10 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 b6205e4a..933345c4 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ diff --git a/docs/articles/datasets.html b/docs/articles/datasets.html index 6d57e4fb..0d0c8bee 100644 --- a/docs/articles/datasets.html +++ b/docs/articles/datasets.html @@ -39,7 +39,7 @@ @@ -192,7 +192,7 @@vignettes/datasets.Rmd
datasets.Rmd
A data set with 21,996 rows and 10 columns, containing the following column names:
guideline, method, site, mo, ab, ref_tbl, disk_dose, breakpoint_S, breakpoint_R and uti.
A data set with 22,000 rows and 10 columns, containing the following column names:
guideline, method, site, mo, ab, ref_tbl, disk_dose, breakpoint_S, breakpoint_R and uti.
This data set is in R available as rsi_translation
, after you load the AMR
package.
It was last updated on 1 June 2021 14:47:11 UTC. Find more info about the structure of this data set here.
+It was last updated on 12 July 2021 10:10:26 UTC. Find more info about the structure of this data set here.
Direct download links:
NEWS.md
- AMR
1.7.1.9018AMR
1.7.1.9019ab_name()
gained argument snake_case
, which is useful for column renaming
scale_rsi_colours()
when using ggplot2
v3.3.4 or higher (this is bug ggplot2#4511, soon to be fixed)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.
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)ampc_cephalosporin_resistance
in eucast_rules()
now also applies to value “I” (not only “S”)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()
+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()
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.mo_name()
when used in other languages than English