diff --git a/DESCRIPTION b/DESCRIPTION index 494c8ac9..38ae3acb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.4.0.9039 -Date: 2020-12-13 +Version: 1.4.0.9040 +Date: 2020-12-16 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index ab499e7b..e19c7bf6 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# AMR 1.4.0.9039 -## Last updated: 13 December 2020 +# AMR 1.4.0.9040 +## Last updated: 16 December 2020 ### 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: @@ -39,6 +39,7 @@ * Better tibble printing for MIC values * Fix for plotting MIC values with `plot()` * Added `plot()` generic to class `` +* LA-MRSA and CA-MRSA are now recognised as an abbreviation for *Staphylococcus aureus*, meaning that e.g. `mo_genus("LA-MRSA")` will return `"Staphylococcus"` and `mo_is_gram_positive("LA-MRSA")` will return `TRUE`. ### Other * All messages and warnings thrown by this package now break sentences on whole words diff --git a/R/amr.R b/R/amr.R index a91297ef..0b9910eb 100644 --- a/R/amr.R +++ b/R/amr.R @@ -66,6 +66,7 @@ #' Post Office Box 30001 \cr #' 9700 RB Groningen \cr #' The Netherlands +#' #' #' If you have found a bug, please file a new issue at: \cr #' @@ -73,7 +74,7 @@ #' @rdname AMR NULL -#' Plotting for classes `rsi` and `disk` +#' Plotting for classes `rsi`, `mic` and `disk` #' #' Functions to print classes of the `AMR` package. #' @inheritSection lifecycle Stable lifecycle diff --git a/R/eucast_rules.R b/R/eucast_rules.R index daa2aedf..7783f2b0 100755 --- a/R/eucast_rules.R +++ b/R/eucast_rules.R @@ -636,14 +636,18 @@ eucast_rules <- function(x, ab_name_base <- ab_name(cols_ab[ab_enzyme[i, ]$base_ab], language = NULL, tolower = TRUE) ab_name_enzyme <- ab_name(cols_ab[ab_enzyme[i, ]$ab], language = NULL, tolower = TRUE) - # Set base to R where base + enzyme inhibitor is R + # Set base to R where base + enzyme inhibitor is R ---- rule_current <- paste0("Set ", ab_name_base, " (", cols_ab[ab_enzyme[i, ]$base_ab], ") = R where ", ab_name_enzyme, " (", cols_ab[ab_enzyme[i, ]$ab], ") = R") - cat(word_wrap(rule_current)) + if (info == TRUE) { + cat(word_wrap(rule_current)) + cat("\n") + } run_changes <- edit_rsi(x = x, col_mo = col_mo, to = "R", - rule = c(rule_current, "Other rules", "", paste0("Non-EUCAST: AMR package v", utils::packageDescription("AMR")$Version)), + rule = c(rule_current, "Other rules", "", + paste0("Non-EUCAST: AMR package v", utils::packageDescription("AMR")$Version)), rows = which(as.rsi_no_warning(x[, cols_ab[ab_enzyme[i, ]$ab]]) == "R"), cols = cols_ab[ab_enzyme[i, ]$base_ab], last_verbose_info = verbose_info, @@ -664,16 +668,18 @@ eucast_rules <- function(x, n_changed <- 0 } - # Set base + enzyme inhibitor to S where base is S + # Set base + enzyme inhibitor to S where base is S ---- rule_current <- paste0("Set ", ab_name_enzyme, " (", cols_ab[ab_enzyme[i, ]$ab], ") = S where ", ab_name_base, " (", cols_ab[ab_enzyme[i, ]$base_ab], ") = S") if (info == TRUE) { cat(word_wrap(rule_current)) + cat("\n") } run_changes <- edit_rsi(x = x, col_mo = col_mo, to = "S", - rule = c(rule_current, "Other rules", "", paste0("Non-EUCAST: AMR package v", utils::packageDescription("AMR")$Version)), + rule = c(rule_current, "Other rules", "", + paste0("Non-EUCAST: AMR package v", utils::packageDescription("AMR")$Version)), rows = which(as.rsi_no_warning(x[, cols_ab[ab_enzyme[i, ]$base_ab]]) == "S"), cols = cols_ab[ab_enzyme[i, ]$ab], last_verbose_info = verbose_info, diff --git a/R/mo.R b/R/mo.R index 8af7a92f..de212b9f 100755 --- a/R/mo.R +++ b/R/mo.R @@ -677,17 +677,17 @@ exec_as.mo <- function(x, # translate known trivial abbreviations to genus + species ---- if (toupper(x_backup_without_spp[i]) %in% c("MRSA", "MSSA", "VISA", "VRSA", "BORSA") - | x_backup_without_spp[i] %like_case% " (mrsa|mssa|visa|vrsa) ") { + | x_backup_without_spp[i] %like_case% "(^| )(mrsa|mssa|visa|vrsa|borsa|la-?mrsa|ca-?mrsa)( |$)") { x[i] <- lookup(fullname == "Staphylococcus aureus", uncertainty = -1) next } if (toupper(x_backup_without_spp[i]) %in% c("MRSE", "MSSE") - | x_backup_without_spp[i] %like_case% " (mrse|msse) ") { + | x_backup_without_spp[i] %like_case% "(^| )(mrse|msse)( |$)") { x[i] <- lookup(fullname == "Staphylococcus epidermidis", uncertainty = -1) next } if (toupper(x_backup_without_spp[i]) == "VRE" - | x_backup_without_spp[i] %like_case% " vre " + | x_backup_without_spp[i] %like_case% "(^| )vre " | x_backup_without_spp[i] %like_case% "(enterococci|enterokok|enterococo)[a-z]*?$") { x[i] <- lookup(genus == "Enterococcus", uncertainty = -1) next @@ -711,7 +711,7 @@ exec_as.mo <- function(x, next } if (toupper(x_backup_without_spp[i]) == "MRPA" - | x_backup_without_spp[i] %like_case% " mrpa ") { + | x_backup_without_spp[i] %like_case% "(^| )mrpa( |$)") { # multi resistant P. aeruginosa x[i] <- lookup(fullname == "Pseudomonas aeruginosa", uncertainty = -1) next @@ -722,7 +722,7 @@ exec_as.mo <- function(x, next } if (toupper(x_backup_without_spp[i]) %in% c("PISP", "PRSP", "VISP", "VRSP") - | x_backup_without_spp[i] %like_case% " (pisp|prsp|visp|vrsp) ") { + | x_backup_without_spp[i] %like_case% "(^| )(pisp|prsp|visp|vrsp)( |$)") { # peni I, peni R, vanco I, vanco R: S. pneumoniae x[i] <- lookup(fullname == "Streptococcus pneumoniae", uncertainty = -1) next diff --git a/docs/404.html b/docs/404.html index 43eb4ec6..4ebcba69 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9039 + 1.4.0.9040 @@ -89,14 +89,14 @@