mirror of
https://github.com/msberends/AMR.git
synced 2026-04-04 18:56:02 +02:00
Compare commits
4 Commits
claude/rev
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c24718893 | |||
| 225493192c | |||
| 26613d774b | |||
| 3a736bc484 |
11
CLAUDE.md
11
CLAUDE.md
@@ -152,16 +152,7 @@ All PRs are **squash-merged**, so each PR lands as exactly **one commit** on the
|
|||||||
|
|
||||||
#### Computing the correct version number
|
#### Computing the correct version number
|
||||||
|
|
||||||
**First, ensure `git` and `gh` are installed** — both are required for the version computation and for pushing changes. Install them if missing before doing anything else:
|
Run the following from the repo root to determine the version string to use:
|
||||||
|
|
||||||
```bash
|
|
||||||
which git || apt-get install -y git
|
|
||||||
which gh || apt-get install -y gh
|
|
||||||
# Also ensure all tags are fetched so git describe works
|
|
||||||
git fetch --tags
|
|
||||||
```
|
|
||||||
|
|
||||||
Then run the following from the repo root to determine the version string to use:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
currenttag=$(git describe --tags --abbrev=0 | sed 's/v//')
|
currenttag=$(git describe --tags --abbrev=0 | sed 's/v//')
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 3.0.1.9040
|
Version: 3.0.1.9044
|
||||||
Date: 2026-03-24
|
Date: 2026-04-04
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||||
data analysis and to work with microbial and antimicrobial properties by
|
data analysis and to work with microbial and antimicrobial properties by
|
||||||
|
|||||||
3
NEWS.md
3
NEWS.md
@@ -1,6 +1,7 @@
|
|||||||
# AMR 3.0.1.9040
|
# AMR 3.0.1.9044
|
||||||
|
|
||||||
### New
|
### New
|
||||||
|
* Support for clinical breakpoints of 2026 of both CLSI and EUCAST, by adding all of their over 5,700 new clinical breakpoints to the `clinical_breakpoints` data set for usage in `as.sir()`. EUCAST 2026 is now the new default guideline for all MIC and disk diffusion interpretations.
|
||||||
* Integration with the **tidymodels** framework to allow seamless use of SIR, MIC and disk data in modelling pipelines via `recipes`
|
* Integration with the **tidymodels** framework to allow seamless use of SIR, MIC and disk data in modelling pipelines via `recipes`
|
||||||
- `step_mic_log2()` to transform `<mic>` columns with log2, and `step_sir_numeric()` to convert `<sir>` columns to numeric
|
- `step_mic_log2()` to transform `<mic>` columns with log2, and `step_sir_numeric()` to convert `<sir>` columns to numeric
|
||||||
- New `tidyselect` helpers:
|
- New `tidyselect` helpers:
|
||||||
|
|||||||
@@ -30,6 +30,12 @@
|
|||||||
# add new version numbers here, and add the rules themselves to "data-raw/eucast_rules.tsv" and clinical_breakpoints
|
# add new version numbers here, and add the rules themselves to "data-raw/eucast_rules.tsv" and clinical_breakpoints
|
||||||
# (sourcing "data-raw/_pre_commit_checks.R" will process the TSV file)
|
# (sourcing "data-raw/_pre_commit_checks.R" will process the TSV file)
|
||||||
EUCAST_VERSION_BREAKPOINTS <- list(
|
EUCAST_VERSION_BREAKPOINTS <- list(
|
||||||
|
"16.0" = list(
|
||||||
|
version_txt = "v16.0",
|
||||||
|
year = 2026,
|
||||||
|
title = "'EUCAST Clinical Breakpoint Tables'",
|
||||||
|
url = "https://www.eucast.org/bacteria/clinical-breakpoints-and-interpretation/clinical-breakpoint-tables/"
|
||||||
|
),
|
||||||
"15.0" = list(
|
"15.0" = list(
|
||||||
version_txt = "v15.0",
|
version_txt = "v15.0",
|
||||||
year = 2025,
|
year = 2025,
|
||||||
|
|||||||
@@ -359,9 +359,9 @@ stop_ifnot_installed <- function(package) {
|
|||||||
if (any(!installed) && any(package == "rstudioapi")) {
|
if (any(!installed) && any(package == "rstudioapi")) {
|
||||||
stop("This function only works in RStudio when using R >= 3.2.", call. = FALSE)
|
stop("This function only works in RStudio when using R >= 3.2.", call. = FALSE)
|
||||||
} else if (any(!installed)) {
|
} else if (any(!installed)) {
|
||||||
stop("This requires the ", vector_and(package[!installed]), " package.",
|
stop_(
|
||||||
"\nTry to install with install.packages().",
|
"This requires the ", vector_and(paste0("{.pkg ", package[!installed], "}"), quotes = FALSE), " package.",
|
||||||
call. = FALSE
|
"\nTry to install with {.fun install.packages}."
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
return(invisible())
|
return(invisible())
|
||||||
@@ -405,8 +405,12 @@ import_fn <- function(name, pkg, error_on_fail = TRUE) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
has_cli_rlang <- function() {
|
||||||
|
pkg_is_available("cli", min_version = "3.0.0") && pkg_is_available("rlang", min_version = "1.0.3")
|
||||||
|
}
|
||||||
|
|
||||||
highlight_code <- function(code) {
|
highlight_code <- function(code) {
|
||||||
if (pkg_is_available("cli", min_version = "3.0.0")) {
|
if (has_cli_rlang()) {
|
||||||
cli::code_highlight(code)
|
cli::code_highlight(code)
|
||||||
} else {
|
} else {
|
||||||
code
|
code
|
||||||
@@ -419,7 +423,7 @@ highlight_code <- function(code) {
|
|||||||
# output function (e.g. packageStartupMessage()).
|
# output function (e.g. packageStartupMessage()).
|
||||||
format_inline_ <- function(...) {
|
format_inline_ <- function(...) {
|
||||||
msg <- paste0(c(...), collapse = "")
|
msg <- paste0(c(...), collapse = "")
|
||||||
if (pkg_is_available("cli", min_version = "3.0.0")) {
|
if (has_cli_rlang()) {
|
||||||
if (!cli::ansi_has_hyperlink_support()) {
|
if (!cli::ansi_has_hyperlink_support()) {
|
||||||
msg <- simplify_help_markup(msg)
|
msg <- simplify_help_markup(msg)
|
||||||
}
|
}
|
||||||
@@ -518,7 +522,7 @@ word_wrap <- function(...,
|
|||||||
as_note = FALSE,
|
as_note = FALSE,
|
||||||
width = 0.95 * getOption("width"),
|
width = 0.95 * getOption("width"),
|
||||||
extra_indent = 0) {
|
extra_indent = 0) {
|
||||||
if (pkg_is_available("cli", min_version = "3.0.0")) {
|
if (has_cli_rlang()) {
|
||||||
return(paste0(c(...), collapse = ""))
|
return(paste0(c(...), collapse = ""))
|
||||||
}
|
}
|
||||||
msg <- paste0(c(...), collapse = "")
|
msg <- paste0(c(...), collapse = "")
|
||||||
@@ -580,7 +584,7 @@ simplify_help_markup <- function(msg) {
|
|||||||
message_ <- function(...,
|
message_ <- function(...,
|
||||||
appendLF = TRUE,
|
appendLF = TRUE,
|
||||||
as_note = TRUE) {
|
as_note = TRUE) {
|
||||||
if (pkg_is_available("cli", min_version = "3.0.0")) {
|
if (has_cli_rlang()) {
|
||||||
msg <- paste0(c(...), collapse = "")
|
msg <- paste0(c(...), collapse = "")
|
||||||
if (!cli::ansi_has_hyperlink_support()) {
|
if (!cli::ansi_has_hyperlink_support()) {
|
||||||
msg <- simplify_help_markup(msg)
|
msg <- simplify_help_markup(msg)
|
||||||
@@ -602,7 +606,7 @@ message_ <- function(...,
|
|||||||
warning_ <- function(...,
|
warning_ <- function(...,
|
||||||
immediate = FALSE,
|
immediate = FALSE,
|
||||||
call = FALSE) {
|
call = FALSE) {
|
||||||
if (pkg_is_available("cli", min_version = "3.0.0")) {
|
if (has_cli_rlang()) {
|
||||||
msg <- paste0(c(...), collapse = "")
|
msg <- paste0(c(...), collapse = "")
|
||||||
if (!cli::ansi_has_hyperlink_support()) {
|
if (!cli::ansi_has_hyperlink_support()) {
|
||||||
msg <- simplify_help_markup(msg)
|
msg <- simplify_help_markup(msg)
|
||||||
@@ -622,7 +626,7 @@ stop_ <- function(..., call = TRUE) {
|
|||||||
if (!cli::ansi_has_hyperlink_support()) {
|
if (!cli::ansi_has_hyperlink_support()) {
|
||||||
msg <- simplify_help_markup(msg)
|
msg <- simplify_help_markup(msg)
|
||||||
}
|
}
|
||||||
if (pkg_is_available("cli", min_version = "3.0.0")) {
|
if (has_cli_rlang()) {
|
||||||
if (isTRUE(call)) {
|
if (isTRUE(call)) {
|
||||||
call_obj <- sys.call(-1)
|
call_obj <- sys.call(-1)
|
||||||
} else if (!isFALSE(call)) {
|
} else if (!isFALSE(call)) {
|
||||||
@@ -747,7 +751,7 @@ format_included_data_number <- function(data) {
|
|||||||
paste0(ifelse(rounder == 0, "", "~"), format(round(n, rounder), decimal.mark = ".", big.mark = " "))
|
paste0(ifelse(rounder == 0, "", "~"), format(round(n, rounder), decimal.mark = ".", big.mark = " "))
|
||||||
}
|
}
|
||||||
|
|
||||||
vector_or <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, initial_captital = FALSE, last_sep = " or ") {
|
vector_or <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, initial_captital = FALSE, last_sep = " or ", documentation = FALSE) {
|
||||||
# makes unique and sorts, and this also removed NAs
|
# makes unique and sorts, and this also removed NAs
|
||||||
v <- unique(v)
|
v <- unique(v)
|
||||||
has_na <- anyNA(v)
|
has_na <- anyNA(v)
|
||||||
@@ -761,17 +765,25 @@ vector_or <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, initial_ca
|
|||||||
v <- rev(v)
|
v <- rev(v)
|
||||||
}
|
}
|
||||||
if (isTRUE(quotes)) {
|
if (isTRUE(quotes)) {
|
||||||
|
if (isTRUE(documentation)) {
|
||||||
quotes <- '"'
|
quotes <- '"'
|
||||||
|
} else {
|
||||||
|
# use cli to format as values
|
||||||
|
quotes <- c("{.val ", "}")
|
||||||
|
}
|
||||||
} else if (isFALSE(quotes)) {
|
} else if (isFALSE(quotes)) {
|
||||||
quotes <- ""
|
quotes <- ""
|
||||||
} else {
|
} else {
|
||||||
quotes <- quotes[1L]
|
quotes <- quotes[1L]
|
||||||
}
|
}
|
||||||
|
if (length(quotes) == 1) {
|
||||||
|
quotes <- c(quotes, quotes)
|
||||||
|
}
|
||||||
if (isTRUE(initial_captital)) {
|
if (isTRUE(initial_captital)) {
|
||||||
v[1] <- gsub("^([a-z])", "\\U\\1", v[1], perl = TRUE)
|
v[1] <- gsub("^([a-z])", "\\U\\1", v[1], perl = TRUE)
|
||||||
}
|
}
|
||||||
if (length(v) <= 1) {
|
if (length(v) <= 1) {
|
||||||
return(paste0(quotes, v, quotes))
|
return(paste0(quotes[1], v, quotes[2]))
|
||||||
}
|
}
|
||||||
if (identical(v, c("I", "R", "S"))) {
|
if (identical(v, c("I", "R", "S"))) {
|
||||||
# class 'sir' should be sorted like this
|
# class 'sir' should be sorted like this
|
||||||
@@ -790,7 +802,7 @@ vector_or <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, initial_ca
|
|||||||
if (is.numeric(v)) {
|
if (is.numeric(v)) {
|
||||||
v <- trimws(vapply(FUN.VALUE = character(1), v, format, scientific = FALSE))
|
v <- trimws(vapply(FUN.VALUE = character(1), v, format, scientific = FALSE))
|
||||||
}
|
}
|
||||||
quoted <- paste0(quotes, v, quotes)
|
quoted <- paste0(quotes[1], v, quotes[2])
|
||||||
quoted[NAs] <- "NA"
|
quoted[NAs] <- "NA"
|
||||||
# all commas except for last item, so will become '"val1", "val2", "val3" or "val4"'
|
# all commas except for last item, so will become '"val1", "val2", "val3" or "val4"'
|
||||||
paste0(
|
paste0(
|
||||||
@@ -799,10 +811,11 @@ vector_or <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, initial_ca
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
vector_and <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, initial_captital = FALSE) {
|
vector_and <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, initial_captital = FALSE, documentation = FALSE) {
|
||||||
vector_or(
|
vector_or(
|
||||||
v = v, quotes = quotes, reverse = reverse, sort = sort,
|
v = v, quotes = quotes, reverse = reverse, sort = sort,
|
||||||
initial_captital = initial_captital, last_sep = " and "
|
initial_captital = initial_captital, documentation = documentation,
|
||||||
|
last_sep = " and "
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
R/ab.R
2
R/ab.R
@@ -554,7 +554,7 @@ type_sum.ab <- function(x, ...) {
|
|||||||
print.ab <- function(x, ...) {
|
print.ab <- function(x, ...) {
|
||||||
if (!is.null(attributes(x)$amr_selector)) {
|
if (!is.null(attributes(x)$amr_selector)) {
|
||||||
function_name <- attributes(x)$amr_selector
|
function_name <- attributes(x)$amr_selector
|
||||||
if (pkg_is_available("cli", min_version = "3.0.0")) {
|
if (has_cli_rlang()) {
|
||||||
cli::cli_inform(c(
|
cli::cli_inform(c(
|
||||||
"i" = paste0("This {.cls ab} vector was retrieved using {.fun ", function_name, "}, which should normally be used inside a {.pkg dplyr} verb or {.cls data.frame} call, e.g.:"),
|
"i" = paste0("This {.cls ab} vector was retrieved using {.fun ", function_name, "}, which should normally be used inside a {.pkg dplyr} verb or {.cls data.frame} call, e.g.:"),
|
||||||
paste0("\u00a0\u00a0", AMR_env$bullet_icon, " ", highlight_code(paste0("your_data %>% select(", function_name, "())"))),
|
paste0("\u00a0\u00a0", AMR_env$bullet_icon, " ", highlight_code(paste0("your_data %>% select(", function_name, "())"))),
|
||||||
|
|||||||
@@ -857,7 +857,7 @@ all_any_amr_selector <- function(type, ..., na.rm = TRUE) {
|
|||||||
cols_ab <- c(...)
|
cols_ab <- c(...)
|
||||||
result <- cols_ab[toupper(cols_ab) %in% VALID_SIR_LEVELS]
|
result <- cols_ab[toupper(cols_ab) %in% VALID_SIR_LEVELS]
|
||||||
if (length(result) == 0) {
|
if (length(result) == 0) {
|
||||||
message_("Filtering ", type, " of columns ", vector_and(font_bold(cols_ab, collapse = NULL), quotes = "'"), ' to contain value "S", "I" or "R"')
|
message_("Filtering ", type, " of columns ", vector_and(paste0("{.field ", font_bold(cols_ab, collapse = NULL), "}"), quotes = FALSE), " to only contain values ", vector_or(VALID_SIR_LEVELS))
|
||||||
result <- VALID_SIR_LEVELS
|
result <- VALID_SIR_LEVELS
|
||||||
}
|
}
|
||||||
cols_ab <- cols_ab[!cols_ab %in% result]
|
cols_ab <- cols_ab[!cols_ab %in% result]
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
#'
|
#'
|
||||||
#' ### Using taxonomic properties in rules
|
#' ### Using taxonomic properties in rules
|
||||||
#'
|
#'
|
||||||
#' There is one exception in columns used for the rules: all column names of the [microorganisms] data set can also be used, but do not have to exist in the data set. These column names are: `r vector_and(colnames(microorganisms), sort = FALSE)`. Thus, this next example will work as well, despite the fact that the `df` data set does not contain a column `genus`:
|
#' There is one exception in columns used for the rules: all column names of the [microorganisms] data set can also be used, but do not have to exist in the data set. These column names are: `r vector_and(colnames(microorganisms), sort = FALSE, documentation = TRUE)`. Thus, this next example will work as well, despite the fact that the `df` data set does not contain a column `genus`:
|
||||||
#'
|
#'
|
||||||
#' ```r
|
#' ```r
|
||||||
#' y <- custom_eucast_rules(
|
#' y <- custom_eucast_rules(
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ get_column_abx <- function(x,
|
|||||||
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
|
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
|
||||||
meet_criteria(sort, allow_class = "logical", has_length = 1)
|
meet_criteria(sort, allow_class = "logical", has_length = 1)
|
||||||
|
|
||||||
if (isTRUE(info)) {
|
if (isTRUE(info) && message_not_thrown_before("get_column_abx", colnames(x))) {
|
||||||
message_("Auto-guessing columns suitable for analysis", appendLF = FALSE, as_note = FALSE)
|
message_("Auto-guessing columns suitable for analysis", appendLF = FALSE, as_note = FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
|||||||
#' @param overwrite A [logical] indicating whether to overwrite existing SIR values (default: `FALSE`). When `FALSE`, only non-SIR values are modified (i.e., any value that is not already S, I or R). To ensure compliance with EUCAST guidelines, **this should remain** `FALSE`, as EUCAST notes often state that an organism "should be tested for susceptibility to individual agents or be reported resistant".
|
#' @param overwrite A [logical] indicating whether to overwrite existing SIR values (default: `FALSE`). When `FALSE`, only non-SIR values are modified (i.e., any value that is not already S, I or R). To ensure compliance with EUCAST guidelines, **this should remain** `FALSE`, as EUCAST notes often state that an organism "should be tested for susceptibility to individual agents or be reported resistant".
|
||||||
#' @inheritParams first_isolate
|
#' @inheritParams first_isolate
|
||||||
#' @details
|
#' @details
|
||||||
#' **Note:** This function does not translate MIC values to SIR values. Use [as.sir()] for that. \cr
|
#' **Note:** This function does not translate MIC or disk values to SIR values. Use [as.sir()] 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. \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. \cr
|
||||||
#'
|
#'
|
||||||
#' The file containing all EUCAST rules is located here: <https://github.com/msberends/AMR/blob/main/data-raw/eucast_rules.tsv>. **Note:** Old taxonomic names are replaced with the current taxonomy where applicable. For example, *Ochrobactrum anthropi* was renamed to *Brucella anthropi* in 2020; the original EUCAST rules v3.1 and v3.2 did not yet contain this new taxonomic name. The `AMR` package contains the full microbial taxonomy updated until `r documentation_date(max(TAXONOMY_VERSION$GBIF$accessed_date, TAXONOMY_VERSION$LPSN$accessed_date))`, see [microorganisms].
|
#' The file containing all EUCAST rules is located here: <https://github.com/msberends/AMR/blob/main/data-raw/eucast_rules.tsv>. **Note:** Old taxonomic names are replaced with the current taxonomy where applicable. For example, *Ochrobactrum anthropi* was renamed to *Brucella anthropi* in 2020; the original EUCAST rules v3.1 and v3.2 did not yet contain this new taxonomic name. The `AMR` package contains the full microbial taxonomy updated until `r documentation_date(max(TAXONOMY_VERSION$GBIF$accessed_date, TAXONOMY_VERSION$LPSN$accessed_date))`, see [microorganisms].
|
||||||
@@ -163,7 +163,7 @@ interpretive_rules <- function(x,
|
|||||||
rules = getOption("AMR_interpretive_rules", default = c("breakpoints", "expected_phenotypes")),
|
rules = getOption("AMR_interpretive_rules", default = c("breakpoints", "expected_phenotypes")),
|
||||||
guideline = getOption("AMR_guideline", "EUCAST"),
|
guideline = getOption("AMR_guideline", "EUCAST"),
|
||||||
verbose = FALSE,
|
verbose = FALSE,
|
||||||
version_breakpoints = 15.0,
|
version_breakpoints = 16.0,
|
||||||
version_expected_phenotypes = 1.2,
|
version_expected_phenotypes = 1.2,
|
||||||
version_expertrules = 3.3,
|
version_expertrules = 3.3,
|
||||||
ampc_cephalosporin_resistance = NA,
|
ampc_cephalosporin_resistance = NA,
|
||||||
|
|||||||
4
R/mic.R
4
R/mic.R
@@ -174,7 +174,7 @@ as.mic <- function(x, na.rm = FALSE, keep_operators = "all", round_to_next_log2
|
|||||||
keep_operators <- "none"
|
keep_operators <- "none"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is.mic(x) && (keep_operators == "all" || !any(x %like% "[>=<]", na.rm = TRUE))) {
|
if (any(is.mic(x)) && (keep_operators == "all" || !any(x %like% "[>=<]", na.rm = TRUE))) {
|
||||||
if (isTRUE(round_to_next_log2)) {
|
if (isTRUE(round_to_next_log2)) {
|
||||||
x <- roundup_to_nearest_log2(x)
|
x <- roundup_to_nearest_log2(x)
|
||||||
}
|
}
|
||||||
@@ -327,7 +327,7 @@ rescale_mic <- function(x, mic_range, keep_operators = "edges", as.mic = TRUE, r
|
|||||||
mic_range <- trimws(format(mic_range, scientific = FALSE))
|
mic_range <- trimws(format(mic_range, scientific = FALSE))
|
||||||
mic_range <- gsub("[.]0+$", "", mic_range)
|
mic_range <- gsub("[.]0+$", "", mic_range)
|
||||||
mic_range[mic_range == "NA"] <- NA_character_
|
mic_range[mic_range == "NA"] <- NA_character_
|
||||||
} else if (is.mic(mic_range)) {
|
} else if (any(is.mic(mic_range))) {
|
||||||
mic_range <- as.character(mic_range)
|
mic_range <- as.character(mic_range)
|
||||||
}
|
}
|
||||||
stop_ifnot(
|
stop_ifnot(
|
||||||
|
|||||||
8
R/mo.R
8
R/mo.R
@@ -249,7 +249,7 @@ as.mo <- function(x,
|
|||||||
if (length(which(ind)) > 0 && isTRUE(info) && message_not_thrown_before("as.mo_microorganisms.codes", is.na(out), toupper(x))) {
|
if (length(which(ind)) > 0 && isTRUE(info) && message_not_thrown_before("as.mo_microorganisms.codes", is.na(out), toupper(x))) {
|
||||||
message_(
|
message_(
|
||||||
"Retrieved value", ifelse(sum(ind) > 1, "s", ""),
|
"Retrieved value", ifelse(sum(ind) > 1, "s", ""),
|
||||||
" from the `microorganisms.codes` data set for ", vector_and(toupper(x)[ind]), "."
|
" from the {.help [microorganisms.codes](AMR::microorganisms.codes)} data set for ", vector_and(toupper(x)[ind]), "."
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
# From SNOMED ----
|
# From SNOMED ----
|
||||||
@@ -686,7 +686,7 @@ pillar_shaft.mo <- function(x, ...) {
|
|||||||
}
|
}
|
||||||
warning_(
|
warning_(
|
||||||
col, " contains old MO codes (from a previous AMR package version). ",
|
col, " contains old MO codes (from a previous AMR package version). ",
|
||||||
"Please update your MO codes with `as.mo()`.",
|
"Please update your MO codes with {.help [{.fun as.mo}](AMR::as.mo)}.",
|
||||||
call = FALSE
|
call = FALSE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -793,7 +793,7 @@ print.mo <- function(x, print.shortnames = FALSE, ...) {
|
|||||||
if (!all(x %in% c(AMR_env$MO_lookup$mo, NA))) {
|
if (!all(x %in% c(AMR_env$MO_lookup$mo, NA))) {
|
||||||
warning_(
|
warning_(
|
||||||
"Some MO codes are from a previous AMR package version. ",
|
"Some MO codes are from a previous AMR package version. ",
|
||||||
"Please update the MO codes with `as.mo()`.",
|
"Please update the MO codes with {.help [{.fun as.mo}](AMR::as.mo)}.",
|
||||||
call = FALSE
|
call = FALSE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -827,7 +827,7 @@ as.data.frame.mo <- function(x, ...) {
|
|||||||
if (!all(x %in% c(AMR_env$MO_lookup$mo, NA))) {
|
if (!all(x %in% c(AMR_env$MO_lookup$mo, NA))) {
|
||||||
warning_(
|
warning_(
|
||||||
"The data contains old MO codes (from a previous AMR package version). ",
|
"The data contains old MO codes (from a previous AMR package version). ",
|
||||||
"Please update your MO codes with `as.mo()`."
|
"Please update your MO codes with {.help [{.fun as.mo}](AMR::as.mo)}."
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
nm <- deparse1(substitute(x))
|
nm <- deparse1(substitute(x))
|
||||||
|
|||||||
8
R/sir.R
8
R/sir.R
@@ -1079,8 +1079,8 @@ get_guideline <- function(guideline, reference_data) {
|
|||||||
guideline_param[guideline_param %unlike% " "] <- gsub("([a-z]+)([0-9]+)", "\\1 \\2", guideline_param[guideline_param %unlike% " "], ignore.case = TRUE)
|
guideline_param[guideline_param %unlike% " "] <- gsub("([a-z]+)([0-9]+)", "\\1 \\2", guideline_param[guideline_param %unlike% " "], ignore.case = TRUE)
|
||||||
|
|
||||||
stop_ifnot(guideline_param %in% reference_data$guideline,
|
stop_ifnot(guideline_param %in% reference_data$guideline,
|
||||||
"invalid guideline: '", guideline,
|
"invalid guideline: {.val ", guideline,
|
||||||
"'.\nValid guidelines are: ", vector_and(reference_data$guideline, quotes = TRUE, reverse = TRUE),
|
"}.\nValid guidelines are: ", vector_and(reference_data$guideline, reverse = TRUE),
|
||||||
call = FALSE
|
call = FALSE
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -2080,10 +2080,10 @@ freq.sir <- function(x, ...) {
|
|||||||
# this prevents the requirement for putting the dependency in Imports:
|
# this prevents the requirement for putting the dependency in Imports:
|
||||||
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, sir)
|
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, sir)
|
||||||
get_skimmers.sir <- function(column) {
|
get_skimmers.sir <- function(column) {
|
||||||
# TODO add here in AMR 3.1.0 details about guideline
|
# TODO #170 add here in AMR 3.1.0 details about guideline
|
||||||
skimr::sfl(
|
skimr::sfl(
|
||||||
skim_type = "sir",
|
skim_type = "sir",
|
||||||
# guideline = function(x) "EUCAST 2025", # or "Multiple"
|
# guideline = function(x) "EUCAST 2026", # or "Multiple"
|
||||||
# origin = function(x) "MIC", # or "Multiple"
|
# origin = function(x) "MIC", # or "Multiple"
|
||||||
count_S = count_S,
|
count_S = count_S,
|
||||||
count_I = count_I,
|
count_I = count_I,
|
||||||
|
|||||||
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
@@ -128,7 +128,8 @@ step_mic_log2 <- function(
|
|||||||
trained = FALSE,
|
trained = FALSE,
|
||||||
columns = NULL,
|
columns = NULL,
|
||||||
skip = FALSE,
|
skip = FALSE,
|
||||||
id = recipes::rand_id("mic_log2")) {
|
id = recipes::rand_id("mic_log2")
|
||||||
|
) {
|
||||||
recipes::add_step(
|
recipes::add_step(
|
||||||
recipe,
|
recipe,
|
||||||
step_mic_log2_new(
|
step_mic_log2_new(
|
||||||
@@ -203,7 +204,8 @@ step_sir_numeric <- function(
|
|||||||
trained = FALSE,
|
trained = FALSE,
|
||||||
columns = NULL,
|
columns = NULL,
|
||||||
skip = FALSE,
|
skip = FALSE,
|
||||||
id = recipes::rand_id("sir_numeric")) {
|
id = recipes::rand_id("sir_numeric")
|
||||||
|
) {
|
||||||
recipes::add_step(
|
recipes::add_step(
|
||||||
recipe,
|
recipe,
|
||||||
step_sir_numeric_new(
|
step_sir_numeric_new(
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Overview:
|
|||||||
even WISCA
|
even WISCA
|
||||||
- Provides the **full microbiological taxonomy** of ~79 000 distinct
|
- Provides the **full microbiological taxonomy** of ~79 000 distinct
|
||||||
species and extensive info of ~620 antimicrobial drugs
|
species and extensive info of ~620 antimicrobial drugs
|
||||||
- Applies **CLSI 2011-2025** and **EUCAST 2011-2025** clinical and
|
- Applies **CLSI 2011-2026** and **EUCAST 2011-2026** clinical and
|
||||||
veterinary breakpoints, and ECOFFs, for MIC and disk zone
|
veterinary breakpoints, and ECOFFs, for MIC and disk zone
|
||||||
interpretation
|
interpretation
|
||||||
- Corrects for duplicate isolates, **calculates** and **predicts** AMR
|
- Corrects for duplicate isolates, **calculates** and **predicts** AMR
|
||||||
|
|||||||
@@ -141,32 +141,6 @@ import numpy as np
|
|||||||
# Import the AMR R package
|
# Import the AMR R package
|
||||||
amr_r = importr('AMR')
|
amr_r = importr('AMR')
|
||||||
|
|
||||||
def convert_to_r(value):
|
|
||||||
"""Convert Python lists/tuples to typed R vectors.
|
|
||||||
|
|
||||||
rpy2's default_converter passes Python lists to R as R lists, not as
|
|
||||||
character/numeric vectors. This causes element-wise type-check functions
|
|
||||||
such as is.mic(), is.sir(), and is.disk() to return a logical vector
|
|
||||||
rather than a single logical, breaking R's scalar && operator.
|
|
||||||
|
|
||||||
This helper converts Python lists and tuples to the appropriate R vector
|
|
||||||
type based on the element types, so R always receives a proper vector."""
|
|
||||||
if isinstance(value, (list, tuple)):
|
|
||||||
if len(value) == 0:
|
|
||||||
return StrVector([])
|
|
||||||
# bool must be checked before int because bool is a subclass of int
|
|
||||||
if all(isinstance(v, bool) for v in value):
|
|
||||||
return robjects.vectors.BoolVector(value)
|
|
||||||
if all(isinstance(v, int) for v in value):
|
|
||||||
return IntVector(value)
|
|
||||||
if all(isinstance(v, float) for v in value):
|
|
||||||
return FloatVector(value)
|
|
||||||
if all(isinstance(v, str) for v in value):
|
|
||||||
return StrVector(value)
|
|
||||||
# Mixed types: coerce all to string
|
|
||||||
return StrVector([str(v) for v in value])
|
|
||||||
return value
|
|
||||||
|
|
||||||
def convert_to_python(r_output):
|
def convert_to_python(r_output):
|
||||||
# Check if it's a StrVector (R character vector)
|
# Check if it's a StrVector (R character vector)
|
||||||
if isinstance(r_output, StrVector):
|
if isinstance(r_output, StrVector):
|
||||||
@@ -192,13 +166,10 @@ def convert_to_python(r_output):
|
|||||||
return r_output
|
return r_output
|
||||||
|
|
||||||
def r_to_python(r_func):
|
def r_to_python(r_func):
|
||||||
"""Decorator that converts Python list/tuple inputs to typed R vectors,
|
"""Decorator that runs an rpy2 function under a localconverter
|
||||||
runs the rpy2 function under a localconverter, and converts the output
|
and then applies convert_to_python to its output."""
|
||||||
to a Python type."""
|
|
||||||
@functools.wraps(r_func)
|
@functools.wraps(r_func)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
args = tuple(convert_to_r(a) for a in args)
|
|
||||||
kwargs = {k: convert_to_r(v) for k, v in kwargs.items()}
|
|
||||||
with localconverter(default_converter + numpy2ri.converter + pandas2ri.converter):
|
with localconverter(default_converter + numpy2ri.converter + pandas2ri.converter):
|
||||||
return convert_to_python(r_func(*args, **kwargs))
|
return convert_to_python(r_func(*args, **kwargs))
|
||||||
return wrapper
|
return wrapper
|
||||||
@@ -341,3 +312,4 @@ cd ../PythonPackage/AMR
|
|||||||
pip3 install build
|
pip3 install build
|
||||||
python3 -m build
|
python3 -m build
|
||||||
# python3 setup.py sdist bdist_wheel
|
# python3 setup.py sdist bdist_wheel
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ devtools::load_all()
|
|||||||
|
|
||||||
# BE SURE TO RUN data-raw/_reproduction_scripts/reproduction_of_microorganisms.groups.R FIRST TO GET THE GROUPS!
|
# BE SURE TO RUN data-raw/_reproduction_scripts/reproduction_of_microorganisms.groups.R FIRST TO GET THE GROUPS!
|
||||||
|
|
||||||
|
# For non-interactive use
|
||||||
|
if (!interactive()) {
|
||||||
|
View <- glimpse
|
||||||
|
}
|
||||||
|
|
||||||
# READ DATA ----
|
# READ DATA ----
|
||||||
|
|
||||||
# files are retrieved from https://github.com/AClark-WHONET/AMRIE
|
# files are retrieved from https://github.com/AClark-WHONET/AMRIE
|
||||||
@@ -46,21 +51,21 @@ file_organisms <- file.path(github_repo, "Organisms.txt")
|
|||||||
file_breakpoints <- file.path(github_repo, "Breakpoints.txt")
|
file_breakpoints <- file.path(github_repo, "Breakpoints.txt")
|
||||||
file_antibiotics <- file.path(github_repo, "Antibiotics.txt")
|
file_antibiotics <- file.path(github_repo, "Antibiotics.txt")
|
||||||
|
|
||||||
whonet_organisms <- read_tsv(file_organisms, na = c("", "NA", "-"), show_col_types = FALSE, guess_max = Inf) |>
|
whonet_organisms_raw <- read_tsv(file_organisms, na = c("", "NA", "-"), show_col_types = FALSE, guess_max = Inf) |>
|
||||||
# remove old taxonomic names
|
# remove old taxonomic names
|
||||||
filter(TAXONOMIC_STATUS == "C") |>
|
filter(TAXONOMIC_STATUS == "C") |>
|
||||||
mutate(ORGANISM_CODE = toupper(WHONET_ORG_CODE))
|
mutate(ORGANISM_CODE = toupper(WHONET_ORG_CODE))
|
||||||
|
|
||||||
whonet_breakpoints <- read_tsv(file_breakpoints, na = c("", "NA", "-"), show_col_types = FALSE, guess_max = Inf) |>
|
whonet_breakpoints_raw <- read_tsv(file_breakpoints, na = c("", "NA", "-"), show_col_types = FALSE, guess_max = Inf) |>
|
||||||
filter(GUIDELINES %in% c("CLSI", "EUCAST"))
|
filter(GUIDELINES %in% c("CLSI", "EUCAST"))
|
||||||
|
|
||||||
whonet_antibiotics <- read_tsv(file_antibiotics, na = c("", "NA", "-"), show_col_types = FALSE, guess_max = Inf) |>
|
whonet_antibiotics_raw <- read_tsv(file_antibiotics, na = c("", "NA", "-"), show_col_types = FALSE, guess_max = Inf) |>
|
||||||
arrange(WHONET_ABX_CODE) |>
|
arrange(WHONET_ABX_CODE) |>
|
||||||
distinct(WHONET_ABX_CODE, .keep_all = TRUE)
|
distinct(WHONET_ABX_CODE, .keep_all = TRUE)
|
||||||
|
|
||||||
# MICROORGANISMS WHONET CODES ----
|
# MICROORGANISMS WHONET CODES ----
|
||||||
|
|
||||||
whonet_organisms <- whonet_organisms |>
|
whonet_organisms <- whonet_organisms_raw |>
|
||||||
select(ORGANISM_CODE, ORGANISM, SPECIES_GROUP, GBIF_TAXON_ID) |>
|
select(ORGANISM_CODE, ORGANISM, SPECIES_GROUP, GBIF_TAXON_ID) |>
|
||||||
mutate(
|
mutate(
|
||||||
# this one was called Issatchenkia orientalis, but it should be:
|
# this one was called Issatchenkia orientalis, but it should be:
|
||||||
@@ -110,6 +115,13 @@ organisms <- matched |> transmute(code = toupper(ORGANISM_CODE), group = SPECIES
|
|||||||
mutate(name = mo_name(mo, keep_synonyms = TRUE)) |>
|
mutate(name = mo_name(mo, keep_synonyms = TRUE)) |>
|
||||||
arrange(code)
|
arrange(code)
|
||||||
|
|
||||||
|
# self-defined codes in the MO table must be retained
|
||||||
|
existing_codes <- microorganisms$fullname[microorganisms$fullname %like% ".* \\("]
|
||||||
|
existing_codes <- gsub(".*\\((.*)\\)", "\\1", existing_codes)
|
||||||
|
|
||||||
|
organisms <- organisms |>
|
||||||
|
filter(!code %in% existing_codes)
|
||||||
|
|
||||||
# some subspecies exist, while their upper species do not, add them as the species level:
|
# some subspecies exist, while their upper species do not, add them as the species level:
|
||||||
subspp <- organisms |>
|
subspp <- organisms |>
|
||||||
filter(mo_species(mo, keep_synonyms = TRUE) == mo_subspecies(mo, keep_synonyms = TRUE) &
|
filter(mo_species(mo, keep_synonyms = TRUE) == mo_subspecies(mo, keep_synonyms = TRUE) &
|
||||||
@@ -139,9 +151,10 @@ organisms <- organisms |> filter(code != "XXX")
|
|||||||
# 2023-07-08 SGM is also Strep gamma in WHONET, must only be Slowly-growing Mycobacterium
|
# 2023-07-08 SGM is also Strep gamma in WHONET, must only be Slowly-growing Mycobacterium
|
||||||
# 2024-06-14 still the case
|
# 2024-06-14 still the case
|
||||||
# 2025-04-20 still the case
|
# 2025-04-20 still the case
|
||||||
|
# 2026-03-27 still the case, but fixed using `existing_codes` above
|
||||||
organisms |> filter(code == "SGM")
|
organisms |> filter(code == "SGM")
|
||||||
organisms <- organisms |>
|
# organisms <- organisms |>
|
||||||
filter(!(code == "SGM" & name %like% "Streptococcus"))
|
# filter(!(code == "SGM" & name %like% "Streptococcus"))
|
||||||
# this must be empty:
|
# this must be empty:
|
||||||
organisms$code[organisms$code |> duplicated()]
|
organisms$code[organisms$code |> duplicated()]
|
||||||
|
|
||||||
@@ -162,7 +175,7 @@ microorganisms.codes2 <- microorganisms.codes |>
|
|||||||
# new codes:
|
# new codes:
|
||||||
microorganisms.codes2$code[which(!microorganisms.codes2$code %in% microorganisms.codes$code)]
|
microorganisms.codes2$code[which(!microorganisms.codes2$code %in% microorganisms.codes$code)]
|
||||||
mo_name(microorganisms.codes2$mo[which(!microorganisms.codes2$code %in% microorganisms.codes$code)], keep_synonyms = TRUE)
|
mo_name(microorganisms.codes2$mo[which(!microorganisms.codes2$code %in% microorganisms.codes$code)], keep_synonyms = TRUE)
|
||||||
microorganisms.codes <- microorganisms.codes2
|
microorganisms.codes <- microorganisms.codes2 |> distinct()
|
||||||
|
|
||||||
# Run this part to update ASIARS-Net:
|
# Run this part to update ASIARS-Net:
|
||||||
# 2024-06-14: file not available anymore
|
# 2024-06-14: file not available anymore
|
||||||
@@ -201,10 +214,15 @@ devtools::load_all()
|
|||||||
|
|
||||||
# now that we have the correct MO codes, get the breakpoints and convert them
|
# now that we have the correct MO codes, get the breakpoints and convert them
|
||||||
|
|
||||||
whonet_breakpoints |>
|
whonet_breakpoints_raw |>
|
||||||
count(GUIDELINES, BREAKPOINT_TYPE) |>
|
count(GUIDELINES, BREAKPOINT_TYPE) |>
|
||||||
pivot_wider(names_from = BREAKPOINT_TYPE, values_from = n) |>
|
pivot_wider(names_from = BREAKPOINT_TYPE, values_from = n) |>
|
||||||
janitor::adorn_totals(where = c("row", "col"))
|
janitor::adorn_totals(where = c("row", "col"))
|
||||||
|
whonet_breakpoints_raw |>
|
||||||
|
filter(YEAR == format(Sys.Date(), "%Y")) |>
|
||||||
|
count(GUIDELINES, YEAR, BREAKPOINT_TYPE) |>
|
||||||
|
pivot_wider(names_from = BREAKPOINT_TYPE, values_from = n) |>
|
||||||
|
janitor::adorn_totals(where = c("row", "col"))
|
||||||
# compared to current
|
# compared to current
|
||||||
AMR::clinical_breakpoints |>
|
AMR::clinical_breakpoints |>
|
||||||
count(GUIDELINES = gsub("[^a-zA-Z]", "", guideline), type) |>
|
count(GUIDELINES = gsub("[^a-zA-Z]", "", guideline), type) |>
|
||||||
@@ -213,7 +231,7 @@ AMR::clinical_breakpoints |>
|
|||||||
as.data.frame() |>
|
as.data.frame() |>
|
||||||
janitor::adorn_totals(where = c("row", "col"))
|
janitor::adorn_totals(where = c("row", "col"))
|
||||||
|
|
||||||
breakpoints <- whonet_breakpoints |>
|
breakpoints <- whonet_breakpoints_raw |>
|
||||||
mutate(code = toupper(ORGANISM_CODE)) |>
|
mutate(code = toupper(ORGANISM_CODE)) |>
|
||||||
left_join(bind_rows(microorganisms.codes |> filter(!code %in% c("ALL", "GEN")),
|
left_join(bind_rows(microorganisms.codes |> filter(!code %in% c("ALL", "GEN")),
|
||||||
# GEN (Generic) and ALL (All) are PK/PD codes
|
# GEN (Generic) and ALL (All) are PK/PD codes
|
||||||
@@ -233,7 +251,7 @@ breakpoints <- breakpoints |>
|
|||||||
|
|
||||||
# and these ones have unknown antibiotics according to WHONET itself:
|
# and these ones have unknown antibiotics according to WHONET itself:
|
||||||
breakpoints |>
|
breakpoints |>
|
||||||
filter(!WHONET_ABX_CODE %in% whonet_antibiotics$WHONET_ABX_CODE) |>
|
filter(!WHONET_ABX_CODE %in% whonet_antibiotics_raw$WHONET_ABX_CODE) |>
|
||||||
count(GUIDELINES, WHONET_ABX_CODE) |>
|
count(GUIDELINES, WHONET_ABX_CODE) |>
|
||||||
mutate(ab = as.ab(WHONET_ABX_CODE, fast_mode = TRUE),
|
mutate(ab = as.ab(WHONET_ABX_CODE, fast_mode = TRUE),
|
||||||
ab_name = ab_name(ab))
|
ab_name = ab_name(ab))
|
||||||
@@ -296,7 +314,7 @@ breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_R"] <- as.d
|
|||||||
# regarding animal breakpoints, CLSI has adults and foals for horses, but only for amikacin - only keep adult horses
|
# regarding animal breakpoints, CLSI has adults and foals for horses, but only for amikacin - only keep adult horses
|
||||||
breakpoints_new |>
|
breakpoints_new |>
|
||||||
filter(host %like% "foal") |>
|
filter(host %like% "foal") |>
|
||||||
count(guideline, host)
|
count(guideline, host, ab)
|
||||||
breakpoints_new <- breakpoints_new |>
|
breakpoints_new <- breakpoints_new |>
|
||||||
filter(host %unlike% "foal") |>
|
filter(host %unlike% "foal") |>
|
||||||
mutate(host = ifelse(host %like% "horse", "horse", host))
|
mutate(host = ifelse(host %like% "horse", "horse", host))
|
||||||
@@ -304,7 +322,7 @@ breakpoints_new <- breakpoints_new |>
|
|||||||
# FIXES FOR WHONET ERRORS ----
|
# FIXES FOR WHONET ERRORS ----
|
||||||
m <- unique(as.double(as.mic(levels(as.mic(1)))))
|
m <- unique(as.double(as.mic(levels(as.mic(1)))))
|
||||||
|
|
||||||
# WHONET has no >1024 but instead uses 1025, 513, etc, so as.mic() cannot be used to clean.
|
# WHONET has no >1024 but instead uses 1025, 513, and 129, so as.mic() cannot be used to clean.
|
||||||
# instead, raise these one higher valid MIC factor level:
|
# instead, raise these one higher valid MIC factor level:
|
||||||
breakpoints_new |> filter(method == "MIC" & (!breakpoint_S %in% c(m, NA))) |> distinct(breakpoint_S)
|
breakpoints_new |> filter(method == "MIC" & (!breakpoint_S %in% c(m, NA))) |> distinct(breakpoint_S)
|
||||||
breakpoints_new |> filter(method == "MIC" & (!breakpoint_R %in% c(m, NA))) |> distinct(breakpoint_R)
|
breakpoints_new |> filter(method == "MIC" & (!breakpoint_R %in% c(m, NA))) |> distinct(breakpoint_R)
|
||||||
@@ -318,6 +336,7 @@ anyNA(breakpoints_new$breakpoint_S)
|
|||||||
|
|
||||||
# a lot of R breakpoints are missing, but for CLSI this is required and can be set using as.sir(..., substitute_missing_r_breakpoint = TRUE/FALSE, ...)
|
# a lot of R breakpoints are missing, but for CLSI this is required and can be set using as.sir(..., substitute_missing_r_breakpoint = TRUE/FALSE, ...)
|
||||||
# 2025-04-20/ For EUCAST, this should not be the case, only happens to old guideline now it seems
|
# 2025-04-20/ For EUCAST, this should not be the case, only happens to old guideline now it seems
|
||||||
|
# 2026-03-27/ Now 2026 is in it as well, but making R same to S is fine
|
||||||
breakpoints_new |>
|
breakpoints_new |>
|
||||||
filter(method == "MIC" & guideline %like% "EUCAST" & is.na(breakpoint_R)) |>
|
filter(method == "MIC" & guideline %like% "EUCAST" & is.na(breakpoint_R)) |>
|
||||||
count(guideline)
|
count(guideline)
|
||||||
@@ -325,10 +344,15 @@ breakpoints_new[which(breakpoints_new$method == "MIC" & breakpoints_new$guidelin
|
|||||||
|
|
||||||
|
|
||||||
# fix streptococci in WHONET table of EUCAST: Strep A, B, C and G must only include these groups and not all streptococci:
|
# fix streptococci in WHONET table of EUCAST: Strep A, B, C and G must only include these groups and not all streptococci:
|
||||||
breakpoints_new$mo[breakpoints_new$mo == "B_STRPT" & breakpoints_new$ref_tbl %like% "^strep.* a.* b.*c.*g"] <- as.mo("B_STRPT_ABCG")
|
# 2026-03-27/ Only erroneous in EUCAST until 2024, it's fixed for 2025 and 2026, but we need to fix this historically too
|
||||||
|
breakpoints_new$mo[breakpoints_new$guideline %like% "EUCAST" & breakpoints_new$mo == "B_STRPT" & breakpoints_new$ref_tbl %like% "^strep.* a.* b.*c.*g"] <- as.mo("B_STRPT_ABCG")
|
||||||
# Haemophilus same error (must only be H. influenzae)
|
# Haemophilus same error (must only be H. influenzae)
|
||||||
breakpoints_new$mo[breakpoints_new$mo == "B_HMPHL" & breakpoints_new$ref_tbl %like% "^h.* influenzae"] <- as.mo("B_HMPHL_INFL")
|
# 2026-03-27/ Only erroneous in EUCAST until 2024, it's fixed for 2025 and 2026, but we need to fix this historically too
|
||||||
|
breakpoints_new$mo[breakpoints_new$guideline %like% "EUCAST" & breakpoints_new$mo == "B_HMPHL" & breakpoints_new$ref_tbl %like% "^h.* influenzae"] <- as.mo("B_HMPHL_INFL")
|
||||||
# EUCAST says that for H. parainfluenzae the H. influenza rules can be used, so add them
|
# EUCAST says that for H. parainfluenzae the H. influenza rules can be used, so add them
|
||||||
|
breakpoints_new |>
|
||||||
|
filter(method == "MIC" & guideline %like% "EUCAST" & mo %like% as.mo("B_HMPHL")) |>
|
||||||
|
count(guideline, mo)
|
||||||
breakpoints_new <- breakpoints_new |>
|
breakpoints_new <- breakpoints_new |>
|
||||||
bind_rows(
|
bind_rows(
|
||||||
breakpoints_new |>
|
breakpoints_new |>
|
||||||
@@ -345,24 +369,56 @@ breakpoints_new |> filter(mo == as.mo("Streptococcus viridans") & ab == "GEH")
|
|||||||
breakpoints_new <- breakpoints_new |> filter(!(mo == as.mo("Streptococcus viridans") & ab == "GEN"))
|
breakpoints_new <- breakpoints_new |> filter(!(mo == as.mo("Streptococcus viridans") & ab == "GEN"))
|
||||||
# Nitrofurantoin in Staph (EUCAST) only applies to S. saprophyticus, while WHONET has the DISK correct but the MIC on genus level
|
# Nitrofurantoin in Staph (EUCAST) only applies to S. saprophyticus, while WHONET has the DISK correct but the MIC on genus level
|
||||||
breakpoints_new$mo[breakpoints_new$mo == "B_STPHY" & breakpoints_new$ab == "NIT" & breakpoints_new$guideline %like% "EUCAST"] <- as.mo("B_STPHY_SPRP")
|
breakpoints_new$mo[breakpoints_new$mo == "B_STPHY" & breakpoints_new$ab == "NIT" & breakpoints_new$guideline %like% "EUCAST"] <- as.mo("B_STPHY_SPRP")
|
||||||
|
|
||||||
|
# WHONET contains breakpoint for EUCAST that are not actually in EUCAST:
|
||||||
|
# IPM in M. morganii is not in it since v10
|
||||||
|
wrong <- with(breakpoints_new, guideline %like% "EUCAST" & ab == "IPM" & mo == as.mo("M. morganii") & ref_tbl != "ECOFF")
|
||||||
|
breakpoints_new |> filter(wrong)
|
||||||
|
breakpoints_new <- breakpoints_new |> filter(!wrong)
|
||||||
|
# Breakpoints for COPS were part of EUCAST until v11
|
||||||
|
wrong <- with(breakpoints_new, guideline %like% "EUCAST" & mo == as.mo("CoPS") & ref_tbl != "ECOFF")
|
||||||
|
breakpoints_new |> filter(wrong)
|
||||||
|
breakpoints_new <- breakpoints_new |> filter(!wrong)
|
||||||
|
|
||||||
# WHONET sets the 2023 breakpoints for SAM to MIC of 16/32 for Enterobacterales, should be MIC 8/32 like AMC (see issue #123 on github.com/msberends/AMR)
|
# WHONET sets the 2023 breakpoints for SAM to MIC of 16/32 for Enterobacterales, should be MIC 8/32 like AMC (see issue #123 on github.com/msberends/AMR)
|
||||||
# 2024-02-22/ fixed now
|
# 2024-02-22/ fixed now
|
||||||
|
|
||||||
# There's a problem with C. diff in EUCAST where breakpoint_R is missing - they are listed as normal human breakpoints but are ECOFF
|
# There's a problem with C. diff in EUCAST where breakpoint_R is missing - they are listed as normal human breakpoints but are ECOFF
|
||||||
# 2025-04-20/ fixed now
|
# 2025-04-20/ fixed now
|
||||||
|
|
||||||
# determine rank again now that some changes were made on taxonomic level (genus -> species)
|
# WHONET sets for EUCAST 2026 TMP breakpoints for all Klebsiella, but this is now only for non-aerogenes species
|
||||||
|
kleb_spp <- microorganisms |> filter(rank == "species", genus == "Klebsiella", !species %in% c("", "aerogenes")) |> pull(mo)
|
||||||
|
kleb_tmp_mic <- breakpoints_new |>
|
||||||
|
filter(guideline == "EUCAST 2026", method == "MIC", ab == "TMP", mo == as.mo("Klebsiella")) |>
|
||||||
|
uncount(length(kleb_spp)) |>
|
||||||
|
mutate(mo = kleb_spp)
|
||||||
|
kleb_tmp_disk <- breakpoints_new |>
|
||||||
|
filter(guideline == "EUCAST 2026", method == "DISK", ab == "TMP", mo == as.mo("Klebsiella")) |>
|
||||||
|
uncount(length(kleb_spp)) |>
|
||||||
|
mutate(mo = kleb_spp)
|
||||||
breakpoints_new <- breakpoints_new |>
|
breakpoints_new <- breakpoints_new |>
|
||||||
mutate(rank_index = case_when(
|
filter(!(guideline == "EUCAST 2026" & method == "MIC" & ab == "TMP" & mo == as.mo("Klebsiella"))) |>
|
||||||
mo_rank(mo, keep_synonyms = TRUE) %like% "(infra|sub)" ~ 1,
|
bind_rows(kleb_tmp_mic,
|
||||||
mo_rank(mo, keep_synonyms = TRUE) == "species" ~ 2,
|
kleb_tmp_disk)
|
||||||
mo_rank(mo, keep_synonyms = TRUE) == "species group" ~ 2.5,
|
|
||||||
mo_rank(mo, keep_synonyms = TRUE) == "genus" ~ 3,
|
# WHONET contains wrong EUCAST breakpoints for enterococci/SXT: disk should be 23/23, not 21/50, and MIC should be 1/1, not 0.032/1
|
||||||
mo_rank(mo, keep_synonyms = TRUE) == "family" ~ 4,
|
# applies to all previous years, since v11 (2011)
|
||||||
mo_rank(mo, keep_synonyms = TRUE) == "order" ~ 5,
|
breakpoints_new |> filter(guideline %like% "EUCAST", ab == "SXT", mo == as.mo("Enterococcus"), type == "human")
|
||||||
mo != "UNKNOWN" ~ 6, # for B_ANAER, etc.
|
breakpoints_new$breakpoint_S[breakpoints_new$guideline %like% "EUCAST" & breakpoints_new$ab == "SXT" & breakpoints_new$mo == as.mo("Enterococcus") & breakpoints_new$type == "human" & breakpoints_new$method == "DISK"] <- 23
|
||||||
TRUE ~ 7
|
breakpoints_new$breakpoint_R[breakpoints_new$guideline %like% "EUCAST" & breakpoints_new$ab == "SXT" & breakpoints_new$mo == as.mo("Enterococcus") & breakpoints_new$type == "human" & breakpoints_new$method == "DISK"] <- 23
|
||||||
))
|
breakpoints_new$breakpoint_S[breakpoints_new$guideline %like% "EUCAST" & breakpoints_new$ab == "SXT" & breakpoints_new$mo == as.mo("Enterococcus") & breakpoints_new$type == "human" & breakpoints_new$method == "MIC"] <- 1
|
||||||
|
breakpoints_new$breakpoint_R[breakpoints_new$guideline %like% "EUCAST" & breakpoints_new$ab == "SXT" & breakpoints_new$mo == as.mo("Enterococcus") & breakpoints_new$type == "human" & breakpoints_new$method == "MIC"] <- 1
|
||||||
|
# Also wrong EUCAST breakpoints for enterococci/TMP: disk should be 21/21, not 21/50, and MIC should be 1/1, not 0.032/1
|
||||||
|
breakpoints_new |> filter(guideline %like% "EUCAST", ab == "TMP", mo == as.mo("Enterococcus"), type == "human")
|
||||||
|
breakpoints_new$breakpoint_S[breakpoints_new$guideline %like% "EUCAST" & breakpoints_new$ab == "TMP" & breakpoints_new$mo == as.mo("Enterococcus") & breakpoints_new$type == "human" & breakpoints_new$method == "DISK"] <- 21
|
||||||
|
breakpoints_new$breakpoint_R[breakpoints_new$guideline %like% "EUCAST" & breakpoints_new$ab == "TMP" & breakpoints_new$mo == as.mo("Enterococcus") & breakpoints_new$type == "human" & breakpoints_new$method == "DISK"] <- 21
|
||||||
|
breakpoints_new$breakpoint_S[breakpoints_new$guideline %like% "EUCAST" & breakpoints_new$ab == "TMP" & breakpoints_new$mo == as.mo("Enterococcus") & breakpoints_new$type == "human" & breakpoints_new$method == "MIC"] <- 1
|
||||||
|
breakpoints_new$breakpoint_R[breakpoints_new$guideline %like% "EUCAST" & breakpoints_new$ab == "TMP" & breakpoints_new$mo == as.mo("Enterococcus") & breakpoints_new$type == "human" & breakpoints_new$method == "MIC"] <- 1
|
||||||
|
|
||||||
|
# WHONET still contains PK/PD rules for EUCAST >= 2024, but this was ended from v14 (2024) on
|
||||||
|
breakpoints_new <- breakpoints_new |>
|
||||||
|
filter(!(guideline %like% "EUCAST (2024|2025|2026)" & ref_tbl == "PK/PD"))
|
||||||
|
|
||||||
|
|
||||||
# WHONET adds one log2 level to the R breakpoint for their software, e.g. in AMC in Enterobacterales:
|
# WHONET adds one log2 level to the R breakpoint for their software, e.g. in AMC in Enterobacterales:
|
||||||
# EUCAST 2023 guideline: S <= 8 and R > 8
|
# EUCAST 2023 guideline: S <= 8 and R > 8
|
||||||
@@ -383,24 +439,24 @@ breakpoints_new <- breakpoints_new |>
|
|||||||
breakpoint_R
|
breakpoint_R
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
# check the strange duplicates
|
# check the strange duplicates
|
||||||
breakpoints_new |>
|
breakpoints_new |>
|
||||||
mutate(id = paste(guideline, type, host, method, site, mo, ab, uti)) %>%
|
mutate(id = paste(guideline, type, host, method, site, mo, ab, uti)) %>%
|
||||||
filter(id %in% .$id[which(duplicated(id))]) |>
|
filter(id %in% .$id[which(duplicated(id))]) |>
|
||||||
arrange(desc(guideline)) |>
|
arrange(desc(guideline)) |>
|
||||||
View()
|
View()
|
||||||
# 2024-06-19/ mostly ECOFFs, but there's no explanation in the whonet_breakpoints file, we have to remove duplicates
|
# 2024-06-19/ mostly ECOFFs, but there's no explanation in the whonet_breakpoints_raw df, we have to remove duplicates
|
||||||
# 2025-04-20/ same, most important one seems M. tuberculosis in CLSI (also in 2025)
|
# 2025-04-20/ same, most important one seems M. tuberculosis in CLSI (also in 2025)
|
||||||
breakpoints_new <- breakpoints_new |>
|
breakpoints_new <- breakpoints_new |>
|
||||||
distinct(guideline, type, host, method, site, mo, ab, uti, .keep_all = TRUE)
|
distinct(guideline, type, host, method, site, mo, ab, uti, .keep_all = TRUE)
|
||||||
|
|
||||||
|
|
||||||
# CHECKS AND SAVE TO PACKAGE ----
|
# CHECKS ----
|
||||||
|
|
||||||
# check again
|
breakpoints_new |> filter(guideline == "EUCAST 2026", ab == "AMC", mo == "B_[ORD]_ENTRBCTR", method == "MIC")
|
||||||
breakpoints_new |> filter(guideline == "EUCAST 2025", ab == "AMC", mo == "B_[ORD]_ENTRBCTR", method == "MIC")
|
|
||||||
# compare with current version
|
# compare with current version
|
||||||
clinical_breakpoints |> filter(guideline == "EUCAST 2024", ab == "AMC", mo == "B_[ORD]_ENTRBCTR", method == "MIC")
|
clinical_breakpoints |> filter(guideline == "EUCAST 2025", ab == "AMC", mo == "B_[ORD]_ENTRBCTR", method == "MIC")
|
||||||
|
|
||||||
# must have "human" and "ECOFF"
|
# must have "human" and "ECOFF"
|
||||||
breakpoints_new |> filter(mo == "B_STRPT_PNMN", ab == "AMP", guideline == "EUCAST 2020", method == "MIC")
|
breakpoints_new |> filter(mo == "B_STRPT_PNMN", ab == "AMP", guideline == "EUCAST 2020", method == "MIC")
|
||||||
@@ -409,6 +465,24 @@ breakpoints_new |> filter(mo == "B_STRPT_PNMN", ab == "AMP", guideline == "EUCAS
|
|||||||
dim(breakpoints_new)
|
dim(breakpoints_new)
|
||||||
dim(clinical_breakpoints)
|
dim(clinical_breakpoints)
|
||||||
|
|
||||||
|
|
||||||
|
# SAVE TO PACKAGE ----
|
||||||
|
|
||||||
|
# determine rank again now that some changes were made on taxonomic level (genus -> species)
|
||||||
|
breakpoints_new <- breakpoints_new |>
|
||||||
|
mutate(rank_index = case_when(
|
||||||
|
mo_rank(mo, keep_synonyms = TRUE) %like% "(infra|sub)" ~ 1,
|
||||||
|
mo_rank(mo, keep_synonyms = TRUE) == "species" ~ 2,
|
||||||
|
mo_rank(mo, keep_synonyms = TRUE) == "species group" ~ 2.5,
|
||||||
|
mo_rank(mo, keep_synonyms = TRUE) == "genus" ~ 3,
|
||||||
|
mo_rank(mo, keep_synonyms = TRUE) == "family" ~ 4,
|
||||||
|
mo_rank(mo, keep_synonyms = TRUE) == "order" ~ 5,
|
||||||
|
mo != "UNKNOWN" ~ 6, # for B_ANAER, etc.
|
||||||
|
TRUE ~ 7
|
||||||
|
)) |>
|
||||||
|
# and arrange
|
||||||
|
arrange(desc(guideline), mo, ab, type, host, method)
|
||||||
|
|
||||||
clinical_breakpoints <- breakpoints_new
|
clinical_breakpoints <- breakpoints_new
|
||||||
clinical_breakpoints <- clinical_breakpoints |> dataset_UTF8_to_ASCII()
|
clinical_breakpoints <- clinical_breakpoints |> dataset_UTF8_to_ASCII()
|
||||||
usethis::use_data(clinical_breakpoints, overwrite = TRUE, compress = "xz", version = 2)
|
usethis::use_data(clinical_breakpoints, overwrite = TRUE, compress = "xz", version = 2)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
c7062e60fa4fbc2eee233044d15903ce
|
45068afc4cd9770dea329782c1aed045
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2832,6 +2832,7 @@
|
|||||||
"FU-" "B_FSBCTR"
|
"FU-" "B_FSBCTR"
|
||||||
"FUA.SP" "F_FUSRM"
|
"FUA.SP" "F_FUSRM"
|
||||||
"FUL" "B_FSBCTR_ULCR"
|
"FUL" "B_FSBCTR_ULCR"
|
||||||
|
"FUO" "F_FUSRM_OXYS"
|
||||||
"FUR" "F_FUSRM"
|
"FUR" "F_FUSRM"
|
||||||
"FUROXY" "F_FUSRM_OXYS"
|
"FUROXY" "F_FUSRM_OXYS"
|
||||||
"FURPET" "F_FUSRM_PTRL"
|
"FURPET" "F_FUSRM_PTRL"
|
||||||
@@ -2936,6 +2937,7 @@
|
|||||||
"GLO.SP" "B_GLBCT"
|
"GLO.SP" "B_GLBCT"
|
||||||
"GLOSAN" "B_GLBCT_SNGN"
|
"GLOSAN" "B_GLBCT_SNGN"
|
||||||
"GLOSPP" "B_GLBCT"
|
"GLOSPP" "B_GLBCT"
|
||||||
|
"GLS" "B_GLSSR"
|
||||||
"GM+" "B_GRAMP"
|
"GM+" "B_GRAMP"
|
||||||
"GM-" "B_GRAMN"
|
"GM-" "B_GRAMN"
|
||||||
"GMO" "B_GEMLL_MRBL"
|
"GMO" "B_GEMLL_MRBL"
|
||||||
@@ -3026,7 +3028,6 @@
|
|||||||
"HABSPP" "B_HMTBC"
|
"HABSPP" "B_HMTBC"
|
||||||
"HAC" "B_AGGRG_ACTN"
|
"HAC" "B_AGGRG_ACTN"
|
||||||
"HACEK" "B_HACEK"
|
"HACEK" "B_HACEK"
|
||||||
"HACEK" "B_HACEK"
|
|
||||||
"HAE" "B_HMPHL"
|
"HAE" "B_HMPHL"
|
||||||
"HAE.SP" "B_HMPHL"
|
"HAE.SP" "B_HMPHL"
|
||||||
"HAEAEG" "B_HMPHL_AEGY"
|
"HAEAEG" "B_HMPHL_AEGY"
|
||||||
@@ -3122,7 +3123,7 @@
|
|||||||
"HPL" "B_HMPHL_PRPH"
|
"HPL" "B_HMPHL_PRPH"
|
||||||
"HPO" "F_OGATA"
|
"HPO" "F_OGATA"
|
||||||
"HPOSPP" "F_HNDRS_ASTR"
|
"HPOSPP" "F_HNDRS_ASTR"
|
||||||
"HPR" "B_HMPHL_PRSS"
|
"HPR" "B_GLSSR_PRSS"
|
||||||
"HPU" "B_HLCBCT_PLLR"
|
"HPU" "B_HLCBCT_PLLR"
|
||||||
"HPY" "B_HLCBCT_PYLR"
|
"HPY" "B_HLCBCT_PYLR"
|
||||||
"HRB" "B_HRBSP"
|
"HRB" "B_HRBSP"
|
||||||
@@ -3471,6 +3472,7 @@
|
|||||||
"LQU" "B_LGNLL_QTRN"
|
"LQU" "B_LGNLL_QTRN"
|
||||||
"LRC" "B_LPTSP_INTR"
|
"LRC" "B_LPTSP_INTR"
|
||||||
"LRE" "B_LCTBC_RETR"
|
"LRE" "B_LCTBC_RETR"
|
||||||
|
"LRF" "B_LCTCC_RFFN"
|
||||||
"LRI" "B_LMNRL_RCHR"
|
"LRI" "B_LMNRL_RCHR"
|
||||||
"LRU" "B_LGNLL_RBRL"
|
"LRU" "B_LGNLL_RBRL"
|
||||||
"LSA" "B_LCTBC_SLVR"
|
"LSA" "B_LCTBC_SLVR"
|
||||||
@@ -3760,6 +3762,7 @@
|
|||||||
"MNE" "B_MYCBC_NERM"
|
"MNE" "B_MYCBC_NERM"
|
||||||
"MNL" "B_MRXLL_NNLQ"
|
"MNL" "B_MRXLL_NNLQ"
|
||||||
"MNO" "B_MYCBC_NNCH"
|
"MNO" "B_MYCBC_NNCH"
|
||||||
|
"MNT" "B_MYCBC"
|
||||||
"MNV" "B_MNNHM_VRGN"
|
"MNV" "B_MNNHM_VRGN"
|
||||||
"MO-" "B_MRXLL"
|
"MO-" "B_MRXLL"
|
||||||
"MO.BOV" "B_MRXLL_BOVS"
|
"MO.BOV" "B_MRXLL_BOVS"
|
||||||
@@ -4295,6 +4298,7 @@
|
|||||||
"PAT.SP" "B_PANTO"
|
"PAT.SP" "B_PANTO"
|
||||||
"PAU" "B_SLMNL_ENTR_ENTR"
|
"PAU" "B_SLMNL_ENTR_ENTR"
|
||||||
"PAV" "B_AVBCT_AVIM"
|
"PAV" "B_AVBCT_AVIM"
|
||||||
|
"PBA" "B_PSDCL_ALBA"
|
||||||
"PBC" "B_PRVTL_BCCL"
|
"PBC" "B_PRVTL_BCCL"
|
||||||
"PBE" "B_PSTRL_BTTY"
|
"PBE" "B_PSTRL_BTTY"
|
||||||
"PBI" "B_PRBCT"
|
"PBI" "B_PRBCT"
|
||||||
@@ -4591,6 +4595,7 @@
|
|||||||
"PSA" "F_PSDLL"
|
"PSA" "F_PSDLL"
|
||||||
"PSA.SP" "F_PSDLL"
|
"PSA.SP" "F_PSDLL"
|
||||||
"PSASPP" "F_PSDLL"
|
"PSASPP" "F_PSDLL"
|
||||||
|
"PSB" "B_PSDCL"
|
||||||
"PSC" "F_PSDCH"
|
"PSC" "F_PSDCH"
|
||||||
"PSCSPP" "B_PSDCL"
|
"PSCSPP" "B_PSDCL"
|
||||||
"PSD" "B_STPHY_PSDN"
|
"PSD" "B_STPHY_PSDN"
|
||||||
@@ -4706,6 +4711,7 @@
|
|||||||
"RAH.SP" "B_RHNLL"
|
"RAH.SP" "B_RHNLL"
|
||||||
"RAHAQU" "B_RHNLL_AQTL"
|
"RAHAQU" "B_RHNLL_AQTL"
|
||||||
"RAHSPP" "B_RHNLL"
|
"RAHSPP" "B_RHNLL"
|
||||||
|
"RAI" "B_RLSTN_INSD"
|
||||||
"RAK" "B_RTTSA_AKAR"
|
"RAK" "B_RTTSA_AKAR"
|
||||||
"RAL" "B_RLSTN"
|
"RAL" "B_RLSTN"
|
||||||
"RAL.SP" "B_RLSTN"
|
"RAL.SP" "B_RLSTN"
|
||||||
@@ -4800,6 +4806,7 @@
|
|||||||
"ROD" "B_RDNTB"
|
"ROD" "B_RDNTB"
|
||||||
"RODPNE" "B_RDNTB_PNMT"
|
"RODPNE" "B_RDNTB_PNMT"
|
||||||
"RODSPP" "B_RDNTB"
|
"RODSPP" "B_RDNTB"
|
||||||
|
"ROK" "B_ROTHI_KRST"
|
||||||
"ROL" "F_RHZPS_MCRS"
|
"ROL" "F_RHZPS_MCRS"
|
||||||
"ROM" "B_RSMNS"
|
"ROM" "B_RSMNS"
|
||||||
"ROMMUC" "B_RSMNS"
|
"ROMMUC" "B_RSMNS"
|
||||||
@@ -5042,8 +5049,10 @@
|
|||||||
"SAV" "B_SLMNL_ARCH"
|
"SAV" "B_SLMNL_ARCH"
|
||||||
"SB2" "B_STRPT_BOVS"
|
"SB2" "B_STRPT_BOVS"
|
||||||
"SBA" "B_SLMNL_BRLL"
|
"SBA" "B_SLMNL_BRLL"
|
||||||
|
"SBC" "B_SLBCL"
|
||||||
"SBE" "B_SHWNL_BNTH"
|
"SBE" "B_SHWNL_BNTH"
|
||||||
"SBG" "B_SLMNL_BNGR"
|
"SBG" "B_SLMNL_BNGR"
|
||||||
|
"SBI" "B_SLBCL_SLVS"
|
||||||
"SBL" "B_SLMNL_BLCK"
|
"SBL" "B_SLMNL_BLCK"
|
||||||
"SBM" "B_SLMNL_BVSM"
|
"SBM" "B_SLMNL_BVSM"
|
||||||
"SBN" "B_SLMNL_BBRG"
|
"SBN" "B_SLMNL_BBRG"
|
||||||
@@ -5078,6 +5087,7 @@
|
|||||||
"SCS" "F_SCLCB_CNST"
|
"SCS" "F_SCLCB_CNST"
|
||||||
"SCT" "B_STRPT_CNST"
|
"SCT" "B_STRPT_CNST"
|
||||||
"SCU" "B_STPHY_CRNS"
|
"SCU" "B_STPHY_CRNS"
|
||||||
|
"SCV" "F_SCPLR_VCLS"
|
||||||
"SCY" "F_SCYTL"
|
"SCY" "F_SCYTL"
|
||||||
"SCYSPP" "F_SCYTL"
|
"SCYSPP" "F_SCYTL"
|
||||||
"SD1" "B_SHGLL_DYSN"
|
"SD1" "B_SHGLL_DYSN"
|
||||||
@@ -5656,6 +5666,7 @@
|
|||||||
"TAYSPP" "B_TYLRL"
|
"TAYSPP" "B_TYLRL"
|
||||||
"TBE" "F_GTRCH_RDLL"
|
"TBE" "F_GTRCH_RDLL"
|
||||||
"TBESPP" "F_TRCHS"
|
"TBESPP" "F_TRCHS"
|
||||||
|
"TBH" "F_TRCHP_BNHM"
|
||||||
"TBN" "B_TRPRL_BRNR"
|
"TBN" "B_TRPRL_BRNR"
|
||||||
"TCA" "F_DBRYM_CHVL"
|
"TCA" "F_DBRYM_CHVL"
|
||||||
"TCASPP" "F_CANDD"
|
"TCASPP" "F_CANDD"
|
||||||
@@ -5841,6 +5852,8 @@
|
|||||||
"TYASPP" "F_TRCHP"
|
"TYASPP" "F_TRCHP"
|
||||||
"TYE" "P_TRYPN_JNSN"
|
"TYE" "P_TRYPN_JNSN"
|
||||||
"TYI" "F_TRCHP_INDT"
|
"TYI" "F_TRCHP_INDT"
|
||||||
|
"TYM" "B_TRPHR"
|
||||||
|
"TYW" "B_TRPHR_WHPP"
|
||||||
"ULO" "F_ULCLD"
|
"ULO" "F_ULCLD"
|
||||||
"UNK" "UNKNOWN"
|
"UNK" "UNKNOWN"
|
||||||
"UPEC" "B_ESCHR_COLI"
|
"UPEC" "B_ESCHR_COLI"
|
||||||
@@ -5850,6 +5863,7 @@
|
|||||||
"UREPAR" "B_URPLS_PRVM"
|
"UREPAR" "B_URPLS_PRVM"
|
||||||
"URESPP" "B_URPLS"
|
"URESPP" "B_URPLS"
|
||||||
"UREURE" "B_URPLS_URLY"
|
"UREURE" "B_URPLS_URLY"
|
||||||
|
"URP" "B_URPLS_PRVM"
|
||||||
"UUR" "B_URPLS_URLY"
|
"UUR" "B_URPLS_URLY"
|
||||||
"V.ALG" "B_VIBRI_ALGN"
|
"V.ALG" "B_VIBRI_ALGN"
|
||||||
"V.CHO" "B_VIBRI_CHLR"
|
"V.CHO" "B_VIBRI_CHLR"
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
|||||||
986d5110a46bbf297ebaeb4dd5179fff
|
6ef98bb1bcd27052fde453bb12c0b285
|
||||||
|
|||||||
Binary file not shown.
BIN
data-raw/v_16.0__BreakpointTables.xlsx
Normal file
BIN
data-raw/v_16.0__BreakpointTables.xlsx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
32
index.md
32
index.md
@@ -10,7 +10,7 @@
|
|||||||
even WISCA
|
even WISCA
|
||||||
- Provides the **full microbiological taxonomy** of ~79 000 distinct
|
- Provides the **full microbiological taxonomy** of ~79 000 distinct
|
||||||
species and extensive info of ~620 antimicrobial drugs
|
species and extensive info of ~620 antimicrobial drugs
|
||||||
- Applies **CLSI 2011-2025** and **EUCAST 2011-2025** clinical and
|
- Applies **CLSI 2011-2026** and **EUCAST 2011-2026** clinical and
|
||||||
veterinary breakpoints, and ECOFFs, for MIC and disk zone
|
veterinary breakpoints, and ECOFFs, for MIC and disk zone
|
||||||
interpretation
|
interpretation
|
||||||
- Corrects for duplicate isolates, **calculates** and **predicts** AMR
|
- Corrects for duplicate isolates, **calculates** and **predicts** AMR
|
||||||
@@ -68,7 +68,7 @@ species**](./reference/microorganisms.html) (updated June 2024) and all
|
|||||||
drugs**](./reference/antimicrobials.html) by name and code (including
|
drugs**](./reference/antimicrobials.html) by name and code (including
|
||||||
ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all
|
ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all
|
||||||
about valid SIR and MIC values. The integral clinical breakpoint
|
about valid SIR and MIC values. The integral clinical breakpoint
|
||||||
guidelines from CLSI 2011-2025 and EUCAST 2011-2025 are included, even
|
guidelines from CLSI 2011-2026 and EUCAST 2011-2026 are included, even
|
||||||
with epidemiological cut-off (ECOFF) values. It supports and can read
|
with epidemiological cut-off (ECOFF) values. It supports and can read
|
||||||
any data format, including WHONET data. This package works on Windows,
|
any data format, including WHONET data. This package works on Windows,
|
||||||
macOS and Linux with all versions of R since R-3.0 (April 2013). **It
|
macOS and Linux with all versions of R since R-3.0 (April 2013). **It
|
||||||
@@ -171,14 +171,14 @@ example_isolates %>%
|
|||||||
select(bacteria,
|
select(bacteria,
|
||||||
aminoglycosides(),
|
aminoglycosides(),
|
||||||
carbapenems())
|
carbapenems())
|
||||||
#> ℹ Using column 'mo' as input for `mo_fullname()`
|
#> ℹ Using column mo as input for `mo_fullname()`
|
||||||
#> ℹ Using column 'mo' as input for `mo_is_gram_negative()`
|
#> ℹ Using column mo as input for `mo_is_gram_negative()`
|
||||||
#> ℹ Using column 'mo' as input for `mo_is_intrinsic_resistant()`
|
#> ℹ Using column mo as input for `mo_is_intrinsic_resistant()`
|
||||||
#> ℹ Determining intrinsic resistance based on 'EUCAST Expected Resistant
|
#> ℹ Determining intrinsic resistance based on 'EUCAST Expected Resistant
|
||||||
#> Phenotypes' v1.2 (2023). This note will be shown once per session.
|
#> Phenotypes' v1.2 (2023). This note will be shown once per session.
|
||||||
#> ℹ For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
|
#> ℹ For `aminoglycosides()` using columns GEN (gentamicin), TOB (tobramycin), AMK
|
||||||
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
|
#> (amikacin), and KAN (kanamycin)
|
||||||
#> ℹ For `carbapenems()` using columns 'IPM' (imipenem) and 'MEM' (meropenem)
|
#> ℹ For `carbapenems()` using columns IPM (imipenem) and MEM (meropenem)
|
||||||
#> # A tibble: 35 × 7
|
#> # A tibble: 35 × 7
|
||||||
#> bacteria GEN TOB AMK KAN IPM MEM
|
#> bacteria GEN TOB AMK KAN IPM MEM
|
||||||
#> <chr> <sir> <sir> <sir> <sir> <sir> <sir>
|
#> <chr> <sir> <sir> <sir> <sir> <sir> <sir>
|
||||||
@@ -215,9 +215,9 @@ output format automatically (such as markdown, LaTeX, HTML, etc.).
|
|||||||
``` r
|
``` r
|
||||||
antibiogram(example_isolates,
|
antibiogram(example_isolates,
|
||||||
antimicrobials = c(aminoglycosides(), carbapenems()))
|
antimicrobials = c(aminoglycosides(), carbapenems()))
|
||||||
#> ℹ For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
|
#> ℹ For `aminoglycosides()` using columns GEN (gentamicin), TOB (tobramycin), AMK
|
||||||
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
|
#> (amikacin), and KAN (kanamycin)
|
||||||
#> ℹ For `carbapenems()` using columns 'IPM' (imipenem) and 'MEM' (meropenem)
|
#> ℹ For `carbapenems()` using columns IPM (imipenem) and MEM (meropenem)
|
||||||
```
|
```
|
||||||
|
|
||||||
| Pathogen | Amikacin | Gentamicin | Imipenem | Kanamycin | Meropenem | Tobramycin |
|
| Pathogen | Amikacin | Gentamicin | Imipenem | Kanamycin | Meropenem | Tobramycin |
|
||||||
@@ -344,15 +344,15 @@ out <- example_isolates %>%
|
|||||||
# calculate AMR using resistance(), over all aminoglycosides and polymyxins:
|
# calculate AMR using resistance(), over all aminoglycosides and polymyxins:
|
||||||
summarise(across(c(aminoglycosides(), polymyxins()),
|
summarise(across(c(aminoglycosides(), polymyxins()),
|
||||||
resistance))
|
resistance))
|
||||||
#> ℹ For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
|
#> ℹ For `aminoglycosides()` using columns GEN (gentamicin), TOB (tobramycin), AMK
|
||||||
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
|
#> (amikacin), and KAN (kanamycin)
|
||||||
#> ℹ For `polymyxins()` using column 'COL' (colistin)
|
#> ℹ For `polymyxins()` using column COL (colistin)
|
||||||
#> Warning: There was 1 warning in `summarise()`.
|
#> Warning: There was 1 warning in `summarise()`.
|
||||||
#> ℹ In argument: `across(c(aminoglycosides(), polymyxins()), resistance)`.
|
#> ℹ In argument: `across(c(aminoglycosides(), polymyxins()), resistance)`.
|
||||||
#> ℹ In group 3: `ward = "Outpatient"`.
|
#> ℹ In group 3: `ward = "Outpatient"`.
|
||||||
#> Caused by warning:
|
#> Caused by warning:
|
||||||
#> ! Introducing NA: only 23 results available for KAN in group: ward =
|
#> ! Introducing NA: only 23 results available for KAN in group: ward = "Outpatient"
|
||||||
#> "Outpatient" (`minimum` = 30).
|
#> (whilst `minimum = 30`).
|
||||||
out
|
out
|
||||||
#> # A tibble: 3 × 6
|
#> # A tibble: 3 × 6
|
||||||
#> ward GEN TOB AMK KAN COL
|
#> ward GEN TOB AMK KAN COL
|
||||||
|
|||||||
@@ -12,20 +12,20 @@ This is an overview of all the package-specific options you can set in the \code
|
|||||||
|
|
||||||
\itemize{
|
\itemize{
|
||||||
\item \code{AMR_antibiogram_formatting_type} \cr A \link{numeric} (1-22) to use in \code{\link[=antibiogram]{antibiogram()}}, to indicate which formatting type to use.
|
\item \code{AMR_antibiogram_formatting_type} \cr A \link{numeric} (1-22) to use in \code{\link[=antibiogram]{antibiogram()}}, to indicate which formatting type to use.
|
||||||
\item \code{AMR_breakpoint_type} \cr A \link{character} to use in \code{\link[=as.sir]{as.sir()}}, to indicate which breakpoint type to use. This must be either "ECOFF", "animal", or "human".
|
\item \code{AMR_breakpoint_type} \cr A \link{character} to use in \code{\link[=as.sir]{as.sir()}}, to indicate which breakpoint type to use. This must be either {.val ECOFF}, {.val animal}, or {.val human}.
|
||||||
\item \code{AMR_capped_mic_handling} \cr A \link{character} to use in \code{\link[=as.sir]{as.sir()}}, to indicate how capped MIC values (\code{<}, \code{<=}, \code{>}, \code{>=}) should be interpreted. Must be one of \code{"none"}, \code{"conservative"}, \code{"standard"}, or \code{"lenient"} - the default is \code{"conservative"}.
|
\item \code{AMR_capped_mic_handling} \cr A \link{character} to use in \code{\link[=as.sir]{as.sir()}}, to indicate how capped MIC values (\code{<}, \code{<=}, \code{>}, \code{>=}) should be interpreted. Must be one of \code{"none"}, \code{"conservative"}, \code{"standard"}, or \code{"lenient"} - the default is \code{"conservative"}.
|
||||||
\item \code{AMR_cleaning_regex} \cr A \link[base:regex]{regular expression} (case-insensitive) to use in \code{\link[=as.mo]{as.mo()}} and all \code{\link[=mo_property]{mo_*}} functions, to clean the user input. The default is the outcome of \code{\link[=mo_cleaning_regex]{mo_cleaning_regex()}}, which removes texts between brackets and texts such as "species" and "serovar".
|
\item \code{AMR_cleaning_regex} \cr A \link[base:regex]{regular expression} (case-insensitive) to use in \code{\link[=as.mo]{as.mo()}} and all \code{\link[=mo_property]{mo_*}} functions, to clean the user input. The default is the outcome of \code{\link[=mo_cleaning_regex]{mo_cleaning_regex()}}, which removes texts between brackets and texts such as "species" and "serovar".
|
||||||
\item \code{AMR_custom_ab} \cr A file location to an RDS file, to use custom antimicrobial drugs with this package. This is explained in \code{\link[=add_custom_antimicrobials]{add_custom_antimicrobials()}}.
|
\item \code{AMR_custom_ab} \cr A file location to an RDS file, to use custom antimicrobial drugs with this package. This is explained in \code{\link[=add_custom_antimicrobials]{add_custom_antimicrobials()}}.
|
||||||
\item \code{AMR_custom_mo} \cr A file location to an RDS file, to use custom microorganisms with this package. This is explained in \code{\link[=add_custom_microorganisms]{add_custom_microorganisms()}}.
|
\item \code{AMR_custom_mo} \cr A file location to an RDS file, to use custom microorganisms with this package. This is explained in \code{\link[=add_custom_microorganisms]{add_custom_microorganisms()}}.
|
||||||
\item \code{AMR_eucastrules} \cr A \link{character} to set the default types of rules for \code{\link[=eucast_rules]{eucast_rules()}} function, must be one or more of: \code{"breakpoints"}, \code{"expert"}, \code{"other"}, \code{"custom"}, \code{"all"}, and defaults to \code{c("breakpoints", "expert")}.
|
\item \code{AMR_eucastrules} \cr A \link{character} to set the default types of rules for \code{\link[=eucast_rules]{eucast_rules()}} function, must be one or more of: \code{"breakpoints"}, \code{"expert"}, \code{"other"}, \code{"custom"}, \code{"all"}, and defaults to \code{c("breakpoints", "expert")}.
|
||||||
\item \code{AMR_guideline} \cr A \link{character} to set the default guideline used throughout the \code{AMR} package wherever a \code{guideline} argument is available. This option is used as the default in e.g. \code{\link[=as.sir]{as.sir()}}, \code{\link[=resistance]{resistance()}}, \code{\link[=susceptibility]{susceptibility()}}, \code{\link[=interpretive_rules]{interpretive_rules()}} and many plotting functions. \strong{While unset}, the AMR package uses the latest implemented EUCAST guideline (currently EUCAST 2025).
|
\item \code{AMR_guideline} \cr A \link{character} to set the default guideline used throughout the \code{AMR} package wherever a \code{guideline} argument is available. This option is used as the default in e.g. \code{\link[=as.sir]{as.sir()}}, \code{\link[=resistance]{resistance()}}, \code{\link[=susceptibility]{susceptibility()}}, \code{\link[=interpretive_rules]{interpretive_rules()}} and many plotting functions. \strong{While unset}, the AMR package uses the latest implemented EUCAST guideline (currently EUCAST 2026).
|
||||||
\itemize{
|
\itemize{
|
||||||
\item For \code{\link[=as.sir]{as.sir()}}, this determines which clinical breakpoint guideline is used to interpret MIC values and disk diffusion diameters. It can be either the guideline name (e.g., \code{"CLSI"} or \code{"EUCAST"}) or the name including a year (e.g., \code{"CLSI 2019"}). Supported guidelines are EUCAST 2011 to 2025, and CLSI 2011 to 2025.
|
\item For \code{\link[=as.sir]{as.sir()}}, this determines which clinical breakpoint guideline is used to interpret MIC values and disk diffusion diameters. It can be either the guideline name (e.g., \code{"CLSI"} or \code{"EUCAST"}) or the name including a year (e.g., \code{"CLSI 2019"}). Supported guidelines are EUCAST 2011 to 2026, and CLSI 2011 to 2026.
|
||||||
\item For \code{\link[=resistance]{resistance()}} and \code{\link[=susceptibility]{susceptibility()}}, this setting determines how the \code{"I"} (Intermediate / Increased exposure) category is handled in calculations. Under CLSI, \code{"I"} is considered \emph{resistant} in susceptibility calculations; under EUCAST, \code{"I"} is considered \emph{susceptible} in susceptibility calculations. Explicitly setting this option ensures reproducible AMR proportion estimates.
|
\item For \code{\link[=resistance]{resistance()}} and \code{\link[=susceptibility]{susceptibility()}}, this setting determines how the \code{"I"} (Intermediate / Increased exposure) category is handled in calculations. Under CLSI, \code{"I"} is considered \emph{resistant} in susceptibility calculations; under EUCAST, \code{"I"} is considered \emph{susceptible} in susceptibility calculations. Explicitly setting this option ensures reproducible AMR proportion estimates.
|
||||||
\item For \code{\link[=interpretive_rules]{interpretive_rules()}}, this determines which guideline-specific interpretive (expert) rules are applied to antimicrobial test results, either EUCAST or CLSI.
|
\item For \code{\link[=interpretive_rules]{interpretive_rules()}}, this determines which guideline-specific interpretive (expert) rules are applied to antimicrobial test results, either EUCAST or CLSI.
|
||||||
\item For many plotting functions (e.g., for MIC or disk diffusion values), supplying \code{mo} and \code{ab} enables automatic SIR-based interpretative colouring. These colours are derived from \code{\link[=as.sir]{as.sir()}} in the background and therefore depend on the active \code{guideline} setting, which again uses EUCAST 2025 if not set explicitly.
|
\item For many plotting functions (e.g., for MIC or disk diffusion values), supplying \code{mo} and \code{ab} enables automatic SIR-based interpretative colouring. These colours are derived from \code{\link[=as.sir]{as.sir()}} in the background and therefore depend on the active \code{guideline} setting, which again uses EUCAST 2026 if not set explicitly.
|
||||||
}
|
}
|
||||||
\item \code{AMR_guideline} \cr A \link{character} to set the default guideline for interpreting MIC values and disk diffusion diameters with \code{\link[=as.sir]{as.sir()}}. Can be only the guideline name (e.g., \code{"CLSI"}) or the name with a year (e.g. \code{"CLSI 2019"}). The default to the latest implemented EUCAST guideline, currently \code{"EUCAST 2025"}. Supported guideline are currently EUCAST (2011-2025) and CLSI (2011-2025).
|
\item \code{AMR_guideline} \cr A \link{character} to set the default guideline for interpreting MIC values and disk diffusion diameters with \code{\link[=as.sir]{as.sir()}}. Can be only the guideline name (e.g., \code{"CLSI"}) or the name with a year (e.g. \code{"CLSI 2019"}). The default to the latest implemented EUCAST guideline, currently \code{"EUCAST 2026"}. Supported guideline are currently EUCAST (2011-2026) and CLSI (2011-2026).
|
||||||
\item \code{AMR_ignore_pattern} \cr A \link[base:regex]{regular expression} to ignore (i.e., make \code{NA}) any match given in \code{\link[=as.mo]{as.mo()}} and all \code{\link[=mo_property]{mo_*}} functions.
|
\item \code{AMR_ignore_pattern} \cr A \link[base:regex]{regular expression} to ignore (i.e., make \code{NA}) any match given in \code{\link[=as.mo]{as.mo()}} and all \code{\link[=mo_property]{mo_*}} functions.
|
||||||
\item \code{AMR_include_PKPD} \cr A \link{logical} to use in \code{\link[=as.sir]{as.sir()}}, to indicate that PK/PD clinical breakpoints must be applied as a last resort - the default is \code{TRUE}.
|
\item \code{AMR_include_PKPD} \cr A \link{logical} to use in \code{\link[=as.sir]{as.sir()}}, to indicate that PK/PD clinical breakpoints must be applied as a last resort - the default is \code{TRUE}.
|
||||||
\item \code{AMR_substitute_missing_r_breakpoint} \cr A \link{logical} to use in \code{\link[=as.sir]{as.sir()}}, to indicate that missing R breakpoints must be substituted with \code{"R"} - the default is \code{FALSE}.
|
\item \code{AMR_substitute_missing_r_breakpoint} \cr A \link{logical} to use in \code{\link[=as.sir]{as.sir()}}, to indicate that missing R breakpoints must be substituted with \code{"R"} - the default is \code{FALSE}.
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ The \code{AMR} package is a peer-reviewed, \href{https://amr-for-r.org/#copyrigh
|
|||||||
|
|
||||||
This work was published in the Journal of Statistical Software (Volume 104(3); \doi{10.18637/jss.v104.i03}) and formed the basis of two PhD theses (\doi{10.33612/diss.177417131} and \doi{10.33612/diss.192486375}).
|
This work was published in the Journal of Statistical Software (Volume 104(3); \doi{10.18637/jss.v104.i03}) and formed the basis of two PhD theses (\doi{10.33612/diss.177417131} and \doi{10.33612/diss.192486375}).
|
||||||
|
|
||||||
After installing this package, R knows \href{https://amr-for-r.org/reference/microorganisms.html}{\strong{~79 000 distinct microbial species}} (updated June 2024) and all \href{https://amr-for-r.org/reference/antimicrobials.html}{\strong{~620 antimicrobial and antiviral drugs}} by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI 2011-2025 and EUCAST 2011-2025 are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). \strong{It was designed to work in any setting, including those with very limited resources}. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the \href{https://www.rug.nl}{University of Groningen} and the \href{https://www.umcg.nl}{University Medical Center Groningen}.
|
After installing this package, R knows \href{https://amr-for-r.org/reference/microorganisms.html}{\strong{~79 000 distinct microbial species}} (updated June 2024) and all \href{https://amr-for-r.org/reference/antimicrobials.html}{\strong{~620 antimicrobial and antiviral drugs}} by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI 2011-2026 and EUCAST 2011-2026 are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). \strong{It was designed to work in any setting, including those with very limited resources}. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the \href{https://www.rug.nl}{University of Groningen} and the \href{https://www.umcg.nl}{University Medical Center Groningen}.
|
||||||
|
|
||||||
The \code{AMR} package is available in English, Arabic, Bengali, Chinese, Czech, Danish, Dutch, Finnish, French, German, Greek, Hindi, Indonesian, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Romanian, Russian, Spanish, Swahili, Swedish, Turkish, Ukrainian, Urdu, and Vietnamese. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages.
|
The \code{AMR} package is available in English, Arabic, Bengali, Chinese, Czech, Danish, Dutch, Finnish, French, German, Greek, Hindi, Indonesian, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Romanian, Russian, Spanish, Swahili, Swedish, Turkish, Ukrainian, Urdu, and Vietnamese. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,9 +68,9 @@ retrieve_wisca_parameters(wisca_model, ...)
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
\item{mo_transform}{A character to transform microorganism input - must be \code{"name"}, \code{"shortname"} (default), \code{"gramstain"}, or one of the column names of the \link{microorganisms} data set: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "oxygen_tolerance", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "mycobank", "mycobank_parent", "mycobank_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence", or "snomed". Can also be \code{NULL} to not transform the input or \code{NA} to consider all microorganisms 'unknown'.}
|
\item{mo_transform}{A character to transform microorganism input - must be \code{"name"}, \code{"shortname"} (default), \code{"gramstain"}, or one of the column names of the \link{microorganisms} data set: {.val mo}, {.val fullname}, {.val status}, {.val kingdom}, {.val phylum}, {.val class}, {.val order}, {.val family}, {.val genus}, {.val species}, {.val subspecies}, {.val rank}, {.val ref}, {.val oxygen_tolerance}, {.val source}, {.val lpsn}, {.val lpsn_parent}, {.val lpsn_renamed_to}, {.val mycobank}, {.val mycobank_parent}, {.val mycobank_renamed_to}, {.val gbif}, {.val gbif_parent}, {.val gbif_renamed_to}, {.val prevalence}, or {.val snomed}. Can also be \code{NULL} to not transform the input or \code{NA} to consider all microorganisms 'unknown'.}
|
||||||
|
|
||||||
\item{ab_transform}{A character to transform antimicrobial input - must be one of the column names of the \link{antimicrobials} data set (defaults to \code{"name"}): "ab", "cid", "name", "group", "atc", "atc_group1", "atc_group2", "abbreviations", "synonyms", "oral_ddd", "oral_units", "iv_ddd", "iv_units", or "loinc". Can also be \code{NULL} to not transform the input.}
|
\item{ab_transform}{A character to transform antimicrobial input - must be one of the column names of the \link{antimicrobials} data set (defaults to \code{"name"}): {.val ab}, {.val cid}, {.val name}, {.val group}, {.val atc}, {.val atc_group1}, {.val atc_group2}, {.val abbreviations}, {.val synonyms}, {.val oral_ddd}, {.val oral_units}, {.val iv_ddd}, {.val iv_units}, or {.val loinc}. Can also be \code{NULL} to not transform the input.}
|
||||||
|
|
||||||
\item{syndromic_group}{A column name of \code{x}, or values calculated to split rows of \code{x}, e.g. by using \code{\link[=ifelse]{ifelse()}} or \code{\link[dplyr:case-and-replace-when]{case_when()}}. See \emph{Examples}.}
|
\item{syndromic_group}{A column name of \code{x}, or values calculated to split rows of \code{x}, e.g. by using \code{\link[=ifelse]{ifelse()}} or \code{\link[dplyr:case-and-replace-when]{case_when()}}. See \emph{Examples}.}
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ not_intrinsic_resistant(only_sir_columns = FALSE, col_mo = NULL,
|
|||||||
|
|
||||||
\item{col_mo}{Column name of the names or codes of the microorganisms (see \code{\link[=as.mo]{as.mo()}}) - the default is the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
|
\item{col_mo}{Column name of the names or codes of the microorganisms (see \code{\link[=as.mo]{as.mo()}}) - the default is the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
|
||||||
|
|
||||||
\item{version_expected_phenotypes}{The version number to use for the EUCAST Expected Phenotypes. Can be "1.2".}
|
\item{version_expected_phenotypes}{The version number to use for the EUCAST Expected Phenotypes. Can be {.val 1.2}.}
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
When used inside selecting or filtering, this returns a \link{character} vector of column names, with additional class \code{"amr_selector"}. When used individually, this returns an \link[=as.ab]{'ab' vector} with all possible antimicrobials that the function would be able to select or filter.
|
When used inside selecting or filtering, this returns a \link{character} vector of column names, with additional class \code{"amr_selector"}. When used individually, this returns an \link[=as.ab]{'ab' vector} with all possible antimicrobials that the function would be able to select or filter.
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ Ordered \link{factor} with additional class \code{\link{mic}}, that in mathemati
|
|||||||
This transforms vectors to a new class \code{\link{mic}}, which treats the input as decimal numbers, while maintaining operators (such as ">=") and only allowing valid MIC values known to the field of (medical) microbiology.
|
This transforms vectors to a new class \code{\link{mic}}, which treats the input as decimal numbers, while maintaining operators (such as ">=") and only allowing valid MIC values known to the field of (medical) microbiology.
|
||||||
}
|
}
|
||||||
\details{
|
\details{
|
||||||
To interpret MIC values as SIR values, use \code{\link[=as.sir]{as.sir()}} on MIC values. It supports guidelines from EUCAST (2011-2025) and CLSI (2011-2025).
|
To interpret MIC values as SIR values, use \code{\link[=as.sir]{as.sir()}} on MIC values. It supports guidelines from EUCAST (2011-2026) and CLSI (2011-2026).
|
||||||
|
|
||||||
This class for MIC values is a quite a special data type: formally it is an ordered \link{factor} with valid MIC values as \link{factor} levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers:
|
This class for MIC values is a quite a special data type: formally it is an ordered \link{factor} with valid MIC values as \link{factor} levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers:
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,11 @@
|
|||||||
\source{
|
\source{
|
||||||
For interpretations of minimum inhibitory concentration (MIC) values and disk diffusion diameters:
|
For interpretations of minimum inhibitory concentration (MIC) values and disk diffusion diameters:
|
||||||
\itemize{
|
\itemize{
|
||||||
\item \strong{CLSI M39: Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data}, 2011-2025, \emph{Clinical and Laboratory Standards Institute} (CLSI). \url{https://clsi.org/standards/products/microbiology/documents/m39/}.
|
\item \strong{CLSI M39: Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data}, 2011-2026, \emph{Clinical and Laboratory Standards Institute} (CLSI). \url{https://clsi.org/standards/products/microbiology/documents/m39/}.
|
||||||
\item \strong{CLSI M100: Performance Standard for Antimicrobial Susceptibility Testing}, 2011-2025, \emph{Clinical and Laboratory Standards Institute} (CLSI). \url{https://clsi.org/standards/products/microbiology/documents/m100/}.
|
\item \strong{CLSI M100: Performance Standard for Antimicrobial Susceptibility Testing}, 2011-2026, \emph{Clinical and Laboratory Standards Institute} (CLSI). \url{https://clsi.org/standards/products/microbiology/documents/m100/}.
|
||||||
\item \strong{CLSI VET01: Performance Standards for Antimicrobial Disk and Dilution Susceptibility Tests for Bacteria Isolated From Animals}, 2019-2025, \emph{Clinical and Laboratory Standards Institute} (CLSI). \url{https://clsi.org/standards/products/veterinary-medicine/documents/vet01/}.
|
\item \strong{CLSI VET01: Performance Standards for Antimicrobial Disk and Dilution Susceptibility Tests for Bacteria Isolated From Animals}, 2019-2026, \emph{Clinical and Laboratory Standards Institute} (CLSI). \url{https://clsi.org/standards/products/veterinary-medicine/documents/vet01/}.
|
||||||
\item \strong{EUCAST Breakpoint tables for interpretation of MICs and zone diameters}, 2011-2025, \emph{European Committee on Antimicrobial Susceptibility Testing} (EUCAST). \url{https://www.eucast.org/bacteria/clinical-breakpoints-and-interpretation/clinical-breakpoint-tables/}.
|
\item \strong{EUCAST Breakpoint tables for interpretation of MICs and zone diameters}, 2011-2026, \emph{European Committee on Antimicrobial Susceptibility Testing} (EUCAST). \url{https://www.eucast.org/bacteria/clinical-breakpoints-and-interpretation/clinical-breakpoint-tables/}.
|
||||||
\item \strong{WHONET} as a source for machine-reading the clinical breakpoints (\href{https://amr-for-r.org/reference/clinical_breakpoints.html#imported-from-whonet}{read more here}), 1989-2025, \emph{WHO Collaborating Centre for Surveillance of Antimicrobial Resistance}. \url{https://whonet.org/}.
|
\item \strong{WHONET} as a source for machine-reading the clinical breakpoints (\href{https://amr-for-r.org/reference/clinical_breakpoints.html#imported-from-whonet}{read more here}), 1989-2026, \emph{WHO Collaborating Centre for Surveillance of Antimicrobial Resistance}. \url{https://whonet.org/}.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\usage{
|
\usage{
|
||||||
@@ -94,7 +94,7 @@ Otherwise: arguments passed on to methods.}
|
|||||||
|
|
||||||
\item{ab}{A vector (or column name) with \link{character}s that can be coerced to a valid antimicrobial drug code with \code{\link[=as.ab]{as.ab()}}.}
|
\item{ab}{A vector (or column name) with \link{character}s that can be coerced to a valid antimicrobial drug code with \code{\link[=as.ab]{as.ab()}}.}
|
||||||
|
|
||||||
\item{guideline}{A guideline name (or column name) to use for SIR interpretation. Defaults to EUCAST 2025 (the latest implemented EUCAST guideline in the \link{clinical_breakpoints} data set), but can be set with the package option \code{\link[=AMR-options]{AMR_guideline}}. Currently supports EUCAST (2011-2025) and CLSI (2011-2025), see \emph{Details}. Using a column name allows for straightforward interpretation of historical data, which must be analysed in the context of, for example, different years.}
|
\item{guideline}{A guideline name (or column name) to use for SIR interpretation. Defaults to EUCAST 2026 (the latest implemented EUCAST guideline in the \link{clinical_breakpoints} data set), but can be set with the package option \code{\link[=AMR-options]{AMR_guideline}}. Currently supports EUCAST (2011-2026) and CLSI (2011-2026), see \emph{Details}. Using a column name allows for straightforward interpretation of historical data, which must be analysed in the context of, for example, different years.}
|
||||||
|
|
||||||
\item{uti}{(Urinary Tract Infection) a vector (or column name) with \link{logical}s (\code{TRUE} or \code{FALSE}) to specify whether a UTI specific interpretation from the guideline should be chosen. For using \code{\link[=as.sir]{as.sir()}} on a \link{data.frame}, this can also be a column containing \link{logical}s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See \emph{Examples}.}
|
\item{uti}{(Urinary Tract Infection) a vector (or column name) with \link{logical}s (\code{TRUE} or \code{FALSE}) to specify whether a UTI specific interpretation from the guideline should be chosen. For using \code{\link[=as.sir]{as.sir()}} on a \link{data.frame}, this can also be a column containing \link{logical}s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See \emph{Examples}.}
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ The default \code{"conservative"} setting ensures cautious handling of uncertain
|
|||||||
|
|
||||||
\item{include_PKPD}{A \link{logical} to indicate that PK/PD clinical breakpoints must be applied as a last resort - the default is \code{TRUE}. Can also be set with the package option \code{\link[=AMR-options]{AMR_include_PKPD}}.}
|
\item{include_PKPD}{A \link{logical} to indicate that PK/PD clinical breakpoints must be applied as a last resort - the default is \code{TRUE}. Can also be set with the package option \code{\link[=AMR-options]{AMR_include_PKPD}}.}
|
||||||
|
|
||||||
\item{breakpoint_type}{The type of breakpoints to use, either "ECOFF", "animal", or "human". ECOFF stands for Epidemiological Cut-Off values. The default is \code{"human"}, which can also be set with the package option \code{\link[=AMR-options]{AMR_breakpoint_type}}. If \code{host} is set to values of veterinary species, this will automatically be set to \code{"animal"}.}
|
\item{breakpoint_type}{The type of breakpoints to use, either {.val ECOFF}, {.val animal}, or {.val human}. ECOFF stands for Epidemiological Cut-Off values. The default is \code{"human"}, which can also be set with the package option \code{\link[=AMR-options]{AMR_breakpoint_type}}. If \code{host} is set to values of veterinary species, this will automatically be set to \code{"animal"}.}
|
||||||
|
|
||||||
\item{host}{A vector (or column name) with \link{character}s to indicate the host. Only useful for veterinary breakpoints, as it requires \code{breakpoint_type = "animal"}. The values can be any text resembling the animal species, even in any of the 28 supported languages of this package. For foreign languages, be sure to set the language with \code{\link[=set_AMR_locale]{set_AMR_locale()}} (though it will be automatically guessed based on the system language).}
|
\item{host}{A vector (or column name) with \link{character}s to indicate the host. Only useful for veterinary breakpoints, as it requires \code{breakpoint_type = "animal"}. The values can be any text resembling the animal species, even in any of the 28 supported languages of this package. For foreign languages, be sure to set the language with \code{\link[=set_AMR_locale]{set_AMR_locale()}} (though it will be automatically guessed based on the system language).}
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ Ordered \link{factor} with new class \code{sir}
|
|||||||
\description{
|
\description{
|
||||||
Clean up existing SIR values, or interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI. \code{\link[=as.sir]{as.sir()}} transforms the input to a new class \code{\link{sir}}, which is an ordered \link{factor} containing the levels \code{S}, \code{SDD}, \code{I}, \code{R}, \code{NI}.
|
Clean up existing SIR values, or interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI. \code{\link[=as.sir]{as.sir()}} transforms the input to a new class \code{\link{sir}}, which is an ordered \link{factor} containing the levels \code{S}, \code{SDD}, \code{I}, \code{R}, \code{NI}.
|
||||||
|
|
||||||
Breakpoints are currently implemented from EUCAST 2011-2025 and CLSI 2011-2025, see \emph{Details}. All breakpoints used for interpretation are available in our \link{clinical_breakpoints} data set.
|
Breakpoints are currently implemented from EUCAST 2011-2026 and CLSI 2011-2026, see \emph{Details}. All breakpoints used for interpretation are available in our \link{clinical_breakpoints} data set.
|
||||||
}
|
}
|
||||||
\details{
|
\details{
|
||||||
\emph{Note: The clinical breakpoints in this package were validated through, and imported from, \href{https://whonet.org}{WHONET}. The public use of this \code{AMR} package has been endorsed by both CLSI and EUCAST. See \link{clinical_breakpoints} for more information.}
|
\emph{Note: The clinical breakpoints in this package were validated through, and imported from, \href{https://whonet.org}{WHONET}. The public use of this \code{AMR} package has been endorsed by both CLSI and EUCAST. See \link{clinical_breakpoints} for more information.}
|
||||||
@@ -215,12 +215,12 @@ as.sir(your_data, ..., parallel = TRUE)
|
|||||||
|
|
||||||
For interpreting MIC values as well as disk diffusion diameters, currently implemented guidelines are:
|
For interpreting MIC values as well as disk diffusion diameters, currently implemented guidelines are:
|
||||||
\itemize{
|
\itemize{
|
||||||
\item For \strong{clinical microbiology}: EUCAST 2011-2025 and CLSI 2011-2025;
|
\item For \strong{clinical microbiology}: EUCAST 2011-2026 and CLSI 2011-2026;
|
||||||
\item For \strong{veterinary microbiology}: EUCAST 2021-2025 and CLSI 2019-2025;
|
\item For \strong{veterinary microbiology}: EUCAST 2021-2026 and CLSI 2019-2026;
|
||||||
\item For \strong{ECOFFs} (Epidemiological Cut-off Values): EUCAST 2020-2025 and CLSI 2022-2025.
|
\item For \strong{ECOFFs} (Epidemiological Cut-off Values): EUCAST 2020-2026 and CLSI 2022-2026.
|
||||||
}
|
}
|
||||||
|
|
||||||
The \code{guideline} argument must be set to e.g., \code{"EUCAST 2025"} or \code{"CLSI 2025"}. By simply using \code{"EUCAST"} (the default) or \code{"CLSI"} as input, the latest included version of that guideline will automatically be selected. Importantly, using a column name of your data instead, allows for straightforward interpretation of historical data that must be analysed in the context of, for example, different years.
|
The \code{guideline} argument must be set to e.g., \code{"EUCAST 2026"} or \code{"CLSI 2026"}. By simply using \code{"EUCAST"} (the default) or \code{"CLSI"} as input, the latest included version of that guideline will automatically be selected. Importantly, using a column name of your data instead, allows for straightforward interpretation of historical data that must be analysed in the context of, for example, different years.
|
||||||
|
|
||||||
You can set your own data set using the \code{reference_data} argument. The \code{guideline} argument will then be ignored.
|
You can set your own data set using the \code{reference_data} argument. The \code{guideline} argument will then be ignored.
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
\alias{clinical_breakpoints}
|
\alias{clinical_breakpoints}
|
||||||
\title{Data Set with Clinical Breakpoints for SIR Interpretation}
|
\title{Data Set with Clinical Breakpoints for SIR Interpretation}
|
||||||
\format{
|
\format{
|
||||||
A \link[tibble:tibble]{tibble} with 40 217 observations and 14 variables:
|
A \link[tibble:tibble]{tibble} with 45 730 observations and 14 variables:
|
||||||
\itemize{
|
\itemize{
|
||||||
\item \code{guideline}\cr Name of the guideline
|
\item \code{guideline}\cr Name of the guideline
|
||||||
\item \code{type}\cr Breakpoint type, either "ECOFF", "animal", or "human"
|
\item \code{type}\cr Breakpoint type, either {.val ECOFF}, {.val animal}, or {.val human}
|
||||||
\item \code{host}\cr Host of infectious agent. This is mostly useful for veterinary breakpoints and is either "ECOFF", "aquatic", "cats", "cattle", "dogs", "horse", "human", "poultry", or "swine"
|
\item \code{host}\cr Host of infectious agent. This is mostly useful for veterinary breakpoints and is either {.val ECOFF}, {.val aquatic}, {.val cats}, {.val cattle}, {.val dogs}, {.val horse}, {.val human}, {.val poultry}, or {.val swine}
|
||||||
\item \code{method}\cr Testing method, either "DISK" or "MIC"
|
\item \code{method}\cr Testing method, either {.val DISK} or {.val MIC}
|
||||||
\item \code{site}\cr Body site for which the breakpoint must be applied, e.g. "Oral" or "Respiratory"
|
\item \code{site}\cr Body site for which the breakpoint must be applied, e.g. "Oral" or "Respiratory"
|
||||||
\item \code{mo}\cr Microbial ID, see \code{\link[=as.mo]{as.mo()}}
|
\item \code{mo}\cr Microbial ID, see \code{\link[=as.mo]{as.mo()}}
|
||||||
\item \code{rank_index}\cr Taxonomic rank index of \code{mo} from 1 (subspecies/infraspecies) to 5 (unknown microorganism)
|
\item \code{rank_index}\cr Taxonomic rank index of \code{mo} from 1 (subspecies/infraspecies) to 5 (unknown microorganism)
|
||||||
@@ -20,7 +20,7 @@ A \link[tibble:tibble]{tibble} with 40 217 observations and 14 variables:
|
|||||||
\item \code{breakpoint_S}\cr Lowest MIC value or highest number of millimetres that leads to "S"
|
\item \code{breakpoint_S}\cr Lowest MIC value or highest number of millimetres that leads to "S"
|
||||||
\item \code{breakpoint_R}\cr Highest MIC value or lowest number of millimetres that leads to "R", can be \code{NA}
|
\item \code{breakpoint_R}\cr Highest MIC value or lowest number of millimetres that leads to "R", can be \code{NA}
|
||||||
\item \code{uti}\cr A \link{logical} value (\code{TRUE}/\code{FALSE}) to indicate whether the rule applies to a urinary tract infection (UTI)
|
\item \code{uti}\cr A \link{logical} value (\code{TRUE}/\code{FALSE}) to indicate whether the rule applies to a urinary tract infection (UTI)
|
||||||
\item \code{is_SDD}\cr A \link{logical} value (\code{TRUE}/\code{FALSE}) to indicate whether the intermediate range between "S" and "R" should be interpreted as "SDD", instead of "I". This currently applies to 48 breakpoints.
|
\item \code{is_SDD}\cr A \link{logical} value (\code{TRUE}/\code{FALSE}) to indicate whether the intermediate range between "S" and "R" should be interpreted as "SDD", instead of "I". This currently applies to 72 breakpoints.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\usage{
|
\usage{
|
||||||
@@ -31,9 +31,9 @@ Data set containing clinical breakpoints to interpret MIC and disk diffusion to
|
|||||||
|
|
||||||
These breakpoints are currently implemented:
|
These breakpoints are currently implemented:
|
||||||
\itemize{
|
\itemize{
|
||||||
\item For \strong{clinical microbiology}: EUCAST 2011-2025 and CLSI 2011-2025;
|
\item For \strong{clinical microbiology}: EUCAST 2011-2026 and CLSI 2011-2026;
|
||||||
\item For \strong{veterinary microbiology}: EUCAST 2021-2025 and CLSI 2019-2025;
|
\item For \strong{veterinary microbiology}: EUCAST 2021-2026 and CLSI 2019-2026;
|
||||||
\item For \strong{ECOFFs} (Epidemiological Cut-off Values): EUCAST 2020-2025 and CLSI 2022-2025.
|
\item For \strong{ECOFFs} (Epidemiological Cut-off Values): EUCAST 2020-2026 and CLSI 2022-2026.
|
||||||
}
|
}
|
||||||
|
|
||||||
Use \code{\link[=as.sir]{as.sir()}} to transform MICs or disks measurements to SIR values.
|
Use \code{\link[=as.sir]{as.sir()}} to transform MICs or disks measurements to SIR values.
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ A \link[tibble:tibble]{tibble} with 759 observations and 9 variables:
|
|||||||
\itemize{
|
\itemize{
|
||||||
\item \code{ab}\cr Antimicrobial ID as used in this package (such as \code{AMC}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available
|
\item \code{ab}\cr Antimicrobial ID as used in this package (such as \code{AMC}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available
|
||||||
\item \code{name}\cr Official name of the antimicrobial drug as used by WHONET/EARS-Net or the WHO
|
\item \code{name}\cr Official name of the antimicrobial drug as used by WHONET/EARS-Net or the WHO
|
||||||
\item \code{type}\cr Type of the dosage, either "high_dosage", "standard_dosage", or "uncomplicated_uti"
|
\item \code{type}\cr Type of the dosage, either {.val high_dosage}, {.val standard_dosage}, or {.val uncomplicated_uti}
|
||||||
\item \code{dose}\cr Dose, such as "2 g" or "25 mg/kg"
|
\item \code{dose}\cr Dose, such as "2 g" or "25 mg/kg"
|
||||||
\item \code{dose_times}\cr Number of times a dose must be administered
|
\item \code{dose_times}\cr Number of times a dose must be administered
|
||||||
\item \code{administration}\cr Route of administration, either "", "im", "iv", "oral", or NA
|
\item \code{administration}\cr Route of administration, either {.val }, {.val im}, {.val iv}, {.val oral}, or NA
|
||||||
\item \code{notes}\cr Additional dosage notes
|
\item \code{notes}\cr Additional dosage notes
|
||||||
\item \code{original_txt}\cr Original text in the PDF file of EUCAST
|
\item \code{original_txt}\cr Original text in the PDF file of EUCAST
|
||||||
\item \code{eucast_version}\cr Version number of the EUCAST Clinical Breakpoints guideline to which these dosages apply, either 15, 14, 13.1, 12, or 11
|
\item \code{eucast_version}\cr Version number of the EUCAST Clinical Breakpoints guideline to which these dosages apply, either 15, 14, 13.1, 12, or 11
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ A \link[tibble:tibble]{tibble} with 2 000 observations and 46 variables:
|
|||||||
\item \code{date}\cr Date of receipt at the laboratory
|
\item \code{date}\cr Date of receipt at the laboratory
|
||||||
\item \code{patient}\cr ID of the patient
|
\item \code{patient}\cr ID of the patient
|
||||||
\item \code{age}\cr Age of the patient
|
\item \code{age}\cr Age of the patient
|
||||||
\item \code{gender}\cr Gender of the patient, either "F" or "M"
|
\item \code{gender}\cr Gender of the patient, either {.val F} or {.val M}
|
||||||
\item \code{ward}\cr Ward type where the patient was admitted, either "Clinical", "ICU", or "Outpatient"
|
\item \code{ward}\cr Ward type where the patient was admitted, either {.val Clinical}, {.val ICU}, or {.val Outpatient}
|
||||||
\item \code{mo}\cr ID of microorganism created with \code{\link[=as.mo]{as.mo()}}, see also the \link{microorganisms} data set
|
\item \code{mo}\cr ID of microorganism created with \code{\link[=as.mo]{as.mo()}}, see also the \link{microorganisms} data set
|
||||||
\item \code{PEN:RIF}\cr 40 different antimicrobials with class \code{\link{sir}} (see \code{\link[=as.sir]{as.sir()}}); these column names occur in the \link{antimicrobials} data set and can be translated with \code{\link[=set_ab_names]{set_ab_names()}} or \code{\link[=ab_name]{ab_name()}}
|
\item \code{PEN:RIF}\cr 40 different antimicrobials with class \code{\link{sir}} (see \code{\link[=as.sir]{as.sir()}}); these column names occur in the \link{antimicrobials} data set and can be translated with \code{\link[=set_ab_names]{set_ab_names()}} or \code{\link[=ab_name]{ab_name()}}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ Leclercq et al. \strong{EUCAST expert rules in antimicrobial susceptibility test
|
|||||||
interpretive_rules(x, col_mo = NULL, info = interactive(),
|
interpretive_rules(x, col_mo = NULL, info = interactive(),
|
||||||
rules = getOption("AMR_interpretive_rules", default = c("breakpoints",
|
rules = getOption("AMR_interpretive_rules", default = c("breakpoints",
|
||||||
"expected_phenotypes")), guideline = getOption("AMR_guideline", "EUCAST"),
|
"expected_phenotypes")), guideline = getOption("AMR_guideline", "EUCAST"),
|
||||||
verbose = FALSE, version_breakpoints = 15,
|
verbose = FALSE, version_breakpoints = 16,
|
||||||
version_expected_phenotypes = 1.2, version_expertrules = 3.3,
|
version_expected_phenotypes = 1.2, version_expertrules = 3.3,
|
||||||
ampc_cephalosporin_resistance = NA, only_sir_columns = any(is.sir(x)),
|
ampc_cephalosporin_resistance = NA, only_sir_columns = any(is.sir(x)),
|
||||||
custom_rules = NULL, overwrite = FALSE, ...)
|
custom_rules = NULL, overwrite = FALSE, ...)
|
||||||
@@ -52,11 +52,11 @@ eucast_dosage(ab, administration = "iv", version_breakpoints = 15)
|
|||||||
|
|
||||||
\item{verbose}{A \link{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.}
|
\item{verbose}{A \link{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.}
|
||||||
|
|
||||||
\item{version_breakpoints}{The version number to use for the EUCAST Clinical Breakpoints guideline. Can be "15.0", "14.0", "13.1", "12.0", "11.0", or "10.0".}
|
\item{version_breakpoints}{The version number to use for the EUCAST Clinical Breakpoints guideline. Can be {.val 16.0}, {.val 15.0}, {.val 14.0}, {.val 13.1}, {.val 12.0}, {.val 11.0}, or {.val 10.0}.}
|
||||||
|
|
||||||
\item{version_expected_phenotypes}{The version number to use for the EUCAST Expected Phenotypes. Can be "1.2".}
|
\item{version_expected_phenotypes}{The version number to use for the EUCAST Expected Phenotypes. Can be {.val 1.2}.}
|
||||||
|
|
||||||
\item{version_expertrules}{The version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be "3.3", "3.2", or "3.1".}
|
\item{version_expertrules}{The version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be {.val 3.3}, {.val 3.2}, or {.val 3.1}.}
|
||||||
|
|
||||||
\item{ampc_cephalosporin_resistance}{(only applies when \code{rules} contains \code{"expert"} or \code{"all"}) a \link{character} value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants - the default is \code{NA}. Currently only works when \code{version_expertrules} is \code{3.2} and higher; these versions of '\emph{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 drugs. A value of \code{NA} (the default) for this argument will remove results for these three drugs, while e.g. a value of \code{"R"} will make the results for these drugs resistant. Use \code{NULL} or \code{FALSE} to not alter results for these three drugs of AmpC de-repressed cephalosporin-resistant mutants. Using \code{TRUE} is equal to using \code{"R"}. \cr For \emph{EUCAST Expert Rules} v3.2, this rule applies to: \emph{Citrobacter braakii}, \emph{Citrobacter freundii}, \emph{Citrobacter gillenii}, \emph{Citrobacter murliniae}, \emph{Citrobacter rodenticum}, \emph{Citrobacter sedlakii}, \emph{Citrobacter werkmanii}, \emph{Citrobacter youngae}, \emph{Enterobacter}, \emph{Hafnia alvei}, \emph{Klebsiella aerogenes}, \emph{Morganella morganii}, \emph{Providencia}, and \emph{Serratia}.}
|
\item{ampc_cephalosporin_resistance}{(only applies when \code{rules} contains \code{"expert"} or \code{"all"}) a \link{character} value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants - the default is \code{NA}. Currently only works when \code{version_expertrules} is \code{3.2} and higher; these versions of '\emph{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 drugs. A value of \code{NA} (the default) for this argument will remove results for these three drugs, while e.g. a value of \code{"R"} will make the results for these drugs resistant. Use \code{NULL} or \code{FALSE} to not alter results for these three drugs of AmpC de-repressed cephalosporin-resistant mutants. Using \code{TRUE} is equal to using \code{"R"}. \cr For \emph{EUCAST Expert Rules} v3.2, this rule applies to: \emph{Citrobacter braakii}, \emph{Citrobacter freundii}, \emph{Citrobacter gillenii}, \emph{Citrobacter murliniae}, \emph{Citrobacter rodenticum}, \emph{Citrobacter sedlakii}, \emph{Citrobacter werkmanii}, \emph{Citrobacter youngae}, \emph{Enterobacter}, \emph{Hafnia alvei}, \emph{Klebsiella aerogenes}, \emph{Morganella morganii}, \emph{Providencia}, and \emph{Serratia}.}
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ eucast_dosage(ab, administration = "iv", version_breakpoints = 15)
|
|||||||
|
|
||||||
\item{ab}{Any (vector of) text that can be coerced to a valid antimicrobial drug code with \code{\link[=as.ab]{as.ab()}}.}
|
\item{ab}{Any (vector of) text that can be coerced to a valid antimicrobial drug code with \code{\link[=as.ab]{as.ab()}}.}
|
||||||
|
|
||||||
\item{administration}{Route of administration, either "", "im", "iv", "oral", or NA.}
|
\item{administration}{Route of administration, either {.val }, {.val im}, {.val iv}, {.val oral}, or NA.}
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
The input of \code{x}, possibly with edited values of antimicrobials. Or, if \code{verbose = TRUE}, a \link{data.frame} with all original and new values of the affected bug-drug combinations.
|
The input of \code{x}, possibly with edited values of antimicrobials. Or, if \code{verbose = TRUE}, a \link{data.frame} with all original and new values of the affected bug-drug combinations.
|
||||||
@@ -81,7 +81,7 @@ Apply rules from clinical breakpoints notes and expected resistant phenotypes as
|
|||||||
To improve the interpretation of the antibiogram before CLSI/EUCAST interpretive rules are applied, some AMR-specific rules can be applied at default, see \emph{Details}.
|
To improve the interpretation of the antibiogram before CLSI/EUCAST interpretive rules are applied, some AMR-specific rules can be applied at default, see \emph{Details}.
|
||||||
}
|
}
|
||||||
\details{
|
\details{
|
||||||
\strong{Note:} This function does not translate MIC values to SIR values. Use \code{\link[=as.sir]{as.sir()}} for that. \cr
|
\strong{Note:} This function does not translate MIC or disk values to SIR values. Use \code{\link[=as.sir]{as.sir()}} 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. \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. \cr
|
||||||
|
|
||||||
The file containing all EUCAST rules is located here: \url{https://github.com/msberends/AMR/blob/main/data-raw/eucast_rules.tsv}. \strong{Note:} Old taxonomic names are replaced with the current taxonomy where applicable. For example, \emph{Ochrobactrum anthropi} was renamed to \emph{Brucella anthropi} in 2020; the original EUCAST rules v3.1 and v3.2 did not yet contain this new taxonomic name. The \code{AMR} package contains the full microbial taxonomy updated until June 24th, 2024, see \link{microorganisms}.
|
The file containing all EUCAST rules is located here: \url{https://github.com/msberends/AMR/blob/main/data-raw/eucast_rules.tsv}. \strong{Note:} Old taxonomic names are replaced with the current taxonomy where applicable. For example, \emph{Ochrobactrum anthropi} was renamed to \emph{Brucella anthropi} in 2020; the original EUCAST rules v3.1 and v3.2 did not yet contain this new taxonomic name. The \code{AMR} package contains the full microbial taxonomy updated until June 24th, 2024, see \link{microorganisms}.
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ A \link[tibble:tibble]{tibble} with 78 679 observations and 26 variables:
|
|||||||
\itemize{
|
\itemize{
|
||||||
\item \code{mo}\cr ID of microorganism as used by this package. \emph{\strong{This is a unique identifier.}}
|
\item \code{mo}\cr ID of microorganism as used by this package. \emph{\strong{This is a unique identifier.}}
|
||||||
\item \code{fullname}\cr Full name, like \code{"Escherichia coli"}. For the taxonomic ranks genus, species and subspecies, this is the 'pasted' text of genus, species, and subspecies. For all taxonomic ranks higher than genus, this is the name of the taxon. \emph{\strong{This is a unique identifier.}}
|
\item \code{fullname}\cr Full name, like \code{"Escherichia coli"}. For the taxonomic ranks genus, species and subspecies, this is the 'pasted' text of genus, species, and subspecies. For all taxonomic ranks higher than genus, this is the name of the taxon. \emph{\strong{This is a unique identifier.}}
|
||||||
\item \code{status} \cr Status of the taxon, either "accepted", "not validly published", "synonym", or "unknown"
|
\item \code{status} \cr Status of the taxon, either {.val accepted}, {.val not validly published}, {.val synonym}, or {.val unknown}
|
||||||
\item \code{kingdom}, \code{phylum}, \code{class}, \code{order}, \code{family}, \code{genus}, \code{species}, \code{subspecies}\cr Taxonomic rank of the microorganism. Note that for fungi, \emph{phylum} is equal to their taxonomic \emph{division}. Also, for fungi, \emph{subkingdom} and \emph{subdivision} were left out since they do not occur in the bacterial taxonomy.
|
\item \code{kingdom}, \code{phylum}, \code{class}, \code{order}, \code{family}, \code{genus}, \code{species}, \code{subspecies}\cr Taxonomic rank of the microorganism. Note that for fungi, \emph{phylum} is equal to their taxonomic \emph{division}. Also, for fungi, \emph{subkingdom} and \emph{subdivision} were left out since they do not occur in the bacterial taxonomy.
|
||||||
\item \code{rank}\cr Text of the taxonomic rank of the microorganism, such as \code{"species"} or \code{"genus"}
|
\item \code{rank}\cr Text of the taxonomic rank of the microorganism, such as \code{"species"} or \code{"genus"}
|
||||||
\item \code{ref}\cr Author(s) and year of related scientific publication. This contains only the \emph{first surname} and year of the \emph{latest} authors, e.g. "Wallis \emph{et al.} 2006 \emph{emend.} Smith and Jones 2018" becomes "Smith \emph{et al.}, 2018". This field is directly retrieved from the source specified in the column \code{source}. Moreover, accents were removed to comply with CRAN that only allows ASCII characters.
|
\item \code{ref}\cr Author(s) and year of related scientific publication. This contains only the \emph{first surname} and year of the \emph{latest} authors, e.g. "Wallis \emph{et al.} 2006 \emph{emend.} Smith and Jones 2018" becomes "Smith \emph{et al.}, 2018". This field is directly retrieved from the source specified in the column \code{source}. Moreover, accents were removed to comply with CRAN that only allows ASCII characters.
|
||||||
\item \code{oxygen_tolerance} \cr Oxygen tolerance, either "aerobe", "anaerobe", "anaerobe/microaerophile", "facultative anaerobe", "likely facultative anaerobe", "microaerophile", or NA. These data were retrieved from BacDive (see \emph{Source}). Items that contain "likely" are missing from BacDive and were extrapolated from other species within the same genus to guess the oxygen tolerance. Currently 68.3\% of all ~39 000 bacteria in the data set contain an oxygen tolerance.
|
\item \code{oxygen_tolerance} \cr Oxygen tolerance, either {.val aerobe}, {.val anaerobe}, {.val anaerobe/microaerophile}, {.val facultative anaerobe}, {.val likely facultative anaerobe}, {.val microaerophile}, or NA. These data were retrieved from BacDive (see \emph{Source}). Items that contain "likely" are missing from BacDive and were extrapolated from other species within the same genus to guess the oxygen tolerance. Currently 68.3\% of all ~39 000 bacteria in the data set contain an oxygen tolerance.
|
||||||
\item \code{source}\cr Either "GBIF", "LPSN", "Manually added", "MycoBank", or "manually added" (see \emph{Source})
|
\item \code{source}\cr Either {.val GBIF}, {.val LPSN}, {.val Manually added}, {.val MycoBank}, or {.val manually added} (see \emph{Source})
|
||||||
\item \code{lpsn}\cr Identifier ('Record number') of List of Prokaryotic names with Standing in Nomenclature (LPSN). This will be the first/highest LPSN identifier to keep one identifier per row. For example, \emph{Acetobacter ascendens} has LPSN Record number 7864 and 11011. Only the first is available in the \code{microorganisms} data set. \emph{\strong{This is a unique identifier}}, though available for only ~33 000 records.
|
\item \code{lpsn}\cr Identifier ('Record number') of List of Prokaryotic names with Standing in Nomenclature (LPSN). This will be the first/highest LPSN identifier to keep one identifier per row. For example, \emph{Acetobacter ascendens} has LPSN Record number 7864 and 11011. Only the first is available in the \code{microorganisms} data set. \emph{\strong{This is a unique identifier}}, though available for only ~33 000 records.
|
||||||
\item \code{lpsn_parent}\cr LPSN identifier of the parent taxon
|
\item \code{lpsn_parent}\cr LPSN identifier of the parent taxon
|
||||||
\item \code{lpsn_renamed_to}\cr LPSN identifier of the currently valid taxon
|
\item \code{lpsn_renamed_to}\cr LPSN identifier of the currently valid taxon
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
\docType{data}
|
\docType{data}
|
||||||
\name{microorganisms.codes}
|
\name{microorganisms.codes}
|
||||||
\alias{microorganisms.codes}
|
\alias{microorganisms.codes}
|
||||||
\title{Data Set with 6 036 Common Microorganism Codes}
|
\title{Data Set with 6 050 Common Microorganism Codes}
|
||||||
\format{
|
\format{
|
||||||
A \link[tibble:tibble]{tibble} with 6 036 observations and 2 variables:
|
A \link[tibble:tibble]{tibble} with 6 050 observations and 2 variables:
|
||||||
\itemize{
|
\itemize{
|
||||||
\item \code{code}\cr Commonly used code of a microorganism. \emph{\strong{This is a unique identifier.}}
|
\item \code{code}\cr Commonly used code of a microorganism. \emph{\strong{This is a unique identifier.}}
|
||||||
\item \code{mo}\cr ID of the microorganism in the \link{microorganisms} data set
|
\item \code{mo}\cr ID of the microorganism in the \link{microorganisms} data set
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ The default is \code{FALSE}, which will return a note if outdated taxonomic name
|
|||||||
|
|
||||||
\item{open}{Browse the URL using \code{\link[utils:browseURL]{browseURL()}}.}
|
\item{open}{Browse the URL using \code{\link[utils:browseURL]{browseURL()}}.}
|
||||||
|
|
||||||
\item{property}{One of the column names of the \link{microorganisms} data set: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "oxygen_tolerance", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "mycobank", "mycobank_parent", "mycobank_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence", or "snomed", or must be \code{"shortname"}.}
|
\item{property}{One of the column names of the \link{microorganisms} data set: {.val mo}, {.val fullname}, {.val status}, {.val kingdom}, {.val phylum}, {.val class}, {.val order}, {.val family}, {.val genus}, {.val species}, {.val subspecies}, {.val rank}, {.val ref}, {.val oxygen_tolerance}, {.val source}, {.val lpsn}, {.val lpsn_parent}, {.val lpsn_renamed_to}, {.val mycobank}, {.val mycobank_parent}, {.val mycobank_renamed_to}, {.val gbif}, {.val gbif_parent}, {.val gbif_renamed_to}, {.val prevalence}, or {.val snomed}, or must be \code{"shortname"}.}
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
\itemize{
|
\itemize{
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ labels_sir_count(position = NULL, x = "antibiotic",
|
|||||||
|
|
||||||
\item{include_PKPD}{A \link{logical} to indicate that PK/PD clinical breakpoints must be applied as a last resort - the default is \code{TRUE}. Can also be set with the package option \code{\link[=AMR-options]{AMR_include_PKPD}}.}
|
\item{include_PKPD}{A \link{logical} to indicate that PK/PD clinical breakpoints must be applied as a last resort - the default is \code{TRUE}. Can also be set with the package option \code{\link[=AMR-options]{AMR_include_PKPD}}.}
|
||||||
|
|
||||||
\item{breakpoint_type}{The type of breakpoints to use, either "ECOFF", "animal", or "human". ECOFF stands for Epidemiological Cut-Off values. The default is \code{"human"}, which can also be set with the package option \code{\link[=AMR-options]{AMR_breakpoint_type}}. If \code{host} is set to values of veterinary species, this will automatically be set to \code{"animal"}.}
|
\item{breakpoint_type}{The type of breakpoints to use, either {.val ECOFF}, {.val animal}, or {.val human}. ECOFF stands for Epidemiological Cut-Off values. The default is \code{"human"}, which can also be set with the package option \code{\link[=AMR-options]{AMR_breakpoint_type}}. If \code{host} is set to values of veterinary species, this will automatically be set to \code{"animal"}.}
|
||||||
|
|
||||||
\item{facet}{Variable to split plots by, either \code{"interpretation"} (default) or \code{"antibiotic"} or a grouping variable.}
|
\item{facet}{Variable to split plots by, either \code{"interpretation"} (default) or \code{"antibiotic"} or a grouping variable.}
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ This package contains more functions that extend the \code{ggplot2} package, to
|
|||||||
|
|
||||||
The interpretation of "I" will be named "Increased exposure" for all EUCAST guidelines since 2019, and will be named "Intermediate" in all other cases.
|
The interpretation of "I" will be named "Increased exposure" for all EUCAST guidelines since 2019, and will be named "Intermediate" in all other cases.
|
||||||
|
|
||||||
For interpreting MIC values as well as disk diffusion diameters, the default guideline is EUCAST 2025, unless the package option \code{\link[=AMR-options]{AMR_guideline}} is set. See \code{\link[=as.sir]{as.sir()}} for more information.
|
For interpreting MIC values as well as disk diffusion diameters, the default guideline is EUCAST 2026, unless the package option \code{\link[=AMR-options]{AMR_guideline}} is set. See \code{\link[=as.sir]{as.sir()}} for more information.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ top_n_microorganisms(x, n, property = "species", n_for_each = NULL,
|
|||||||
|
|
||||||
\item{n}{An integer specifying the maximum number of unique values of the \code{property} to include in the output.}
|
\item{n}{An integer specifying the maximum number of unique values of the \code{property} to include in the output.}
|
||||||
|
|
||||||
\item{property}{A character string indicating the microorganism property to use for filtering. Must be one of the column names of the \link{microorganisms} data set: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "oxygen_tolerance", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "mycobank", "mycobank_parent", "mycobank_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence", or "snomed". If \code{NULL}, the raw values from \code{col_mo} will be used without transformation. When using \code{"species"} (default) or \code{"subpecies"}, the genus will be added to make sure each (sub)species still belongs to the right genus.}
|
\item{property}{A character string indicating the microorganism property to use for filtering. Must be one of the column names of the \link{microorganisms} data set: {.val mo}, {.val fullname}, {.val status}, {.val kingdom}, {.val phylum}, {.val class}, {.val order}, {.val family}, {.val genus}, {.val species}, {.val subspecies}, {.val rank}, {.val ref}, {.val oxygen_tolerance}, {.val source}, {.val lpsn}, {.val lpsn_parent}, {.val lpsn_renamed_to}, {.val mycobank}, {.val mycobank_parent}, {.val mycobank_renamed_to}, {.val gbif}, {.val gbif_parent}, {.val gbif_renamed_to}, {.val prevalence}, or {.val snomed}. If \code{NULL}, the raw values from \code{col_mo} will be used without transformation. When using \code{"species"} (default) or \code{"subpecies"}, the genus will be added to make sure each (sub)species still belongs to the right genus.}
|
||||||
|
|
||||||
\item{n_for_each}{An optional integer specifying the maximum number of rows to retain for each value of the selected property. If \code{NULL}, all rows within the top \emph{n} groups will be included.}
|
\item{n_for_each}{An optional integer specifying the maximum number of rows to retain for each value of the selected property. If \code{NULL}, all rows within the top \emph{n} groups will be included.}
|
||||||
|
|
||||||
|
|||||||
@@ -32,15 +32,15 @@ test_that("test-eucast_rules.R", {
|
|||||||
|
|
||||||
# thoroughly check input table
|
# thoroughly check input table
|
||||||
expect_equal(
|
expect_equal(
|
||||||
colnames(AMR:::EUCAST_RULES_DF),
|
sort(colnames(AMR:::EUCAST_RULES_DF)),
|
||||||
c(
|
sort(c(
|
||||||
"if_mo_property", "like.is.one_of", "this_value",
|
"if_mo_property", "like.is.one_of", "this_value",
|
||||||
"and_these_antibiotics", "have_these_values",
|
"and_these_antibiotics", "have_these_values",
|
||||||
"then_change_these_antibiotics", "to_value",
|
"then_change_these_antibiotics", "to_value",
|
||||||
"reference.rule", "reference.rule_group",
|
"reference.rule", "reference.rule_group",
|
||||||
"reference.version",
|
"reference.version",
|
||||||
"note"
|
"note"
|
||||||
)
|
))
|
||||||
)
|
)
|
||||||
MOs_mentioned <- unique(AMR:::EUCAST_RULES_DF$this_value)
|
MOs_mentioned <- unique(AMR:::EUCAST_RULES_DF$this_value)
|
||||||
MOs_mentioned <- sort(trimws(unlist(strsplit(MOs_mentioned[!AMR:::is_valid_regex(MOs_mentioned)], ",", fixed = TRUE))))
|
MOs_mentioned <- sort(trimws(unlist(strsplit(MOs_mentioned[!AMR:::is_valid_regex(MOs_mentioned)], ",", fixed = TRUE))))
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ test_that("test-sir.R", {
|
|||||||
# allow for guideline length > 1
|
# allow for guideline length > 1
|
||||||
expect_equal(
|
expect_equal(
|
||||||
AMR:::get_guideline(c("CLSI", "CLSI", "CLSI2023", "EUCAST", "EUCAST2020"), AMR::clinical_breakpoints),
|
AMR:::get_guideline(c("CLSI", "CLSI", "CLSI2023", "EUCAST", "EUCAST2020"), AMR::clinical_breakpoints),
|
||||||
c("CLSI 2025", "CLSI 2025", "CLSI 2023", "EUCAST 2025", "EUCAST 2020")
|
c("CLSI 2026", "CLSI 2026", "CLSI 2023", "EUCAST 2026", "EUCAST 2020")
|
||||||
)
|
)
|
||||||
|
|
||||||
# these are used in the script
|
# these are used in the script
|
||||||
|
|||||||
Reference in New Issue
Block a user