diff --git a/DESCRIPTION b/DESCRIPTION index 7636222b..02a971ed 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.1.0.9014 -Date: 2020-05-19 +Version: 1.1.0.9015 +Date: 2020-05-20 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index 3b30ebbd..ef77ddd9 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,18 +1,18 @@ -# AMR 1.1.0.9014 -## Last updated: 19-May-2020 +# AMR 1.1.0.9015 +## Last updated: 20-May-2020 ### Breaking -* Removed code dependency on all other R packages: `cleaner`, `crayon`, `data.table`, `dplyr`, `ggplot2`, `knitr`, `microbenchmark`, `pillar`, `R6`, `rlang`, `tidyr` and `vctrs`. This is a major code change, but will probably not be noticeable by most users. +* Removed code dependency on all other R packages, making this package fully independent on the development process of others. This is a major code change, but will probably not be noticeable by most users. - Making this package independent on especially the tidyverse tremendously increases sustainability on the long term, since tidyverse functions change quite often. 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. - + Making this package independent on especially the tidyverse 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: * Function `freq()` that was borrowed from the `cleaner` package was removed. Use `cleaner::freq()`, or run `library("cleaner")` before you use `freq()`. - * Printing values of class `mo` or `ab` in a tibble will no longer be in colour. + * Printing values of class `mo` or `ab` in a tibble will no longer be in colour and printing `rsi` in a tibble will show the class ``, not `` anymore. This is purely a visual effect. * All functions from the `mo_*` family (like `mo_name()` and `mo_gramstain()`) are noticeably slower when running on hundreds of thousands of rows. * For developers: classes `mo` and `ab` now both also inherit class `character`, to support any data transformation. This change invalidates code that checks for class length == 1. ### Changed +* The EUCAST rules function (`eucast_rules()`) at default no longer applies "other" rules that are made available by this package (like setting ampicillin = R when ampicillin + enzym inhibitor = R). The default input value for `rules` is now `c("breakpoints", "expert")` instead of `"all"`, but this can be changed by the user. To return to the old behaviour, set `options(AMR.eucast_rules = "all")`. * Small fix for some text input that could not be coerced as valid MIC values * Fix for cases where some functions of newer versions of the `dplyr` package (such as `bind_rows()`) would not preserve the right class for microorganisms (class `mo`) and antibiotics (class `ab`) * Fixed interpretation of generic CLSI interpretation rules (thanks to Anthony Underwood) @@ -20,7 +20,7 @@ ### Other * Removed previously deprecated function `p.symbol()` - it was replaced with `p_symbol()` -* Removed function `read.4d()`, that was only useful for reading from an old test database. +* Removed function `read.4d()`, that was only useful for reading data from an old test database. # AMR 1.1.0 diff --git a/R/eucast_rules.R b/R/eucast_rules.R index 150606c2..cc5f68e5 100755 --- a/R/eucast_rules.R +++ b/R/eucast_rules.R @@ -26,13 +26,13 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016" #' Apply EUCAST rules #' #' @description -#' Apply susceptibility rules as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, ), see *Source*. This includes (1) expert rules, (2) intrinsic resistance and (3) inferred resistance as defined in their breakpoint tables. +#' Apply susceptibility rules as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, ), see *Source*. This includes (1) expert rules and intrinsic resistance and (2) inferred resistance as defined in their breakpoint tables. #' #' To improve the interpretation of the antibiogram before EUCAST rules are applied, some non-EUCAST rules are applied at default, see Details. #' @inheritSection lifecycle Maturing lifecycle #' @param x data with antibiotic columns, like e.g. `AMX` and `AMC` #' @param info print progress -#' @param rules a character vector that specifies which rules should be applied - one or more of `c("breakpoints", "expert", "other", "all")` +#' @param rules a character vector that specifies which rules should be applied. Must be one or more of `"breakpoints"`, `"expert"`, `"other"`, `"all"`, and defaults to `c("breakpoints", "expert")`. The default value can be set to another value using e.g. `options(AMR.eucast_rules = "all")`. #' @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. #' @param ... column name of an antibiotic, please see section *Antibiotics* below #' @inheritParams first_isolate @@ -40,7 +40,7 @@ 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 are applied to improve the efficacy of the EUCAST rules. These non-EUCAST rules, that are applied to all isolates, are: +#' 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; @@ -50,7 +50,7 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016" #' - Set piperacillin/tazobactam (TZP) = S where piperacillin (PIP) = S; #' - Set trimethoprim/sulfamethoxazole (SXT) = S where trimethoprim (TMP) = S. #' -#' To *not* use these rules, please use `eucast_rules(..., rules = c("breakpoints", "expert"))`. +#' 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). #' #' The file containing all EUCAST rules is located here: . #' @@ -195,7 +195,7 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016" eucast_rules <- function(x, col_mo = NULL, info = interactive(), - rules = c("breakpoints", "expert", "other", "all"), + rules = getOption("AMR.eucast_rules", default = c("breakpoints", "expert")), verbose = FALSE, ...) { @@ -231,7 +231,7 @@ eucast_rules <- function(x, } if (!all(rules %in% c("breakpoints", "expert", "other", "all"))) { - stop("`rules` must be one or more of: 'breakpoints', 'expert', 'other', 'all'.") + stop('`rules` must be one or more of: "breakpoints", "expert", "other", "all".') } if (is.null(col_mo)) { @@ -599,6 +599,10 @@ eucast_rules <- function(x, } } + if (!any(c("other", "all") %in% rules, na.rm = TRUE)) { + cat(font_red("\nSkipping inheritance rules defined by this package, such as setting trimethoprim (TMP) = R where trimethoprim/sulfamethoxazole (SXT) = R.\nUse eucast_rules(..., rules = \"all\") to also apply those rules.\n")) + } + eucast_notification_shown <- FALSE eucast_rules_df <- eucast_rules_file # internal data file no_added <- 0 @@ -658,7 +662,7 @@ eucast_rules <- function(x, rule_group_current %like% "expert", paste0("\nEUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (", font_red(paste0("v", EUCAST_VERSION_EXPERT_RULES)), ")\n"), - "\nOther rules by this AMR package (turn on/off with 'rules' parameter)\n")))) + "\nOther rules by this AMR package\n")))) } # Print rule ------------------------------------------------------------- if (rule_current != rule_previous) { diff --git a/docs/404.html b/docs/404.html index 769e3500..d911055f 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9014 + 1.1.0.9015 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 11879079..affda865 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9014 + 1.1.0.9015 diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index 6b1e2c66..fd2e26e5 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -39,7 +39,7 @@ AMR (for R) - 1.1.0.9014 + 1.1.0.9015 @@ -186,7 +186,7 @@

How to conduct AMR analysis

Matthijs S. Berends

-

19 May 2020

+

20 May 2020

Source: vignettes/AMR.Rmd @@ -195,7 +195,7 @@ -

Note: values on this page will change with every website update since they are based on randomly created values and the page was written in R Markdown. However, the methodology remains unchanged. This page was generated on 19 May 2020.

+

Note: values on this page will change with every website update since they are based on randomly created values and the page was written in R Markdown. However, the methodology remains unchanged. This page was generated on 20 May 2020.

Introduction

@@ -226,21 +226,21 @@ -2020-05-19 +2020-05-20 abcd Escherichia coli S S -2020-05-19 +2020-05-20 abcd Escherichia coli S R -2020-05-19 +2020-05-20 efgh Escherichia coli R @@ -336,42 +336,42 @@ -2017-01-17 -W7 +2013-03-27 +L8 Hospital B -Staphylococcus aureus -S -S -S -S -F - - -2017-01-15 -S1 -Hospital A -Escherichia coli +Streptococcus pneumoniae R S S S -F +M + + +2015-12-30 +K1 +Hospital B +Staphylococcus aureus +S +S +R +S +M -2014-03-03 -F8 +2016-06-06 +D3 +Hospital B +Staphylococcus aureus +S +S +R +S +M + + +2011-07-04 +H10 Hospital D -Staphylococcus aureus -R -S -S -S -M - - -2013-10-12 -K3 -Hospital B Escherichia coli S S @@ -380,27 +380,27 @@ M -2017-07-30 -Y4 +2012-04-12 +M3 Hospital B -Escherichia coli -R -S -R -S -F - - -2011-01-18 -B4 -Hospital C Staphylococcus aureus -S -S R S +S +S M + +2017-03-06 +S4 +Hospital C +Escherichia coli +S +S +S +S +F +

Now, let’s start the cleaning and the analysis!

@@ -432,16 +432,16 @@ Longest: 1

1 M -10,336 -51.68% -10,336 -51.68% +10,319 +51.60% +10,319 +51.60% 2 F -9,664 -48.32% +9,681 +48.41% 20,000 100.00% @@ -456,7 +456,11 @@ Longest: 1

mutate_at(vars(AMX:GEN), as.rsi)

Finally, we will apply EUCAST rules on our antimicrobial results. In Europe, most medical microbiological laboratories already apply these rules. Our package features their latest insights on intrinsic resistance and exceptional phenotypes. Moreover, the eucast_rules() function can also apply additional rules, like forcing ampicillin = R when amoxicillin/clavulanic acid = R.

Because the amoxicillin (column AMX) and amoxicillin/clavulanic acid (column AMC) in our data were generated randomly, some rows will undoubtedly contain AMX = S and AMC = R, which is technically impossible. The eucast_rules() fixes this:

-
data <- eucast_rules(data, col_mo = "bacteria")
+
data <- eucast_rules(data, col_mo = "bacteria")
+# [31m
+# Skipping inheritance rules defined by this package, such as setting trimethoprim (TMP) = R where trimethoprim/sulfamethoxazole (SXT) = R.
+# Use eucast_rules(..., rules = "all") to also apply those rules.
+# [39m

@@ -481,7 +485,7 @@ Longest: 1

# [34mNOTE: Using column `[1mbacteria[22m` as input for `col_mo`.[39m # [34mNOTE: Using column `[1mdate[22m` as input for `col_date`.[39m # [34mNOTE: Using column `[1mpatient_id[22m` as input for `col_patient_id`.[39m

-

So only 28.3% is suitable for resistance analysis! We can now filter on it with the filter() function, also from the dplyr package:

+

So only 28.5% is suitable for resistance analysis! We can now filter on it with the filter() function, also from the dplyr package:

data_1st <- data %>%
   filter(first == TRUE)

For future use, the above two syntaxes can be shortened with the filter_first_isolate() function:

@@ -491,7 +495,7 @@ Longest: 1

First weighted isolates

-

We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient T4, sorted on date:

+

We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient S1, sorted on date:

@@ -507,19 +511,19 @@ Longest: 1

- - + + - + + - - - + + @@ -529,95 +533,95 @@ Longest: 1

- - + + - + - - + + - + - - + + - + - - + + + - - + - - + + - + - + - - + + - + + - - - + + - + - - + + - +
isolate
12010-02-08T42010-02-10S1 B_ESCHR_COLIRSS S RS TRUE
22010-03-28T42010-02-27S1 B_ESCHR_COLI R S
32010-06-15T42010-03-05S1 B_ESCHR_COLI S SSR S FALSE
42010-07-21T42010-04-03S1 B_ESCHR_COLI S SRS S FALSE
52011-01-20T42010-05-22S1 B_ESCHR_COLI RSR R S FALSE
62011-04-24T42010-07-19S1 B_ESCHR_COLI SI S SSTRUEFALSE
72011-06-20T42010-07-19S1 B_ESCHR_COLIIS S RRS FALSE
82011-06-23T42010-08-28S1 B_ESCHR_COLIRIS S SR FALSE
92011-09-20T42010-09-09S1 B_ESCHR_COLI RS R SS FALSE
102011-10-08T42010-09-20S1 B_ESCHR_COLI S SRS S FALSE
-

Only 2 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The key_antibiotics() function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.

+

Only 1 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The key_antibiotics() function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.

If a column exists with a name like ‘key(…)ab’ the first_isolate() function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:

data <- data %>%
   mutate(keyab = key_antibiotics(.)) %>%
@@ -643,20 +647,20 @@ Longest: 1

1 -2010-02-08 -T4 +2010-02-10 +S1 B_ESCHR_COLI -R +S +S S R -S TRUE TRUE 2 -2010-03-28 -T4 +2010-02-27 +S1 B_ESCHR_COLI R S @@ -667,35 +671,35 @@ Longest: 1

3 -2010-06-15 -T4 +2010-03-05 +S1 B_ESCHR_COLI S S -S +R S FALSE TRUE 4 -2010-07-21 -T4 +2010-04-03 +S1 B_ESCHR_COLI S S -R +S S FALSE TRUE 5 -2011-01-20 -T4 +2010-05-22 +S1 B_ESCHR_COLI R -S +R R S FALSE @@ -703,71 +707,71 @@ Longest: 1

6 -2011-04-24 -T4 +2010-07-19 +S1 B_ESCHR_COLI S +I S S -S -TRUE +FALSE TRUE 7 -2011-06-20 -T4 +2010-07-19 +S1 B_ESCHR_COLI -I +S S R -R +S FALSE TRUE 8 -2011-06-23 -T4 +2010-08-28 +S1 B_ESCHR_COLI -R +I +S S S -R FALSE TRUE 9 -2011-09-20 -T4 +2010-09-09 +S1 B_ESCHR_COLI R -S R S +S FALSE TRUE 10 -2011-10-08 -T4 +2010-09-20 +S1 B_ESCHR_COLI S S -R +S S FALSE TRUE -

Instead of 2, now 10 isolates are flagged. In total, 75.2% of all isolates are marked ‘first weighted’ - 46.9% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.

+

Instead of 1, now 10 isolates are flagged. In total, 78.4% of all isolates are marked ‘first weighted’ - 49.9% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.

As with filter_first_isolate(), there’s a shortcut for this new algorithm too:

data_1st <- data %>%
   filter_first_weighted_isolate()
-

So we end up with 15,048 isolates for analysis.

+

So we end up with 15,684 isolates for analysis.

We can remove unneeded columns:

data_1st <- data_1st %>%
   select(-c(first, keyab))
@@ -793,46 +797,46 @@ Longest: 1

1 -2017-01-17 -W7 +2013-03-27 +L8 +Hospital B +B_STRPT_PNMN +R +R +S +R +M +Gram-positive +Streptococcus +pneumoniae +TRUE + + +2 +2015-12-30 +K1 Hospital B B_STPHY_AURS S S +R S -S -F +M Gram-positive Staphylococcus aureus TRUE - -2 -2017-01-15 -S1 -Hospital A -B_ESCHR_COLI -R -S -S -S -F -Gram-negative -Escherichia -coli -TRUE - 3 -2014-03-03 -F8 -Hospital D +2016-06-06 +D3 +Hospital B B_STPHY_AURS +S +S R S -S -S M Gram-positive Staphylococcus @@ -840,16 +844,16 @@ Longest: 1

TRUE -5 -2017-07-30 -Y4 -Hospital B +4 +2011-07-04 +H10 +Hospital D B_ESCHR_COLI -R S -R S -F +S +S +M Gram-negative Escherichia coli @@ -857,34 +861,34 @@ Longest: 1

6 -2011-01-18 -B4 +2017-03-06 +S4 Hospital C -B_STPHY_AURS +B_ESCHR_COLI S S -R S -M -Gram-positive -Staphylococcus -aureus +S +F +Gram-negative +Escherichia +coli TRUE 7 -2013-05-01 -G7 -Hospital B -B_STRPT_PNMN -I -I +2014-08-08 +C5 +Hospital C +B_ESCHR_COLI R +S R +S M -Gram-positive -Streptococcus -pneumoniae +Gram-negative +Escherichia +coli TRUE @@ -906,8 +910,8 @@ Longest: 1

data_1st %>% freq(genus, species)

Frequency table

Class: character
-Length: 15,048
-Available: 15,048 (100%, NA: 0 = 0%)
+Length: 15,684
+Available: 15,684 (100%, NA: 0 = 0%)
Unique: 4

Shortest: 16
Longest: 24

@@ -924,33 +928,33 @@ Longest: 24

1 Escherichia coli -7,376 -49.02% -7,376 -49.02% +7,819 +49.85% +7,819 +49.85% 2 Staphylococcus aureus -3,819 -25.38% -11,195 -74.40% +3,992 +25.45% +11,811 +75.31% 3 Streptococcus pneumoniae -2,330 -15.48% -13,525 -89.88% +2,332 +14.87% +14,143 +90.17% 4 Klebsiella pneumoniae -1,523 -10.12% -15,048 +1,541 +9.83% +15,684 100.00% @@ -962,7 +966,7 @@ Longest: 24

The functions resistance() and susceptibility() can be used to calculate antimicrobial resistance or susceptibility. For more specific analyses, the functions proportion_S(), proportion_SI(), proportion_I(), proportion_IR() and proportion_R() can be used to determine the proportion of a specific antimicrobial outcome.

As per the EUCAST guideline of 2019, we calculate resistance as the proportion of R (proportion_R(), equal to resistance()) and susceptibility as the proportion of S and I (proportion_SI(), equal to susceptibility()). These functions can be used on their own:

data_1st %>% resistance(AMX)
-# [1] 0.4628522
+# [1] 0.4410227

Or can be used in conjuction with group_by() and summarise(), both from the dplyr package:

data_1st %>%
   group_by(hospital) %>%
@@ -975,19 +979,19 @@ Longest: 24

Hospital A -0.4566180 +0.4448217 Hospital B -0.4606292 +0.4476345 Hospital C -0.4775330 +0.4299828 Hospital D -0.4650083 +0.4317450 @@ -1005,23 +1009,23 @@ Longest: 24

Hospital A -0.4566180 -4518 +0.4448217 +4712 Hospital B -0.4606292 -5245 +0.4476345 +5538 Hospital C -0.4775330 -2270 +0.4299828 +2328 Hospital D -0.4650083 -3015 +0.4317450 +3106 @@ -1041,27 +1045,27 @@ Longest: 24

Escherichia -0.9197397 -0.8889642 -0.9940347 +0.8199258 +0.8988362 +0.9842691 Klebsiella -0.9277741 -0.8929744 -0.9954038 +0.8189487 +0.8916288 +0.9857236 Staphylococcus -0.9316575 -0.9279916 -0.9963341 +0.8166333 +0.9170842 +0.9857214 Streptococcus -0.6253219 +0.6170669 0.0000000 -0.6253219 +0.6170669 diff --git a/docs/articles/AMR_files/figure-html/plot 1-1.png b/docs/articles/AMR_files/figure-html/plot 1-1.png index 8f26ee84..19550a37 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 1-1.png and b/docs/articles/AMR_files/figure-html/plot 1-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 3-1.png b/docs/articles/AMR_files/figure-html/plot 3-1.png index 1c6981ed..1d621764 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 3-1.png and b/docs/articles/AMR_files/figure-html/plot 3-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 4-1.png b/docs/articles/AMR_files/figure-html/plot 4-1.png index 37a7354b..ac2e0534 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 4-1.png and b/docs/articles/AMR_files/figure-html/plot 4-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 5-1.png b/docs/articles/AMR_files/figure-html/plot 5-1.png index 04fb1999..9d2bb5cb 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 5-1.png and b/docs/articles/AMR_files/figure-html/plot 5-1.png differ diff --git a/docs/articles/EUCAST.html b/docs/articles/EUCAST.html index ff4e8d26..9144cfc4 100644 --- a/docs/articles/EUCAST.html +++ b/docs/articles/EUCAST.html @@ -39,7 +39,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9015
@@ -186,7 +186,7 @@

How to apply EUCAST rules

Matthijs S. Berends

-

15 April 2020

+

20 May 2020

Source: vignettes/EUCAST.Rmd @@ -208,7 +208,7 @@

Examples

These rules can be used to discard impossible bug-drug combinations in your data. For example, Klebsiella produces beta-lactamase that prevents ampicillin (or amoxicillin) from working against it. In other words, practically every strain of Klebsiella is resistant to ampicillin.

-

Sometimes, laboratory data can still contain such strains with ampicillin being susceptible to ampicillin. This could be because an antibiogram is available before an identification is available, and the antibiogram is then not re-interpreted based on the identification (namely, Klebsiella). EUCAST expert rules solve this, that can be used with eucast_rules():

+

Sometimes, laboratory data can still contain such strains with ampicillin being susceptible to ampicillin. This could be because an antibiogram is available before an identification is available, and the antibiogram is then not re-interpreted based on the identification (namely, Klebsiella). EUCAST expert rules solve this, that can be applied using eucast_rules():

oops <- data.frame(mo = c("Klebsiella",
                           "Escherichia"),
                    ampicillin = "S")
@@ -218,6 +218,10 @@
 # 2 Escherichia          S
 
 eucast_rules(oops, info = FALSE)
+# [31m
+# Skipping inheritance rules defined by this package, such as setting trimethoprim (TMP) = R where trimethoprim/sulfamethoxazole (SXT) = R.
+# Use eucast_rules(..., rules = "all") to also apply those rules.
+# [39m
 #            mo ampicillin
 # 1  Klebsiella          R
 # 2 Escherichia          S
@@ -301,6 +305,10 @@ +
# [31m
+# Skipping inheritance rules defined by this package, such as setting trimethoprim (TMP) = R where trimethoprim/sulfamethoxazole (SXT) = R.
+# Use eucast_rules(..., rules = "all") to also apply those rules.
+# [39m
@@ -383,7 +391,7 @@
-

Site built with pkgdown 1.5.0.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/articles/MDR.html b/docs/articles/MDR.html index 1f82aa67..b596ed6a 100644 --- a/docs/articles/MDR.html +++ b/docs/articles/MDR.html @@ -39,7 +39,7 @@ AMR (for R) - 1.1.0.9014 + 1.1.0.9015 @@ -186,7 +186,7 @@

How to determine multi-drug resistance (MDR)

Matthijs S. Berends

-

19 May 2020

+

20 May 2020

Source: vignettes/MDR.Rmd @@ -302,18 +302,18 @@ Unique: 2

The data set now looks like this:

head(my_TB_data)
 #   rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin
-# 1          R         R            R          R            S            R
-# 2          I         S            R          R            S            R
-# 3          S         R            R          R            I            S
-# 4          R         R            R          R            R            R
-# 5          S         R            I          R            R            R
-# 6          S         R            R          S            R            S
+# 1          R         R            R          R            S            S
+# 2          S         S            S          I            R            S
+# 3          S         R            S          I            S            I
+# 4          S         R            S          S            S            R
+# 5          R         S            R          S            S            R
+# 6          I         S            R          R            R            R
 #   kanamycin
-# 1         S
+# 1         I
 # 2         S
-# 3         S
-# 4         S
-# 5         R
+# 3         R
+# 4         I
+# 5         I
 # 6         S

We can now add the interpretation of MDR-TB to our data set. You can use:

mdro(my_TB_data, guideline = "TB")
@@ -343,40 +343,40 @@ Unique: 5

- - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - + + diff --git a/docs/articles/WHONET.html b/docs/articles/WHONET.html index 1831bacd..ce6c2ad4 100644 --- a/docs/articles/WHONET.html +++ b/docs/articles/WHONET.html @@ -39,7 +39,7 @@ AMR (for R) - 1.1.0.9014 + 1.1.0.9015 @@ -186,7 +186,7 @@

How to work with WHONET data

Matthijs S. Berends

-

19 May 2020

+

20 May 2020

Source: vignettes/WHONET.Rmd diff --git a/docs/articles/benchmarks.html b/docs/articles/benchmarks.html index b6ffc3e1..054cf9b4 100644 --- a/docs/articles/benchmarks.html +++ b/docs/articles/benchmarks.html @@ -39,7 +39,7 @@ AMR (for R) - 1.1.0.9009 + 1.1.0.9015 @@ -186,7 +186,7 @@

Benchmarks

Matthijs S. Berends

-

18 May 2020

+

20 May 2020

Source: vignettes/benchmarks.Rmd @@ -221,36 +221,21 @@ times=10) print(S.aureus, unit="ms", signif=2) # Unit: milliseconds -# expr min lq mean median uq max -# as.mo("sau") 7.5 9.0 21.0 11.0 37.0 43.0 -# as.mo("stau") 130.0 130.0 170.0 170.0 180.0 280.0 -# as.mo("STAU") 130.0 140.0 150.0 150.0 170.0 180.0 -# as.mo("staaur") 7.3 9.7 13.0 11.0 11.0 37.0 -# as.mo("STAAUR") 7.3 9.2 13.0 9.8 10.0 45.0 -# as.mo("S. aureus") 10.0 11.0 23.0 12.0 12.0 120.0 -# as.mo("S aureus") 9.9 12.0 23.0 13.0 40.0 43.0 -# as.mo("Staphylococcus aureus") 5.7 6.4 7.4 7.2 8.8 9.5 -# as.mo("Staphylococcus aureus (MRSA)") 850.0 860.0 870.0 870.0 880.0 910.0 -# as.mo("Sthafilokkockus aaureuz") 330.0 350.0 360.0 360.0 370.0 390.0 -# as.mo("MRSA") 7.7 9.2 12.0 9.7 11.0 39.0 -# as.mo("VISA") 19.0 21.0 25.0 22.0 24.0 55.0 -# as.mo("VRSA") 18.0 22.0 30.0 25.0 26.0 57.0 -# as.mo(22242419) 140.0 150.0 170.0 150.0 190.0 210.0 -# neval -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 +# expr min lq mean median uq max neval +# as.mo("sau") 8.7 9.4 13.0 9.5 11 39.0 10 +# as.mo("stau") 140.0 150.0 160.0 170.0 180 180.0 10 +# as.mo("STAU") 140.0 140.0 160.0 150.0 170 180.0 10 +# as.mo("staaur") 8.7 9.6 16.0 11.0 11 41.0 10 +# as.mo("STAAUR") 8.7 9.2 13.0 10.0 11 37.0 10 +# as.mo("S. aureus") 10.0 12.0 23.0 13.0 39 41.0 10 +# as.mo("S aureus") 9.4 10.0 11.0 11.0 12 12.0 10 +# as.mo("Staphylococcus aureus") 7.5 7.5 8.3 8.4 9 9.3 10 +# as.mo("Staphylococcus aureus (MRSA)") 890.0 930.0 940.0 940.0 950 980.0 10 +# as.mo("Sthafilokkockus aaureuz") 370.0 390.0 420.0 400.0 440 510.0 10 +# as.mo("MRSA") 8.0 8.9 15.0 10.0 11 39.0 10 +# as.mo("VISA") 20.0 21.0 36.0 25.0 53 60.0 10 +# as.mo("VRSA") 19.0 22.0 29.0 24.0 26 53.0 10 +# as.mo(22242419) 150.0 150.0 170.0 150.0 160 290.0 10

In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 100 milliseconds, this is only 10 input values per second.

To achieve this speed, the as.mo function also takes into account the prevalence of human pathogenic microorganisms. The downside of this is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of Methanosarcina semesiae (B_MTHNSR_SEMS), a bug probably never found before in humans:

@@ -263,17 +248,17 @@ print(M.semesiae, unit="ms", signif=4) # Unit: milliseconds# expr min lq mean median uq -# as.mo("metsem") 146.500 150.900 173.300 183.300 191.800 -# as.mo("METSEM") 145.700 153.400 169.300 172.300 185.300 -# as.mo("M. semesiae") 8.586 8.790 9.909 10.140 10.250 -# as.mo("M. semesiae") 8.613 8.719 12.350 9.756 10.210 -# as.mo("Methanosarcina semesiae") 6.153 6.357 9.325 6.729 7.826 -# max neval -# 193.60 10 -# 187.40 10 -# 12.52 10 -# 38.46 10 -# 31.48 10 +# as.mo("metsem") 163.900 165.300 180.600 176.600 192.600 +# as.mo("METSEM") 153.500 156.100 177.300 176.000 200.400 +# as.mo("M. semesiae") 9.155 10.250 15.980 10.800 12.790 +# as.mo("M. semesiae") 9.498 10.160 16.700 10.560 11.050 +# as.mo("Methanosarcina semesiae") 7.006 7.345 7.993 7.814 8.413 +# max neval +# 206.600 10 +# 206.800 10 +# 38.630 10 +# 46.810 10 +# 9.659 10

Looking up arbitrary codes of less prevalent microorganisms costs the most time. Full names (like Methanosarcina semesiae) are always very fast and only take some thousands of seconds to coerce - they are the most probable input from most data sets.

In the figure below, we compare Escherichia coli (which is very common) with Prevotella brevis (which is moderately common) and with Methanosarcina semesiae (which is uncommon):

@@ -308,8 +293,8 @@ print(run_it, unit="ms", signif=3) # Unit: milliseconds# expr min lq mean median uq max neval -# mo_name(x) 1660 1700 1760 1750 1810 1910 10 -

So transforming 500,000 values (!!) of 50 unique values only takes 1.75 seconds. You only lose time on your unique input values.

+# mo_name(x) 1690 1710 1770 1760 1810 1870 10 +

So transforming 500,000 values (!!) of 50 unique values only takes 1.76 seconds. You only lose time on your unique input values.

@@ -321,10 +306,10 @@ times = 10) print(run_it, unit = "ms", signif = 3) # Unit: milliseconds -# expr min lq mean median uq max neval -# A 5.650 6.030 6.36 6.430 6.660 7.130 10 -# B 9.860 9.890 14.20 10.900 11.200 46.300 10 -# C 0.232 0.237 0.30 0.302 0.355 0.369 10

+# expr min lq mean median uq max neval +# A 6.240 6.490 6.860 6.910 7.15 7.510 10 +# B 10.500 10.600 15.300 12.000 12.10 49.300 10 +# C 0.198 0.243 0.266 0.278 0.29 0.322 10

So going from mo_name("Staphylococcus aureus") to "Staphylococcus aureus" takes 0.0003 seconds - it doesn’t even start calculating if the result would be the same as the expected resulting value. That goes for all helper functions:

run_it <- microbenchmark(A = mo_species("aureus"),
                          B = mo_genus("Staphylococcus"),
@@ -338,14 +323,14 @@
 print(run_it, unit = "ms", signif = 3)
 # Unit: milliseconds
 #  expr   min    lq  mean median    uq   max neval
-#     A 0.209 0.214 0.229  0.221 0.229 0.299    10
-#     B 0.199 0.206 0.225  0.209 0.214 0.373    10
-#     C 0.201 0.207 0.217  0.213 0.222 0.247    10
-#     D 0.200 0.203 0.214  0.206 0.222 0.266    10
-#     E 0.200 0.200 0.213  0.209 0.216 0.264    10
-#     F 0.195 0.205 0.216  0.207 0.217 0.284    10
-#     G 0.191 0.194 0.206  0.203 0.206 0.261    10
-#     H 0.190 0.195 0.205  0.198 0.209 0.256    10
+# A 0.248 0.253 0.266 0.256 0.271 0.323 10 +# B 0.248 0.254 0.272 0.255 0.257 0.420 10 +# C 0.245 0.259 0.265 0.268 0.271 0.286 10 +# D 0.248 0.252 0.268 0.261 0.278 0.323 10 +# E 0.250 0.256 0.265 0.261 0.268 0.312 10 +# F 0.237 0.238 0.249 0.243 0.246 0.317 10 +# G 0.239 0.242 0.252 0.245 0.245 0.319 10 +# H 0.233 0.241 0.262 0.256 0.272 0.347 10

Of course, when running mo_phylum("Firmicutes") the function has zero knowledge about the actual microorganism, namely S. aureus. But since the result would be "Firmicutes" 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.

@@ -372,13 +357,13 @@ print(run_it, unit = "ms", signif = 4) # Unit: milliseconds # expr min lq mean median uq max neval -# en 20.58 21.00 24.57 21.31 21.81 65.96 100 -# de 21.28 21.81 25.34 22.15 22.73 62.52 100 -# nl 25.15 25.68 32.14 26.03 27.25 167.40 100 -# es 21.35 21.78 27.39 22.14 23.29 67.97 100 -# it 21.42 21.83 26.19 22.31 22.84 71.71 100 -# fr 21.43 21.82 27.43 22.25 23.39 69.29 100 -# pt 21.42 21.92 28.71 22.23 22.89 187.40 100
+# en 20.99 21.59 26.64 22.35 22.94 69.49 100 +# de 22.02 22.54 26.83 22.98 23.87 63.13 100 +# nl 25.78 26.55 34.69 27.25 28.22 182.90 100 +# es 21.92 22.67 26.97 23.26 24.01 62.68 100 +# it 21.96 22.58 25.11 22.90 23.50 66.81 100 +# fr 21.82 22.76 27.53 23.26 23.84 66.75 100 +# pt 21.76 22.56 25.84 23.13 23.90 63.63 100

Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.

diff --git a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png index 0cc40cb2..156b91b3 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-6-1.png index f7c50996..3448c009 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-6-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-6-1.png differ diff --git a/docs/articles/index.html b/docs/articles/index.html index 816c1e84..9f42f40b 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9014 + 1.1.0.9015 diff --git a/docs/authors.html b/docs/authors.html index 09b0fe6a..22eb7d12 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9014 + 1.1.0.9015 diff --git a/docs/extra.css b/docs/extra.css index 2a84d142..a141e993 100644 --- a/docs/extra.css +++ b/docs/extra.css @@ -65,7 +65,7 @@ footer p { #read-more-on-our-website-, #read-more-on-our-website- + p, li a[href="#read-more-on-our-website-"] { - display: none; + display: none !important; } /* make colour darker and better readable for links */ diff --git a/docs/index.html b/docs/index.html index 9de33bc9..6602fb14 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.1.0.9014 + 1.1.0.9015 diff --git a/docs/news/index.html b/docs/news/index.html index 49abad5f..f7d0a853 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9014 + 1.1.0.9015 @@ -229,25 +229,24 @@ Source: NEWS.md -
-

-AMR 1.1.0.9014 Unreleased +
+

+AMR 1.1.0.9015 Unreleased

-
+

-Last updated: 19-May-2020 +Last updated: 20-May-2020

Breaking

  • -

    Removed code dependency on all other R packages: cleaner, crayon, data.table, dplyr, ggplot2, knitr, microbenchmark, pillar, R6, rlang, tidyr and vctrs. This is a major code change, but will probably not be noticeable by most users.

    -

    Making this package independent on especially the tidyverse tremendously increases sustainability on the long term, since tidyverse functions change quite often. 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: +

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

    +Making this package independent on especially the tidyverse 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:
    • Function freq() that was borrowed from the cleaner package was removed. Use cleaner::freq(), or run library("cleaner") before you use freq().
    • -
    • Printing values of class mo or ab in a tibble will no longer be in colour.
    • +
    • Printing values of class mo or ab in a tibble will no longer be in colour and printing rsi in a tibble will show the class <ord>, not <rsi> anymore. This is purely a visual effect.
    • All functions from the mo_* family (like mo_name() and mo_gramstain()) are noticeably slower when running on hundreds of thousands of rows.
    • For developers: classes mo and ab now both also inherit class character, to support any data transformation. This change invalidates code that checks for class length == 1.
    @@ -258,6 +257,7 @@ Negative effects of this change are:

    Changed

      +
    • The EUCAST rules function (eucast_rules()) at default no longer applies “other” rules that are made available by this package (like setting ampicillin = R when ampicillin + enzym inhibitor = R). The default input value for rules is now c("breakpoints", "expert") instead of "all", but this can be changed by the user. To return to the old behaviour, set options(AMR.eucast_rules = "all").
    • Small fix for some text input that could not be coerced as valid MIC values
    • Fix for cases where some functions of newer versions of the dplyr package (such as bind_rows()) would not preserve the right class for microorganisms (class mo) and antibiotics (class ab)
    • Fixed interpretation of generic CLSI interpretation rules (thanks to Anthony Underwood)
    • @@ -271,7 +271,7 @@ Negative effects of this change are:
      • Removed previously deprecated function p.symbol() - it was replaced with p_symbol()
      • -
      • Removed function read.4d(), that was only useful for reading from an old test database.
      • +
      • Removed function read.4d(), that was only useful for reading data from an old test database.
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 0f0b2e44..f8afe89c 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -10,7 +10,7 @@ articles: WHONET: WHONET.html benchmarks: benchmarks.html resistance_predict: resistance_predict.html -last_built: 2020-05-19T12:15Z +last_built: 2020-05-20T09:55Z urls: reference: https://msberends.gitlab.io/AMR/reference article: https://msberends.gitlab.io/AMR/articles diff --git a/docs/reference/AMR-deprecated.html b/docs/reference/AMR-deprecated.html index b0a4bb28..71342270 100644 --- a/docs/reference/AMR-deprecated.html +++ b/docs/reference/AMR-deprecated.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9004 + 1.1.0.9015
diff --git a/docs/reference/as.disk.html b/docs/reference/as.disk.html index 723ef647..04c4631b 100644 --- a/docs/reference/as.disk.html +++ b/docs/reference/as.disk.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9007 + 1.1.0.9015
diff --git a/docs/reference/as.mic.html b/docs/reference/as.mic.html index 2457654e..109f7934 100644 --- a/docs/reference/as.mic.html +++ b/docs/reference/as.mic.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9004 + 1.1.0.9015

diff --git a/docs/reference/as.mo.html b/docs/reference/as.mo.html index d7cbf65a..e3ef3483 100644 --- a/docs/reference/as.mo.html +++ b/docs/reference/as.mo.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9004 + 1.1.0.9015 diff --git a/docs/reference/as.rsi.html b/docs/reference/as.rsi.html index 38dd93f0..cc63037f 100644 --- a/docs/reference/as.rsi.html +++ b/docs/reference/as.rsi.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9007 + 1.1.0.9015 diff --git a/docs/reference/atc_online.html b/docs/reference/atc_online.html index 81568e30..83db578b 100644 --- a/docs/reference/atc_online.html +++ b/docs/reference/atc_online.html @@ -83,7 +83,7 @@ This function requires an internet connection." /> AMR (for R) - 1.1.0.9007 + 1.1.0.9015 diff --git a/docs/reference/availability.html b/docs/reference/availability.html index 89e6340a..97fb5380 100644 --- a/docs/reference/availability.html +++ b/docs/reference/availability.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9007 + 1.1.0.9015 diff --git a/docs/reference/catalogue_of_life_version.html b/docs/reference/catalogue_of_life_version.html index 8711449d..5c066aee 100644 --- a/docs/reference/catalogue_of_life_version.html +++ b/docs/reference/catalogue_of_life_version.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9004 + 1.1.0.9015 diff --git a/docs/reference/count.html b/docs/reference/count.html index 016b3df3..857741a0 100644 --- a/docs/reference/count.html +++ b/docs/reference/count.html @@ -83,7 +83,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible( AMR (for R) - 1.1.0.9007 + 1.1.0.9015 diff --git a/docs/reference/eucast_rules.html b/docs/reference/eucast_rules.html index 780164b6..ddf2c3fd 100644 --- a/docs/reference/eucast_rules.html +++ b/docs/reference/eucast_rules.html @@ -49,7 +49,7 @@ - @@ -83,7 +83,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied AMR (for R) - 1.1.0 + 1.1.0.9015 @@ -233,7 +233,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
-

Apply susceptibility rules as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, http://eucast.org), see Source. This includes (1) expert rules, (2) intrinsic resistance and (3) inferred resistance as defined in their breakpoint tables.

+

Apply susceptibility rules as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, http://eucast.org), see Source. This includes (1) expert rules and intrinsic resistance and (2) inferred resistance as defined in their breakpoint tables.

To improve the interpretation of the antibiogram before EUCAST rules are applied, some non-EUCAST rules are applied at default, see Details.

@@ -241,7 +241,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied x, col_mo=NULL, info=interactive(), - rules=c("breakpoints", "expert", "other", "all"), + rules=getOption("AMR.eucast_rules", default=c("breakpoints", "expert")), verbose=FALSE, ... ) @@ -263,7 +263,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied - + @@ -295,7 +295,7 @@ 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 are applied to improve the efficacy of the EUCAST rules. These non-EUCAST rules, that are applied to all isolates, are:

    +

    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;

    • @@ -306,7 +306,7 @@ Leclercq et al. EUCAST expert rules in antimicrobial susceptibility test
    • Set trimethoprim/sulfamethoxazole (SXT) = S where trimethoprim (TMP) = S.

    -

    To not use these rules, please use eucast_rules(..., rules = c("breakpoints", "expert")).

    +

    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).

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

    Antibiotics

    @@ -461,7 +461,7 @@ The lifecycle of this function is maturing<
    -

    Site built with pkgdown 1.5.0.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/reference/filter_ab_class.html b/docs/reference/filter_ab_class.html index 344b1ac2..c998ca5b 100644 --- a/docs/reference/filter_ab_class.html +++ b/docs/reference/filter_ab_class.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9004 + 1.1.0.9015 diff --git a/docs/reference/first_isolate.html b/docs/reference/first_isolate.html index 5b019f91..e44c462f 100644 --- a/docs/reference/first_isolate.html +++ b/docs/reference/first_isolate.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9009 + 1.1.0.9015 diff --git a/docs/reference/ggplot_pca.html b/docs/reference/ggplot_pca.html index 154d6a0f..ea2d017d 100644 --- a/docs/reference/ggplot_pca.html +++ b/docs/reference/ggplot_pca.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9005 + 1.1.0.9015 diff --git a/docs/reference/ggplot_rsi.html b/docs/reference/ggplot_rsi.html index be325a91..a8dca305 100644 --- a/docs/reference/ggplot_rsi.html +++ b/docs/reference/ggplot_rsi.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9007 + 1.1.0.9015 diff --git a/docs/reference/index.html b/docs/reference/index.html index 6389e2ab..2791b0b7 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9014 + 1.1.0.9015 diff --git a/docs/reference/join.html b/docs/reference/join.html index 62a86c37..095e8220 100644 --- a/docs/reference/join.html +++ b/docs/reference/join.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9004 + 1.1.0.9015 diff --git a/docs/reference/key_antibiotics.html b/docs/reference/key_antibiotics.html index 7ca2c6f6..765d6a3a 100644 --- a/docs/reference/key_antibiotics.html +++ b/docs/reference/key_antibiotics.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9007 + 1.1.0.9015 diff --git a/docs/reference/like.html b/docs/reference/like.html index 0464e145..75f1eef0 100644 --- a/docs/reference/like.html +++ b/docs/reference/like.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9014 + 1.1.0.9015 @@ -308,7 +308,6 @@ The lifecycle of this function is stable# get isolates whose name start with 'Ent' or 'ent' if (FALSE) { library(dplyr) -library(cleaner) example_isolates %>% filter(mo_name(mo) %like% "^ent") } diff --git a/docs/reference/mdro.html b/docs/reference/mdro.html index dc714558..1761c813 100644 --- a/docs/reference/mdro.html +++ b/docs/reference/mdro.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9014 + 1.1.0.9015 diff --git a/docs/reference/pca.html b/docs/reference/pca.html index 81a70a4f..282fc95a 100644 --- a/docs/reference/pca.html +++ b/docs/reference/pca.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9004 + 1.1.0.9015 diff --git a/docs/reference/proportion.html b/docs/reference/proportion.html index bf9cb651..3002a0c1 100644 --- a/docs/reference/proportion.html +++ b/docs/reference/proportion.html @@ -83,7 +83,7 @@ resistance() should be used to calculate resistance, susceptibility() should be AMR (for R) - 1.1.0.9007 + 1.1.0.9015 diff --git a/docs/reference/resistance_predict.html b/docs/reference/resistance_predict.html index f8eebe60..fc27b98c 100644 --- a/docs/reference/resistance_predict.html +++ b/docs/reference/resistance_predict.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9007 + 1.1.0.9015 diff --git a/docs/reference/translate.html b/docs/reference/translate.html index e97a9da7..45cf8470 100644 --- a/docs/reference/translate.html +++ b/docs/reference/translate.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9004 + 1.1.0.9015 diff --git a/man/eucast_rules.Rd b/man/eucast_rules.Rd index c1b1f37b..315663fc 100644 --- a/man/eucast_rules.Rd +++ b/man/eucast_rules.Rd @@ -20,7 +20,7 @@ eucast_rules( x, col_mo = NULL, info = interactive(), - rules = c("breakpoints", "expert", "other", "all"), + rules = getOption("AMR.eucast_rules", default = c("breakpoints", "expert")), verbose = FALSE, ... ) @@ -32,7 +32,7 @@ eucast_rules( \item{info}{print progress} -\item{rules}{a character vector that specifies which rules should be applied - one or more of \code{c("breakpoints", "expert", "other", "all")}} +\item{rules}{a character vector that specifies which rules should be applied. Must be one or more of \code{"breakpoints"}, \code{"expert"}, \code{"other"}, \code{"all"}, and defaults to \code{c("breakpoints", "expert")}. The default value can be set to another value using e.g. \code{options(AMR.eucast_rules = "all")}.} \item{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.} @@ -42,7 +42,7 @@ eucast_rules( The input of \code{x}, possibly with edited values of antibiotics. Or, if \code{verbose = TRUE}, a \code{\link{data.frame}} with all original and new values of the affected bug-drug combinations. } \description{ -Apply susceptibility rules as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, \url{http://eucast.org}), see \emph{Source}. This includes (1) expert rules, (2) intrinsic resistance and (3) inferred resistance as defined in their breakpoint tables. +Apply susceptibility rules as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, \url{http://eucast.org}), see \emph{Source}. This includes (1) expert rules and intrinsic resistance and (2) inferred resistance as defined in their breakpoint tables. To improve the interpretation of the antibiogram before EUCAST rules are applied, some non-EUCAST rules are applied at default, see Details. } @@ -50,7 +50,7 @@ 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 are applied to improve the efficacy of the EUCAST rules. These non-EUCAST rules, that are applied to all isolates, are: +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; @@ -62,7 +62,7 @@ Before further processing, some non-EUCAST rules are applied to improve the effi \item Set trimethoprim/sulfamethoxazole (SXT) = S where trimethoprim (TMP) = S. } -To \emph{not} use these rules, please use \code{eucast_rules(..., rules = c("breakpoints", "expert"))}. +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). The file containing all EUCAST rules is located here: \url{https://gitlab.com/msberends/AMR/blob/master/data-raw/eucast_rules.tsv}. } diff --git a/pkgdown/extra.css b/pkgdown/extra.css index 2a84d142..a141e993 100644 --- a/pkgdown/extra.css +++ b/pkgdown/extra.css @@ -65,7 +65,7 @@ footer p { #read-more-on-our-website-, #read-more-on-our-website- + p, li a[href="#read-more-on-our-website-"] { - display: none; + display: none !important; } /* make colour darker and better readable for links */ diff --git a/vignettes/EUCAST.Rmd b/vignettes/EUCAST.Rmd index ae67896b..691b74ee 100644 --- a/vignettes/EUCAST.Rmd +++ b/vignettes/EUCAST.Rmd @@ -36,7 +36,7 @@ In Europe, a lot of medical microbiological laboratories already apply these rul These rules can be used to discard impossible bug-drug combinations in your data. For example, *Klebsiella* produces beta-lactamase that prevents ampicillin (or amoxicillin) from working against it. In other words, practically every strain of *Klebsiella* is resistant to ampicillin. -Sometimes, laboratory data can still contain such strains with ampicillin being susceptible to ampicillin. This could be because an antibiogram is available before an identification is available, and the antibiogram is then not re-interpreted based on the identification (namely, *Klebsiella*). EUCAST expert rules solve this, that can be used with `eucast_rules()`: +Sometimes, laboratory data can still contain such strains with ampicillin being susceptible to ampicillin. This could be because an antibiogram is available before an identification is available, and the antibiogram is then not re-interpreted based on the identification (namely, *Klebsiella*). EUCAST expert rules solve this, that can be applied using `eucast_rules()`: ```{r, warning = FALSE, message = FALSE} oops <- data.frame(mo = c("Klebsiella",
mo
1 Mono-resistant329465.88%329465.88%328865.76%328865.76%
2 Negative61312.26%390778.14%63112.62%391978.38%
3 Multi-drug-resistant57211.44%447989.58%58211.64%450190.02%
4 Poly-resistant3126.24%479195.82%2985.96%479995.98%
5 Extensively drug-resistant2094.18%2014.02% 5000 100.00%
rules

a character vector that specifies which rules should be applied - one or more of c("breakpoints", "expert", "other", "all")

a character vector that specifies which rules should be applied. Must be one or more of "breakpoints", "expert", "other", "all", and defaults to c("breakpoints", "expert"). The default value can be set to another value using e.g. options(AMR.eucast_rules = "all").

verbose