mirror of
https://github.com/msberends/AMR.git
synced 2026-02-11 17:15:49 +01:00
Compare commits
9 Commits
v3.0.1
...
35debe25ee
| Author | SHA1 | Date | |
|---|---|---|---|
| 35debe25ee | |||
| e9cf3d5572 | |||
| a5c6aa9fa8 | |||
| f6e28ac95c | |||
| 151af21f38 | |||
| 225c73f7e7 | |||
| ba30b08f76 | |||
| d366949f1b | |||
| 0b24967b23 |
4
.github/ISSUE_TEMPLATE/1-bug-report.yml
vendored
4
.github/ISSUE_TEMPLATE/1-bug-report.yml
vendored
@@ -42,7 +42,7 @@ body:
|
|||||||
multiple: false
|
multiple: false
|
||||||
options:
|
options:
|
||||||
- ''
|
- ''
|
||||||
- Latest CRAN version (3.0.0)
|
- Latest CRAN version (3.0.1)
|
||||||
- One of the latest GitHub versions (3.0.0.9xxx)
|
- One of the latest GitHub versions (3.0.1.9xxx)
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
4
.github/workflows/todo-tracker.yml
vendored
4
.github/workflows/todo-tracker.yml
vendored
@@ -43,8 +43,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Generate TODO list from R/
|
- name: Generate TODO list from R/
|
||||||
run: |
|
run: |
|
||||||
|
export TZ=Europe/Amsterdam
|
||||||
|
last_updated=$(date +"%e %B %Y %H:%M:%S %Z" | sed 's/^ *//')
|
||||||
echo "## \`TODO\` Report" > todo.md
|
echo "## \`TODO\` Report" > todo.md
|
||||||
echo "" >> todo.md
|
echo "" >> todo.md
|
||||||
|
echo "**Last Updated: ${last_updated}**" >> todo.md
|
||||||
|
echo "" >> todo.md
|
||||||
echo "_This overview is automatically updated on each push to \`main\`. It provides an automated overview of all mentions of the text \`TODO\`._" >> todo.md
|
echo "_This overview is automatically updated on each push to \`main\`. It provides an automated overview of all mentions of the text \`TODO\`._" >> todo.md
|
||||||
echo "" >> todo.md
|
echo "" >> todo.md
|
||||||
todos=$(grep -rn --include=\*.{R,Rmd,yaml,yml,md,css,js} --exclude={todo-tracker.yml,todo.md} "TODO" . || true)
|
todos=$(grep -rn --include=\*.{R,Rmd,yaml,yml,md,css,js} --exclude={todo-tracker.yml,todo.md} "TODO" . || true)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 3.0.1
|
Version: 3.0.1.9009
|
||||||
Date: 2025-09-20
|
Date: 2025-12-23
|
||||||
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
|
||||||
@@ -27,10 +27,10 @@ Authors@R: c(
|
|||||||
person(given = c("Judith", "M."), family = "Fonville", role = "ctb"),
|
person(given = c("Judith", "M."), family = "Fonville", role = "ctb"),
|
||||||
person(given = c("Kathryn"), family = "Holt", role = "ctb", comment = c(ORCID = "0000-0003-3949-2471")),
|
person(given = c("Kathryn"), family = "Holt", role = "ctb", comment = c(ORCID = "0000-0003-3949-2471")),
|
||||||
person(given = c("Larisse"), family = "Bolton", role = "ctb", comment = c(ORCID = "0000-0001-7879-2173")),
|
person(given = c("Larisse"), family = "Bolton", role = "ctb", comment = c(ORCID = "0000-0001-7879-2173")),
|
||||||
person(given = c("Matthew"), family = "Saab", role = "ctb"),
|
person(given = c("Matthew"), family = "Saab", role = "ctb", comment = c(ORCID = "0009-0008-6626-7919")),
|
||||||
person(given = c("Natacha"), family = "Couto", role = "ctb", comment = c(ORCID = "0000-0002-9152-5464")),
|
person(given = c("Natacha"), family = "Couto", role = "ctb", comment = c(ORCID = "0000-0002-9152-5464")),
|
||||||
person(given = c("Peter"), family = "Dutey-Magni", role = "ctb", comment = c(ORCID = "0000-0002-8942-9836")),
|
person(given = c("Peter"), family = "Dutey-Magni", role = "ctb", comment = c(ORCID = "0000-0002-8942-9836")),
|
||||||
person(given = c("Rogier", "P."), family = "Schade", role = "ctb"),
|
person(given = c("Rogier", "P."), family = "Schade", role = "ctb", comment = c(ORCID = "0000-0002-9487-4467")),
|
||||||
person(given = c("Sofia"), family = "Ny", role = "ctb", comment = c(ORCID = "0000-0002-2017-1363")),
|
person(given = c("Sofia"), family = "Ny", role = "ctb", comment = c(ORCID = "0000-0002-2017-1363")),
|
||||||
person(given = c("Alex", "W."), family = "Friedrich", role = "ths", comment = c(ORCID = "0000-0003-4881-038X")),
|
person(given = c("Alex", "W."), family = "Friedrich", role = "ths", comment = c(ORCID = "0000-0003-4881-038X")),
|
||||||
person(given = c("Bhanu", "N.", "M."), family = "Sinha", role = "ths", comment = c(ORCID = "0000-0003-1634-0010")),
|
person(given = c("Bhanu", "N.", "M."), family = "Sinha", role = "ths", comment = c(ORCID = "0000-0003-1634-0010")),
|
||||||
|
|||||||
16
NAMESPACE
16
NAMESPACE
@@ -106,6 +106,8 @@ S3method(print,mo_uncertainties)
|
|||||||
S3method(print,pca)
|
S3method(print,pca)
|
||||||
S3method(print,sir)
|
S3method(print,sir)
|
||||||
S3method(print,sir_log)
|
S3method(print,sir_log)
|
||||||
|
S3method(print,step_mic_log2)
|
||||||
|
S3method(print,step_sir_numeric)
|
||||||
S3method(quantile,mic)
|
S3method(quantile,mic)
|
||||||
S3method(rep,ab)
|
S3method(rep,ab)
|
||||||
S3method(rep,av)
|
S3method(rep,av)
|
||||||
@@ -159,6 +161,12 @@ export(administrable_per_os)
|
|||||||
export(age)
|
export(age)
|
||||||
export(age_groups)
|
export(age_groups)
|
||||||
export(all_antimicrobials)
|
export(all_antimicrobials)
|
||||||
|
export(all_disk)
|
||||||
|
export(all_disk_predictors)
|
||||||
|
export(all_mic)
|
||||||
|
export(all_mic_predictors)
|
||||||
|
export(all_sir)
|
||||||
|
export(all_sir_predictors)
|
||||||
export(aminoglycosides)
|
export(aminoglycosides)
|
||||||
export(aminopenicillins)
|
export(aminopenicillins)
|
||||||
export(amr_class)
|
export(amr_class)
|
||||||
@@ -352,6 +360,8 @@ export(sir_df)
|
|||||||
export(sir_interpretation_history)
|
export(sir_interpretation_history)
|
||||||
export(sir_predict)
|
export(sir_predict)
|
||||||
export(skewness)
|
export(skewness)
|
||||||
|
export(step_mic_log2)
|
||||||
|
export(step_sir_numeric)
|
||||||
export(streptogramins)
|
export(streptogramins)
|
||||||
export(sulfonamides)
|
export(sulfonamides)
|
||||||
export(susceptibility)
|
export(susceptibility)
|
||||||
@@ -390,6 +400,12 @@ if(getRversion() >= "3.0.0") S3method(pillar::type_sum, av)
|
|||||||
if(getRversion() >= "3.0.0") S3method(pillar::type_sum, mic)
|
if(getRversion() >= "3.0.0") S3method(pillar::type_sum, mic)
|
||||||
if(getRversion() >= "3.0.0") S3method(pillar::type_sum, mo)
|
if(getRversion() >= "3.0.0") S3method(pillar::type_sum, mo)
|
||||||
if(getRversion() >= "3.0.0") S3method(pillar::type_sum, sir)
|
if(getRversion() >= "3.0.0") S3method(pillar::type_sum, sir)
|
||||||
|
if(getRversion() >= "3.0.0") S3method(recipes::bake, step_mic_log2)
|
||||||
|
if(getRversion() >= "3.0.0") S3method(recipes::bake, step_sir_numeric)
|
||||||
|
if(getRversion() >= "3.0.0") S3method(recipes::prep, step_mic_log2)
|
||||||
|
if(getRversion() >= "3.0.0") S3method(recipes::prep, step_sir_numeric)
|
||||||
|
if(getRversion() >= "3.0.0") S3method(recipes::tidy, step_mic_log2)
|
||||||
|
if(getRversion() >= "3.0.0") S3method(recipes::tidy, step_sir_numeric)
|
||||||
if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, ab)
|
if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, ab)
|
||||||
if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, disk)
|
if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, disk)
|
||||||
if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, mic)
|
if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, mic)
|
||||||
|
|||||||
24
NEWS.md
24
NEWS.md
@@ -1,3 +1,23 @@
|
|||||||
|
# AMR 3.0.1.9009
|
||||||
|
|
||||||
|
### New
|
||||||
|
* 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
|
||||||
|
- New `tidyselect` helpers: `all_sir()`, `all_sir_predictors()`, `all_mic()`, `all_mic_predictors()`, `all_disk()`, `all_disk_predictors()`
|
||||||
|
* Data set `esbl_isolates` to practise with AMR modelling
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* Fixed a bug in `antibiogram()` for when no antimicrobials are set
|
||||||
|
* Added taniborbactam (`TAN`) and cefepime/taniborbactam (`FTA`) to the `antimicrobials` data set
|
||||||
|
* Fixed a bug in `as.sir()` where for numeric input the arguments `S`, `i`, and `R` would not be considered (#244)
|
||||||
|
* Added explaining message to `as.sir()` when interpreting numeric values (e.g., 1 for S, 2 for I, 3 for R) (#244)
|
||||||
|
* Updated handling of capped MIC values (`<`, `<=`, `>`, `>=`) in `as.sir()` in the argument `capped_mic_handling`: (#243)
|
||||||
|
* Introduced four clearly defined options: `"none"`, `"conservative"` (default), `"standard"`, and `"lenient"`
|
||||||
|
* Interpretation of capped MIC values now consistently returns `"NI"` (non-interpretable) when the true MIC could be at either side of a breakpoint, depending on the selected handling mode
|
||||||
|
* This results in more reliable behaviour compared to previous versions for capped MIC values
|
||||||
|
* Removed the `"inverse"` option, which has now become redundant
|
||||||
|
|
||||||
|
|
||||||
# AMR 3.0.1
|
# AMR 3.0.1
|
||||||
|
|
||||||
This is a bugfix release following the release of v3.0.0 in June 2025.
|
This is a bugfix release following the release of v3.0.0 in June 2025.
|
||||||
@@ -34,7 +54,7 @@ This is a bugfix release following the release of v3.0.0 in June 2025.
|
|||||||
This package now supports not only tools for AMR data analysis in clinical settings, but also for veterinary and environmental microbiology. This was made possible through a collaboration with the [University of Prince Edward Island's Atlantic Veterinary College](https://www.upei.ca/avc), Canada. To celebrate this great improvement of the package, we also updated the package logo to reflect this change.
|
This package now supports not only tools for AMR data analysis in clinical settings, but also for veterinary and environmental microbiology. This was made possible through a collaboration with the [University of Prince Edward Island's Atlantic Veterinary College](https://www.upei.ca/avc), Canada. To celebrate this great improvement of the package, we also updated the package logo to reflect this change.
|
||||||
|
|
||||||
### Breaking
|
### Breaking
|
||||||
* Dataset `antibiotics` has been renamed to `antimicrobials` as the data set contains more than just antibiotics. Using `antibiotics` will still work, but now returns a warning.
|
* Data set `antibiotics` has been renamed to `antimicrobials` as the data set contains more than just antibiotics. Using `antibiotics` will still work, but now returns a warning.
|
||||||
* Removed all functions and references that used the deprecated `rsi` class, which were all replaced with their `sir` equivalents over two years ago.
|
* Removed all functions and references that used the deprecated `rsi` class, which were all replaced with their `sir` equivalents over two years ago.
|
||||||
* Functions `resistance_predict()` and `sir_predict()` are now deprecated and will be removed in a future version. Use the `tidymodels` framework instead, for which we [wrote a basic introduction](https://amr-for-r.org/articles/AMR_with_tidymodels.html).
|
* Functions `resistance_predict()` and `sir_predict()` are now deprecated and will be removed in a future version. Use the `tidymodels` framework instead, for which we [wrote a basic introduction](https://amr-for-r.org/articles/AMR_with_tidymodels.html).
|
||||||
|
|
||||||
@@ -46,7 +66,7 @@ This package now supports not only tools for AMR data analysis in clinical setti
|
|||||||
* `ab_atc()` now supports ATC codes of veterinary antimicrobials (that all start with "Q")
|
* `ab_atc()` now supports ATC codes of veterinary antimicrobials (that all start with "Q")
|
||||||
* `ab_url()` now supports retrieving the WHOCC url of their ATCvet pages
|
* `ab_url()` now supports retrieving the WHOCC url of their ATCvet pages
|
||||||
* **Support for WISCA antibiograms**
|
* **Support for WISCA antibiograms**
|
||||||
* The `antibiogram()` function now supports creating true Weighted-Incidence Syndromic Combination Antibiograms (WISCA), a powerful Bayesian method for estimating regimen coverage probabilities using pathogen incidence and antimicrobial susceptibility data. WISCA offers improved precision for syndrome-specific treatment, even in datasets with sparse data. A dedicated `wisca()` function is also available for easy usage.
|
* The `antibiogram()` function now supports creating true Weighted-Incidence Syndromic Combination Antibiograms (WISCA), a powerful Bayesian method for estimating regimen coverage probabilities using pathogen incidence and antimicrobial susceptibility data. WISCA offers improved precision for syndrome-specific treatment, even in data sets with sparse data. A dedicated `wisca()` function is also available for easy usage.
|
||||||
* **More global coverage of languages**
|
* **More global coverage of languages**
|
||||||
* Added full support for 8 new languages: Arabic, Bengali, Hindi, Indonesian, Korean, Swahili, Urdu, and Vietnamese. The `AMR` package is now available in 28 languages.
|
* Added full support for 8 new languages: Arabic, Bengali, Hindi, Indonesian, Korean, Swahili, Urdu, and Vietnamese. The `AMR` package is now available in 28 languages.
|
||||||
* **Major update to fungal taxonomy and tools for mycologists**
|
* **Major update to fungal taxonomy and tools for mycologists**
|
||||||
|
|||||||
@@ -966,8 +966,13 @@ get_current_data <- function(arg_name, call) {
|
|||||||
# an element `.data` will be in the environment when using dplyr::select()
|
# an element `.data` will be in the environment when using dplyr::select()
|
||||||
return(env$`.data`)
|
return(env$`.data`)
|
||||||
} else if (valid_df(env$training)) {
|
} else if (valid_df(env$training)) {
|
||||||
# an element `training` will be in the environment when using some tidymodels functions such as `prep()`
|
if (!is.null(env$x) && valid_df(env$x$template)) {
|
||||||
|
# an element `x$template` will be in the environment when using some tidymodels functions such as `prep()`
|
||||||
|
return(env$x$template)
|
||||||
|
} else {
|
||||||
|
# this is a fallback for some tidymodels functions such as `prep()`
|
||||||
return(env$training)
|
return(env$training)
|
||||||
|
}
|
||||||
} else if (valid_df(env$data)) {
|
} else if (valid_df(env$data)) {
|
||||||
# an element `data` will be in the environment when using older dplyr versions, or some tidymodels functions such as `fit()`
|
# an element `data` will be in the environment when using older dplyr versions, or some tidymodels functions such as `fit()`
|
||||||
return(env$data)
|
return(env$data)
|
||||||
@@ -1620,8 +1625,8 @@ get_n_cores <- function(max_cores = Inf) {
|
|||||||
|
|
||||||
# Support `where()` if tidyselect not installed ----
|
# Support `where()` if tidyselect not installed ----
|
||||||
if (!is.null(import_fn("where", "tidyselect", error_on_fail = FALSE))) {
|
if (!is.null(import_fn("where", "tidyselect", error_on_fail = FALSE))) {
|
||||||
# tidyselect::where() exists, load the namespace to make `where()`s work across the package in default arguments
|
# tidyselect::where() exists, retrieve from their namespace to make `where()`s work across the package in default arguments
|
||||||
loadNamespace("tidyselect")
|
where <- tidyselect::where
|
||||||
} else {
|
} else {
|
||||||
where <- function(fn) {
|
where <- function(fn) {
|
||||||
# based on https://github.com/nathaneastwood/poorman/blob/52eb6947e0b4430cd588976ed8820013eddf955f/R/where.R#L17-L32
|
# based on https://github.com/nathaneastwood/poorman/blob/52eb6947e0b4430cd588976ed8820013eddf955f/R/where.R#L17-L32
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#' @section Options:
|
#' @section Options:
|
||||||
#' * `AMR_antibiogram_formatting_type` \cr A [numeric] (1-22) to use in [antibiogram()], to indicate which formatting type to use.
|
#' * `AMR_antibiogram_formatting_type` \cr A [numeric] (1-22) to use in [antibiogram()], to indicate which formatting type to use.
|
||||||
#' * `AMR_breakpoint_type` \cr A [character] to use in [as.sir()], to indicate which breakpoint type to use. This must be either `r vector_or(clinical_breakpoints$type)`.
|
#' * `AMR_breakpoint_type` \cr A [character] to use in [as.sir()], to indicate which breakpoint type to use. This must be either `r vector_or(clinical_breakpoints$type)`.
|
||||||
#' * `AMR_capped_mic_handling` \cr A [character] to use in [as.sir()], to indicate how capped MIC values (`<`, `<=`, `>`, `>=`) should be interpreted. Must be one of `"standard"`, `"strict"`, `"relaxed"`, or `"inverse"` - the default is `"standard"`.
|
#' * `AMR_capped_mic_handling` \cr A [character] to use in [as.sir()], to indicate how capped MIC values (`<`, `<=`, `>`, `>=`) should be interpreted. Must be one of `"none"`, `"conservative"`, `"standard"`, or `"lenient"` - the default is `"conservative"`.
|
||||||
#' * `AMR_cleaning_regex` \cr A [regular expression][base::regex] (case-insensitive) to use in [as.mo()] and all [`mo_*`][mo_property()] functions, to clean the user input. The default is the outcome of [mo_cleaning_regex()], which removes texts between brackets and texts such as "species" and "serovar".
|
#' * `AMR_cleaning_regex` \cr A [regular expression][base::regex] (case-insensitive) to use in [as.mo()] and all [`mo_*`][mo_property()] functions, to clean the user input. The default is the outcome of [mo_cleaning_regex()], which removes texts between brackets and texts such as "species" and "serovar".
|
||||||
#' * `AMR_custom_ab` \cr A file location to an RDS file, to use custom antimicrobial drugs with this package. This is explained in [add_custom_antimicrobials()].
|
#' * `AMR_custom_ab` \cr A file location to an RDS file, to use custom antimicrobial drugs with this package. This is explained in [add_custom_antimicrobials()].
|
||||||
#' * `AMR_custom_mo` \cr A file location to an RDS file, to use custom microorganisms with this package. This is explained in [add_custom_microorganisms()].
|
#' * `AMR_custom_mo` \cr A file location to an RDS file, to use custom microorganisms with this package. This is explained in [add_custom_microorganisms()].
|
||||||
|
|||||||
@@ -163,7 +163,7 @@
|
|||||||
#' antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"))
|
#' antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"))
|
||||||
#' ```
|
#' ```
|
||||||
#'
|
#'
|
||||||
#' WISCA uses a sophisticated Bayesian decision model to combine both local and pooled antimicrobial resistance data. This approach not only evaluates local patterns but can also draw on multi-centre datasets to improve regimen accuracy, even in low-incidence infections like paediatric bloodstream infections (BSIs).
|
#' WISCA uses a sophisticated Bayesian decision model to combine both local and pooled antimicrobial resistance data. This approach not only evaluates local patterns but can also draw on multi-centre data sets to improve regimen accuracy, even in low-incidence infections like paediatric bloodstream infections (BSIs).
|
||||||
#'
|
#'
|
||||||
#' ### Grouped tibbles
|
#' ### Grouped tibbles
|
||||||
#'
|
#'
|
||||||
@@ -453,7 +453,7 @@ antibiogram.default <- function(x,
|
|||||||
deprecation_warning("antibiotics", "antimicrobials", fn = "antibiogram", is_argument = TRUE)
|
deprecation_warning("antibiotics", "antimicrobials", fn = "antibiogram", is_argument = TRUE)
|
||||||
antimicrobials <- list(...)$antibiotics
|
antimicrobials <- list(...)$antibiotics
|
||||||
}
|
}
|
||||||
meet_criteria(antimicrobials, allow_class = c("character", "numeric", "integer"), allow_NA = FALSE, allow_NULL = FALSE)
|
meet_criteria(antimicrobials, allow_class = c("character", "numeric", "integer", "function"), allow_NA = FALSE, allow_NULL = FALSE)
|
||||||
if (!is.function(mo_transform)) {
|
if (!is.function(mo_transform)) {
|
||||||
meet_criteria(mo_transform, allow_class = "character", has_length = 1, is_in = c("name", "shortname", "gramstain", colnames(AMR::microorganisms)), allow_NULL = TRUE, allow_NA = TRUE)
|
meet_criteria(mo_transform, allow_class = "character", has_length = 1, is_in = c("name", "shortname", "gramstain", colnames(AMR::microorganisms)), allow_NULL = TRUE, allow_NA = TRUE)
|
||||||
}
|
}
|
||||||
@@ -518,6 +518,10 @@ antibiogram.default <- function(x,
|
|||||||
|
|
||||||
# get antimicrobials
|
# get antimicrobials
|
||||||
ab_trycatch <- tryCatch(colnames(suppressWarnings(x[, antimicrobials, drop = FALSE])), error = function(e) NULL)
|
ab_trycatch <- tryCatch(colnames(suppressWarnings(x[, antimicrobials, drop = FALSE])), error = function(e) NULL)
|
||||||
|
if (is.null(ab_trycatch)) {
|
||||||
|
# try with tidyverse
|
||||||
|
ab_trycatch <- tryCatch(colnames(dplyr::select(x, {{ antimicrobials }})), error = function(e) NULL)
|
||||||
|
}
|
||||||
if (is.null(ab_trycatch)) {
|
if (is.null(ab_trycatch)) {
|
||||||
stop_ifnot(is.character(suppressMessages(antimicrobials)), "`antimicrobials` must be an antimicrobial selector, or a character vector.")
|
stop_ifnot(is.character(suppressMessages(antimicrobials)), "`antimicrobials` must be an antimicrobial selector, or a character vector.")
|
||||||
antimicrobials.bak <- antimicrobials
|
antimicrobials.bak <- antimicrobials
|
||||||
|
|||||||
@@ -99,7 +99,8 @@ atc_online_property <- function(atc_code,
|
|||||||
read_html <- import_fn("read_html", "xml2")
|
read_html <- import_fn("read_html", "xml2")
|
||||||
|
|
||||||
if (!all(atc_code %in% unlist(AMR::antimicrobials$atc))) {
|
if (!all(atc_code %in% unlist(AMR::antimicrobials$atc))) {
|
||||||
atc_code <- as.character(ab_atc(atc_code, only_first = TRUE))
|
missing <- atc_code %unlike% "[A-Z][0-9][0-9][A-Z][A-Z][0-9][0-9]"
|
||||||
|
atc_code[missing] <- as.character(ab_atc(atc_code[missing], only_first = TRUE))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_internet()) {
|
if (!has_internet()) {
|
||||||
|
|||||||
24
R/data.R
24
R/data.R
@@ -282,7 +282,7 @@
|
|||||||
|
|
||||||
#' Data Set with Clinical Breakpoints for SIR Interpretation
|
#' Data Set with Clinical Breakpoints for SIR Interpretation
|
||||||
#'
|
#'
|
||||||
#' @description Data set containing clinical breakpoints to interpret MIC and disk diffusion to SIR values, according to international guidelines. This dataset contain breakpoints for humans, `r length(unique(clinical_breakpoints$host[!clinical_breakpoints$host %in% clinical_breakpoints$type]))` different animal groups, and ECOFFs.
|
#' @description Data set containing clinical breakpoints to interpret MIC and disk diffusion to SIR values, according to international guidelines. This data set contains breakpoints for humans, `r length(unique(clinical_breakpoints$host[!clinical_breakpoints$host %in% clinical_breakpoints$type]))` different animal groups, and ECOFFs.
|
||||||
#'
|
#'
|
||||||
#' These breakpoints are currently implemented:
|
#' These breakpoints are currently implemented:
|
||||||
#' - For **clinical microbiology**: EUCAST `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "human")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "human")$guideline)))` and CLSI `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "human")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "human")$guideline)))`;
|
#' - For **clinical microbiology**: EUCAST `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "human")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "human")$guideline)))` and CLSI `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "human")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "human")$guideline)))`;
|
||||||
@@ -362,14 +362,14 @@
|
|||||||
#' dosage
|
#' dosage
|
||||||
"dosage"
|
"dosage"
|
||||||
|
|
||||||
# TODO #' Data Set with `r format(nrow(esbl_isolates), big.mark = " ")` ESBL Isolates
|
#' Data Set with `r format(nrow(esbl_isolates), big.mark = " ")` ESBL Isolates
|
||||||
# TODO #'
|
#'
|
||||||
# TODO #' A data set containing `r format(nrow(esbl_isolates), big.mark = " ")` microbial isolates with MIC values of common antibiotics and a binary `esbl` column for extended-spectrum beta-lactamase (ESBL) production. This data set contains randomised fictitious data but reflects reality and can be used to practise AMR-related machine learning, e.g., classification modelling with [tidymodels](https://amr-for-r.org/articles/AMR_with_tidymodels.html).
|
#' A data set containing `r format(nrow(esbl_isolates), big.mark = " ")` microbial isolates with MIC values of common antibiotics and a binary `esbl` column for extended-spectrum beta-lactamase (ESBL) production. This data set contains randomised fictitious data but reflects reality and can be used to practise AMR-related machine learning, e.g., classification modelling with [tidymodels](https://amr-for-r.org/articles/AMR_with_tidymodels.html).
|
||||||
# TODO #' @format A [tibble][tibble::tibble] with `r format(nrow(esbl_isolates), big.mark = " ")` observations and `r ncol(esbl_isolates)` variables:
|
#' @format A [tibble][tibble::tibble] with `r format(nrow(esbl_isolates), big.mark = " ")` observations and `r ncol(esbl_isolates)` variables:
|
||||||
# TODO #' - `esbl`\cr Logical indicator if the isolate is ESBL-producing
|
#' - `esbl`\cr Logical indicator if the isolate is ESBL-producing
|
||||||
# TODO #' - `genus`\cr Genus of the microorganism
|
#' - `genus`\cr Genus of the microorganism
|
||||||
# TODO #' - `AMC:COL`\cr MIC values for 17 antimicrobial agents, transformed to class [`mic`] (see [as.mic()])
|
#' - `AMC:COL`\cr MIC values for 17 antimicrobial agents, transformed to class [`mic`] (see [as.mic()])
|
||||||
# TODO #' @details See our [tidymodels integration][amr-tidymodels] for an example using this data set.
|
#' @details See our [tidymodels integration][amr-tidymodels] for an example using this data set.
|
||||||
# TODO #' @examples
|
#' @examples
|
||||||
# TODO #' esbl_isolates
|
#' esbl_isolates
|
||||||
# TODO "esbl_isolates"
|
"esbl_isolates"
|
||||||
|
|||||||
228
R/sir.R
228
R/sir.R
@@ -42,22 +42,22 @@
|
|||||||
#' @param capped_mic_handling A [character] string that controls how MIC values with a cap (i.e., starting with `<`, `<=`, `>`, or `>=`) are interpreted. Supports the following options:
|
#' @param capped_mic_handling A [character] string that controls how MIC values with a cap (i.e., starting with `<`, `<=`, `>`, or `>=`) are interpreted. Supports the following options:
|
||||||
#'
|
#'
|
||||||
#' `"none"`
|
#' `"none"`
|
||||||
#' * `<=` and `>=` are treated as-is.
|
#' * `<=`, `<`, `>` and `>=` are ignored.
|
||||||
#' * `<` and `>` are treated as-is.
|
|
||||||
#'
|
#'
|
||||||
#' `"conservative"`
|
#' `"conservative"` (default)
|
||||||
#' * `<=` and `>=` return `"NI"` (non-interpretable) if the MIC is within the breakpoint guideline range.
|
#' * `<=`, `<`, `>` and `>=` return `"NI"` (non-interpretable) if the *true* MIC could be at either side of the breakpoint.
|
||||||
#' * `<` always returns `"S"`, and `>` always returns `"R"`.
|
#' * This is the only mode that preserves uncertainty for ECOFFs.
|
||||||
#'
|
#'
|
||||||
#' `"standard"` (default)
|
#' `"standard"`
|
||||||
#' * `<=` and `>=` return `"NI"` (non-interpretable) if the MIC is within the breakpoint guideline range.
|
#' * `<=` and `>=` return `"NI"` (non-interpretable) if the *true* MIC could be at either side of the breakpoint.
|
||||||
#' * `<` and `>` are treated as-is.
|
#' * `<` always returns `"S"`, regardless of the breakpoint.
|
||||||
|
#' * `>` always returns `"R"`, regardless of the breakpoint.
|
||||||
#'
|
#'
|
||||||
#' `"inverse"`
|
#' `"lenient"`
|
||||||
#' * `<=` and `>=` are treated as-is.
|
#' * `<=` and `<` always return `"S"`, regardless of the breakpoint.
|
||||||
#' * `<` always returns `"S"`, and `>` always returns `"R"`.
|
#' * `>=` and `>` always return `"R"`, regardless of the breakpoint.
|
||||||
#'
|
#'
|
||||||
#' The default `"standard"` setting ensures cautious handling of uncertain values while preserving interpretability. This option can also be set with the package option [`AMR_capped_mic_handling`][AMR-options].
|
#' The default `"conservative"` setting ensures cautious handling of uncertain values while preserving interpretability. This option can also be set with the package option [`AMR_capped_mic_handling`][AMR-options].
|
||||||
#' @param add_intrinsic_resistance *(only useful when using a EUCAST guideline)* a [logical] to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in *Klebsiella* species. Determination is based on the [intrinsic_resistant] data set, that itself is based on `r format_eucast_version_nr(3.3)`.
|
#' @param add_intrinsic_resistance *(only useful when using a EUCAST guideline)* a [logical] to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in *Klebsiella* species. Determination is based on the [intrinsic_resistant] data set, that itself is based on `r format_eucast_version_nr(3.3)`.
|
||||||
#' @param substitute_missing_r_breakpoint A [logical] to indicate that a missing clinical breakpoints for R (resistant) must be substituted with R - the default is `FALSE`. Some (especially CLSI) breakpoints only have a breakpoint for S, meaning that the outcome can only be `"S"` or `NA`. Setting this to `TRUE` will convert the `NA`s in these cases to `"R"`. Can also be set with the package option [`AMR_substitute_missing_r_breakpoint`][AMR-options].
|
#' @param substitute_missing_r_breakpoint A [logical] to indicate that a missing clinical breakpoints for R (resistant) must be substituted with R - the default is `FALSE`. Some (especially CLSI) breakpoints only have a breakpoint for S, meaning that the outcome can only be `"S"` or `NA`. Setting this to `TRUE` will convert the `NA`s in these cases to `"R"`. Can also be set with the package option [`AMR_substitute_missing_r_breakpoint`][AMR-options].
|
||||||
#' @param include_screening A [logical] to indicate that clinical breakpoints for screening are allowed - the default is `FALSE`. Can also be set with the package option [`AMR_include_screening`][AMR-options].
|
#' @param include_screening A [logical] to indicate that clinical breakpoints for screening are allowed - the default is `FALSE`. Can also be set with the package option [`AMR_include_screening`][AMR-options].
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
#' @param reference_data A [data.frame] to be used for interpretation, which defaults to the [clinical_breakpoints] data set. Changing this argument allows for using own interpretation guidelines. This argument must contain a data set that is equal in structure to the [clinical_breakpoints] data set (same column names and column types). Please note that the `guideline` argument will be ignored when `reference_data` is manually set.
|
#' @param reference_data A [data.frame] to be used for interpretation, which defaults to the [clinical_breakpoints] data set. Changing this argument allows for using own interpretation guidelines. This argument must contain a data set that is equal in structure to the [clinical_breakpoints] data set (same column names and column types). Please note that the `guideline` argument will be ignored when `reference_data` is manually set.
|
||||||
#' @param threshold Maximum fraction of invalid antimicrobial interpretations of `x`, see *Examples*.
|
#' @param threshold Maximum fraction of invalid antimicrobial interpretations of `x`, see *Examples*.
|
||||||
#' @param conserve_capped_values Deprecated, use `capped_mic_handling` instead.
|
#' @param conserve_capped_values Deprecated, use `capped_mic_handling` instead.
|
||||||
#' @param ... For using on a [data.frame]: selection of columns to apply `as.sir()` to. Supports [tidyselect language][tidyselect::starts_with()] such as `where(is.mic)`, `starts_with(...)`, or `column1:column4`, and can thus also be [antimicrobial selectors][amr_selector()] such as `as.sir(df, penicillins())`.
|
#' @param ... For using on a [data.frame]: selection of columns to apply `as.sir()` to. Supports [tidyselect language][tidyselect::starts_with()] such as `where(is.mic)`, `starts_with(...)`, or `column1:column4`, and can thus also be [antimicrobial selectors][amr_selector()], e.g. `as.sir(df, penicillins())`.
|
||||||
#'
|
#'
|
||||||
#' Otherwise: arguments passed on to methods.
|
#' Otherwise: arguments passed on to methods.
|
||||||
#' @details
|
#' @details
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
#' # fast processing with parallel computing:
|
#' # fast processing with parallel computing:
|
||||||
#' as.sir(your_data, ..., parallel = TRUE)
|
#' as.sir(your_data, ..., parallel = TRUE)
|
||||||
#' ```
|
#' ```
|
||||||
#' * Operators like "<=" will be stripped before interpretation. When using `capped_mic_handling = "conservative"`, an MIC value of e.g. ">2" will always return "R", even if the breakpoint according to the chosen guideline is ">=4". This is to prevent that capped values from raw laboratory data would not be treated conservatively. The default behaviour (`capped_mic_handling = "standard"`) considers ">2" to be lower than ">=4" and might in this case return "S" or "I".
|
#' * Operators like "<=" will be considered according to the `capped_mic_handling` setting. At default, an MIC value of e.g. ">2" will return "NI" (non-interpretable) if the breakpoint is 4-8; the *true* MIC could be at either side of the breakpoint. This is to prevent that capped values from raw laboratory data would not be treated conservatively.
|
||||||
#' * **Note:** When using CLSI as the guideline, MIC values must be log2-based doubling dilutions. Values not in this format, will be automatically rounded up to the nearest log2 level as CLSI instructs, and a warning will be thrown.
|
#' * **Note:** When using CLSI as the guideline, MIC values must be log2-based doubling dilutions. Values not in this format, will be automatically rounded up to the nearest log2 level as CLSI instructs, and a warning will be thrown.
|
||||||
#'
|
#'
|
||||||
#' 3. For **interpreting disk diffusion diameters** according to EUCAST or CLSI. You must clean your disk zones first using [as.disk()], that also gives your columns the new data class [`disk`]. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the `mo` argument.
|
#' 3. For **interpreting disk diffusion diameters** according to EUCAST or CLSI. You must clean your disk zones first using [as.disk()], that also gives your columns the new data class [`disk`]. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the `mo` argument.
|
||||||
@@ -353,6 +353,10 @@
|
|||||||
#'
|
#'
|
||||||
#' as.sir(c("S", "SDD", "I", "R", "NI", "A", "B", "C"))
|
#' as.sir(c("S", "SDD", "I", "R", "NI", "A", "B", "C"))
|
||||||
#' as.sir("<= 0.002; S") # will return "S"
|
#' as.sir("<= 0.002; S") # will return "S"
|
||||||
|
#'
|
||||||
|
#' as.sir(c(1, 2, 3))
|
||||||
|
#' as.sir(c(1, 2, 3), S = 3, I = 2, R = 1)
|
||||||
|
#'
|
||||||
#' sir_data <- as.sir(c(rep("S", 474), rep("I", 36), rep("R", 370)))
|
#' sir_data <- as.sir(c(rep("S", 474), rep("I", 36), rep("R", 370)))
|
||||||
#' is.sir(sir_data)
|
#' is.sir(sir_data)
|
||||||
#' plot(sir_data) # for percentages
|
#' plot(sir_data) # for percentages
|
||||||
@@ -486,18 +490,18 @@ is_sir_eligible <- function(x, threshold = 0.05) {
|
|||||||
#' @param info A [logical] to print information about the process, defaults to `TRUE` only in [interactive sessions][base::interactive()].
|
#' @param info A [logical] to print information about the process, defaults to `TRUE` only in [interactive sessions][base::interactive()].
|
||||||
# extra param: warn (logical, to never throw a warning)
|
# extra param: warn (logical, to never throw a warning)
|
||||||
as.sir.default <- function(x,
|
as.sir.default <- function(x,
|
||||||
S = "^(S|U)+$",
|
S = "^(S|U|1)+$",
|
||||||
I = "^(I)+$",
|
I = "^(I|2)+$",
|
||||||
R = "^(R)+$",
|
R = "^(R|3)+$",
|
||||||
NI = "^(N|NI|V)+$",
|
NI = "^(N|NI|V|4)+$",
|
||||||
SDD = "^(SDD|D|H)+$",
|
SDD = "^(SDD|D|H|5)+$",
|
||||||
info = interactive(),
|
info = interactive(),
|
||||||
...) {
|
...) {
|
||||||
meet_criteria(S, allow_class = "character", has_length = 1)
|
meet_criteria(S, allow_class = c("character", "numeric", "integer"), has_length = 1)
|
||||||
meet_criteria(I, allow_class = "character", has_length = 1)
|
meet_criteria(I, allow_class = c("character", "numeric", "integer"), has_length = 1)
|
||||||
meet_criteria(R, allow_class = "character", has_length = 1)
|
meet_criteria(R, allow_class = c("character", "numeric", "integer"), has_length = 1)
|
||||||
meet_criteria(NI, allow_class = "character", has_length = 1)
|
meet_criteria(NI, allow_class = c("character", "numeric", "integer"), has_length = 1)
|
||||||
meet_criteria(SDD, allow_class = "character", has_length = 1)
|
meet_criteria(SDD, allow_class = c("character", "numeric", "integer"), has_length = 1)
|
||||||
meet_criteria(info, allow_class = "logical", has_length = 1)
|
meet_criteria(info, allow_class = "logical", has_length = 1)
|
||||||
if (inherits(x, "sir")) {
|
if (inherits(x, "sir")) {
|
||||||
return(as_sir_structure(x))
|
return(as_sir_structure(x))
|
||||||
@@ -506,30 +510,14 @@ as.sir.default <- function(x,
|
|||||||
x.bak <- x
|
x.bak <- x
|
||||||
x <- as.character(x) # this is needed to prevent the vctrs pkg from throwing an error
|
x <- as.character(x) # this is needed to prevent the vctrs pkg from throwing an error
|
||||||
|
|
||||||
if (inherits(x.bak, c("numeric", "integer")) && all(x %in% c(1:3, NA))) {
|
lbls <- attr(x.bak, "labels", exact = TRUE)
|
||||||
|
if (inherits(x.bak, c("numeric", "integer")) && all(x %in% c(1:3, NA)) && !is.null(lbls) && all(c("S", "I", "R") %in% names(lbls)) && all(c(1:3) %in% lbls)) {
|
||||||
# support haven package for importing e.g., from SPSS - it adds the 'labels' attribute
|
# support haven package for importing e.g., from SPSS - it adds the 'labels' attribute
|
||||||
lbls <- attributes(x.bak)$labels
|
|
||||||
if (!is.null(lbls) && all(c("S", "I", "R") %in% names(lbls)) && all(c(1:3) %in% lbls)) {
|
|
||||||
x[x.bak == 1] <- names(lbls[lbls == 1])
|
x[x.bak == 1] <- names(lbls[lbls == 1])
|
||||||
x[x.bak == 2] <- names(lbls[lbls == 2])
|
x[x.bak == 2] <- names(lbls[lbls == 2])
|
||||||
x[x.bak == 3] <- names(lbls[lbls == 3])
|
x[x.bak == 3] <- names(lbls[lbls == 3])
|
||||||
} else {
|
|
||||||
x[x.bak == 1] <- "S"
|
|
||||||
x[x.bak == 2] <- "I"
|
|
||||||
x[x.bak == 3] <- "R"
|
|
||||||
}
|
|
||||||
} else if (inherits(x.bak, "character") && all(x %in% c("1", "2", "3", "S", "I", "R", NA_character_))) {
|
|
||||||
x[x.bak == "1"] <- "S"
|
|
||||||
x[x.bak == "2"] <- "I"
|
|
||||||
x[x.bak == "3"] <- "R"
|
|
||||||
} else if (inherits(x.bak, "character") && all(x %in% c("1", "2", "3", "4", "5", "S", "SDD", "I", "R", "NI", NA_character_))) {
|
|
||||||
x[x.bak == "1"] <- "S"
|
|
||||||
x[x.bak == "2"] <- "SDD"
|
|
||||||
x[x.bak == "3"] <- "I"
|
|
||||||
x[x.bak == "4"] <- "R"
|
|
||||||
x[x.bak == "5"] <- "NI"
|
|
||||||
} else if (!all(is.na(x)) && !identical(levels(x), c("S", "SDD", "I", "R", "NI")) && !all(x %in% c("S", "SDD", "I", "R", "NI", NA))) {
|
} else if (!all(is.na(x)) && !identical(levels(x), c("S", "SDD", "I", "R", "NI")) && !all(x %in% c("S", "SDD", "I", "R", "NI", NA))) {
|
||||||
if (all(x %unlike% "(S|I|R)", na.rm = TRUE)) {
|
if (all(x %unlike% "(S|I|R)", na.rm = TRUE) && !all(x %in% c(1, 2, 3, 4, 5), na.rm = TRUE)) {
|
||||||
# check if they are actually MICs or disks
|
# check if they are actually MICs or disks
|
||||||
if (all_valid_mics(x)) {
|
if (all_valid_mics(x)) {
|
||||||
warning_("in `as.sir()`: input values were guessed to be MIC values - preferably transform them with `as.mic()` before running `as.sir()`.")
|
warning_("in `as.sir()`: input values were guessed to be MIC values - preferably transform them with `as.mic()` before running `as.sir()`.")
|
||||||
@@ -569,7 +557,8 @@ as.sir.default <- function(x,
|
|||||||
x[x %like% "not|non"] <- "NI"
|
x[x %like% "not|non"] <- "NI"
|
||||||
x[x %like% "([^a-z]|^)int(er(mediate)?)?|incr.*exp"] <- "I"
|
x[x %like% "([^a-z]|^)int(er(mediate)?)?|incr.*exp"] <- "I"
|
||||||
x[x %like% "dose"] <- "SDD"
|
x[x %like% "dose"] <- "SDD"
|
||||||
x <- gsub("[^A-Z]+", "", x, perl = TRUE)
|
mtch <- grepl(paste0("(", S, "|", I, "|", R, "|", NI, "|", SDD, "|[A-Z]+)"), x, perl = TRUE)
|
||||||
|
x[!mtch] <- ""
|
||||||
# apply regexes set by user
|
# apply regexes set by user
|
||||||
x[x %like% S] <- "S"
|
x[x %like% S] <- "S"
|
||||||
x[x %like% I] <- "I"
|
x[x %like% I] <- "I"
|
||||||
@@ -580,6 +569,22 @@ as.sir.default <- function(x,
|
|||||||
na_after <- length(x[is.na(x) | x == ""])
|
na_after <- length(x[is.na(x) | x == ""])
|
||||||
|
|
||||||
if (!isFALSE(list(...)$warn)) { # so as.sir(..., warn = FALSE) will never throw a warning
|
if (!isFALSE(list(...)$warn)) { # so as.sir(..., warn = FALSE) will never throw a warning
|
||||||
|
if (all(x.bak %in% c(1, 2, 3, 4, 5), na.rm = TRUE) && message_not_thrown_before("as.sir", "numeric_interpretation", x, x.bak)) {
|
||||||
|
out1 <- unique(x[x.bak == 1])
|
||||||
|
out2 <- unique(x[x.bak == 2])
|
||||||
|
out3 <- unique(x[x.bak == 3])
|
||||||
|
out4 <- unique(x[x.bak == 4])
|
||||||
|
out5 <- unique(x[x.bak == 5])
|
||||||
|
out <- c(
|
||||||
|
ifelse(length(out1) > 0, paste0("1 as \"", out1, "\""), NA_character_),
|
||||||
|
ifelse(length(out2) > 0, paste0("2 as \"", out2, "\""), NA_character_),
|
||||||
|
ifelse(length(out3) > 0, paste0("3 as \"", out3, "\""), NA_character_),
|
||||||
|
ifelse(length(out4) > 0, paste0("4 as \"", out4, "\""), NA_character_),
|
||||||
|
ifelse(length(out5) > 0, paste0("5 as \"", out5, "\""), NA_character_)
|
||||||
|
)
|
||||||
|
message_("in `as.sir()`: Interpreting input value ", vector_and(out[!is.na(out)], quotes = FALSE, sort = FALSE))
|
||||||
|
}
|
||||||
|
|
||||||
if (na_before != na_after) {
|
if (na_before != na_after) {
|
||||||
list_missing <- x.bak[is.na(x) & !is.na(x.bak) & x.bak != ""] %pm>%
|
list_missing <- x.bak[is.na(x) & !is.na(x.bak) & x.bak != ""] %pm>%
|
||||||
unique() %pm>%
|
unique() %pm>%
|
||||||
@@ -714,7 +719,7 @@ as.sir.data.frame <- function(x,
|
|||||||
meet_criteria(col_mo, allow_class = "character", is_in = colnames(x), allow_NULL = TRUE)
|
meet_criteria(col_mo, allow_class = "character", is_in = colnames(x), allow_NULL = TRUE)
|
||||||
meet_criteria(guideline, allow_class = "character")
|
meet_criteria(guideline, allow_class = "character")
|
||||||
meet_criteria(uti, allow_class = c("logical", "character"), allow_NULL = TRUE, allow_NA = TRUE)
|
meet_criteria(uti, allow_class = c("logical", "character"), allow_NULL = TRUE, allow_NA = TRUE)
|
||||||
meet_criteria(capped_mic_handling, allow_class = "character", has_length = 1, is_in = c("standard", "conservative", "none", "inverse"))
|
meet_criteria(capped_mic_handling, allow_class = "character", has_length = 1, is_in = c("none", "conservative", "standard", "lenient"))
|
||||||
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1)
|
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1)
|
||||||
meet_criteria(reference_data, allow_class = "data.frame")
|
meet_criteria(reference_data, allow_class = "data.frame")
|
||||||
meet_criteria(substitute_missing_r_breakpoint, allow_class = "logical", has_length = 1)
|
meet_criteria(substitute_missing_r_breakpoint, allow_class = "logical", has_length = 1)
|
||||||
@@ -795,8 +800,8 @@ as.sir.data.frame <- function(x,
|
|||||||
col_specimen <- suppressMessages(search_type_in_df(x = x, type = "specimen", info = info))
|
col_specimen <- suppressMessages(search_type_in_df(x = x, type = "specimen", info = info))
|
||||||
if (!is.null(col_specimen)) {
|
if (!is.null(col_specimen)) {
|
||||||
uti <- x[, col_specimen, drop = TRUE] %like% "urin"
|
uti <- x[, col_specimen, drop = TRUE] %like% "urin"
|
||||||
values <- sort(unique(x[uti, col_specimen, drop = TRUE]))
|
col_values <- sort(unique(x[uti, col_specimen, drop = TRUE]))
|
||||||
if (length(values) > 1) {
|
if (length(col_values) > 1) {
|
||||||
plural <- c("s", "", "")
|
plural <- c("s", "", "")
|
||||||
} else {
|
} else {
|
||||||
plural <- c("", "s", "a ")
|
plural <- c("", "s", "a ")
|
||||||
@@ -804,7 +809,7 @@ as.sir.data.frame <- function(x,
|
|||||||
if (isTRUE(info)) {
|
if (isTRUE(info)) {
|
||||||
message_(
|
message_(
|
||||||
"Assuming value", plural[1], " ",
|
"Assuming value", plural[1], " ",
|
||||||
vector_and(values, quotes = TRUE),
|
vector_and(col_values, quotes = TRUE),
|
||||||
" in column '", font_bold(col_specimen),
|
" in column '", font_bold(col_specimen),
|
||||||
"' reflect", plural[2], " ", plural[3], "urinary tract infection", plural[1],
|
"' reflect", plural[2], " ", plural[3], "urinary tract infection", plural[1],
|
||||||
".\n Use `as.sir(uti = FALSE)` to prevent this."
|
".\n Use `as.sir(uti = FALSE)` to prevent this."
|
||||||
@@ -1117,7 +1122,7 @@ as_sir_method <- function(method_short,
|
|||||||
meet_criteria(ab, allow_class = c("ab", "character"), has_length = c(1, length(x)), .call_depth = -2)
|
meet_criteria(ab, allow_class = c("ab", "character"), has_length = c(1, length(x)), .call_depth = -2)
|
||||||
meet_criteria(guideline, allow_class = "character", has_length = c(1, length(x)), .call_depth = -2)
|
meet_criteria(guideline, allow_class = "character", has_length = c(1, length(x)), .call_depth = -2)
|
||||||
meet_criteria(uti, allow_class = c("logical", "character"), has_length = c(1, length(x)), allow_NULL = TRUE, allow_NA = TRUE, .call_depth = -2)
|
meet_criteria(uti, allow_class = c("logical", "character"), has_length = c(1, length(x)), allow_NULL = TRUE, allow_NA = TRUE, .call_depth = -2)
|
||||||
meet_criteria(capped_mic_handling, allow_class = "character", has_length = 1, is_in = c("standard", "conservative", "none", "inverse"), .call_depth = -2)
|
meet_criteria(capped_mic_handling, allow_class = "character", has_length = 1, is_in = c("none", "conservative", "standard", "lenient"), .call_depth = -2)
|
||||||
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1, .call_depth = -2)
|
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1, .call_depth = -2)
|
||||||
meet_criteria(reference_data, allow_class = "data.frame", .call_depth = -2)
|
meet_criteria(reference_data, allow_class = "data.frame", .call_depth = -2)
|
||||||
meet_criteria(substitute_missing_r_breakpoint, allow_class = "logical", has_length = 1, .call_depth = -2)
|
meet_criteria(substitute_missing_r_breakpoint, allow_class = "logical", has_length = 1, .call_depth = -2)
|
||||||
@@ -1378,8 +1383,8 @@ as_sir_method <- function(method_short,
|
|||||||
|
|
||||||
# create the unique data frame to be filled to save time
|
# create the unique data frame to be filled to save time
|
||||||
df <- data.frame(
|
df <- data.frame(
|
||||||
values = x,
|
input_clean = x,
|
||||||
values_bak = x,
|
input_original = x,
|
||||||
guideline = guideline_coerced,
|
guideline = guideline_coerced,
|
||||||
mo = mo,
|
mo = mo,
|
||||||
ab = ab,
|
ab = ab,
|
||||||
@@ -1393,7 +1398,7 @@ as_sir_method <- function(method_short,
|
|||||||
# CLSI in log 2 ----
|
# CLSI in log 2 ----
|
||||||
# CLSI says: if MIC is not a log2 value it must be rounded up to the nearest log2 value
|
# CLSI says: if MIC is not a log2 value it must be rounded up to the nearest log2 value
|
||||||
log2_levels <- as.double(VALID_MIC_LEVELS[which(VALID_MIC_LEVELS %in% 2^c(-20:20))])
|
log2_levels <- as.double(VALID_MIC_LEVELS[which(VALID_MIC_LEVELS %in% 2^c(-20:20))])
|
||||||
test_values <- df$values
|
test_values <- df$input_clean
|
||||||
test_values_dbl <- as.double(test_values)
|
test_values_dbl <- as.double(test_values)
|
||||||
test_values_dbl[test_values %like% "^>[0-9]"] <- test_values_dbl[test_values %like% "^>[0-9]"] + 0.0000001
|
test_values_dbl[test_values %like% "^>[0-9]"] <- test_values_dbl[test_values %like% "^>[0-9]"] + 0.0000001
|
||||||
test_values_dbl[test_values %like% "^<[0-9]"] <- test_values_dbl[test_values %like% "^<[0-9]"] - 0.0000001
|
test_values_dbl[test_values %like% "^<[0-9]"] <- test_values_dbl[test_values %like% "^<[0-9]"] - 0.0000001
|
||||||
@@ -1417,12 +1422,12 @@ as_sir_method <- function(method_short,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
df$values[which(df$guideline %like% "CLSI" & test_values != test_outcome)] <- test_outcome[which(df$guideline %like% "CLSI" & test_values != test_outcome)]
|
df$input_clean[which(df$guideline %like% "CLSI" & test_values != test_outcome)] <- test_outcome[which(df$guideline %like% "CLSI" & test_values != test_outcome)]
|
||||||
}
|
}
|
||||||
df$values <- as.mic(df$values)
|
df$input_clean <- as.mic(df$input_clean)
|
||||||
} else if (method == "disk") {
|
} else if (method == "disk") {
|
||||||
# when as.sir.disk is called directly
|
# when as.sir.disk is called directly
|
||||||
df$values <- as.disk(df$values)
|
df$input_clean <- as.disk(df$input_clean)
|
||||||
}
|
}
|
||||||
|
|
||||||
df_unique <- unique(df[, c("guideline", "mo", "ab", "uti", "host"), drop = FALSE])
|
df_unique <- unique(df[, c("guideline", "mo", "ab", "uti", "host"), drop = FALSE])
|
||||||
@@ -1500,8 +1505,8 @@ as_sir_method <- function(method_short,
|
|||||||
# this can happen if a host is unavailable, just continue with the next one, since a note about hosts having NA are already given at this point
|
# this can happen if a host is unavailable, just continue with the next one, since a note about hosts having NA are already given at this point
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
values <- df[rows, "values", drop = TRUE]
|
input_clean <- df[rows, "input_clean", drop = TRUE]
|
||||||
values_bak <- df[rows, "values_bak", drop = TRUE]
|
input_original <- df[rows, "input_original", drop = TRUE]
|
||||||
notes_current <- rep("", length(rows))
|
notes_current <- rep("", length(rows))
|
||||||
new_sir <- rep(NA_sir_, length(rows))
|
new_sir <- rep(NA_sir_, length(rows))
|
||||||
|
|
||||||
@@ -1636,11 +1641,11 @@ as_sir_method <- function(method_short,
|
|||||||
ab_given = vectorise_log_entry(ab.bak[match(ab_current, df$ab)][1], length(rows)),
|
ab_given = vectorise_log_entry(ab.bak[match(ab_current, df$ab)][1], length(rows)),
|
||||||
mo_given = vectorise_log_entry(mo.bak[match(mo_current, df$mo)][1], length(rows)),
|
mo_given = vectorise_log_entry(mo.bak[match(mo_current, df$mo)][1], length(rows)),
|
||||||
host_given = vectorise_log_entry(host.bak[match(host_current, df$host)][1], length(rows)),
|
host_given = vectorise_log_entry(host.bak[match(host_current, df$host)][1], length(rows)),
|
||||||
input_given = vectorise_log_entry(as.character(values_bak), length(rows)),
|
input_given = vectorise_log_entry(as.character(input_original), length(rows)),
|
||||||
ab = vectorise_log_entry(ab_current, length(rows)),
|
ab = vectorise_log_entry(ab_current, length(rows)),
|
||||||
mo = vectorise_log_entry(mo_current, length(rows)),
|
mo = vectorise_log_entry(mo_current, length(rows)),
|
||||||
host = vectorise_log_entry(host_current, length(rows)),
|
host = vectorise_log_entry(host_current, length(rows)),
|
||||||
input = vectorise_log_entry(as.character(values), length(rows)),
|
input = vectorise_log_entry(as.character(input_clean), length(rows)),
|
||||||
outcome = vectorise_log_entry(NA_sir_, length(rows)),
|
outcome = vectorise_log_entry(NA_sir_, length(rows)),
|
||||||
notes = vectorise_log_entry("No breakpoint available", length(rows)),
|
notes = vectorise_log_entry("No breakpoint available", length(rows)),
|
||||||
guideline = vectorise_log_entry(guideline_current, length(rows)),
|
guideline = vectorise_log_entry(guideline_current, length(rows)),
|
||||||
@@ -1734,31 +1739,51 @@ as_sir_method <- function(method_short,
|
|||||||
""
|
""
|
||||||
),
|
),
|
||||||
"\n",
|
"\n",
|
||||||
ifelse(method == "mic" & capped_mic_handling %in% c("conservative", "inverse") & as.character(values_bak) %like% "^[<][0-9]",
|
ifelse(method == "mic" & capped_mic_handling == "none" & as.character(input_original) %like% "^[<>][0-9]" &
|
||||||
paste0("MIC values with the operator '<' are all considered 'S' since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
((as.character(input_original) %like% "^<" & as.double(input_clean) > breakpoints_current$breakpoint_S) |
|
||||||
|
(as.character(input_original) %like% "^>" & as.double(input_clean) < breakpoints_current$breakpoint_R)),
|
||||||
|
paste0("Operators such as '<' and '>' were ignored since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||||
""
|
""
|
||||||
),
|
),
|
||||||
"\n",
|
"\n",
|
||||||
ifelse(method == "mic" & capped_mic_handling %in% c("conservative", "inverse") & as.character(values_bak) %like% "^[>][0-9]",
|
ifelse(method == "mic" & capped_mic_handling == "standard" & as.character(input_original) %like% "^[<][0-9]",
|
||||||
paste0("MIC values with the operator '>' are all considered 'R' since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
paste0("MIC values with the operator '<' are considered 'S' since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||||
""
|
""
|
||||||
),
|
),
|
||||||
"\n",
|
"\n",
|
||||||
ifelse(method == "mic" & capped_mic_handling %in% c("conservative", "standard") & as.character(values_bak) %like% "^[><]=[0-9]" & as.double(values) > breakpoints_current$breakpoint_S & as.double(values) < breakpoints_current$breakpoint_R,
|
ifelse(method == "mic" & capped_mic_handling == "standard" & as.character(input_original) %like% "^[>][0-9]",
|
||||||
paste0("MIC values within the breakpoint guideline range with the operator '<=' or '>=' are considered 'NI' (non-interpretable) since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
paste0("MIC values with the operator '>' are considered 'R' since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||||
""
|
""
|
||||||
),
|
),
|
||||||
"\n",
|
"\n",
|
||||||
ifelse(method == "mic" & capped_mic_handling %in% c("conservative", "standard") & as.character(values_bak) %like% "^<=[0-9]" & as.double(values) == breakpoints_current$breakpoint_R,
|
ifelse(method == "mic" & capped_mic_handling == "lenient" & as.character(input_original) %like% "^[<]=?[0-9]",
|
||||||
paste0("MIC values at the R breakpoint with the operator '<=' are considered 'NI' (non-interpretable) since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
paste0("MIC values with the operator '<' or '<=' are considered 'S' since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||||
""
|
""
|
||||||
),
|
),
|
||||||
"\n",
|
"\n",
|
||||||
ifelse(method == "mic" & capped_mic_handling %in% c("conservative", "standard") & as.character(values_bak) %like% "^>=[0-9]" & as.double(values) == breakpoints_current$breakpoint_S,
|
ifelse(method == "mic" & capped_mic_handling == "lenient" & as.character(input_original) %like% "^[>]=?[0-9]",
|
||||||
paste0("MIC values at the S breakpoint with the operator '>=' are considered 'NI' (non-interpretable) since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
paste0("MIC values with the operator '>' or '>=' are considered 'R' since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||||
|
""
|
||||||
|
),
|
||||||
|
"\n",
|
||||||
|
ifelse(method == "mic" & capped_mic_handling == "conservative" & as.character(input_original) %like% "^[<>][0-9]" &
|
||||||
|
((as.character(input_original) %like% "^<" & as.double(input_clean) > breakpoints_current$breakpoint_S) |
|
||||||
|
(as.character(input_original) %like% "^>" & as.double(input_clean) < breakpoints_current$breakpoint_R)),
|
||||||
|
paste0("MIC values are considered 'NI' (non-interpretable) if the true MIC could be at either side of the breakpoint and capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||||
|
""
|
||||||
|
),
|
||||||
|
"\n",
|
||||||
|
ifelse(method == "mic" & capped_mic_handling %in% c("conservative", "standard") & as.character(input_original) %like% "^<=[0-9]" & as.double(input_clean) > breakpoints_current$breakpoint_S,
|
||||||
|
paste0("MIC values are considered 'NI' (non-interpretable) if the true MIC could be at either side of the breakpoint and capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||||
|
""
|
||||||
|
),
|
||||||
|
"\n",
|
||||||
|
ifelse(method == "mic" & capped_mic_handling %in% c("conservative", "standard") & as.character(input_original) %like% "^>=[0-9]" & as.double(input_clean) <= breakpoints_current$breakpoint_R,
|
||||||
|
paste0("MIC values are considered 'NI' (non-interpretable) if the true MIC could be at either side of the breakpoint and capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||||
""
|
""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if (isTRUE(substitute_missing_r_breakpoint) && !is.na(breakpoints_current$breakpoint_S) && is.na(breakpoints_current$breakpoint_R)) {
|
if (isTRUE(substitute_missing_r_breakpoint) && !is.na(breakpoints_current$breakpoint_S) && is.na(breakpoints_current$breakpoint_R)) {
|
||||||
# breakpoints_current only has 1 row at this moment
|
# breakpoints_current only has 1 row at this moment
|
||||||
breakpoints_current$breakpoint_R <- breakpoints_current$breakpoint_S
|
breakpoints_current$breakpoint_R <- breakpoints_current$breakpoint_S
|
||||||
@@ -1774,27 +1799,62 @@ as_sir_method <- function(method_short,
|
|||||||
## actual interpretation ----
|
## actual interpretation ----
|
||||||
if (method == "mic") {
|
if (method == "mic") {
|
||||||
new_sir <- case_when_AMR(
|
new_sir <- case_when_AMR(
|
||||||
is.na(values) ~ NA_sir_,
|
is.na(input_clean) ~ NA_sir_,
|
||||||
capped_mic_handling %in% c("conservative", "inverse") & as.character(values_bak) %like% "^[<][0-9]" ~ as.sir("S"),
|
|
||||||
capped_mic_handling %in% c("conservative", "inverse") & as.character(values_bak) %like% "^[>][0-9]" ~ as.sir("R"),
|
# "lenient" for any cap: force S/R
|
||||||
capped_mic_handling %in% c("conservative", "standard") & as.character(values_bak) %like% "^[><]=[0-9]" & as.double(values) > breakpoints_current$breakpoint_S & as.double(values) < breakpoints_current$breakpoint_R ~ as.sir("NI"),
|
capped_mic_handling == "lenient" &
|
||||||
capped_mic_handling %in% c("conservative", "standard") & as.character(values_bak) %like% "^<=[0-9]" & as.double(values) == breakpoints_current$breakpoint_R ~ as.sir("NI"),
|
as.character(input_original) %like% "^[<]=?[0-9]"
|
||||||
capped_mic_handling %in% c("conservative", "standard") & as.character(values_bak) %like% "^>=[0-9]" & as.double(values) == breakpoints_current$breakpoint_S ~ as.sir("NI"),
|
~ as.sir("S"),
|
||||||
values <= breakpoints_current$breakpoint_S ~ as.sir("S"),
|
capped_mic_handling == "lenient" &
|
||||||
guideline_current %like% "EUCAST" & values > breakpoints_current$breakpoint_R ~ as.sir("R"),
|
as.character(input_original) %like% "^[>]=?[0-9]"
|
||||||
guideline_current %like% "CLSI" & values >= breakpoints_current$breakpoint_R ~ as.sir("R"),
|
~ as.sir("R"),
|
||||||
|
|
||||||
|
# "standard" for < and >: force S/R
|
||||||
|
capped_mic_handling == "standard" &
|
||||||
|
as.character(input_original) %like% "^[<][0-9]"
|
||||||
|
~ as.sir("S"),
|
||||||
|
capped_mic_handling == "standard" &
|
||||||
|
as.character(input_original) %like% "^[>][0-9]"
|
||||||
|
~ as.sir("R"),
|
||||||
|
|
||||||
|
# "conservative" for < and >: NI if the true MIC could be on either side of a breakpoint
|
||||||
|
capped_mic_handling == "conservative" &
|
||||||
|
as.character(input_original) %like% "^[<][0-9]" &
|
||||||
|
as.double(input_clean) > breakpoints_current$breakpoint_S
|
||||||
|
~ as.sir("NI"),
|
||||||
|
capped_mic_handling == "conservative" &
|
||||||
|
as.character(input_original) %like% "^[>][0-9]" &
|
||||||
|
as.double(input_clean) < breakpoints_current$breakpoint_R
|
||||||
|
~ as.sir("NI"),
|
||||||
|
|
||||||
|
# both "conservative" and standard": only NI for <= and >= when the true MIC could be at either side of a breakpoint
|
||||||
|
capped_mic_handling %in% c("conservative", "standard") &
|
||||||
|
as.character(input_original) %like% "^<=[0-9]" &
|
||||||
|
as.double(input_clean) > breakpoints_current$breakpoint_S
|
||||||
|
~ as.sir("NI"),
|
||||||
|
capped_mic_handling %in% c("conservative", "standard") &
|
||||||
|
as.character(input_original) %like% "^>=[0-9]" &
|
||||||
|
as.double(input_clean) <= breakpoints_current$breakpoint_R
|
||||||
|
~ as.sir("NI"),
|
||||||
|
|
||||||
|
# otherwise: the normal (uncapped or ignored) interpretation
|
||||||
|
input_clean <= breakpoints_current$breakpoint_S ~ as.sir("S"),
|
||||||
|
guideline_current %like% "EUCAST" & input_clean > breakpoints_current$breakpoint_R ~ as.sir("R"),
|
||||||
|
guideline_current %like% "CLSI" & input_clean >= breakpoints_current$breakpoint_R ~ as.sir("R"),
|
||||||
|
|
||||||
# return "I" or "SDD" when breakpoints are in the middle
|
# return "I" or "SDD" when breakpoints are in the middle
|
||||||
!is.na(breakpoints_current$breakpoint_S) & !is.na(breakpoints_current$breakpoint_R) & breakpoints_current$is_SDD == TRUE ~ as.sir("SDD"),
|
!is.na(breakpoints_current$breakpoint_S) & !is.na(breakpoints_current$breakpoint_R) & breakpoints_current$is_SDD == TRUE ~ as.sir("SDD"),
|
||||||
!is.na(breakpoints_current$breakpoint_S) & !is.na(breakpoints_current$breakpoint_R) & breakpoints_current$is_SDD == FALSE ~ as.sir("I"),
|
!is.na(breakpoints_current$breakpoint_S) & !is.na(breakpoints_current$breakpoint_R) & breakpoints_current$is_SDD == FALSE ~ as.sir("I"),
|
||||||
|
|
||||||
# and NA otherwise
|
# and NA otherwise
|
||||||
TRUE ~ NA_sir_
|
TRUE ~ NA_sir_
|
||||||
)
|
)
|
||||||
} else if (method == "disk") {
|
} else if (method == "disk") {
|
||||||
new_sir <- case_when_AMR(
|
new_sir <- case_when_AMR(
|
||||||
is.na(values) ~ NA_sir_,
|
is.na(input_clean) ~ NA_sir_,
|
||||||
as.double(values) >= as.double(breakpoints_current$breakpoint_S) ~ as.sir("S"),
|
as.double(input_clean) >= as.double(breakpoints_current$breakpoint_S) ~ as.sir("S"),
|
||||||
guideline_current %like% "EUCAST" & as.double(values) < as.double(breakpoints_current$breakpoint_R) ~ as.sir("R"),
|
guideline_current %like% "EUCAST" & as.double(input_clean) < as.double(breakpoints_current$breakpoint_R) ~ as.sir("R"),
|
||||||
guideline_current %like% "CLSI" & as.double(values) <= as.double(breakpoints_current$breakpoint_R) ~ as.sir("R"),
|
guideline_current %like% "CLSI" & as.double(input_clean) <= as.double(breakpoints_current$breakpoint_R) ~ as.sir("R"),
|
||||||
# return "I" or "SDD" when breakpoints are in the middle
|
# return "I" or "SDD" when breakpoints are in the middle
|
||||||
!is.na(breakpoints_current$breakpoint_S) & !is.na(breakpoints_current$breakpoint_R) & breakpoints_current$is_SDD == TRUE ~ as.sir("SDD"),
|
!is.na(breakpoints_current$breakpoint_S) & !is.na(breakpoints_current$breakpoint_R) & breakpoints_current$is_SDD == TRUE ~ as.sir("SDD"),
|
||||||
!is.na(breakpoints_current$breakpoint_S) & !is.na(breakpoints_current$breakpoint_R) & breakpoints_current$is_SDD == FALSE ~ as.sir("I"),
|
!is.na(breakpoints_current$breakpoint_S) & !is.na(breakpoints_current$breakpoint_R) & breakpoints_current$is_SDD == FALSE ~ as.sir("I"),
|
||||||
@@ -1814,11 +1874,11 @@ as_sir_method <- function(method_short,
|
|||||||
ab_given = vectorise_log_entry(ab.bak[match(ab_current, df$ab)][1], length(rows)),
|
ab_given = vectorise_log_entry(ab.bak[match(ab_current, df$ab)][1], length(rows)),
|
||||||
mo_given = vectorise_log_entry(mo.bak[match(mo_current, df$mo)][1], length(rows)),
|
mo_given = vectorise_log_entry(mo.bak[match(mo_current, df$mo)][1], length(rows)),
|
||||||
host_given = vectorise_log_entry(host.bak[match(host_current, df$host)][1], length(rows)),
|
host_given = vectorise_log_entry(host.bak[match(host_current, df$host)][1], length(rows)),
|
||||||
input_given = vectorise_log_entry(as.character(values_bak), length(rows)),
|
input_given = vectorise_log_entry(as.character(input_original), length(rows)),
|
||||||
ab = vectorise_log_entry(breakpoints_current[, "ab", drop = TRUE], length(rows)),
|
ab = vectorise_log_entry(breakpoints_current[, "ab", drop = TRUE], length(rows)),
|
||||||
mo = vectorise_log_entry(breakpoints_current[, "mo", drop = TRUE], length(rows)),
|
mo = vectorise_log_entry(breakpoints_current[, "mo", drop = TRUE], length(rows)),
|
||||||
host = vectorise_log_entry(breakpoints_current[, "host", drop = TRUE], length(rows)),
|
host = vectorise_log_entry(breakpoints_current[, "host", drop = TRUE], length(rows)),
|
||||||
input = vectorise_log_entry(as.character(values), length(rows)),
|
input = vectorise_log_entry(as.character(input_clean), length(rows)),
|
||||||
outcome = vectorise_log_entry(as.sir(new_sir), length(rows)),
|
outcome = vectorise_log_entry(as.sir(new_sir), length(rows)),
|
||||||
notes = font_stripstyle(notes_current), # vectorise_log_entry(paste0(font_stripstyle(notes_current), collapse = "\n"), length(rows)),
|
notes = font_stripstyle(notes_current), # vectorise_log_entry(paste0(font_stripstyle(notes_current), collapse = "\n"), length(rows)),
|
||||||
guideline = vectorise_log_entry(guideline_current, length(rows)),
|
guideline = vectorise_log_entry(guideline_current, length(rows)),
|
||||||
|
|||||||
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
@@ -1,20 +1,21 @@
|
|||||||
#' AMR Extensions for Tidymodels
|
#' AMR Extensions for Tidymodels
|
||||||
#'
|
#'
|
||||||
#' This family of functions allows using AMR-specific data types such as `<mic>` and `<sir>` inside `tidymodels` pipelines.
|
#' This family of functions allows using AMR-specific data types such as `<sir>` and `<mic>` inside `tidymodels` pipelines.
|
||||||
#' @inheritParams recipes::step_center
|
#' @inheritParams recipes::step_center
|
||||||
#' @details
|
#' @details
|
||||||
#' You can read more in our online [AMR with tidymodels introduction](https://amr-for-r.org/articles/AMR_with_tidymodels.html).
|
#' You can read more in our online [AMR with tidymodels introduction](https://amr-for-r.org/articles/AMR_with_tidymodels.html).
|
||||||
#'
|
#'
|
||||||
#' Tidyselect helpers include:
|
#' Tidyselect helpers include:
|
||||||
#' - [all_mic()] and [all_mic_predictors()] to select `<mic>` columns
|
#' - [all_sir()] and [all_sir_predictors()] to select [`<sir>`][as.sir()] columns
|
||||||
#' - [all_sir()] and [all_sir_predictors()] to select `<sir>` columns
|
#' - [all_mic()] and [all_mic_predictors()] to select [`<mic>`][as.mic()] columns
|
||||||
|
#' - [all_disk()] and [all_disk_predictors()] to select [`<disk>`][as.disk()] columns
|
||||||
#'
|
#'
|
||||||
#' Pre-processing pipeline steps include:
|
#' Pre-processing pipeline steps include:
|
||||||
#' - [step_mic_log2()] to convert MIC columns to numeric (via `as.numeric()`) and apply a log2 transform, to be used with [all_mic_predictors()]
|
|
||||||
#' - [step_sir_numeric()] to convert SIR columns to numeric (via `as.numeric()`), to be used with [all_sir_predictors()]: `"S"` = 1, `"I"`/`"SDD"` = 2, `"R"` = 3. All other values are rendered `NA`. Keep this in mind for further processing, especially if the model does not allow for `NA` values.
|
#' - [step_sir_numeric()] to convert SIR columns to numeric (via `as.numeric()`), to be used with [all_sir_predictors()]: `"S"` = 1, `"I"`/`"SDD"` = 2, `"R"` = 3. All other values are rendered `NA`. Keep this in mind for further processing, especially if the model does not allow for `NA` values.
|
||||||
|
#' - [step_mic_log2()] to convert MIC columns to numeric (via `as.numeric()`) and apply a log2 transform, to be used with [all_mic_predictors()]
|
||||||
#'
|
#'
|
||||||
#' These steps integrate with `recipes::recipe()` and work like standard preprocessing steps. They are useful for preparing data for modelling, especially with classification models.
|
#' These steps integrate with `recipes::recipe()` and work like standard preprocessing steps. They are useful for preparing data for modelling, especially with classification models.
|
||||||
#' @seealso [recipes::recipe()], [as.mic()], [as.sir()]
|
#' @seealso [recipes::recipe()], [as.sir()], [as.mic()], [as.disk()]
|
||||||
#' @name amr-tidymodels
|
#' @name amr-tidymodels
|
||||||
#' @keywords internal
|
#' @keywords internal
|
||||||
#' @export
|
#' @export
|
||||||
@@ -66,35 +67,55 @@
|
|||||||
#' bind_cols(out_testing)
|
#' bind_cols(out_testing)
|
||||||
#'
|
#'
|
||||||
#' # Evaluate predictions using standard classification metrics
|
#' # Evaluate predictions using standard classification metrics
|
||||||
#' our_metrics <- metric_set(accuracy, kap, ppv, npv)
|
#' our_metrics <- metric_set(accuracy,
|
||||||
|
#' recall,
|
||||||
|
#' precision,
|
||||||
|
#' sensitivity,
|
||||||
|
#' specificity,
|
||||||
|
#' ppv,
|
||||||
|
#' npv)
|
||||||
#' metrics <- our_metrics(predictions, truth = esbl, estimate = .pred_class)
|
#' metrics <- our_metrics(predictions, truth = esbl, estimate = .pred_class)
|
||||||
#'
|
#'
|
||||||
#' # Show performance
|
#' # Show performance
|
||||||
#' metrics
|
#' metrics
|
||||||
#' }
|
#' }
|
||||||
all_mic <- function() {
|
|
||||||
x <- tidymodels_amr_select(levels(NA_mic_))
|
|
||||||
names(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
#' @rdname amr-tidymodels
|
|
||||||
#' @export
|
|
||||||
all_mic_predictors <- function() {
|
|
||||||
x <- tidymodels_amr_select(levels(NA_mic_))
|
|
||||||
intersect(x, recipes::has_role("predictor"))
|
|
||||||
}
|
|
||||||
|
|
||||||
#' @rdname amr-tidymodels
|
|
||||||
#' @export
|
|
||||||
all_sir <- function() {
|
all_sir <- function() {
|
||||||
x <- tidymodels_amr_select(levels(NA_sir_))
|
x <- tidymodels_amr_select(class = "sir")
|
||||||
names(x)
|
names(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname amr-tidymodels
|
#' @rdname amr-tidymodels
|
||||||
#' @export
|
#' @export
|
||||||
all_sir_predictors <- function() {
|
all_sir_predictors <- function() {
|
||||||
x <- tidymodels_amr_select(levels(NA_sir_))
|
x <- tidymodels_amr_select(class = "sir")
|
||||||
|
intersect(x, recipes::has_role("predictor"))
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname amr-tidymodels
|
||||||
|
#' @export
|
||||||
|
all_mic <- function() {
|
||||||
|
x <- tidymodels_amr_select(class = "mic")
|
||||||
|
names(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname amr-tidymodels
|
||||||
|
#' @export
|
||||||
|
all_mic_predictors <- function() {
|
||||||
|
x <- tidymodels_amr_select(class = "mic")
|
||||||
|
intersect(x, recipes::has_role("predictor"))
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname amr-tidymodels
|
||||||
|
#' @export
|
||||||
|
all_disk <- function() {
|
||||||
|
x <- tidymodels_amr_select(class = "disk")
|
||||||
|
names(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname amr-tidymodels
|
||||||
|
#' @export
|
||||||
|
all_disk_predictors <- function() {
|
||||||
|
x <- tidymodels_amr_select(class = "disk")
|
||||||
intersect(x, recipes::has_role("predictor"))
|
intersect(x, recipes::has_role("predictor"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +181,6 @@ bake.step_mic_log2 <- function(object, new_data, ...) {
|
|||||||
print.step_mic_log2 <- function(x, width = max(20, options()$width - 35), ...) {
|
print.step_mic_log2 <- function(x, width = max(20, options()$width - 35), ...) {
|
||||||
title <- "Log2 transformation of MIC columns"
|
title <- "Log2 transformation of MIC columns"
|
||||||
recipes::print_step(x$columns, x$terms, x$trained, title, width)
|
recipes::print_step(x$columns, x$terms, x$trained, title, width)
|
||||||
invisible(x)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(recipes::tidy, step_mic_log2)
|
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(recipes::tidy, step_mic_log2)
|
||||||
@@ -236,7 +256,6 @@ bake.step_sir_numeric <- function(object, new_data, ...) {
|
|||||||
print.step_sir_numeric <- function(x, width = max(20, options()$width - 35), ...) {
|
print.step_sir_numeric <- function(x, width = max(20, options()$width - 35), ...) {
|
||||||
title <- "Numeric transformation of SIR columns"
|
title <- "Numeric transformation of SIR columns"
|
||||||
recipes::print_step(x$columns, x$terms, x$trained, title, width)
|
recipes::print_step(x$columns, x$terms, x$trained, title, width)
|
||||||
invisible(x)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(recipes::tidy, step_sir_numeric)
|
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(recipes::tidy, step_sir_numeric)
|
||||||
@@ -250,13 +269,13 @@ tidy.step_sir_numeric <- function(x, ...) {
|
|||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|
||||||
tidymodels_amr_select <- function(check_vector) {
|
tidymodels_amr_select <- function(class) {
|
||||||
df <- get_current_data()
|
df <- get_current_data()
|
||||||
ind <- which(
|
ind <- which(
|
||||||
vapply(
|
vapply(
|
||||||
FUN.VALUE = logical(1),
|
FUN.VALUE = logical(1),
|
||||||
df,
|
df,
|
||||||
function(x) all(x %in% c(check_vector, NA), na.rm = TRUE) & any(x %in% check_vector),
|
function(x) inherits(x, class),
|
||||||
USE.NAMES = TRUE
|
USE.NAMES = TRUE
|
||||||
),
|
),
|
||||||
useNames = TRUE
|
useNames = TRUE
|
||||||
@@ -234,7 +234,7 @@ reference:
|
|||||||
- "`antimicrobials`"
|
- "`antimicrobials`"
|
||||||
- "`clinical_breakpoints`"
|
- "`clinical_breakpoints`"
|
||||||
- "`example_isolates`"
|
- "`example_isolates`"
|
||||||
# TODO - "`esbl_isolates`"
|
- "`esbl_isolates`"
|
||||||
- "`microorganisms.codes`"
|
- "`microorganisms.codes`"
|
||||||
- "`microorganisms.groups`"
|
- "`microorganisms.groups`"
|
||||||
- "`intrinsic_resistant`"
|
- "`intrinsic_resistant`"
|
||||||
|
|||||||
@@ -912,6 +912,24 @@ antimicrobials <- antimicrobials %>%
|
|||||||
oral_ddd = NA_real_
|
oral_ddd = NA_real_
|
||||||
))
|
))
|
||||||
|
|
||||||
|
# add Taniborbactam and Cefepime/taniborbactam
|
||||||
|
antimicrobials <- antimicrobials |>
|
||||||
|
mutate(ab = as.character(ab)) |>
|
||||||
|
bind_rows(
|
||||||
|
antimicrobials |>
|
||||||
|
filter(ab == "FPE") |>
|
||||||
|
mutate(ab = as.character(ab)) |>
|
||||||
|
mutate(ab = "FTA",
|
||||||
|
name = "Cefepime/taniborbactam",
|
||||||
|
cid = NA_real_),
|
||||||
|
antimicrobials |>
|
||||||
|
filter(ab == "TBP") |>
|
||||||
|
mutate(ab = as.character(ab)) |>
|
||||||
|
mutate(ab = "TAN",
|
||||||
|
name = "Taniborbactam",
|
||||||
|
cid = 76902493,
|
||||||
|
abbreviations = list("VNRX-5133"))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# update ATC codes from WHOCC website -------------------------------------
|
# update ATC codes from WHOCC website -------------------------------------
|
||||||
|
|||||||
@@ -35,24 +35,26 @@ library(readr)
|
|||||||
library(tidyr)
|
library(tidyr)
|
||||||
devtools::load_all()
|
devtools::load_all()
|
||||||
|
|
||||||
# Install the WHONET software on Windows (http://www.whonet.org/software.html),
|
|
||||||
# and copy the folder C:\WHONET\Resources to the data-raw/WHONET/ folder
|
|
||||||
# (for ASIARS-Net update, also copy C:\WHONET\Codes to the data-raw/WHONET/ folder)
|
|
||||||
|
|
||||||
# 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!
|
||||||
|
|
||||||
# READ DATA ----
|
# READ DATA ----
|
||||||
|
|
||||||
whonet_organisms <- read_tsv("data-raw/WHONET/Resources/Organisms.txt", na = c("", "NA", "-"), show_col_types = FALSE) |>
|
# files are retrieved from https://github.com/AClark-WHONET/AMRIE
|
||||||
|
|
||||||
|
github_repo <- "https://raw.github.com/AClark-WHONET/AMRIE/main/Interpretation%20Engine/Resources"
|
||||||
|
file_organisms <- file.path(github_repo, "Organisms.txt")
|
||||||
|
file_breakpoints <- file.path(github_repo, "Breakpoints.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) |>
|
||||||
# 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("data-raw/WHONET/Resources/Breakpoints.txt", na = c("", "NA", "-"),
|
whonet_breakpoints <- read_tsv(file_breakpoints, na = c("", "NA", "-"), show_col_types = FALSE, guess_max = Inf) |>
|
||||||
show_col_types = FALSE, guess_max = Inf) |>
|
|
||||||
filter(GUIDELINES %in% c("CLSI", "EUCAST"))
|
filter(GUIDELINES %in% c("CLSI", "EUCAST"))
|
||||||
|
|
||||||
whonet_antibiotics <- read_tsv("data-raw/WHONET/Resources/Antibiotics.txt", na = c("", "NA", "-"), show_col_types = FALSE) |>
|
whonet_antibiotics <- 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)
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
# how to conduct AMR data analysis: https://amr-for-r.org #
|
# how to conduct AMR data analysis: https://amr-for-r.org #
|
||||||
# ==================================================================== #
|
# ==================================================================== #
|
||||||
|
|
||||||
# This data set is being used in the clinical_breakpoints data set, and thus by as.sir().
|
# This data set is being referenced from in the clinical_breakpoints data set, and also by as.sir().
|
||||||
# It prevents the breakpoints table from being extremely long for species that are part of a species group.
|
# It prevents the breakpoints table from being extremely long for species that are part of a species group.
|
||||||
# Also used by eucast_rules() to expand group names.
|
# Also used by eucast_rules() to expand group names.
|
||||||
|
|
||||||
@@ -36,10 +36,6 @@ library(readr)
|
|||||||
library(tidyr)
|
library(tidyr)
|
||||||
devtools::load_all()
|
devtools::load_all()
|
||||||
|
|
||||||
# Install the WHONET software on Windows (http://www.whonet.org/software.html),
|
|
||||||
# and copy the folder C:\WHONET\Resources to the data-raw/WHONET/ folder
|
|
||||||
|
|
||||||
|
|
||||||
# BACTERIAL COMPLEXES
|
# BACTERIAL COMPLEXES
|
||||||
# find all bacterial complex in the NCBI Taxonomy Browser here:
|
# find all bacterial complex in the NCBI Taxonomy Browser here:
|
||||||
# https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Undef&id=2&lvl=6&lin=f&keep=1&srchmode=1&unlock
|
# https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Undef&id=2&lvl=6&lin=f&keep=1&srchmode=1&unlock
|
||||||
@@ -48,9 +44,14 @@ devtools::load_all()
|
|||||||
|
|
||||||
# READ DATA ----
|
# READ DATA ----
|
||||||
|
|
||||||
whonet_organisms <- read_tsv("data-raw/WHONET/Resources/Organisms.txt", na = c("", "NA", "-"), show_col_types = FALSE) %>%
|
# files are retrieved from https://github.com/AClark-WHONET/AMRIE
|
||||||
|
|
||||||
|
github_repo <- "https://raw.github.com/AClark-WHONET/AMRIE/main/Interpretation%20Engine/Resources"
|
||||||
|
file_organisms <- file.path(github_repo, "Organisms.txt")
|
||||||
|
|
||||||
|
whonet_organisms <- 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_organisms <- whonet_organisms %>%
|
whonet_organisms <- whonet_organisms %>%
|
||||||
@@ -87,7 +88,7 @@ microorganisms.groups <- whonet_organisms %>%
|
|||||||
mo = ifelse(is.na(mo),
|
mo = ifelse(is.na(mo),
|
||||||
as.character(as.mo(ORGANISM, keep_synonyms = TRUE, minimum_matching_score = 0)),
|
as.character(as.mo(ORGANISM, keep_synonyms = TRUE, minimum_matching_score = 0)),
|
||||||
mo)) %>%
|
mo)) %>%
|
||||||
# add our own CoNS and CoPS, WHONET does not strictly follow Becker et al (2014, 2019, 2020)
|
# add our own CoNS and CoPS, WHONET does not strictly follow Becker et al. (2014, 2019, 2020)
|
||||||
filter(mo_group != as.mo("CoNS")) %>%
|
filter(mo_group != as.mo("CoNS")) %>%
|
||||||
bind_rows(tibble(mo_group = as.mo("CoNS"), mo = MO_CONS)) %>%
|
bind_rows(tibble(mo_group = as.mo("CoNS"), mo = MO_CONS)) %>%
|
||||||
filter(mo_group != as.mo("CoPS")) %>%
|
filter(mo_group != as.mo("CoPS")) %>%
|
||||||
@@ -153,7 +154,7 @@ microorganisms.groups <- whonet_organisms %>%
|
|||||||
filter(mo_group != "B_YERSN_PSDT-C") %>%
|
filter(mo_group != "B_YERSN_PSDT-C") %>%
|
||||||
bind_rows(tibble(mo_group = as.mo("B_YERSN_PSDT-C"),
|
bind_rows(tibble(mo_group = as.mo("B_YERSN_PSDT-C"),
|
||||||
mo = paste("Yersinia", c("pseudotuberculosis", "pestis", "similis", "wautersii")) %>% as.mo(keep_synonyms = TRUE))) %>%
|
mo = paste("Yersinia", c("pseudotuberculosis", "pestis", "similis", "wautersii")) %>% as.mo(keep_synonyms = TRUE))) %>%
|
||||||
# RGM are Rapidly-grwoing Mycobacteria, see https://pubmed.ncbi.nlm.nih.gov/28084211/
|
# RGM are Rapidly-growing Mycobacteria, see https://pubmed.ncbi.nlm.nih.gov/28084211/
|
||||||
filter(mo_group != "B_MYCBC_RGM") %>%
|
filter(mo_group != "B_MYCBC_RGM") %>%
|
||||||
bind_rows(tibble(mo_group = as.mo("B_MYCBC_RGM"),
|
bind_rows(tibble(mo_group = as.mo("B_MYCBC_RGM"),
|
||||||
mo = paste("Mycobacterium", c( "abscessus abscessus", "abscessus bolletii", "abscessus massiliense", "agri", "aichiense", "algericum", "alvei", "anyangense", "arabiense", "aromaticivorans", "aubagnense", "aubagnense", "aurum", "austroafricanum", "bacteremicum", "boenickei", "bourgelatii", "brisbanense", "brumae", "canariasense", "celeriflavum", "chelonae", "chitae", "chlorophenolicum", "chubuense", "confluentis", "cosmeticum", "crocinum", "diernhoferi", "duvalii", "elephantis", "fallax", "flavescens", "fluoranthenivorans", "fortuitum", "franklinii", "frederiksbergense", "gadium", "gilvum", "goodii", "hassiacum", "hippocampi", "hodleri", "holsaticum", "houstonense", "immunogenum", "insubricum", "iranicum", "komossense", "litorale", "llatzerense", "madagascariense", "mageritense", "monacense", "moriokaense", "mucogenicum", "mucogenicum", "murale", "neoaurum", "neworleansense", "novocastrense", "obuense", "pallens", "parafortuitum", "peregrinum", "phlei", "phocaicum", "phocaicum", "porcinum", "poriferae", "psychrotolerans", "pyrenivorans", "rhodesiae", "rufum", "rutilum", "salmoniphilum", "sediminis", "senegalense", "septicum", "setense", "smegmatis", "sphagni", "thermoresistibile", "tokaiense", "vaccae", "vanbaalenii", "wolinskyi")) %>% as.mo(keep_synonyms = TRUE)))
|
mo = paste("Mycobacterium", c( "abscessus abscessus", "abscessus bolletii", "abscessus massiliense", "agri", "aichiense", "algericum", "alvei", "anyangense", "arabiense", "aromaticivorans", "aubagnense", "aubagnense", "aurum", "austroafricanum", "bacteremicum", "boenickei", "bourgelatii", "brisbanense", "brumae", "canariasense", "celeriflavum", "chelonae", "chitae", "chlorophenolicum", "chubuense", "confluentis", "cosmeticum", "crocinum", "diernhoferi", "duvalii", "elephantis", "fallax", "flavescens", "fluoranthenivorans", "fortuitum", "franklinii", "frederiksbergense", "gadium", "gilvum", "goodii", "hassiacum", "hippocampi", "hodleri", "holsaticum", "houstonense", "immunogenum", "insubricum", "iranicum", "komossense", "litorale", "llatzerense", "madagascariense", "mageritense", "monacense", "moriokaense", "mucogenicum", "mucogenicum", "murale", "neoaurum", "neworleansense", "novocastrense", "obuense", "pallens", "parafortuitum", "peregrinum", "phlei", "phocaicum", "phocaicum", "porcinum", "poriferae", "psychrotolerans", "pyrenivorans", "rhodesiae", "rufum", "rutilum", "salmoniphilum", "sediminis", "senegalense", "septicum", "setense", "smegmatis", "sphagni", "thermoresistibile", "tokaiense", "vaccae", "vanbaalenii", "wolinskyi")) %>% as.mo(keep_synonyms = TRUE)))
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
d12f1c78feaecbb4d1631f9c735ad49b
|
a6b3279028d26ee414c47e7a074b420c
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -74,6 +74,7 @@
|
|||||||
"CPC" 9567559 "Cefepime/clavulanic acid" "Cephalosporins (4th gen.)" "J01DE51,QJ01DE51" "cefcla,cicl,xpml" "NA" "NA"
|
"CPC" 9567559 "Cefepime/clavulanic acid" "Cephalosporins (4th gen.)" "J01DE51,QJ01DE51" "cefcla,cicl,xpml" "NA" "NA"
|
||||||
"FPE" 23653540 "Cefepime/enmetazobactam" "Cephalosporins (4th gen.)" "J01DE51,QJ01DE51" "NA" "NA" "NA"
|
"FPE" 23653540 "Cefepime/enmetazobactam" "Cephalosporins (4th gen.)" "J01DE51,QJ01DE51" "NA" "NA" "NA"
|
||||||
"FNC" "Cefepime/nacubactam" "Cephalosporins (4th gen.)" "J01DE51,QJ01DE51" "NA" "NA" "NA"
|
"FNC" "Cefepime/nacubactam" "Cephalosporins (4th gen.)" "J01DE51,QJ01DE51" "NA" "NA" "NA"
|
||||||
|
"FTA" "Cefepime/taniborbactam" "Cephalosporins (4th gen.)" "J01DE51,QJ01DE51" "NA" "NA" "NA"
|
||||||
"FPT" 9567558 "Cefepime/tazobactam" "Cephalosporins (4th gen.)" "J01DE51,QJ01DE51" "NA" "NA" "NA"
|
"FPT" 9567558 "Cefepime/tazobactam" "Cephalosporins (4th gen.)" "J01DE51,QJ01DE51" "NA" "NA" "NA"
|
||||||
"FPZ" "Cefepime/zidebactam" "Cephalosporins (4th gen.)" "J01DE51,QJ01DE51" "NA" "NA" "NA"
|
"FPZ" "Cefepime/zidebactam" "Cephalosporins (4th gen.)" "J01DE51,QJ01DE51" "NA" "NA" "NA"
|
||||||
"CAT" 5487888 "Cefetamet" "Cephalosporins (3rd gen.)" "J01DD10,QJ01DD10" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cefeta,cefmtm" "cefetametum,deacetoxycefotaxime,epocelin" 1 "g" "32377-4,35764-0,35765-7,55640-7"
|
"CAT" 5487888 "Cefetamet" "Cephalosporins (3rd gen.)" "J01DD10,QJ01DD10" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cefeta,cefmtm" "cefetametum,deacetoxycefotaxime,epocelin" 1 "g" "32377-4,35764-0,35765-7,55640-7"
|
||||||
@@ -442,6 +443,7 @@
|
|||||||
"SUR" 46700778 "Surotomycin" "Other antibacterials" "NA" "NA" "surotomicina,surotomycine" "NA"
|
"SUR" 46700778 "Surotomycin" "Other antibacterials" "NA" "NA" "surotomicina,surotomycine" "NA"
|
||||||
"TAL" 71447 "Talampicillin" "Beta-lactams/penicillins" "J01CA15,QJ01CA15" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "NA" "aseocillin,phthalidyl,talampicilina,talampicilline,talampicillinum,talpen,yamacillin" 2 "g" "18988-6,479-6,480-4,481-2,482-0"
|
"TAL" 71447 "Talampicillin" "Beta-lactams/penicillins" "J01CA15,QJ01CA15" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "NA" "aseocillin,phthalidyl,talampicilina,talampicilline,talampicillinum,talpen,yamacillin" 2 "g" "18988-6,479-6,480-4,481-2,482-0"
|
||||||
"TLP" 163307 "Talmetoprim" "Other antibacterials" "NA" "NA" "NA" "NA"
|
"TLP" 163307 "Talmetoprim" "Other antibacterials" "NA" "NA" "NA" "NA"
|
||||||
|
"TAN" 76902493 "Taniborbactam" "Carbapenems" "NA" "vnrx-5133" "NA" "NA"
|
||||||
"TAZ" 123630 "Tazobactam" "Beta-lactams/penicillins" "J01CG02,QJ01CG02" "Beta-lactam antibacterials, penicillins" "Beta-lactamase inhibitors" "tazo,tazoba" "exblifep,tazobactamsalt,tazobactamum,tazobactum" "41719-6,41720-4,41721-2,41740-2"
|
"TAZ" 123630 "Tazobactam" "Beta-lactams/penicillins" "J01CG02,QJ01CG02" "Beta-lactam antibacterials, penicillins" "Beta-lactamase inhibitors" "tazo,tazoba" "exblifep,tazobactamsalt,tazobactamum,tazobactum" "41719-6,41720-4,41721-2,41740-2"
|
||||||
"TBP" 9800194 "Tebipenem" "Carbapenems" "NA" "NA" "NA" "NA"
|
"TBP" 9800194 "Tebipenem" "Carbapenems" "NA" "NA" "NA" "NA"
|
||||||
"TZD" 11234049 "Tedizolid" "Oxazolidinones" "J01XX11,QJ01XX11" "Other antibacterials" "Other antibacterials" "tedi" "torezolid" 0.2 "g" 0.2 "g" "73586-0,73608-2,73631-4"
|
"TZD" 11234049 "Tedizolid" "Oxazolidinones" "J01XX11,QJ01XX11" "Other antibacterials" "Other antibacterials" "tedi" "torezolid" 0.2 "g" 0.2 "g" "73586-0,73608-2,73631-4"
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -11,7 +11,7 @@ This is an overview of all the package-specific \code{\link[=options]{options()}
|
|||||||
\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 "ECOFF", "animal", or "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{"standard"}, \code{"strict"}, \code{"relaxed"}, or \code{"inverse"} - the default is \code{"standard"}.
|
\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()}}.
|
||||||
|
|||||||
@@ -83,10 +83,10 @@ Other contributors:
|
|||||||
\item Judith M. Fonville [contributor]
|
\item Judith M. Fonville [contributor]
|
||||||
\item Kathryn Holt (\href{https://orcid.org/0000-0003-3949-2471}{ORCID}) [contributor]
|
\item Kathryn Holt (\href{https://orcid.org/0000-0003-3949-2471}{ORCID}) [contributor]
|
||||||
\item Larisse Bolton (\href{https://orcid.org/0000-0001-7879-2173}{ORCID}) [contributor]
|
\item Larisse Bolton (\href{https://orcid.org/0000-0001-7879-2173}{ORCID}) [contributor]
|
||||||
\item Matthew Saab [contributor]
|
\item Matthew Saab (\href{https://orcid.org/0009-0008-6626-7919}{ORCID}) [contributor]
|
||||||
\item Natacha Couto (\href{https://orcid.org/0000-0002-9152-5464}{ORCID}) [contributor]
|
\item Natacha Couto (\href{https://orcid.org/0000-0002-9152-5464}{ORCID}) [contributor]
|
||||||
\item Peter Dutey-Magni (\href{https://orcid.org/0000-0002-8942-9836}{ORCID}) [contributor]
|
\item Peter Dutey-Magni (\href{https://orcid.org/0000-0002-8942-9836}{ORCID}) [contributor]
|
||||||
\item Rogier P. Schade [contributor]
|
\item Rogier P. Schade (\href{https://orcid.org/0000-0002-9487-4467}{ORCID}) [contributor]
|
||||||
\item Sofia Ny (\href{https://orcid.org/0000-0002-2017-1363}{ORCID}) [contributor]
|
\item Sofia Ny (\href{https://orcid.org/0000-0002-2017-1363}{ORCID}) [contributor]
|
||||||
\item Alex W. Friedrich (\href{https://orcid.org/0000-0003-4881-038X}{ORCID}) [thesis advisor]
|
\item Alex W. Friedrich (\href{https://orcid.org/0000-0003-4881-038X}{ORCID}) [thesis advisor]
|
||||||
\item Bhanu N. M. Sinha (\href{https://orcid.org/0000-0003-1634-0010}{ORCID}) [thesis advisor]
|
\item Bhanu N. M. Sinha (\href{https://orcid.org/0000-0003-1634-0010}{ORCID}) [thesis advisor]
|
||||||
|
|||||||
138
man/amr-tidymodels.Rd
Normal file
138
man/amr-tidymodels.Rd
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/tidymodels.R
|
||||||
|
\name{amr-tidymodels}
|
||||||
|
\alias{amr-tidymodels}
|
||||||
|
\alias{all_sir}
|
||||||
|
\alias{all_sir_predictors}
|
||||||
|
\alias{all_mic}
|
||||||
|
\alias{all_mic_predictors}
|
||||||
|
\alias{all_disk}
|
||||||
|
\alias{all_disk_predictors}
|
||||||
|
\alias{step_mic_log2}
|
||||||
|
\alias{step_sir_numeric}
|
||||||
|
\title{AMR Extensions for Tidymodels}
|
||||||
|
\usage{
|
||||||
|
all_sir()
|
||||||
|
|
||||||
|
all_sir_predictors()
|
||||||
|
|
||||||
|
all_mic()
|
||||||
|
|
||||||
|
all_mic_predictors()
|
||||||
|
|
||||||
|
all_disk()
|
||||||
|
|
||||||
|
all_disk_predictors()
|
||||||
|
|
||||||
|
step_mic_log2(recipe, ..., role = NA, trained = FALSE, columns = NULL,
|
||||||
|
skip = FALSE, id = recipes::rand_id("mic_log2"))
|
||||||
|
|
||||||
|
step_sir_numeric(recipe, ..., role = NA, trained = FALSE, columns = NULL,
|
||||||
|
skip = FALSE, id = recipes::rand_id("sir_numeric"))
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{recipe}{A recipe object. The step will be added to the sequence of
|
||||||
|
operations for this recipe.}
|
||||||
|
|
||||||
|
\item{...}{One or more selector functions to choose variables for this step.
|
||||||
|
See \code{\link[recipes:selections]{selections()}} for more details.}
|
||||||
|
|
||||||
|
\item{role}{Not used by this step since no new variables are created.}
|
||||||
|
|
||||||
|
\item{trained}{A logical to indicate if the quantities for preprocessing have
|
||||||
|
been estimated.}
|
||||||
|
|
||||||
|
\item{skip}{A logical. Should the step be skipped when the recipe is baked by
|
||||||
|
\code{\link[recipes:bake]{bake()}}? While all operations are baked when \code{\link[recipes:prep]{prep()}} is run, some
|
||||||
|
operations may not be able to be conducted on new data (e.g. processing the
|
||||||
|
outcome variable(s)). Care should be taken when using \code{skip = TRUE} as it
|
||||||
|
may affect the computations for subsequent operations.}
|
||||||
|
|
||||||
|
\item{id}{A character string that is unique to this step to identify it.}
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
This family of functions allows using AMR-specific data types such as \verb{<sir>} and \verb{<mic>} inside \code{tidymodels} pipelines.
|
||||||
|
}
|
||||||
|
\details{
|
||||||
|
You can read more in our online \href{https://amr-for-r.org/articles/AMR_with_tidymodels.html}{AMR with tidymodels introduction}.
|
||||||
|
|
||||||
|
Tidyselect helpers include:
|
||||||
|
\itemize{
|
||||||
|
\item \code{\link[=all_sir]{all_sir()}} and \code{\link[=all_sir_predictors]{all_sir_predictors()}} to select \code{\link[=as.sir]{<sir>}} columns
|
||||||
|
\item \code{\link[=all_mic]{all_mic()}} and \code{\link[=all_mic_predictors]{all_mic_predictors()}} to select \code{\link[=as.mic]{<mic>}} columns
|
||||||
|
\item \code{\link[=all_disk]{all_disk()}} and \code{\link[=all_disk_predictors]{all_disk_predictors()}} to select \code{\link[=as.disk]{<disk>}} columns
|
||||||
|
}
|
||||||
|
|
||||||
|
Pre-processing pipeline steps include:
|
||||||
|
\itemize{
|
||||||
|
\item \code{\link[=step_sir_numeric]{step_sir_numeric()}} to convert SIR columns to numeric (via \code{as.numeric()}), to be used with \code{\link[=all_sir_predictors]{all_sir_predictors()}}: \code{"S"} = 1, \code{"I"}/\code{"SDD"} = 2, \code{"R"} = 3. All other values are rendered \code{NA}. Keep this in mind for further processing, especially if the model does not allow for \code{NA} values.
|
||||||
|
\item \code{\link[=step_mic_log2]{step_mic_log2()}} to convert MIC columns to numeric (via \code{as.numeric()}) and apply a log2 transform, to be used with \code{\link[=all_mic_predictors]{all_mic_predictors()}}
|
||||||
|
}
|
||||||
|
|
||||||
|
These steps integrate with \code{recipes::recipe()} and work like standard preprocessing steps. They are useful for preparing data for modelling, especially with classification models.
|
||||||
|
}
|
||||||
|
\examples{
|
||||||
|
if (require("tidymodels")) {
|
||||||
|
|
||||||
|
# The below approach formed the basis for this paper: DOI 10.3389/fmicb.2025.1582703
|
||||||
|
# Presence of ESBL genes was predicted based on raw MIC values.
|
||||||
|
|
||||||
|
|
||||||
|
# example data set in the AMR package
|
||||||
|
esbl_isolates
|
||||||
|
|
||||||
|
# Prepare a binary outcome and convert to ordered factor
|
||||||
|
data <- esbl_isolates \%>\%
|
||||||
|
mutate(esbl = factor(esbl, levels = c(FALSE, TRUE), ordered = TRUE))
|
||||||
|
|
||||||
|
# Split into training and testing sets
|
||||||
|
split <- initial_split(data)
|
||||||
|
training_data <- training(split)
|
||||||
|
testing_data <- testing(split)
|
||||||
|
|
||||||
|
# Create and prep a recipe with MIC log2 transformation
|
||||||
|
mic_recipe <- recipe(esbl ~ ., data = training_data) \%>\%
|
||||||
|
|
||||||
|
# Optionally remove non-predictive variables
|
||||||
|
remove_role(genus, old_role = "predictor") \%>\%
|
||||||
|
|
||||||
|
# Apply the log2 transformation to all MIC predictors
|
||||||
|
step_mic_log2(all_mic_predictors()) \%>\%
|
||||||
|
|
||||||
|
# And apply the preparation steps
|
||||||
|
prep()
|
||||||
|
|
||||||
|
# View prepped recipe
|
||||||
|
mic_recipe
|
||||||
|
|
||||||
|
# Apply the recipe to training and testing data
|
||||||
|
out_training <- bake(mic_recipe, new_data = NULL)
|
||||||
|
out_testing <- bake(mic_recipe, new_data = testing_data)
|
||||||
|
|
||||||
|
# Fit a logistic regression model
|
||||||
|
fitted <- logistic_reg(mode = "classification") \%>\%
|
||||||
|
set_engine("glm") \%>\%
|
||||||
|
fit(esbl ~ ., data = out_training)
|
||||||
|
|
||||||
|
# Generate predictions on the test set
|
||||||
|
predictions <- predict(fitted, out_testing) \%>\%
|
||||||
|
bind_cols(out_testing)
|
||||||
|
|
||||||
|
# Evaluate predictions using standard classification metrics
|
||||||
|
our_metrics <- metric_set(accuracy,
|
||||||
|
recall,
|
||||||
|
precision,
|
||||||
|
sensitivity,
|
||||||
|
specificity,
|
||||||
|
ppv,
|
||||||
|
npv)
|
||||||
|
metrics <- our_metrics(predictions, truth = esbl, estimate = .pred_class)
|
||||||
|
|
||||||
|
# Show performance
|
||||||
|
metrics
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\seealso{
|
||||||
|
\code{\link[recipes:recipe]{recipes::recipe()}}, \code{\link[=as.sir]{as.sir()}}, \code{\link[=as.mic]{as.mic()}}, \code{\link[=as.disk]{as.disk()}}
|
||||||
|
}
|
||||||
|
\keyword{internal}
|
||||||
@@ -209,7 +209,7 @@ wisca(your_data,
|
|||||||
antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"))
|
antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"))
|
||||||
}\if{html}{\out{</div>}}
|
}\if{html}{\out{</div>}}
|
||||||
|
|
||||||
WISCA uses a sophisticated Bayesian decision model to combine both local and pooled antimicrobial resistance data. This approach not only evaluates local patterns but can also draw on multi-centre datasets to improve regimen accuracy, even in low-incidence infections like paediatric bloodstream infections (BSIs).
|
WISCA uses a sophisticated Bayesian decision model to combine both local and pooled antimicrobial resistance data. This approach not only evaluates local patterns but can also draw on multi-centre data sets to improve regimen accuracy, even in low-incidence infections like paediatric bloodstream infections (BSIs).
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -182,14 +182,14 @@ The \code{\link[=not_intrinsic_resistant]{not_intrinsic_resistant()}} function c
|
|||||||
\item \code{\link[=aminopenicillins]{aminopenicillins()}} can select: \cr amoxicillin (AMX) and ampicillin (AMP)
|
\item \code{\link[=aminopenicillins]{aminopenicillins()}} can select: \cr amoxicillin (AMX) and ampicillin (AMP)
|
||||||
\item \code{\link[=antifungals]{antifungals()}} can select: \cr amorolfine (AMO), amphotericin B (AMB), amphotericin B-high (AMH), anidulafungin (ANI), butoconazole (BUT), caspofungin (CAS), ciclopirox (CIX), clotrimazole (CTR), econazole (ECO), fluconazole (FLU), flucytosine (FCT), fosfluconazole (FFL), griseofulvin (GRI), hachimycin (HCH), ibrexafungerp (IBX), isavuconazole (ISV), isoconazole (ISO), itraconazole (ITR), ketoconazole (KET), manogepix (MGX), micafungin (MIF), miconazole (MCZ), nystatin (NYS), oteseconazole (OTE), pimaricin (PMR), posaconazole (POS), rezafungin (RZF), ribociclib (RBC), sulconazole (SUC), terbinafine (TRB), terconazole (TRC), and voriconazole (VOR)
|
\item \code{\link[=antifungals]{antifungals()}} can select: \cr amorolfine (AMO), amphotericin B (AMB), amphotericin B-high (AMH), anidulafungin (ANI), butoconazole (BUT), caspofungin (CAS), ciclopirox (CIX), clotrimazole (CTR), econazole (ECO), fluconazole (FLU), flucytosine (FCT), fosfluconazole (FFL), griseofulvin (GRI), hachimycin (HCH), ibrexafungerp (IBX), isavuconazole (ISV), isoconazole (ISO), itraconazole (ITR), ketoconazole (KET), manogepix (MGX), micafungin (MIF), miconazole (MCZ), nystatin (NYS), oteseconazole (OTE), pimaricin (PMR), posaconazole (POS), rezafungin (RZF), ribociclib (RBC), sulconazole (SUC), terbinafine (TRB), terconazole (TRC), and voriconazole (VOR)
|
||||||
\item \code{\link[=antimycobacterials]{antimycobacterials()}} can select: \cr 4-aminosalicylic acid (AMA), calcium aminosalicylate (CLA), capreomycin (CAP), clofazimine (CLF), delamanid (DLM), enviomycin (ENV), ethambutol (ETH), ethambutol/isoniazid (ETI), ethionamide (ETI1), isoniazid (INH), isoniazid/sulfamethoxazole/trimethoprim/pyridoxine (IST), morinamide (MRN), p-aminosalicylic acid (PAS), pretomanid (PMD), protionamide (PTH), pyrazinamide (PZA), rifabutin (RIB), rifampicin (RIF), rifampicin/ethambutol/isoniazid (REI), rifampicin/isoniazid (RFI), rifampicin/pyrazinamide/ethambutol/isoniazid (RPEI), rifampicin/pyrazinamide/isoniazid (RPI), rifamycin (RFM), rifapentine (RFP), sodium aminosalicylate (SDA), streptomycin/isoniazid (STI), terizidone (TRZ), thioacetazone (TAT), thioacetazone/isoniazid (THI1), tiocarlide (TCR), and viomycin (VIO)
|
\item \code{\link[=antimycobacterials]{antimycobacterials()}} can select: \cr 4-aminosalicylic acid (AMA), calcium aminosalicylate (CLA), capreomycin (CAP), clofazimine (CLF), delamanid (DLM), enviomycin (ENV), ethambutol (ETH), ethambutol/isoniazid (ETI), ethionamide (ETI1), isoniazid (INH), isoniazid/sulfamethoxazole/trimethoprim/pyridoxine (IST), morinamide (MRN), p-aminosalicylic acid (PAS), pretomanid (PMD), protionamide (PTH), pyrazinamide (PZA), rifabutin (RIB), rifampicin (RIF), rifampicin/ethambutol/isoniazid (REI), rifampicin/isoniazid (RFI), rifampicin/pyrazinamide/ethambutol/isoniazid (RPEI), rifampicin/pyrazinamide/isoniazid (RPI), rifamycin (RFM), rifapentine (RFP), sodium aminosalicylate (SDA), streptomycin/isoniazid (STI), terizidone (TRZ), thioacetazone (TAT), thioacetazone/isoniazid (THI1), tiocarlide (TCR), and viomycin (VIO)
|
||||||
\item \code{\link[=betalactams]{betalactams()}} can select: \cr amoxicillin (AMX), amoxicillin/clavulanic acid (AMC), amoxicillin/sulbactam (AXS), ampicillin (AMP), ampicillin/sulbactam (SAM), apalcillin (APL), aspoxicillin (APX), azidocillin (AZD), azlocillin (AZL), aztreonam (ATM), aztreonam/avibactam (AZA), aztreonam/nacubactam (ANC), bacampicillin (BAM), benzathine benzylpenicillin (BNB), benzathine phenoxymethylpenicillin (BNP), benzylpenicillin (PEN), benzylpenicillin screening test (PEN-S), biapenem (BIA), carbenicillin (CRB), carindacillin (CRN), carumonam (CAR), cefacetrile (CAC), cefaclor (CEC), cefadroxil (CFR), cefalexin (LEX), cefaloridine (RID), cefalotin (CEP), cefamandole (MAN), cefapirin (HAP), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefepime (FEP), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefetamet (CAT), cefetamet pivoxil (CPI), cefetecol (CCL), cefetrizole (CZL), cefiderocol (FDC), cefixime (CFM), cefmenoxime (CMX), cefmetazole (CMZ), cefodizime (DIZ), cefonicid (CID), cefoperazone (CFP), cefoperazone/sulbactam (CSL), ceforanide (CND), cefoselis (CSE), cefotaxime (CTX), cefotaxime screening test (CTX-S), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotetan (CTT), cefotiam (CTF), cefotiam hexetil (CHE), cefovecin (FOV), cefoxitin (FOX), cefoxitin screening test (FOX-S), cefozopran (ZOP), cefpimizole (CFZ), cefpiramide (CPM), cefpirome (CPO), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefprozil (CPR), cefquinome (CEQ), cefroxadine (CRD), cefsulodin (CFS), cefsumide (CSU), ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftezole (CTL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), ceftolozane/tazobactam (CZT), ceftriaxone (CRO), ceftriaxone/beta-lactamase inhibitor (CEB), cefuroxime (CXM), cefuroxime axetil (CXA), cephradine (CED), ciclacillin (CIC), clometocillin (CLM), cloxacillin (CLO), dicloxacillin (DIC), doripenem (DOR), epicillin (EPC), ertapenem (ETP), flucloxacillin (FLC), hetacillin (HET), imipenem (IPM), imipenem/EDTA (IPE), imipenem/relebactam (IMR), latamoxef (LTM), lenampicillin (LEN), loracarbef (LOR), mecillinam (MEC), meropenem (MEM), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), metampicillin (MTM), meticillin (MET), mezlocillin (MEZ), mezlocillin/sulbactam (MSU), nafcillin (NAF), oxacillin (OXA), oxacillin screening test (OXA-S), panipenem (PAN), penamecillin (PNM), penicillin/novobiocin (PNO), penicillin/sulbactam (PSU), pheneticillin (PHE), phenoxymethylpenicillin (PHN), piperacillin (PIP), piperacillin/sulbactam (PIS), piperacillin/tazobactam (TZP), piridicillin (PRC), pivampicillin (PVM), pivmecillinam (PME), procaine benzylpenicillin (PRB), propicillin (PRP), razupenem (RZM), ritipenem (RIT), ritipenem acoxil (RIA), sarmoxicillin (SRX), sulbenicillin (SBC), sultamicillin (SLT6), talampicillin (TAL), tebipenem (TBP), temocillin (TEM), ticarcillin (TIC), ticarcillin/clavulanic acid (TCC), and tigemonam (TMN)
|
\item \code{\link[=betalactams]{betalactams()}} can select: \cr amoxicillin (AMX), amoxicillin/clavulanic acid (AMC), amoxicillin/sulbactam (AXS), ampicillin (AMP), ampicillin/sulbactam (SAM), apalcillin (APL), aspoxicillin (APX), azidocillin (AZD), azlocillin (AZL), aztreonam (ATM), aztreonam/avibactam (AZA), aztreonam/nacubactam (ANC), bacampicillin (BAM), benzathine benzylpenicillin (BNB), benzathine phenoxymethylpenicillin (BNP), benzylpenicillin (PEN), benzylpenicillin screening test (PEN-S), biapenem (BIA), carbenicillin (CRB), carindacillin (CRN), carumonam (CAR), cefacetrile (CAC), cefaclor (CEC), cefadroxil (CFR), cefalexin (LEX), cefaloridine (RID), cefalotin (CEP), cefamandole (MAN), cefapirin (HAP), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefepime (FEP), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/taniborbactam (FTA), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefetamet (CAT), cefetamet pivoxil (CPI), cefetecol (CCL), cefetrizole (CZL), cefiderocol (FDC), cefixime (CFM), cefmenoxime (CMX), cefmetazole (CMZ), cefodizime (DIZ), cefonicid (CID), cefoperazone (CFP), cefoperazone/sulbactam (CSL), ceforanide (CND), cefoselis (CSE), cefotaxime (CTX), cefotaxime screening test (CTX-S), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotetan (CTT), cefotiam (CTF), cefotiam hexetil (CHE), cefovecin (FOV), cefoxitin (FOX), cefoxitin screening test (FOX-S), cefozopran (ZOP), cefpimizole (CFZ), cefpiramide (CPM), cefpirome (CPO), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefprozil (CPR), cefquinome (CEQ), cefroxadine (CRD), cefsulodin (CFS), cefsumide (CSU), ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftezole (CTL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), ceftolozane/tazobactam (CZT), ceftriaxone (CRO), ceftriaxone/beta-lactamase inhibitor (CEB), cefuroxime (CXM), cefuroxime axetil (CXA), cephradine (CED), ciclacillin (CIC), clometocillin (CLM), cloxacillin (CLO), dicloxacillin (DIC), doripenem (DOR), epicillin (EPC), ertapenem (ETP), flucloxacillin (FLC), hetacillin (HET), imipenem (IPM), imipenem/EDTA (IPE), imipenem/relebactam (IMR), latamoxef (LTM), lenampicillin (LEN), loracarbef (LOR), mecillinam (MEC), meropenem (MEM), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), metampicillin (MTM), meticillin (MET), mezlocillin (MEZ), mezlocillin/sulbactam (MSU), nafcillin (NAF), oxacillin (OXA), oxacillin screening test (OXA-S), panipenem (PAN), penamecillin (PNM), penicillin/novobiocin (PNO), penicillin/sulbactam (PSU), pheneticillin (PHE), phenoxymethylpenicillin (PHN), piperacillin (PIP), piperacillin/sulbactam (PIS), piperacillin/tazobactam (TZP), piridicillin (PRC), pivampicillin (PVM), pivmecillinam (PME), procaine benzylpenicillin (PRB), propicillin (PRP), razupenem (RZM), ritipenem (RIT), ritipenem acoxil (RIA), sarmoxicillin (SRX), sulbenicillin (SBC), sultamicillin (SLT6), talampicillin (TAL), taniborbactam (TAN), tebipenem (TBP), temocillin (TEM), ticarcillin (TIC), ticarcillin/clavulanic acid (TCC), and tigemonam (TMN)
|
||||||
\item \code{\link[=betalactams_with_inhibitor]{betalactams_with_inhibitor()}} can select: \cr amoxicillin/clavulanic acid (AMC), amoxicillin/sulbactam (AXS), ampicillin/sulbactam (SAM), aztreonam/avibactam (AZA), aztreonam/nacubactam (ANC), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefoperazone/sulbactam (CSL), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefpodoxime/clavulanic acid (CDC), ceftaroline/avibactam (CPA), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), ceftolozane/tazobactam (CZT), ceftriaxone/beta-lactamase inhibitor (CEB), imipenem/relebactam (IMR), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), mezlocillin/sulbactam (MSU), penicillin/novobiocin (PNO), penicillin/sulbactam (PSU), piperacillin/sulbactam (PIS), piperacillin/tazobactam (TZP), and ticarcillin/clavulanic acid (TCC)
|
\item \code{\link[=betalactams_with_inhibitor]{betalactams_with_inhibitor()}} can select: \cr amoxicillin/clavulanic acid (AMC), amoxicillin/sulbactam (AXS), ampicillin/sulbactam (SAM), aztreonam/avibactam (AZA), aztreonam/nacubactam (ANC), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/taniborbactam (FTA), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefoperazone/sulbactam (CSL), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefpodoxime/clavulanic acid (CDC), ceftaroline/avibactam (CPA), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), ceftolozane/tazobactam (CZT), ceftriaxone/beta-lactamase inhibitor (CEB), imipenem/relebactam (IMR), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), mezlocillin/sulbactam (MSU), penicillin/novobiocin (PNO), penicillin/sulbactam (PSU), piperacillin/sulbactam (PIS), piperacillin/tazobactam (TZP), and ticarcillin/clavulanic acid (TCC)
|
||||||
\item \code{\link[=carbapenems]{carbapenems()}} can select: \cr biapenem (BIA), doripenem (DOR), ertapenem (ETP), imipenem (IPM), imipenem/EDTA (IPE), imipenem/relebactam (IMR), meropenem (MEM), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), panipenem (PAN), razupenem (RZM), ritipenem (RIT), ritipenem acoxil (RIA), and tebipenem (TBP)
|
\item \code{\link[=carbapenems]{carbapenems()}} can select: \cr biapenem (BIA), doripenem (DOR), ertapenem (ETP), imipenem (IPM), imipenem/EDTA (IPE), imipenem/relebactam (IMR), meropenem (MEM), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), panipenem (PAN), razupenem (RZM), ritipenem (RIT), ritipenem acoxil (RIA), taniborbactam (TAN), and tebipenem (TBP)
|
||||||
\item \code{\link[=cephalosporins]{cephalosporins()}} can select: \cr cefacetrile (CAC), cefaclor (CEC), cefadroxil (CFR), cefalexin (LEX), cefaloridine (RID), cefalotin (CEP), cefamandole (MAN), cefapirin (HAP), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefepime (FEP), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefetamet (CAT), cefetamet pivoxil (CPI), cefetecol (CCL), cefetrizole (CZL), cefiderocol (FDC), cefixime (CFM), cefmenoxime (CMX), cefmetazole (CMZ), cefodizime (DIZ), cefonicid (CID), cefoperazone (CFP), cefoperazone/sulbactam (CSL), ceforanide (CND), cefoselis (CSE), cefotaxime (CTX), cefotaxime screening test (CTX-S), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotetan (CTT), cefotiam (CTF), cefotiam hexetil (CHE), cefovecin (FOV), cefoxitin (FOX), cefoxitin screening test (FOX-S), cefozopran (ZOP), cefpimizole (CFZ), cefpiramide (CPM), cefpirome (CPO), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefprozil (CPR), cefquinome (CEQ), cefroxadine (CRD), cefsulodin (CFS), cefsumide (CSU), ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftezole (CTL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), ceftolozane/tazobactam (CZT), ceftriaxone (CRO), ceftriaxone/beta-lactamase inhibitor (CEB), cefuroxime (CXM), cefuroxime axetil (CXA), cephradine (CED), latamoxef (LTM), and loracarbef (LOR)
|
\item \code{\link[=cephalosporins]{cephalosporins()}} can select: \cr cefacetrile (CAC), cefaclor (CEC), cefadroxil (CFR), cefalexin (LEX), cefaloridine (RID), cefalotin (CEP), cefamandole (MAN), cefapirin (HAP), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefepime (FEP), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/taniborbactam (FTA), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefetamet (CAT), cefetamet pivoxil (CPI), cefetecol (CCL), cefetrizole (CZL), cefiderocol (FDC), cefixime (CFM), cefmenoxime (CMX), cefmetazole (CMZ), cefodizime (DIZ), cefonicid (CID), cefoperazone (CFP), cefoperazone/sulbactam (CSL), ceforanide (CND), cefoselis (CSE), cefotaxime (CTX), cefotaxime screening test (CTX-S), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotetan (CTT), cefotiam (CTF), cefotiam hexetil (CHE), cefovecin (FOV), cefoxitin (FOX), cefoxitin screening test (FOX-S), cefozopran (ZOP), cefpimizole (CFZ), cefpiramide (CPM), cefpirome (CPO), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefprozil (CPR), cefquinome (CEQ), cefroxadine (CRD), cefsulodin (CFS), cefsumide (CSU), ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftezole (CTL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), ceftolozane/tazobactam (CZT), ceftriaxone (CRO), ceftriaxone/beta-lactamase inhibitor (CEB), cefuroxime (CXM), cefuroxime axetil (CXA), cephradine (CED), latamoxef (LTM), and loracarbef (LOR)
|
||||||
\item \code{\link[=cephalosporins_1st]{cephalosporins_1st()}} can select: \cr cefacetrile (CAC), cefadroxil (CFR), cefalexin (LEX), cefaloridine (RID), cefalotin (CEP), cefapirin (HAP), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefroxadine (CRD), ceftezole (CTL), and cephradine (CED)
|
\item \code{\link[=cephalosporins_1st]{cephalosporins_1st()}} can select: \cr cefacetrile (CAC), cefadroxil (CFR), cefalexin (LEX), cefaloridine (RID), cefalotin (CEP), cefapirin (HAP), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefroxadine (CRD), ceftezole (CTL), and cephradine (CED)
|
||||||
\item \code{\link[=cephalosporins_2nd]{cephalosporins_2nd()}} can select: \cr cefaclor (CEC), cefamandole (MAN), cefmetazole (CMZ), cefonicid (CID), ceforanide (CND), cefotetan (CTT), cefotiam (CTF), cefoxitin (FOX), cefoxitin screening test (FOX-S), cefprozil (CPR), cefuroxime (CXM), cefuroxime axetil (CXA), and loracarbef (LOR)
|
\item \code{\link[=cephalosporins_2nd]{cephalosporins_2nd()}} can select: \cr cefaclor (CEC), cefamandole (MAN), cefmetazole (CMZ), cefonicid (CID), ceforanide (CND), cefotetan (CTT), cefotiam (CTF), cefoxitin (FOX), cefoxitin screening test (FOX-S), cefprozil (CPR), cefuroxime (CXM), cefuroxime axetil (CXA), and loracarbef (LOR)
|
||||||
\item \code{\link[=cephalosporins_3rd]{cephalosporins_3rd()}} can select: \cr cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefetamet (CAT), cefetamet pivoxil (CPI), cefixime (CFM), cefmenoxime (CMX), cefodizime (DIZ), cefoperazone (CFP), cefoperazone/sulbactam (CSL), cefotaxime (CTX), cefotaxime screening test (CTX-S), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotiam hexetil (CHE), cefovecin (FOV), cefpimizole (CFZ), cefpiramide (CPM), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefsulodin (CFS), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftriaxone (CRO), ceftriaxone/beta-lactamase inhibitor (CEB), and latamoxef (LTM)
|
\item \code{\link[=cephalosporins_3rd]{cephalosporins_3rd()}} can select: \cr cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefetamet (CAT), cefetamet pivoxil (CPI), cefixime (CFM), cefmenoxime (CMX), cefodizime (DIZ), cefoperazone (CFP), cefoperazone/sulbactam (CSL), cefotaxime (CTX), cefotaxime screening test (CTX-S), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotiam hexetil (CHE), cefovecin (FOV), cefpimizole (CFZ), cefpiramide (CPM), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefsulodin (CFS), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftriaxone (CRO), ceftriaxone/beta-lactamase inhibitor (CEB), and latamoxef (LTM)
|
||||||
\item \code{\link[=cephalosporins_4th]{cephalosporins_4th()}} can select: \cr cefepime (FEP), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefetecol (CCL), cefoselis (CSE), cefozopran (ZOP), cefpirome (CPO), and cefquinome (CEQ)
|
\item \code{\link[=cephalosporins_4th]{cephalosporins_4th()}} can select: \cr cefepime (FEP), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/taniborbactam (FTA), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefetecol (CCL), cefoselis (CSE), cefozopran (ZOP), cefpirome (CPO), and cefquinome (CEQ)
|
||||||
\item \code{\link[=cephalosporins_5th]{cephalosporins_5th()}} can select: \cr ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), and ceftolozane/tazobactam (CZT)
|
\item \code{\link[=cephalosporins_5th]{cephalosporins_5th()}} can select: \cr ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), and ceftolozane/tazobactam (CZT)
|
||||||
\item \code{\link[=fluoroquinolones]{fluoroquinolones()}} can select: \cr besifloxacin (BES), ciprofloxacin (CIP), ciprofloxacin/metronidazole (CIM), ciprofloxacin/ornidazole (CIO), ciprofloxacin/tinidazole (CIT), clinafloxacin (CLX), danofloxacin (DAN), delafloxacin (DFX), difloxacin (DIF), enoxacin (ENX), enrofloxacin (ENR), finafloxacin (FIN), fleroxacin (FLE), garenoxacin (GRN), gatifloxacin (GAT), gemifloxacin (GEM), grepafloxacin (GRX), lascufloxacin (LSC), levofloxacin (LVX), levofloxacin/ornidazole (LEO), levonadifloxacin (LND), lomefloxacin (LOM), marbofloxacin (MAR), metioxate (MXT), miloxacin (MIL), moxifloxacin (MFX), nadifloxacin (NAD), nemonoxacin (NEM), nifuroquine (NIF), nitroxoline (NTR), norfloxacin (NOR), norfloxacin screening test (NOR-S), norfloxacin/metronidazole (NME), norfloxacin/tinidazole (NTI), ofloxacin (OFX), ofloxacin/ornidazole (OOR), orbifloxacin (ORB), pazufloxacin (PAZ), pefloxacin (PEF), pefloxacin screening test (PEF-S), pradofloxacin (PRA), premafloxacin (PRX), prulifloxacin (PRU), rufloxacin (RFL), sarafloxacin (SAR), sitafloxacin (SIT), sparfloxacin (SPX), temafloxacin (TMX), tilbroquinol (TBQ), tioxacin (TXC), tosufloxacin (TFX), and trovafloxacin (TVA)
|
\item \code{\link[=fluoroquinolones]{fluoroquinolones()}} can select: \cr besifloxacin (BES), ciprofloxacin (CIP), ciprofloxacin/metronidazole (CIM), ciprofloxacin/ornidazole (CIO), ciprofloxacin/tinidazole (CIT), clinafloxacin (CLX), danofloxacin (DAN), delafloxacin (DFX), difloxacin (DIF), enoxacin (ENX), enrofloxacin (ENR), finafloxacin (FIN), fleroxacin (FLE), garenoxacin (GRN), gatifloxacin (GAT), gemifloxacin (GEM), grepafloxacin (GRX), lascufloxacin (LSC), levofloxacin (LVX), levofloxacin/ornidazole (LEO), levonadifloxacin (LND), lomefloxacin (LOM), marbofloxacin (MAR), metioxate (MXT), miloxacin (MIL), moxifloxacin (MFX), nadifloxacin (NAD), nemonoxacin (NEM), nifuroquine (NIF), nitroxoline (NTR), norfloxacin (NOR), norfloxacin screening test (NOR-S), norfloxacin/metronidazole (NME), norfloxacin/tinidazole (NTI), ofloxacin (OFX), ofloxacin/ornidazole (OOR), orbifloxacin (ORB), pazufloxacin (PAZ), pefloxacin (PEF), pefloxacin screening test (PEF-S), pradofloxacin (PRA), premafloxacin (PRX), prulifloxacin (PRU), rufloxacin (RFL), sarafloxacin (SAR), sitafloxacin (SIT), sparfloxacin (SPX), temafloxacin (TMX), tilbroquinol (TBQ), tioxacin (TXC), tosufloxacin (TFX), and trovafloxacin (TVA)
|
||||||
\item \code{\link[=glycopeptides]{glycopeptides()}} can select: \cr avoparcin (AVO), bleomycin (BLM), dalbavancin (DAL), norvancomycin (NVA), oritavancin (ORI), ramoplanin (RAM), teicoplanin (TEC), teicoplanin-macromethod (TCM), telavancin (TLV), vancomycin (VAN), and vancomycin-macromethod (VAM)
|
\item \code{\link[=glycopeptides]{glycopeptides()}} can select: \cr avoparcin (AVO), bleomycin (BLM), dalbavancin (DAL), norvancomycin (NVA), oritavancin (ORI), ramoplanin (RAM), teicoplanin (TEC), teicoplanin-macromethod (TCM), telavancin (TLV), vancomycin (VAN), and vancomycin-macromethod (VAM)
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
\alias{antimicrobials}
|
\alias{antimicrobials}
|
||||||
\alias{antibiotics}
|
\alias{antibiotics}
|
||||||
\alias{antivirals}
|
\alias{antivirals}
|
||||||
\title{Data Sets with 616 Antimicrobial Drugs}
|
\title{Data Sets with 618 Antimicrobial Drugs}
|
||||||
\format{
|
\format{
|
||||||
\subsection{For the \link{antimicrobials} data set: a \link[tibble:tibble]{tibble} with 496 observations and 14 variables:}{
|
\subsection{For the \link{antimicrobials} data set: a \link[tibble:tibble]{tibble} with 498 observations and 14 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. \emph{\strong{This is a unique identifier.}}
|
\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. \emph{\strong{This is a unique identifier.}}
|
||||||
\item \code{cid}\cr Compound ID as found in PubChem. \emph{\strong{This is a unique identifier.}}
|
\item \code{cid}\cr Compound ID as found in PubChem. \emph{\strong{This is a unique identifier.}}
|
||||||
@@ -50,7 +50,7 @@ LOINC:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
An object of class \code{deprecated_amr_dataset} (inherits from \code{tbl_df}, \code{tbl}, \code{data.frame}) with 496 rows and 14 columns.
|
An object of class \code{deprecated_amr_dataset} (inherits from \code{tbl_df}, \code{tbl}, \code{data.frame}) with 498 rows and 14 columns.
|
||||||
|
|
||||||
An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 120 rows and 11 columns.
|
An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 120 rows and 11 columns.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,9 @@ is.sir(x)
|
|||||||
|
|
||||||
is_sir_eligible(x, threshold = 0.05)
|
is_sir_eligible(x, threshold = 0.05)
|
||||||
|
|
||||||
\method{as.sir}{default}(x, S = "^(S|U)+$", I = "^(I)+$", R = "^(R)+$",
|
\method{as.sir}{default}(x, S = "^(S|U|1)+$", I = "^(I|2)+$",
|
||||||
NI = "^(N|NI|V)+$", SDD = "^(SDD|D|H)+$", info = interactive(), ...)
|
R = "^(R|3)+$", NI = "^(N|NI|V|4)+$", SDD = "^(SDD|D|H|5)+$",
|
||||||
|
info = interactive(), ...)
|
||||||
|
|
||||||
\method{as.sir}{mic}(x, mo = NULL, ab = deparse(substitute(x)),
|
\method{as.sir}{mic}(x, mo = NULL, ab = deparse(substitute(x)),
|
||||||
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
||||||
@@ -75,7 +76,7 @@ sir_interpretation_history(clean = FALSE)
|
|||||||
\arguments{
|
\arguments{
|
||||||
\item{x}{Vector of values (for class \code{\link{mic}}: MIC values in mg/L, for class \code{\link{disk}}: a disk diffusion radius in millimetres).}
|
\item{x}{Vector of values (for class \code{\link{mic}}: MIC values in mg/L, for class \code{\link{disk}}: a disk diffusion radius in millimetres).}
|
||||||
|
|
||||||
\item{...}{For using on a \link{data.frame}: selection of columns to apply \code{as.sir()} to. Supports \link[tidyselect:starts_with]{tidyselect language} such as \code{where(is.mic)}, \code{starts_with(...)}, or \code{column1:column4}, and can thus also be \link[=amr_selector]{antimicrobial selectors} such as \code{as.sir(df, penicillins())}.
|
\item{...}{For using on a \link{data.frame}: selection of columns to apply \code{as.sir()} to. Supports \link[tidyselect:starts_with]{tidyselect language} such as \code{where(is.mic)}, \code{starts_with(...)}, or \code{column1:column4}, and can thus also be \link[=amr_selector]{antimicrobial selectors}, e.g. \code{as.sir(df, penicillins())}.
|
||||||
|
|
||||||
Otherwise: arguments passed on to methods.}
|
Otherwise: arguments passed on to methods.}
|
||||||
|
|
||||||
@@ -97,29 +98,29 @@ Otherwise: arguments passed on to methods.}
|
|||||||
|
|
||||||
\code{"none"}
|
\code{"none"}
|
||||||
\itemize{
|
\itemize{
|
||||||
\item \code{<=} and \code{>=} are treated as-is.
|
\item \code{<=}, \code{<}, \code{>} and \code{>=} are ignored.
|
||||||
\item \code{<} and \code{>} are treated as-is.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
\code{"conservative"}
|
\code{"conservative"} (default)
|
||||||
\itemize{
|
\itemize{
|
||||||
\item \code{<=} and \code{>=} return \code{"NI"} (non-interpretable) if the MIC is within the breakpoint guideline range.
|
\item \code{<=}, \code{<}, \code{>} and \code{>=} return \code{"NI"} (non-interpretable) if the \emph{true} MIC could be at either side of the breakpoint.
|
||||||
\item \code{<} always returns \code{"S"}, and \code{>} always returns \code{"R"}.
|
\item This is the only mode that preserves uncertainty for ECOFFs.
|
||||||
}
|
}
|
||||||
|
|
||||||
\code{"standard"} (default)
|
\code{"standard"}
|
||||||
\itemize{
|
\itemize{
|
||||||
\item \code{<=} and \code{>=} return \code{"NI"} (non-interpretable) if the MIC is within the breakpoint guideline range.
|
\item \code{<=} and \code{>=} return \code{"NI"} (non-interpretable) if the \emph{true} MIC could be at either side of the breakpoint.
|
||||||
\item \code{<} and \code{>} are treated as-is.
|
\item \code{<} always returns \code{"S"}, regardless of the breakpoint.
|
||||||
|
\item \code{>} always returns \code{"R"}, regardless of the breakpoint.
|
||||||
}
|
}
|
||||||
|
|
||||||
\code{"inverse"}
|
\code{"lenient"}
|
||||||
\itemize{
|
\itemize{
|
||||||
\item \code{<=} and \code{>=} are treated as-is.
|
\item \code{<=} and \code{<} always return \code{"S"}, regardless of the breakpoint.
|
||||||
\item \code{<} always returns \code{"S"}, and \code{>} always returns \code{"R"}.
|
\item \code{>=} and \code{>} always return \code{"R"}, regardless of the breakpoint.
|
||||||
}
|
}
|
||||||
|
|
||||||
The default \code{"standard"} setting ensures cautious handling of uncertain values while preserving interpretability. This option can also be set with the package option \code{\link[=AMR-options]{AMR_capped_mic_handling}}.}
|
The default \code{"conservative"} setting ensures cautious handling of uncertain values while preserving interpretability. This option can also be set with the package option \code{\link[=AMR-options]{AMR_capped_mic_handling}}.}
|
||||||
|
|
||||||
\item{add_intrinsic_resistance}{\emph{(only useful when using a EUCAST guideline)} a \link{logical} to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in \emph{Klebsiella} species. Determination is based on the \link{intrinsic_resistant} data set, that itself is based on \href{https://www.eucast.org/expert_rules_and_expected_phenotypes}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3} (2021).}
|
\item{add_intrinsic_resistance}{\emph{(only useful when using a EUCAST guideline)} a \link{logical} to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in \emph{Klebsiella} species. Determination is based on the \link{intrinsic_resistant} data set, that itself is based on \href{https://www.eucast.org/expert_rules_and_expected_phenotypes}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3} (2021).}
|
||||||
|
|
||||||
@@ -179,7 +180,7 @@ your_data \%>\% mutate_if(is.mic, as.sir, host = "column_with_animal_species", g
|
|||||||
# fast processing with parallel computing:
|
# fast processing with parallel computing:
|
||||||
as.sir(your_data, ..., parallel = TRUE)
|
as.sir(your_data, ..., parallel = TRUE)
|
||||||
}\if{html}{\out{</div>}}
|
}\if{html}{\out{</div>}}
|
||||||
\item Operators like "<=" will be stripped before interpretation. When using \code{capped_mic_handling = "conservative"}, an MIC value of e.g. ">2" will always return "R", even if the breakpoint according to the chosen guideline is ">=4". This is to prevent that capped values from raw laboratory data would not be treated conservatively. The default behaviour (\code{capped_mic_handling = "standard"}) considers ">2" to be lower than ">=4" and might in this case return "S" or "I".
|
\item Operators like "<=" will be considered according to the \code{capped_mic_handling} setting. At default, an MIC value of e.g. ">2" will return "NI" (non-interpretable) if the breakpoint is 4-8; the \emph{true} MIC could be at either side of the breakpoint. This is to prevent that capped values from raw laboratory data would not be treated conservatively.
|
||||||
\item \strong{Note:} When using CLSI as the guideline, MIC values must be log2-based doubling dilutions. Values not in this format, will be automatically rounded up to the nearest log2 level as CLSI instructs, and a warning will be thrown.
|
\item \strong{Note:} When using CLSI as the guideline, MIC values must be log2-based doubling dilutions. Values not in this format, will be automatically rounded up to the nearest log2 level as CLSI instructs, and a warning will be thrown.
|
||||||
}
|
}
|
||||||
\item For \strong{interpreting disk diffusion diameters} according to EUCAST or CLSI. You must clean your disk zones first using \code{\link[=as.disk]{as.disk()}}, that also gives your columns the new data class \code{\link{disk}}. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the \code{mo} argument.
|
\item For \strong{interpreting disk diffusion diameters} according to EUCAST or CLSI. You must clean your disk zones first using \code{\link[=as.disk]{as.disk()}}, that also gives your columns the new data class \code{\link{disk}}. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the \code{mo} argument.
|
||||||
@@ -442,6 +443,10 @@ as.sir(
|
|||||||
|
|
||||||
as.sir(c("S", "SDD", "I", "R", "NI", "A", "B", "C"))
|
as.sir(c("S", "SDD", "I", "R", "NI", "A", "B", "C"))
|
||||||
as.sir("<= 0.002; S") # will return "S"
|
as.sir("<= 0.002; S") # will return "S"
|
||||||
|
|
||||||
|
as.sir(c(1, 2, 3))
|
||||||
|
as.sir(c(1, 2, 3), S = 3, I = 2, R = 1)
|
||||||
|
|
||||||
sir_data <- as.sir(c(rep("S", 474), rep("I", 36), rep("R", 370)))
|
sir_data <- as.sir(c(rep("S", 474), rep("I", 36), rep("R", 370)))
|
||||||
is.sir(sir_data)
|
is.sir(sir_data)
|
||||||
plot(sir_data) # for percentages
|
plot(sir_data) # for percentages
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ A \link[tibble:tibble]{tibble} with 40 217 observations and 14 variables:
|
|||||||
clinical_breakpoints
|
clinical_breakpoints
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
Data set containing clinical breakpoints to interpret MIC and disk diffusion to SIR values, according to international guidelines. This dataset contain breakpoints for humans, 7 different animal groups, and ECOFFs.
|
Data set containing clinical breakpoints to interpret MIC and disk diffusion to SIR values, according to international guidelines. This data set contains breakpoints for humans, 7 different animal groups, and ECOFFs.
|
||||||
|
|
||||||
These breakpoints are currently implemented:
|
These breakpoints are currently implemented:
|
||||||
\itemize{
|
\itemize{
|
||||||
|
|||||||
@@ -104,16 +104,16 @@ These 35 antimicrobial groups are allowed in the rules (case-insensitive) and ca
|
|||||||
\item aminopenicillins\cr(amoxicillin and ampicillin)
|
\item aminopenicillins\cr(amoxicillin and ampicillin)
|
||||||
\item antifungals\cr(amorolfine, amphotericin B, amphotericin B-high, anidulafungin, butoconazole, caspofungin, ciclopirox, clotrimazole, econazole, fluconazole, flucytosine, fosfluconazole, griseofulvin, hachimycin, ibrexafungerp, isavuconazole, isoconazole, itraconazole, ketoconazole, manogepix, micafungin, miconazole, nystatin, oteseconazole, pimaricin, posaconazole, rezafungin, ribociclib, sulconazole, terbinafine, terconazole, and voriconazole)
|
\item antifungals\cr(amorolfine, amphotericin B, amphotericin B-high, anidulafungin, butoconazole, caspofungin, ciclopirox, clotrimazole, econazole, fluconazole, flucytosine, fosfluconazole, griseofulvin, hachimycin, ibrexafungerp, isavuconazole, isoconazole, itraconazole, ketoconazole, manogepix, micafungin, miconazole, nystatin, oteseconazole, pimaricin, posaconazole, rezafungin, ribociclib, sulconazole, terbinafine, terconazole, and voriconazole)
|
||||||
\item antimycobacterials\cr(4-aminosalicylic acid, calcium aminosalicylate, capreomycin, clofazimine, delamanid, enviomycin, ethambutol, ethambutol/isoniazid, ethionamide, isoniazid, isoniazid/sulfamethoxazole/trimethoprim/pyridoxine, morinamide, p-aminosalicylic acid, pretomanid, protionamide, pyrazinamide, rifabutin, rifampicin, rifampicin/ethambutol/isoniazid, rifampicin/isoniazid, rifampicin/pyrazinamide/ethambutol/isoniazid, rifampicin/pyrazinamide/isoniazid, rifamycin, rifapentine, sodium aminosalicylate, streptomycin/isoniazid, terizidone, thioacetazone, thioacetazone/isoniazid, tiocarlide, and viomycin)
|
\item antimycobacterials\cr(4-aminosalicylic acid, calcium aminosalicylate, capreomycin, clofazimine, delamanid, enviomycin, ethambutol, ethambutol/isoniazid, ethionamide, isoniazid, isoniazid/sulfamethoxazole/trimethoprim/pyridoxine, morinamide, p-aminosalicylic acid, pretomanid, protionamide, pyrazinamide, rifabutin, rifampicin, rifampicin/ethambutol/isoniazid, rifampicin/isoniazid, rifampicin/pyrazinamide/ethambutol/isoniazid, rifampicin/pyrazinamide/isoniazid, rifamycin, rifapentine, sodium aminosalicylate, streptomycin/isoniazid, terizidone, thioacetazone, thioacetazone/isoniazid, tiocarlide, and viomycin)
|
||||||
\item betalactams\cr(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, benzylpenicillin screening test, biapenem, carbenicillin, carindacillin, carumonam, cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, meticillin, mezlocillin, mezlocillin/sulbactam, nafcillin, oxacillin, oxacillin screening test, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, pheneticillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbenicillin, sultamicillin, talampicillin, tebipenem, temocillin, ticarcillin, ticarcillin/clavulanic acid, and tigemonam)
|
\item betalactams\cr(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, benzylpenicillin screening test, biapenem, carbenicillin, carindacillin, carumonam, cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, meticillin, mezlocillin, mezlocillin/sulbactam, nafcillin, oxacillin, oxacillin screening test, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, pheneticillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbenicillin, sultamicillin, talampicillin, taniborbactam, tebipenem, temocillin, ticarcillin, ticarcillin/clavulanic acid, and tigemonam)
|
||||||
\item betalactams_with_inhibitor\cr(amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin/sulbactam, aztreonam/avibactam, aztreonam/nacubactam, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefoperazone/sulbactam, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefpodoxime/clavulanic acid, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, ceftolozane/tazobactam, ceftriaxone/beta-lactamase inhibitor, imipenem/relebactam, meropenem/nacubactam, meropenem/vaborbactam, mezlocillin/sulbactam, penicillin/novobiocin, penicillin/sulbactam, piperacillin/sulbactam, piperacillin/tazobactam, and ticarcillin/clavulanic acid)
|
\item betalactams_with_inhibitor\cr(amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin/sulbactam, aztreonam/avibactam, aztreonam/nacubactam, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefoperazone/sulbactam, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefpodoxime/clavulanic acid, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, ceftolozane/tazobactam, ceftriaxone/beta-lactamase inhibitor, imipenem/relebactam, meropenem/nacubactam, meropenem/vaborbactam, mezlocillin/sulbactam, penicillin/novobiocin, penicillin/sulbactam, piperacillin/sulbactam, piperacillin/tazobactam, and ticarcillin/clavulanic acid)
|
||||||
\item carbapenems\cr(biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA, imipenem/relebactam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem acoxil, and tebipenem)
|
\item carbapenems\cr(biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA, imipenem/relebactam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem acoxil, taniborbactam, and tebipenem)
|
||||||
\item cephalosporins\cr(cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, latamoxef, and loracarbef)
|
\item cephalosporins\cr(cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, latamoxef, and loracarbef)
|
||||||
\item cephalosporins_1st\cr(cefacetrile, cefadroxil, cefalexin, cefaloridine, cefalotin, cefapirin, cefatrizine, cefazedone, cefazolin, cefroxadine, ceftezole, and cephradine)
|
\item cephalosporins_1st\cr(cefacetrile, cefadroxil, cefalexin, cefaloridine, cefalotin, cefapirin, cefatrizine, cefazedone, cefazolin, cefroxadine, ceftezole, and cephradine)
|
||||||
\item cephalosporins_2nd\cr(cefaclor, cefamandole, cefmetazole, cefonicid, ceforanide, cefotetan, cefotiam, cefoxitin, cefoxitin screening test, cefprozil, cefuroxime, cefuroxime axetil, and loracarbef)
|
\item cephalosporins_2nd\cr(cefaclor, cefamandole, cefmetazole, cefonicid, ceforanide, cefotetan, cefotiam, cefoxitin, cefoxitin screening test, cefprozil, cefuroxime, cefuroxime axetil, and loracarbef)
|
||||||
\item cephalosporins_3rd\cr(cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime, cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole, cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefsulodin, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, and latamoxef)
|
\item cephalosporins_3rd\cr(cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime, cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole, cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefsulodin, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, and latamoxef)
|
||||||
\item cephalosporins_4th\cr(cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetecol, cefoselis, cefozopran, cefpirome, and cefquinome)
|
\item cephalosporins_4th\cr(cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetecol, cefoselis, cefozopran, cefpirome, and cefquinome)
|
||||||
\item cephalosporins_5th\cr(ceftaroline, ceftaroline/avibactam, ceftobiprole, ceftobiprole medocaril, and ceftolozane/tazobactam)
|
\item cephalosporins_5th\cr(ceftaroline, ceftaroline/avibactam, ceftobiprole, ceftobiprole medocaril, and ceftolozane/tazobactam)
|
||||||
\item cephalosporins_except_caz\cr(cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, latamoxef, and loracarbef)
|
\item cephalosporins_except_caz\cr(cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, latamoxef, and loracarbef)
|
||||||
\item fluoroquinolones\cr(besifloxacin, ciprofloxacin, ciprofloxacin/metronidazole, ciprofloxacin/ornidazole, ciprofloxacin/tinidazole, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, lascufloxacin, levofloxacin, levofloxacin/ornidazole, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nemonoxacin, nifuroquine, nitroxoline, norfloxacin, norfloxacin screening test, norfloxacin/metronidazole, norfloxacin/tinidazole, ofloxacin, ofloxacin/ornidazole, orbifloxacin, pazufloxacin, pefloxacin, pefloxacin screening test, pradofloxacin, premafloxacin, prulifloxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin, and trovafloxacin)
|
\item fluoroquinolones\cr(besifloxacin, ciprofloxacin, ciprofloxacin/metronidazole, ciprofloxacin/ornidazole, ciprofloxacin/tinidazole, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, lascufloxacin, levofloxacin, levofloxacin/ornidazole, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nemonoxacin, nifuroquine, nitroxoline, norfloxacin, norfloxacin screening test, norfloxacin/metronidazole, norfloxacin/tinidazole, ofloxacin, ofloxacin/ornidazole, orbifloxacin, pazufloxacin, pefloxacin, pefloxacin screening test, pradofloxacin, premafloxacin, prulifloxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin, and trovafloxacin)
|
||||||
\item glycopeptides\cr(avoparcin, bleomycin, dalbavancin, norvancomycin, oritavancin, ramoplanin, teicoplanin, teicoplanin-macromethod, telavancin, vancomycin, and vancomycin-macromethod)
|
\item glycopeptides\cr(avoparcin, bleomycin, dalbavancin, norvancomycin, oritavancin, ramoplanin, teicoplanin, teicoplanin-macromethod, telavancin, vancomycin, and vancomycin-macromethod)
|
||||||
\item glycopeptides_except_lipo\cr(avoparcin, bleomycin, norvancomycin, ramoplanin, teicoplanin, teicoplanin-macromethod, vancomycin, and vancomycin-macromethod)
|
\item glycopeptides_except_lipo\cr(avoparcin, bleomycin, norvancomycin, ramoplanin, teicoplanin, teicoplanin-macromethod, vancomycin, and vancomycin-macromethod)
|
||||||
|
|||||||
@@ -100,14 +100,14 @@ All 35 antimicrobial selectors are supported for use in the rules:
|
|||||||
\item \code{\link[=aminopenicillins]{aminopenicillins()}} can select: \cr amoxicillin and ampicillin
|
\item \code{\link[=aminopenicillins]{aminopenicillins()}} can select: \cr amoxicillin and ampicillin
|
||||||
\item \code{\link[=antifungals]{antifungals()}} can select: \cr amorolfine, amphotericin B, amphotericin B-high, anidulafungin, butoconazole, caspofungin, ciclopirox, clotrimazole, econazole, fluconazole, flucytosine, fosfluconazole, griseofulvin, hachimycin, ibrexafungerp, isavuconazole, isoconazole, itraconazole, ketoconazole, manogepix, micafungin, miconazole, nystatin, oteseconazole, pimaricin, posaconazole, rezafungin, ribociclib, sulconazole, terbinafine, terconazole, and voriconazole
|
\item \code{\link[=antifungals]{antifungals()}} can select: \cr amorolfine, amphotericin B, amphotericin B-high, anidulafungin, butoconazole, caspofungin, ciclopirox, clotrimazole, econazole, fluconazole, flucytosine, fosfluconazole, griseofulvin, hachimycin, ibrexafungerp, isavuconazole, isoconazole, itraconazole, ketoconazole, manogepix, micafungin, miconazole, nystatin, oteseconazole, pimaricin, posaconazole, rezafungin, ribociclib, sulconazole, terbinafine, terconazole, and voriconazole
|
||||||
\item \code{\link[=antimycobacterials]{antimycobacterials()}} can select: \cr 4-aminosalicylic acid, calcium aminosalicylate, capreomycin, clofazimine, delamanid, enviomycin, ethambutol, ethambutol/isoniazid, ethionamide, isoniazid, isoniazid/sulfamethoxazole/trimethoprim/pyridoxine, morinamide, p-aminosalicylic acid, pretomanid, protionamide, pyrazinamide, rifabutin, rifampicin, rifampicin/ethambutol/isoniazid, rifampicin/isoniazid, rifampicin/pyrazinamide/ethambutol/isoniazid, rifampicin/pyrazinamide/isoniazid, rifamycin, rifapentine, sodium aminosalicylate, streptomycin/isoniazid, terizidone, thioacetazone, thioacetazone/isoniazid, tiocarlide, and viomycin
|
\item \code{\link[=antimycobacterials]{antimycobacterials()}} can select: \cr 4-aminosalicylic acid, calcium aminosalicylate, capreomycin, clofazimine, delamanid, enviomycin, ethambutol, ethambutol/isoniazid, ethionamide, isoniazid, isoniazid/sulfamethoxazole/trimethoprim/pyridoxine, morinamide, p-aminosalicylic acid, pretomanid, protionamide, pyrazinamide, rifabutin, rifampicin, rifampicin/ethambutol/isoniazid, rifampicin/isoniazid, rifampicin/pyrazinamide/ethambutol/isoniazid, rifampicin/pyrazinamide/isoniazid, rifamycin, rifapentine, sodium aminosalicylate, streptomycin/isoniazid, terizidone, thioacetazone, thioacetazone/isoniazid, tiocarlide, and viomycin
|
||||||
\item \code{\link[=betalactams]{betalactams()}} can select: \cr amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, benzylpenicillin screening test, biapenem, carbenicillin, carindacillin, carumonam, cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, meticillin, mezlocillin, mezlocillin/sulbactam, nafcillin, oxacillin, oxacillin screening test, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, pheneticillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbenicillin, sultamicillin, talampicillin, tebipenem, temocillin, ticarcillin, ticarcillin/clavulanic acid, and tigemonam
|
\item \code{\link[=betalactams]{betalactams()}} can select: \cr amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, benzylpenicillin screening test, biapenem, carbenicillin, carindacillin, carumonam, cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, meticillin, mezlocillin, mezlocillin/sulbactam, nafcillin, oxacillin, oxacillin screening test, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, pheneticillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbenicillin, sultamicillin, talampicillin, taniborbactam, tebipenem, temocillin, ticarcillin, ticarcillin/clavulanic acid, and tigemonam
|
||||||
\item \code{\link[=betalactams_with_inhibitor]{betalactams_with_inhibitor()}} can select: \cr amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin/sulbactam, aztreonam/avibactam, aztreonam/nacubactam, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefoperazone/sulbactam, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefpodoxime/clavulanic acid, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, ceftolozane/tazobactam, ceftriaxone/beta-lactamase inhibitor, imipenem/relebactam, meropenem/nacubactam, meropenem/vaborbactam, mezlocillin/sulbactam, penicillin/novobiocin, penicillin/sulbactam, piperacillin/sulbactam, piperacillin/tazobactam, and ticarcillin/clavulanic acid
|
\item \code{\link[=betalactams_with_inhibitor]{betalactams_with_inhibitor()}} can select: \cr amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin/sulbactam, aztreonam/avibactam, aztreonam/nacubactam, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefoperazone/sulbactam, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefpodoxime/clavulanic acid, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, ceftolozane/tazobactam, ceftriaxone/beta-lactamase inhibitor, imipenem/relebactam, meropenem/nacubactam, meropenem/vaborbactam, mezlocillin/sulbactam, penicillin/novobiocin, penicillin/sulbactam, piperacillin/sulbactam, piperacillin/tazobactam, and ticarcillin/clavulanic acid
|
||||||
\item \code{\link[=carbapenems]{carbapenems()}} can select: \cr biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA, imipenem/relebactam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem acoxil, and tebipenem
|
\item \code{\link[=carbapenems]{carbapenems()}} can select: \cr biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA, imipenem/relebactam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem acoxil, taniborbactam, and tebipenem
|
||||||
\item \code{\link[=cephalosporins]{cephalosporins()}} can select: \cr cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, latamoxef, and loracarbef
|
\item \code{\link[=cephalosporins]{cephalosporins()}} can select: \cr cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, latamoxef, and loracarbef
|
||||||
\item \code{\link[=cephalosporins_1st]{cephalosporins_1st()}} can select: \cr cefacetrile, cefadroxil, cefalexin, cefaloridine, cefalotin, cefapirin, cefatrizine, cefazedone, cefazolin, cefroxadine, ceftezole, and cephradine
|
\item \code{\link[=cephalosporins_1st]{cephalosporins_1st()}} can select: \cr cefacetrile, cefadroxil, cefalexin, cefaloridine, cefalotin, cefapirin, cefatrizine, cefazedone, cefazolin, cefroxadine, ceftezole, and cephradine
|
||||||
\item \code{\link[=cephalosporins_2nd]{cephalosporins_2nd()}} can select: \cr cefaclor, cefamandole, cefmetazole, cefonicid, ceforanide, cefotetan, cefotiam, cefoxitin, cefoxitin screening test, cefprozil, cefuroxime, cefuroxime axetil, and loracarbef
|
\item \code{\link[=cephalosporins_2nd]{cephalosporins_2nd()}} can select: \cr cefaclor, cefamandole, cefmetazole, cefonicid, ceforanide, cefotetan, cefotiam, cefoxitin, cefoxitin screening test, cefprozil, cefuroxime, cefuroxime axetil, and loracarbef
|
||||||
\item \code{\link[=cephalosporins_3rd]{cephalosporins_3rd()}} can select: \cr cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime, cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole, cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefsulodin, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, and latamoxef
|
\item \code{\link[=cephalosporins_3rd]{cephalosporins_3rd()}} can select: \cr cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime, cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole, cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefsulodin, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, and latamoxef
|
||||||
\item \code{\link[=cephalosporins_4th]{cephalosporins_4th()}} can select: \cr cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetecol, cefoselis, cefozopran, cefpirome, and cefquinome
|
\item \code{\link[=cephalosporins_4th]{cephalosporins_4th()}} can select: \cr cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetecol, cefoselis, cefozopran, cefpirome, and cefquinome
|
||||||
\item \code{\link[=cephalosporins_5th]{cephalosporins_5th()}} can select: \cr ceftaroline, ceftaroline/avibactam, ceftobiprole, ceftobiprole medocaril, and ceftolozane/tazobactam
|
\item \code{\link[=cephalosporins_5th]{cephalosporins_5th()}} can select: \cr ceftaroline, ceftaroline/avibactam, ceftobiprole, ceftobiprole medocaril, and ceftolozane/tazobactam
|
||||||
\item \code{\link[=fluoroquinolones]{fluoroquinolones()}} can select: \cr besifloxacin, ciprofloxacin, ciprofloxacin/metronidazole, ciprofloxacin/ornidazole, ciprofloxacin/tinidazole, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, lascufloxacin, levofloxacin, levofloxacin/ornidazole, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nemonoxacin, nifuroquine, nitroxoline, norfloxacin, norfloxacin screening test, norfloxacin/metronidazole, norfloxacin/tinidazole, ofloxacin, ofloxacin/ornidazole, orbifloxacin, pazufloxacin, pefloxacin, pefloxacin screening test, pradofloxacin, premafloxacin, prulifloxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin, and trovafloxacin
|
\item \code{\link[=fluoroquinolones]{fluoroquinolones()}} can select: \cr besifloxacin, ciprofloxacin, ciprofloxacin/metronidazole, ciprofloxacin/ornidazole, ciprofloxacin/tinidazole, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, lascufloxacin, levofloxacin, levofloxacin/ornidazole, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nemonoxacin, nifuroquine, nitroxoline, norfloxacin, norfloxacin screening test, norfloxacin/metronidazole, norfloxacin/tinidazole, ofloxacin, ofloxacin/ornidazole, orbifloxacin, pazufloxacin, pefloxacin, pefloxacin screening test, pradofloxacin, premafloxacin, prulifloxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin, and trovafloxacin
|
||||||
\item \code{\link[=glycopeptides]{glycopeptides()}} can select: \cr avoparcin, bleomycin, dalbavancin, norvancomycin, oritavancin, ramoplanin, teicoplanin, teicoplanin-macromethod, telavancin, vancomycin, and vancomycin-macromethod
|
\item \code{\link[=glycopeptides]{glycopeptides()}} can select: \cr avoparcin, bleomycin, dalbavancin, norvancomycin, oritavancin, ramoplanin, teicoplanin, teicoplanin-macromethod, telavancin, vancomycin, and vancomycin-macromethod
|
||||||
|
|||||||
27
man/esbl_isolates.Rd
Normal file
27
man/esbl_isolates.Rd
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/data.R
|
||||||
|
\docType{data}
|
||||||
|
\name{esbl_isolates}
|
||||||
|
\alias{esbl_isolates}
|
||||||
|
\title{Data Set with 500 ESBL Isolates}
|
||||||
|
\format{
|
||||||
|
A \link[tibble:tibble]{tibble} with 500 observations and 19 variables:
|
||||||
|
\itemize{
|
||||||
|
\item \code{esbl}\cr Logical indicator if the isolate is ESBL-producing
|
||||||
|
\item \code{genus}\cr Genus of the microorganism
|
||||||
|
\item \code{AMC:COL}\cr MIC values for 17 antimicrobial agents, transformed to class \code{\link{mic}} (see \code{\link[=as.mic]{as.mic()}})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\usage{
|
||||||
|
esbl_isolates
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
A data set containing 500 microbial isolates with MIC values of common antibiotics and a binary \code{esbl} column for extended-spectrum beta-lactamase (ESBL) production. This data set contains randomised fictitious data but reflects reality and can be used to practise AMR-related machine learning, e.g., classification modelling with \href{https://amr-for-r.org/articles/AMR_with_tidymodels.html}{tidymodels}.
|
||||||
|
}
|
||||||
|
\details{
|
||||||
|
See our \link[=amr-tidymodels]{tidymodels integration} for an example using this data set.
|
||||||
|
}
|
||||||
|
\examples{
|
||||||
|
esbl_isolates
|
||||||
|
}
|
||||||
|
\keyword{datasets}
|
||||||
@@ -145,7 +145,7 @@ $(function () {
|
|||||||
x = x.replace("Kathryn", "Prof. Kathryn");
|
x = x.replace("Kathryn", "Prof. Kathryn");
|
||||||
x = x.replace("Larisse", "Dr. Larisse");
|
x = x.replace("Larisse", "Dr. Larisse");
|
||||||
x = x.replace("Matthijs", "Dr. Matthijs");
|
x = x.replace("Matthijs", "Dr. Matthijs");
|
||||||
x = x.replace("Natacha", "Dr. Natacha");
|
x = x.replace("Natacha", "Prof. Natacha");
|
||||||
x = x.replace("Peter", "Dr. Peter");
|
x = x.replace("Peter", "Dr. Peter");
|
||||||
x = x.replace("Rogier", "Dr. Rogier");
|
x = x.replace("Rogier", "Dr. Rogier");
|
||||||
x = x.replace("Sofia", "Dr. Sofia");
|
x = x.replace("Sofia", "Dr. Sofia");
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ test_that("test-antibiogram.R", {
|
|||||||
|
|
||||||
# Traditional antibiogram ----------------------------------------------
|
# Traditional antibiogram ----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
ab0 <- antibiogram(example_isolates)
|
||||||
|
|
||||||
ab1 <- antibiogram(example_isolates,
|
ab1 <- antibiogram(example_isolates,
|
||||||
antimicrobials = c(aminoglycosides(), carbapenems())
|
antimicrobials = c(aminoglycosides(), carbapenems())
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -391,6 +391,17 @@ test_that("test-sir.R", {
|
|||||||
expect_warning(as.sir(as.mic(2), "E. coli", "ampicillin", guideline = "EUCAST 2020", ecoff = TRUE))
|
expect_warning(as.sir(as.mic(2), "E. coli", "ampicillin", guideline = "EUCAST 2020", ecoff = TRUE))
|
||||||
|
|
||||||
|
|
||||||
|
# Capped MIC handling ---------------------------------------------------
|
||||||
|
|
||||||
|
out1 <- as.sir(as.mic(c("0.125", "<0.125", ">0.125")), mo = "E. coli", ab = "Cipro", guideline = "EUCAST 2025", breakpoint_type = "ECOFF", capped_mic_handling = "none")
|
||||||
|
out2 <- as.sir(as.mic(c("0.125", "<0.125", ">0.125")), mo = "E. coli", ab = "Cipro", guideline = "EUCAST 2025", breakpoint_type = "ECOFF", capped_mic_handling = "conservative")
|
||||||
|
out3 <- as.sir(as.mic(c("0.125", "<0.125", ">0.125")), mo = "E. coli", ab = "Cipro", guideline = "EUCAST 2025", breakpoint_type = "ECOFF", capped_mic_handling = "standard")
|
||||||
|
out4 <- as.sir(as.mic(c("0.125", "<0.125", ">0.125")), mo = "E. coli", ab = "Cipro", guideline = "EUCAST 2025", breakpoint_type = "ECOFF", capped_mic_handling = "lenient")
|
||||||
|
expect_equal(out1, as.sir(c("R", "R", "R")))
|
||||||
|
expect_equal(out2, as.sir(c("R", "NI", "R")))
|
||||||
|
expect_equal(out3, as.sir(c("R", "S", "R")))
|
||||||
|
expect_equal(out4, as.sir(c("R", "S", "R")))
|
||||||
|
|
||||||
# Parallel computing ----------------------------------------------------
|
# Parallel computing ----------------------------------------------------
|
||||||
|
|
||||||
# MB 29 Apr 2025: I have run the code of AVC, PEI, Canada (dataset of 2854x65), and compared it like this:
|
# MB 29 Apr 2025: I have run the code of AVC, PEI, Canada (dataset of 2854x65), and compared it like this:
|
||||||
|
|||||||
84
tests/testthat/test-tidymodels.R
Executable file
84
tests/testthat/test-tidymodels.R
Executable file
@@ -0,0 +1,84 @@
|
|||||||
|
# ==================================================================== #
|
||||||
|
# TITLE: #
|
||||||
|
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||||
|
# #
|
||||||
|
# SOURCE CODE: #
|
||||||
|
# https://github.com/msberends/AMR #
|
||||||
|
# #
|
||||||
|
# PLEASE CITE THIS SOFTWARE AS: #
|
||||||
|
# Berends MS, Luz CF, Friedrich AW, et al. (2022). #
|
||||||
|
# AMR: An R Package for Working with Antimicrobial Resistance Data. #
|
||||||
|
# Journal of Statistical Software, 104(3), 1-31. #
|
||||||
|
# https://doi.org/10.18637/jss.v104.i03 #
|
||||||
|
# #
|
||||||
|
# Developed at the University of Groningen and the University Medical #
|
||||||
|
# Center Groningen in The Netherlands, in collaboration with many #
|
||||||
|
# colleagues from around the world, see our website. #
|
||||||
|
# #
|
||||||
|
# This R package is free software; you can freely use and distribute #
|
||||||
|
# it for both personal and commercial purposes under the terms of the #
|
||||||
|
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
||||||
|
# the Free Software Foundation. #
|
||||||
|
# We created this package for both routine data analysis and academic #
|
||||||
|
# research and it was publicly released in the hope that it will be #
|
||||||
|
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||||
|
# #
|
||||||
|
# Visit our website for the full manual and a complete tutorial about #
|
||||||
|
# how to conduct AMR data analysis: https://amr-for-r.org #
|
||||||
|
# ==================================================================== #
|
||||||
|
|
||||||
|
test_that("tidymodels.R", {
|
||||||
|
skip_on_cran()
|
||||||
|
|
||||||
|
if (AMR:::pkg_is_available("recipes", also_load = TRUE) && AMR:::pkg_is_available("dplyr", also_load = TRUE)) {
|
||||||
|
# SIR
|
||||||
|
df <- tibble(
|
||||||
|
sir1 = as.sir(c("S", "I", "R", "S", "R")),
|
||||||
|
sir2 = as.sir(c("I", "R", "S", "R", "I")),
|
||||||
|
not_sir = c("S", "R", "R", "S", "I")
|
||||||
|
)
|
||||||
|
rec <- recipe(~., data = df) %>% step_sir_numeric(all_sir())
|
||||||
|
prepped <- prep(rec)
|
||||||
|
baked <- bake(prepped, new_data = df)
|
||||||
|
expect_inherits(baked$sir1, "numeric")
|
||||||
|
expect_inherits(baked$sir2, "numeric")
|
||||||
|
expect_equal(baked$not_sir, as.factor(df$not_sir))
|
||||||
|
|
||||||
|
# MIC
|
||||||
|
df <- tibble(
|
||||||
|
mic_col1 = as.mic(c("<=0.002", "0.002", "0.004", "0.016", "32")),
|
||||||
|
mic_col2 = as.mic(c("0.5", "1", "2", "4", "8")),
|
||||||
|
non_mic = c(1, 2, 3, 4, 5)
|
||||||
|
)
|
||||||
|
rec <- recipe(~., data = df) %>% step_mic_log2(all_mic())
|
||||||
|
prepped <- prep(rec)
|
||||||
|
baked <- bake(prepped, new_data = df)
|
||||||
|
expect_inherits(baked$mic_col1, "numeric")
|
||||||
|
expect_inherits(baked$mic_col2, "numeric")
|
||||||
|
expect_equal(baked$non_mic, df$non_mic)
|
||||||
|
expect_equal(baked$mic_col2, log2(as.numeric(df$mic_col2)))
|
||||||
|
|
||||||
|
# disk
|
||||||
|
df <- tibble(
|
||||||
|
disk_col = as.disk(c(21, 22, 23, 24, 25)),
|
||||||
|
non_disk = c(21, 22, 23, 24, 25)
|
||||||
|
)
|
||||||
|
rec <- recipe(~., data = df) %>% step_rm(!all_disk())
|
||||||
|
prepped <- prep(rec)
|
||||||
|
baked <- bake(prepped, new_data = df)
|
||||||
|
expect_inherits(baked$disk_col, "disk")
|
||||||
|
|
||||||
|
# steps check
|
||||||
|
df <- tibble(x = as.mic(c("1", "2", "4")))
|
||||||
|
rec <- recipe(~x, data = df) %>% step_mic_log2(all_mic())
|
||||||
|
prepped <- prep(rec)
|
||||||
|
tidy_df <- tidy(prepped, number = 1)
|
||||||
|
expect_equal(unname(tidy_df$terms), "x")
|
||||||
|
|
||||||
|
df <- tibble(x = as.sir(c("S", "I", "R")))
|
||||||
|
rec <- recipe(~x, data = df) %>% step_sir_numeric(all_sir())
|
||||||
|
prepped <- prep(rec)
|
||||||
|
tidy_df <- tidy(prepped, number = 1)
|
||||||
|
expect_equal(unname(tidy_df$terms), "x")
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -22,7 +22,7 @@ knitr::opts_chunk$set(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
> This page was entirely written by our [AMR for R Assistant](https://chat.amr-for-r.org), a ChatGPT manually-trained model able to answer any question about the `AMR` package.
|
> This page was almost entirely written by our [AMR for R Assistant](https://chat.amr-for-r.org), a ChatGPT manually-trained model able to answer any question about the `AMR` package.
|
||||||
|
|
||||||
Antimicrobial resistance (AMR) is a global health crisis, and understanding resistance patterns is crucial for managing effective treatments. The `AMR` R package provides robust tools for analysing AMR data, including convenient antimicrobial selector functions like `aminoglycosides()` and `betalactams()`.
|
Antimicrobial resistance (AMR) is a global health crisis, and understanding resistance patterns is crucial for managing effective treatments. The `AMR` R package provides robust tools for analysing AMR data, including convenient antimicrobial selector functions like `aminoglycosides()` and `betalactams()`.
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ predictions %>%
|
|||||||
|
|
||||||
### **Conclusion**
|
### **Conclusion**
|
||||||
|
|
||||||
In this post, we demonstrated how to build a machine learning pipeline with the `tidymodels` framework and the `AMR` package. By combining selector functions like `aminoglycosides()` and `betalactams()` with `tidymodels`, we efficiently prepared data, trained a model, and evaluated its performance.
|
In this example, we demonstrated how to build a machine learning pipeline with the `tidymodels` framework and the `AMR` package. By combining selector functions like `aminoglycosides()` and `betalactams()` with `tidymodels`, we efficiently prepared data, trained a model, and evaluated its performance.
|
||||||
|
|
||||||
This workflow is extensible to other antimicrobial classes and resistance patterns, empowering users to analyse AMR data systematically and reproducibly.
|
This workflow is extensible to other antimicrobial classes and resistance patterns, empowering users to analyse AMR data systematically and reproducibly.
|
||||||
|
|
||||||
@@ -219,18 +219,163 @@ This workflow is extensible to other antimicrobial classes and resistance patter
|
|||||||
|
|
||||||
In this second example, we demonstrate how to use `<mic>` columns directly in `tidymodels` workflows using AMR-specific recipe steps. This includes a transformation to `log2` scale using `step_mic_log2()`, which prepares MIC values for use in classification models.
|
In this second example, we demonstrate how to use `<mic>` columns directly in `tidymodels` workflows using AMR-specific recipe steps. This includes a transformation to `log2` scale using `step_mic_log2()`, which prepares MIC values for use in classification models.
|
||||||
|
|
||||||
This approach and idea formed the basis for the publication [DOI: 10.3389/fmicb.2025.1582703](https://doi.org/10.3389/fmicb.2025.1582703) to model the presence of extended-spectrum beta-lactamases (ESBL).
|
This approach and idea formed the basis for the publication [DOI: 10.3389/fmicb.2025.1582703](https://doi.org/10.3389/fmicb.2025.1582703) to model the presence of extended-spectrum beta-lactamases (ESBL) based on MIC values.
|
||||||
|
|
||||||
> NOTE: THIS EXAMPLE WILL BE AVAILABLE IN A NEXT VERSION (#TODO)
|
### **Objective**
|
||||||
>
|
|
||||||
> The new AMR package version will contain new tidymodels selectors such as `step_mic_log2()`.
|
|
||||||
|
|
||||||
<!-- TODO for AMR v3.1.0: add info from here: https://github.com/msberends/AMR/blob/2461631bcefa78ebdb37bdfad359be74cdd9165a/vignettes/AMR_with_tidymodels.Rmd#L212-L291 -->
|
Our goal is to:
|
||||||
|
|
||||||
|
1. Use raw MIC values to predict whether a bacterial isolate produces ESBL.
|
||||||
|
2. Apply AMR-aware preprocessing in a `tidymodels` recipe.
|
||||||
|
3. Train a classification model and evaluate its predictive performance.
|
||||||
|
|
||||||
|
### **Data Preparation**
|
||||||
|
|
||||||
|
We use the `esbl_isolates` dataset that comes with the AMR package.
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
# Load required libraries
|
||||||
|
library(AMR)
|
||||||
|
library(tidymodels)
|
||||||
|
|
||||||
|
# View the esbl_isolates data set
|
||||||
|
esbl_isolates
|
||||||
|
|
||||||
|
# Prepare a binary outcome and convert to ordered factor
|
||||||
|
data <- esbl_isolates %>%
|
||||||
|
mutate(esbl = factor(esbl, levels = c(FALSE, TRUE), ordered = TRUE))
|
||||||
|
```
|
||||||
|
|
||||||
|
**Explanation:**
|
||||||
|
|
||||||
|
- `esbl_isolates`: Contains MIC test results and ESBL status for each isolate.
|
||||||
|
- `mutate(esbl = ...)`: Converts the target column to an ordered factor for classification.
|
||||||
|
|
||||||
|
### **Defining the Workflow**
|
||||||
|
|
||||||
|
#### 1. Preprocessing with a Recipe
|
||||||
|
|
||||||
|
We use our `step_mic_log2()` function to log2-transform MIC values, ensuring that MICs are numeric and properly scaled. All MIC predictors can easily and agnostically selected using the new `all_mic_predictors()`:
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
# Split into training and testing sets
|
||||||
|
set.seed(123)
|
||||||
|
split <- initial_split(data)
|
||||||
|
training_data <- training(split)
|
||||||
|
testing_data <- testing(split)
|
||||||
|
|
||||||
|
# Define the recipe
|
||||||
|
mic_recipe <- recipe(esbl ~ ., data = training_data) %>%
|
||||||
|
remove_role(genus, old_role = "predictor") %>% # Remove non-informative variable
|
||||||
|
step_mic_log2(all_mic_predictors()) # Log2 transform all MIC predictors
|
||||||
|
|
||||||
|
prep(mic_recipe)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Explanation:**
|
||||||
|
|
||||||
|
- `remove_role()`: Removes irrelevant variables like genus.
|
||||||
|
- `step_mic_log2()`: Applies `log2(as.numeric(...))` to all MIC predictors in one go.
|
||||||
|
- `prep()`: Finalises the recipe based on training data.
|
||||||
|
|
||||||
|
#### 2. Specifying the Model
|
||||||
|
|
||||||
|
We use a simple logistic regression to model ESBL presence, though recent models such as xgboost ([link to `parsnip` manual](https://parsnip.tidymodels.org/reference/details_boost_tree_xgboost.html)) could be much more precise.
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
# Define the model
|
||||||
|
model <- logistic_reg(mode = "classification") %>%
|
||||||
|
set_engine("glm")
|
||||||
|
|
||||||
|
model
|
||||||
|
```
|
||||||
|
|
||||||
|
**Explanation:**
|
||||||
|
|
||||||
|
- `logistic_reg()`: Specifies a binary classification model.
|
||||||
|
- `set_engine("glm")`: Uses the base R GLM engine.
|
||||||
|
|
||||||
|
#### 3. Building the Workflow
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
# Create workflow
|
||||||
|
workflow_model <- workflow() %>%
|
||||||
|
add_recipe(mic_recipe) %>%
|
||||||
|
add_model(model)
|
||||||
|
|
||||||
|
workflow_model
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Training and Evaluating the Model**
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
# Fit the model
|
||||||
|
fitted <- fit(workflow_model, training_data)
|
||||||
|
|
||||||
|
# Generate predictions
|
||||||
|
predictions <- predict(fitted, testing_data) %>%
|
||||||
|
bind_cols(predict(fitted, testing_data, type = "prob")) %>% # add probabilities
|
||||||
|
bind_cols(testing_data)
|
||||||
|
|
||||||
|
# Evaluate model performance
|
||||||
|
our_metrics <- metric_set(accuracy, recall, precision, sensitivity, specificity, ppv, npv)
|
||||||
|
metrics <- our_metrics(predictions, truth = esbl, estimate = .pred_class)
|
||||||
|
|
||||||
|
metrics
|
||||||
|
```
|
||||||
|
|
||||||
|
**Explanation:**
|
||||||
|
|
||||||
|
- `fit()`: Trains the model on the processed training data.
|
||||||
|
- `predict()`: Produces predictions for unseen test data.
|
||||||
|
- `metric_set()`: Allows evaluating multiple classification metrics. This will make `our_metrics` to become a function that we can use to check the predictions with.
|
||||||
|
|
||||||
|
It appears we can predict ESBL gene presence with a positive predictive value (PPV) of `r round(metrics[metrics$.metric == "ppv", ]$.estimate, 3) * 100`% and a negative predictive value (NPV) of `r round(metrics[metrics$.metric == "npv", ]$.estimate, 3) * 100`% using a simplistic logistic regression model.
|
||||||
|
|
||||||
|
### **Visualising Predictions**
|
||||||
|
|
||||||
|
We can visualise predictions by comparing predicted and actual ESBL status.
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
library(ggplot2)
|
||||||
|
|
||||||
|
ggplot(predictions, aes(x = esbl, fill = .pred_class)) +
|
||||||
|
geom_bar(position = "stack") +
|
||||||
|
labs(title = "Predicted vs Actual ESBL Status",
|
||||||
|
x = "Actual ESBL",
|
||||||
|
y = "Count") +
|
||||||
|
theme_minimal()
|
||||||
|
```
|
||||||
|
|
||||||
|
And plot the certainties too - how certain were the actual predictions?
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
predictions %>%
|
||||||
|
mutate(certainty = ifelse(.pred_class == "FALSE",
|
||||||
|
.pred_FALSE,
|
||||||
|
.pred_TRUE),
|
||||||
|
correct = ifelse(esbl == .pred_class, "Right", "Wrong")) %>%
|
||||||
|
ggplot(aes(x = seq_len(nrow(predictions)),
|
||||||
|
y = certainty,
|
||||||
|
colour = correct)) +
|
||||||
|
scale_colour_manual(values = c(Right = "green3", Wrong = "red2"),
|
||||||
|
name = "Correct?") +
|
||||||
|
geom_point() +
|
||||||
|
scale_y_continuous(labels = function(x) paste0(x * 100, "%"),
|
||||||
|
limits = c(0.5, 1)) +
|
||||||
|
theme_minimal()
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Conclusion**
|
||||||
|
|
||||||
|
In this example, we showcased how the new `AMR`-specific recipe steps simplify working with `<mic>` columns in `tidymodels`. The `step_mic_log2()` transformation converts MICs (with or without operators) to log2-transformed numerics, improving compatibility with classification models.
|
||||||
|
|
||||||
|
This pipeline enables realistic, reproducible, and interpretable modelling of antimicrobial resistance data.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
## Example 2: Predicting AMR Over Time
|
## Example 3: Predicting AMR Over Time
|
||||||
|
|
||||||
In this third example, we aim to predict antimicrobial resistance (AMR) trends over time using `tidymodels`. We will model resistance to three antibiotics (amoxicillin `AMX`, amoxicillin-clavulanic acid `AMC`, and ciprofloxacin `CIP`), based on historical data grouped by year and hospital ward.
|
In this third example, we aim to predict antimicrobial resistance (AMR) trends over time using `tidymodels`. We will model resistance to three antibiotics (amoxicillin `AMX`, amoxicillin-clavulanic acid `AMC`, and ciprofloxacin `CIP`), based on historical data grouped by year and hospital ward.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user