diff --git a/DESCRIPTION b/DESCRIPTION index 83141de83..373efc2af 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.3.0.9007 +Version: 1.3.0.9008 Date: 2020-08-26 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/NAMESPACE b/NAMESPACE index d66e8ebb3..967d8a920 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -40,6 +40,7 @@ S3method(format,bug_drug_combinations) S3method(kurtosis,data.frame) S3method(kurtosis,default) S3method(kurtosis,matrix) +S3method(pillar_shaft,ab) S3method(pillar_shaft,disk) S3method(pillar_shaft,mic) S3method(pillar_shaft,mo) @@ -62,6 +63,7 @@ S3method(skewness,matrix) S3method(summary,mic) S3method(summary,mo) S3method(summary,rsi) +S3method(type_sum,ab) S3method(type_sum,disk) S3method(type_sum,mic) S3method(type_sum,mo) diff --git a/NEWS.md b/NEWS.md index 41a517919..64fb04698 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.3.0.9007 +# AMR 1.3.0.9008 ## Last updated: 26 August 2020 ### New diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R index dbcdce77d..0ffb96c0e 100755 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -575,9 +575,9 @@ isFALSE <- function(x) { deparse1 <- function(expr, collapse = " ", width.cutoff = 500L, ...) { paste(deparse(expr, width.cutoff, ...), collapse = collapse) } -file.size <- function (...) { +file.size <- function(...) { base::file.info(...)$size } -file.mtime <- function (...) { +file.mtime <- function(...) { base::file.info(...)$mtime } diff --git a/R/ab.R b/R/ab.R index 4a926ed76..52469f9ed 100755 --- a/R/ab.R +++ b/R/ab.R @@ -467,6 +467,26 @@ is.ab <- function(x) { inherits(x, "ab") } + +#' @method pillar_shaft ab +#' @export +pillar_shaft.ab <- function(x, ...) { + # import from the pillar package, without being dependent on it! + style_na <- import_fn("style_na", "pillar", error_on_fail = FALSE) + new_pillar_shaft_simple <- import_fn("new_pillar_shaft_simple", "pillar", error_on_fail = FALSE) + out <- format(x) + out[is.na(x)] <- style_na(NA) + new_pillar_shaft_simple(out, + align = "left", + min_width = 4) +} + +#' @method type_sum ab +#' @export +type_sum.ab <- function(x, ...) { + "ab" +} + #' @method print ab #' @export #' @noRd diff --git a/R/eucast_rules.R b/R/eucast_rules.R index acda0d52d..5f2668501 100755 --- a/R/eucast_rules.R +++ b/R/eucast_rules.R @@ -40,17 +40,12 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016" #' **Note:** This function does not translate MIC values to RSI values. Use [as.rsi()] for that. \cr #' **Note:** When ampicillin (AMP, J01CA01) is not available but amoxicillin (AMX, J01CA04) is, the latter will be used for all rules where there is a dependency on ampicillin. These drugs are interchangeable when it comes to expression of antimicrobial resistance. #' -#' Before further processing, some non-EUCAST rules can be applied to improve the efficacy of the EUCAST rules. These non-EUCAST rules, that are then applied to all isolates, are: -#' - Inherit amoxicillin (AMX) from ampicillin (AMP), where amoxicillin (AMX) is unavailable; -#' - Inherit ampicillin (AMP) from amoxicillin (AMX), where ampicillin (AMP) is unavailable; -#' - Set amoxicillin (AMX) = R where amoxicillin/clavulanic acid (AMC) = R; -#' - Set piperacillin (PIP) = R where piperacillin/tazobactam (TZP) = R; -#' - Set trimethoprim (TMP) = R where trimethoprim/sulfamethoxazole (SXT) = R; -#' - Set amoxicillin/clavulanic acid (AMC) = S where amoxicillin (AMX) = S; -#' - Set piperacillin/tazobactam (TZP) = S where piperacillin (PIP) = S; -#' - Set trimethoprim/sulfamethoxazole (SXT) = S where trimethoprim (TMP) = S. +#' Before further processing, two non-EUCAST rules about drug combinations can be applied to improve the efficacy of the EUCAST rules. These rules are: #' -#' These rules are not applied at default, since they are not approved by EUCAST. To use these rules, please use `eucast_rules(..., rules = "all")`, or set the default behaviour of the `[eucast_rules()]` function with `options(AMR.eucast_rules = "all")` (or any other valid input value(s) to the `rules` parameter). +#' 1. A drug **with** enzyme inhibitor will be set to S if the drug **without** enzyme inhibitor is S +#' 2. A drug **without** enzyme inhibitor will be set to R if the drug **with** enzyme inhibitor is R +#' +#' These rules are not applied at default, since they are not approved by EUCAST. To use these rules, use `eucast_rules(..., rules = "all")`, or set the default behaviour of the `[eucast_rules()]` function with `options(AMR.eucast_rules = "all")` (or any other valid input value(s) to the `rules` parameter). #' #' The file containing all EUCAST rules is located here: . #' diff --git a/R/globals.R b/R/globals.R index a86baa5c6..74f68be9e 100755 --- a/R/globals.R +++ b/R/globals.R @@ -19,9 +19,11 @@ # Visit our website for more info: https://msberends.github.io/AMR. # # ==================================================================== # -globalVariables(c("ab", +globalVariables(c(".rowid", + "ab", "ab_txt", "angle", + "antibiotic", "antibiotics", "atc_group1", "atc_group2", @@ -35,9 +37,11 @@ globalVariables(c("ab", "group", "hjust", "input", + "intrinsic_resistant", "isolates", "lang", "lookup", + "microorganism", "microorganisms", "microorganisms.codes", "microorganisms.old", diff --git a/R/zzz.R b/R/zzz.R index 574f5bb44..1e0738015 100755 --- a/R/zzz.R +++ b/R/zzz.R @@ -29,6 +29,8 @@ envir = asNamespace("AMR")) # support for tibble headers (type_sum) and tibble columns content (pillar_shaft) + s3_register("pillar::pillar_shaft", "ab") + s3_register("tibble::type_sum", "ab") s3_register("pillar::pillar_shaft", "mo") s3_register("tibble::type_sum", "mo") s3_register("pillar::pillar_shaft", "rsi") @@ -87,7 +89,7 @@ create_MO.old_lookup <- function() { } # copied from vctrs::s3_register -s3_register <- function (generic, class, method = NULL) { +s3_register <- function(generic, class, method = NULL) { stopifnot(is.character(generic), length(generic) == 1) stopifnot(is.character(class), length(class) == 1) pieces <- strsplit(generic, "::")[[1]] diff --git a/data-raw/antibiotics.dta b/data-raw/antibiotics.dta index 18d7005ab..3f94d9065 100644 Binary files a/data-raw/antibiotics.dta and b/data-raw/antibiotics.dta differ diff --git a/data-raw/antibiotics.sas b/data-raw/antibiotics.sas index 9950b6efc..a6b663161 100644 Binary files a/data-raw/antibiotics.sas and b/data-raw/antibiotics.sas differ diff --git a/data-raw/antibiotics.sav b/data-raw/antibiotics.sav index c6f4a0996..5ec52cbd0 100644 Binary files a/data-raw/antibiotics.sav and b/data-raw/antibiotics.sav differ diff --git a/data-raw/antibiotics.xlsx b/data-raw/antibiotics.xlsx index d7a6a8da9..298927ef6 100644 Binary files a/data-raw/antibiotics.xlsx and b/data-raw/antibiotics.xlsx differ diff --git a/data-raw/antivirals.dta b/data-raw/antivirals.dta index 809ba3cfd..4c4ede05c 100644 Binary files a/data-raw/antivirals.dta and b/data-raw/antivirals.dta differ diff --git a/data-raw/antivirals.sas b/data-raw/antivirals.sas index d12212310..ff8cdd0b7 100644 Binary files a/data-raw/antivirals.sas and b/data-raw/antivirals.sas differ diff --git a/data-raw/antivirals.sav b/data-raw/antivirals.sav index 4ba9e8852..6561d9d28 100644 Binary files a/data-raw/antivirals.sav and b/data-raw/antivirals.sav differ diff --git a/data-raw/antivirals.xlsx b/data-raw/antivirals.xlsx index 9a47392cf..58d46c734 100644 Binary files a/data-raw/antivirals.xlsx and b/data-raw/antivirals.xlsx differ diff --git a/data-raw/intrinsic_resistant.dta b/data-raw/intrinsic_resistant.dta index 6be0a3960..57e639d0e 100644 Binary files a/data-raw/intrinsic_resistant.dta and b/data-raw/intrinsic_resistant.dta differ diff --git a/data-raw/intrinsic_resistant.sas b/data-raw/intrinsic_resistant.sas index f3a19afde..b6dbe2ca9 100644 Binary files a/data-raw/intrinsic_resistant.sas and b/data-raw/intrinsic_resistant.sas differ diff --git a/data-raw/intrinsic_resistant.sav b/data-raw/intrinsic_resistant.sav index c9baa1072..53fd6664b 100644 Binary files a/data-raw/intrinsic_resistant.sav and b/data-raw/intrinsic_resistant.sav differ diff --git a/data-raw/intrinsic_resistant.xlsx b/data-raw/intrinsic_resistant.xlsx index 88a869f59..db36c3c22 100644 Binary files a/data-raw/intrinsic_resistant.xlsx and b/data-raw/intrinsic_resistant.xlsx differ diff --git a/data-raw/microorganisms.dta b/data-raw/microorganisms.dta index 478b99179..1328140a6 100644 Binary files a/data-raw/microorganisms.dta and b/data-raw/microorganisms.dta differ diff --git a/data-raw/microorganisms.old.dta b/data-raw/microorganisms.old.dta index eeec94b21..d1f9430fc 100644 Binary files a/data-raw/microorganisms.old.dta and b/data-raw/microorganisms.old.dta differ diff --git a/data-raw/microorganisms.old.sas b/data-raw/microorganisms.old.sas index 0d6080ed6..df1176c10 100644 Binary files a/data-raw/microorganisms.old.sas and b/data-raw/microorganisms.old.sas differ diff --git a/data-raw/microorganisms.old.sav b/data-raw/microorganisms.old.sav index 7569d9ca7..8aa0b28f1 100644 Binary files a/data-raw/microorganisms.old.sav and b/data-raw/microorganisms.old.sav differ diff --git a/data-raw/microorganisms.old.xlsx b/data-raw/microorganisms.old.xlsx index 47b09d06b..cf0be9843 100644 Binary files a/data-raw/microorganisms.old.xlsx and b/data-raw/microorganisms.old.xlsx differ diff --git a/data-raw/microorganisms.sas b/data-raw/microorganisms.sas index ae64b298c..950fc4591 100644 Binary files a/data-raw/microorganisms.sas and b/data-raw/microorganisms.sas differ diff --git a/data-raw/microorganisms.sav b/data-raw/microorganisms.sav index 089a5a750..3ddd1a2bc 100644 Binary files a/data-raw/microorganisms.sav and b/data-raw/microorganisms.sav differ diff --git a/data-raw/microorganisms.xlsx b/data-raw/microorganisms.xlsx index f6a3f80c5..525118083 100644 Binary files a/data-raw/microorganisms.xlsx and b/data-raw/microorganisms.xlsx differ diff --git a/data-raw/rsi_translation.dta b/data-raw/rsi_translation.dta index 91b9b34f3..aafb6513b 100644 Binary files a/data-raw/rsi_translation.dta and b/data-raw/rsi_translation.dta differ diff --git a/data-raw/rsi_translation.sas b/data-raw/rsi_translation.sas index c707b95a9..e760c7ae8 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 2cea4cf83..8f3af7e99 100644 Binary files a/data-raw/rsi_translation.sav and b/data-raw/rsi_translation.sav differ diff --git a/data-raw/rsi_translation.xlsx b/data-raw/rsi_translation.xlsx index 12573e17c..6d30b389f 100644 Binary files a/data-raw/rsi_translation.xlsx and b/data-raw/rsi_translation.xlsx differ diff --git a/docs/404.html b/docs/404.html index ad154d90f..ba608dbc6 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9007 + 1.3.0.9008 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 37c046d98..3426713a5 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9007 + 1.3.0.9008 diff --git a/docs/articles/index.html b/docs/articles/index.html index 7879e8c50..8240a25b4 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9007 + 1.3.0.9008 diff --git a/docs/authors.html b/docs/authors.html index c05ee22ee..b30cf69a1 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9007 + 1.3.0.9008 diff --git a/docs/index.html b/docs/index.html index 05ddf3403..8c5cf54e1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.3.0.9007 + 1.3.0.9008 diff --git a/docs/news/index.html b/docs/news/index.html index a8db57fed..6df18f1a3 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9007 + 1.3.0.9008 @@ -236,9 +236,9 @@ Source: NEWS.md -
-

-AMR 1.3.0.9007 Unreleased +
+

+AMR 1.3.0.9008 Unreleased

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 6eccbc84b..66658eda6 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 2.7.3 pkgdown: 1.5.1.9000 pkgdown_sha: eae56f08694abebf93cdfc0dd8e9ede06d8c815f articles: [] -last_built: 2020-08-26T09:09Z +last_built: 2020-08-26T13:33Z urls: reference: https://msberends.github.io/AMR/reference article: https://msberends.github.io/AMR/articles diff --git a/docs/reference/eucast_rules.html b/docs/reference/eucast_rules.html index 37cecdd0f..f43976ce0 100644 --- a/docs/reference/eucast_rules.html +++ b/docs/reference/eucast_rules.html @@ -83,7 +83,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied AMR (for R) - 1.3.0.9007 + 1.3.0.9008

@@ -302,18 +302,12 @@ Leclercq et al. EUCAST expert rules in antimicrobial susceptibility test

Note: This function does not translate MIC values to RSI values. Use as.rsi() for that.
Note: When ampicillin (AMP, J01CA01) is not available but amoxicillin (AMX, J01CA04) is, the latter will be used for all rules where there is a dependency on ampicillin. These drugs are interchangeable when it comes to expression of antimicrobial resistance.

-

Before further processing, some non-EUCAST rules can be applied to improve the efficacy of the EUCAST rules. These non-EUCAST rules, that are then applied to all isolates, are:

    -
  • Inherit amoxicillin (AMX) from ampicillin (AMP), where amoxicillin (AMX) is unavailable;

  • -
  • Inherit ampicillin (AMP) from amoxicillin (AMX), where ampicillin (AMP) is unavailable;

  • -
  • Set amoxicillin (AMX) = R where amoxicillin/clavulanic acid (AMC) = R;

  • -
  • Set piperacillin (PIP) = R where piperacillin/tazobactam (TZP) = R;

  • -
  • Set trimethoprim (TMP) = R where trimethoprim/sulfamethoxazole (SXT) = R;

  • -
  • Set amoxicillin/clavulanic acid (AMC) = S where amoxicillin (AMX) = S;

  • -
  • Set piperacillin/tazobactam (TZP) = S where piperacillin (PIP) = S;

  • -
  • Set trimethoprim/sulfamethoxazole (SXT) = S where trimethoprim (TMP) = S.

  • -
+

Before further processing, two non-EUCAST rules about drug combinations can be applied to improve the efficacy of the EUCAST rules. These rules are:

    +
  1. A drug with enzyme inhibitor will be set to S if the drug without enzyme inhibitor is S

  2. +
  3. A drug without enzyme inhibitor will be set to R if the drug with enzyme inhibitor is R

  4. +
-

These rules are not applied at default, since they are not approved by EUCAST. To use these rules, please use eucast_rules(..., rules = "all"), or set the default behaviour of the [eucast_rules()] function with options(AMR.eucast_rules = "all") (or any other valid input value(s) to the rules parameter).

+

These rules are not applied at default, since they are not approved by EUCAST. To use these rules, use eucast_rules(..., rules = "all"), or set the default behaviour of the [eucast_rules()] function with options(AMR.eucast_rules = "all") (or any other valid input value(s) to the rules parameter).

The file containing all EUCAST rules is located here: https://github.com/msberends/AMR/blob/master/data-raw/eucast_rules.tsv.

Antibiotics

diff --git a/docs/reference/index.html b/docs/reference/index.html index 24667a88d..be755b359 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9007 + 1.3.0.9008
diff --git a/docs/survey.html b/docs/survey.html index b04f90ffe..4d912bd7b 100644 --- a/docs/survey.html +++ b/docs/survey.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9007 + 1.3.0.9008

diff --git a/man/eucast_rules.Rd b/man/eucast_rules.Rd index c418ed3c9..a75178bc8 100644 --- a/man/eucast_rules.Rd +++ b/man/eucast_rules.Rd @@ -50,19 +50,13 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied \strong{Note:} This function does not translate MIC values to RSI values. Use \code{\link[=as.rsi]{as.rsi()}} for that. \cr \strong{Note:} When ampicillin (AMP, J01CA01) is not available but amoxicillin (AMX, J01CA04) is, the latter will be used for all rules where there is a dependency on ampicillin. These drugs are interchangeable when it comes to expression of antimicrobial resistance. -Before further processing, some non-EUCAST rules can be applied to improve the efficacy of the EUCAST rules. These non-EUCAST rules, that are then applied to all isolates, are: -\itemize{ -\item Inherit amoxicillin (AMX) from ampicillin (AMP), where amoxicillin (AMX) is unavailable; -\item Inherit ampicillin (AMP) from amoxicillin (AMX), where ampicillin (AMP) is unavailable; -\item Set amoxicillin (AMX) = R where amoxicillin/clavulanic acid (AMC) = R; -\item Set piperacillin (PIP) = R where piperacillin/tazobactam (TZP) = R; -\item Set trimethoprim (TMP) = R where trimethoprim/sulfamethoxazole (SXT) = R; -\item Set amoxicillin/clavulanic acid (AMC) = S where amoxicillin (AMX) = S; -\item Set piperacillin/tazobactam (TZP) = S where piperacillin (PIP) = S; -\item Set trimethoprim/sulfamethoxazole (SXT) = S where trimethoprim (TMP) = S. +Before further processing, two non-EUCAST rules about drug combinations can be applied to improve the efficacy of the EUCAST rules. These rules are: +\enumerate{ +\item A drug \strong{with} enzyme inhibitor will be set to S if the drug \strong{without} enzyme inhibitor is S +\item A drug \strong{without} enzyme inhibitor will be set to R if the drug \strong{with} enzyme inhibitor is R } -These rules are not applied at default, since they are not approved by EUCAST. To use these rules, please use \code{eucast_rules(..., rules = "all")}, or set the default behaviour of the \verb{[eucast_rules()]} function with \code{options(AMR.eucast_rules = "all")} (or any other valid input value(s) to the \code{rules} parameter). +These rules are not applied at default, since they are not approved by EUCAST. To use these rules, use \code{eucast_rules(..., rules = "all")}, or set the default behaviour of the \verb{[eucast_rules()]} function with \code{options(AMR.eucast_rules = "all")} (or any other valid input value(s) to the \code{rules} parameter). The file containing all EUCAST rules is located here: \url{https://github.com/msberends/AMR/blob/master/data-raw/eucast_rules.tsv}. } diff --git a/tests/testthat/test-mo_property.R b/tests/testthat/test-mo_property.R index 81e81d854..0f7a60a88 100644 --- a/tests/testthat/test-mo_property.R +++ b/tests/testthat/test-mo_property.R @@ -54,7 +54,7 @@ test_that("mo_property works", { expect_equal(mo_year("Escherichia coli"), 1919) expect_equal(mo_shortname("Escherichia coli"), "E. coli") - expect_equal(mo_shortname("Escherichia"), "E. spp.") + expect_equal(mo_shortname("Escherichia"), "Escherichia") expect_equal(mo_shortname("Staphylococcus aureus"), "S. aureus") expect_equal(mo_shortname("Staphylococcus aureus", Becker = TRUE), "S. aureus") expect_equal(mo_shortname("Staphylococcus aureus", Becker = "all", language = "en"), "CoPS")