mirror of
https://github.com/msberends/AMR.git
synced 2025-12-18 23:00:21 +01:00
Compare commits
18 Commits
3d40b20c10
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 225c73f7e7 | |||
| ba30b08f76 | |||
| d366949f1b | |||
| 0b24967b23 | |||
| adee419f1c | |||
| 33fb1849eb | |||
| 13f2a864da | |||
| 10ba36821e | |||
| 5796e8f3a4 | |||
| b11866af57 | |||
| e8c99f2775 | |||
| 5b99888151 | |||
| c7b2acbeb6 | |||
| 1922fb5ff2 | |||
| 4d7c4ca52c | |||
| d5a568318b | |||
| c1c49fa463 | |||
| d2ced1db61 |
10
.github/prehooks/pre-commit
vendored
10
.github/prehooks/pre-commit
vendored
@@ -48,7 +48,6 @@ echo "Running prehook..."
|
||||
if command -v Rscript > /dev/null; then
|
||||
if [ "$(Rscript -e 'cat(all(c('"'pkgload'"', '"'devtools'"', '"'dplyr'"') %in% rownames(installed.packages())))')" = "TRUE" ]; then
|
||||
Rscript -e "source('data-raw/_pre_commit_checks.R')"
|
||||
currentpkg=$(Rscript -e "cat(pkgload::pkg_name())")
|
||||
echo "- Adding changed files in ./data-raw and ./man to this commit"
|
||||
git add data-raw/*
|
||||
git add data/*
|
||||
@@ -57,11 +56,9 @@ if command -v Rscript > /dev/null; then
|
||||
git add NAMESPACE
|
||||
else
|
||||
echo "- R package 'pkgload', 'devtools', or 'dplyr' not installed!"
|
||||
currentpkg="your"
|
||||
fi
|
||||
else
|
||||
echo "- R is not available on your system!"
|
||||
currentpkg="your"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
@@ -92,7 +89,7 @@ else
|
||||
|
||||
# Combine tag and commit number
|
||||
currentversion="$currenttag.$((currentcommit + 9001))"
|
||||
echo "- ${currentpkg} pkg version set to ${currentversion}"
|
||||
echo "- AMR pkg version set to ${currentversion}"
|
||||
|
||||
# Update version number and date in DESCRIPTION
|
||||
sed -i -- "s/^Version: .*/Version: ${currentversion}/" DESCRIPTION
|
||||
@@ -103,10 +100,7 @@ else
|
||||
|
||||
# Update version number in NEWS.md
|
||||
if [ -e "NEWS.md" ]; then
|
||||
if [ "$currentpkg" = "your" ]; then
|
||||
currentpkg=""
|
||||
fi
|
||||
sed -i -- "1s/.*/# ${currentpkg} ${currentversion}/" NEWS.md
|
||||
sed -i -- "1s/.*/# AMR ${currentversion}/" NEWS.md
|
||||
echo "- Updated version number in ./NEWS.md"
|
||||
rm -f NEWS.md--
|
||||
git add NEWS.md
|
||||
|
||||
86
.github/workflows/check-current-testthat-dev-versions.yaml
vendored
Normal file
86
.github/workflows/check-current-testthat-dev-versions.yaml
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
# ==================================================================== #
|
||||
# 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 #
|
||||
# ==================================================================== #
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
# run in each PR in this repo
|
||||
branches: '**'
|
||||
push:
|
||||
branches: '**'
|
||||
schedule:
|
||||
# also run a schedule everyday at 1 AM.
|
||||
# this is to check that all dependencies are still available (see R/zzz.R)
|
||||
- cron: '0 1 * * *'
|
||||
|
||||
name: check-recent-dev-pkgs
|
||||
|
||||
jobs:
|
||||
R-code-check:
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
|
||||
continue-on-error: ${{ matrix.config.allowfail }}
|
||||
|
||||
name: ${{ matrix.config.os }} (dev-pkgs)
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
# current 'release' version on Ubuntu
|
||||
- {os: ubuntu-latest, r: 'release', allowfail: false}
|
||||
|
||||
env:
|
||||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
|
||||
R_KEEP_PKG_SOURCE: yes
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: r-lib/actions/setup-pandoc@v2
|
||||
|
||||
- uses: r-lib/actions/setup-r@v2
|
||||
with:
|
||||
r-version: ${{ matrix.config.r }}
|
||||
use-public-rspm: false
|
||||
extra-repositories: >
|
||||
https://tidyverse.r-universe.dev
|
||||
https://r-lib.r-universe.dev
|
||||
https://tidymodels.r-universe.dev
|
||||
https://yihui.r-universe.dev
|
||||
|
||||
- uses: r-lib/actions/setup-r-dependencies@v2
|
||||
with:
|
||||
extra-packages: any::rcmdcheck
|
||||
needs: check
|
||||
upgrade: 'TRUE'
|
||||
|
||||
- uses: r-lib/actions/check-r-package@v2
|
||||
with:
|
||||
upload-snapshots: true
|
||||
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
|
||||
9
.github/workflows/todo-tracker.yml
vendored
9
.github/workflows/todo-tracker.yml
vendored
@@ -47,19 +47,20 @@ jobs:
|
||||
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 "" >> todo.md
|
||||
todos=$(find R/ -type f ! -name "sysdata.rda" -exec grep -nH "TODO" {} + || true)
|
||||
todos=$(grep -rn --include=\*.{R,Rmd,yaml,yml,md,css,js} --exclude={todo-tracker.yml,todo.md} "TODO" . || true)
|
||||
if [ -z "$todos" ]; then
|
||||
echo "✅ No TODOs found." >> todo.md
|
||||
else
|
||||
echo "$todos" | awk -F: '
|
||||
echo "$todos" | awk -F: -v repo="https://github.com/msberends/AMR/blob/main/" '
|
||||
{
|
||||
file = $1
|
||||
gsub("^\\./", "", file) # remove leading ./ if present
|
||||
line = $2
|
||||
text = substr($0, index($0,$3))
|
||||
if (file != last_file) {
|
||||
if (last_file != "") print "```"
|
||||
print ""
|
||||
print "### " file
|
||||
print "### [`" file "`](" repo file ")"
|
||||
print "```r"
|
||||
last_file = file
|
||||
}
|
||||
@@ -74,6 +75,6 @@ jobs:
|
||||
with:
|
||||
token: ${{ secrets.GH_REPO_SCOPE }}
|
||||
issue-number: 231
|
||||
comment-id: 3379846566
|
||||
comment-id: 3253439219
|
||||
body-file: todo.md
|
||||
edit-mode: replace
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
||||
Meta
|
||||
doc
|
||||
docs
|
||||
.Renviron
|
||||
.Rproj.user
|
||||
.Rhistory
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Version: 3.0.0
|
||||
Date: 2025-06-01 16:52:53 UTC
|
||||
SHA: 79038fed2169a25a7fc067c80bb25d9d78be21d9
|
||||
Version: 3.0.1
|
||||
Date: 2025-09-20 10:56:46 UTC
|
||||
SHA: 33fb1849eb5aa6d33828e643c8f5047dd93447e3
|
||||
|
||||
10
DESCRIPTION
10
DESCRIPTION
@@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 3.0.0.9023
|
||||
Date: 2025-09-04
|
||||
Version: 3.0.1.9004
|
||||
Date: 2025-12-15
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
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("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("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("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("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")),
|
||||
@@ -70,5 +70,5 @@ BugReports: https://github.com/msberends/AMR/issues
|
||||
License: GPL-2 | file LICENSE
|
||||
Encoding: UTF-8
|
||||
LazyData: true
|
||||
RoxygenNote: 7.3.2
|
||||
RoxygenNote: 7.3.3
|
||||
Roxygen: list(markdown = TRUE, old_usage = TRUE)
|
||||
|
||||
@@ -373,6 +373,8 @@ if(getRversion() >= "3.0.0") S3method(ggplot2::fortify, disk)
|
||||
if(getRversion() >= "3.0.0") S3method(ggplot2::fortify, mic)
|
||||
if(getRversion() >= "3.0.0") S3method(ggplot2::fortify, resistance_predict)
|
||||
if(getRversion() >= "3.0.0") S3method(ggplot2::fortify, sir)
|
||||
if(getRversion() >= "3.0.0") S3method(ggplot2::scale_type, mic)
|
||||
if(getRversion() >= "3.0.0") S3method(ggplot2::scale_type, sir)
|
||||
if(getRversion() >= "3.0.0") S3method(knitr::knit_print, antibiogram)
|
||||
if(getRversion() >= "3.0.0") S3method(knitr::knit_print, formatted_bug_drug_combinations)
|
||||
if(getRversion() >= "3.0.0") S3method(pillar::pillar_shaft, ab)
|
||||
@@ -388,6 +390,7 @@ 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, mo)
|
||||
if(getRversion() >= "3.0.0") S3method(pillar::type_sum, sir)
|
||||
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, mic)
|
||||
if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, mo)
|
||||
|
||||
26
NEWS.md
26
NEWS.md
@@ -1,8 +1,25 @@
|
||||
# AMR 3.0.0.9023
|
||||
# AMR 3.0.1.9004
|
||||
|
||||
### 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
|
||||
|
||||
This is a bugfix release following the release of v3.0.0 in June 2025.
|
||||
|
||||
### Changed
|
||||
* Fixed bugs introduced by `ggplot2` v4.0.0 (#236)
|
||||
* MIC scale functions (such as `scale_y_mic()`) will now be applied automatically when plotting values of class `mic`
|
||||
* SIR scale functions (such as `scale_x_sir()`) will now be applied automatically when plotting values of class `sir`
|
||||
* Fixed a bug in `antibiogram()` for when no antimicrobials are set
|
||||
* Fixed a bug in `antibiogram()` to allow column names containing the `+` character (#222)
|
||||
* Fixed a bug in `as.ab()` for antimicrobial codes with a number in it if they are preceded by a space
|
||||
@@ -10,16 +27,19 @@ This is a bugfix release following the release of v3.0.0 in June 2025.
|
||||
* Fixed a bug in `as.sir()` to allow any tidyselect language (#220)
|
||||
* Fixed a bug in `as.sir()` to pick right breakpoint when `uti = FALSE` (#216)
|
||||
* Fixed a bug in `ggplot_sir()` when using `combine_SI = FALSE` (#213)
|
||||
* Fixed a bug the `antimicrobials` data set to remove statins (#229)
|
||||
* Fixed a bug in `mdro()` to make sure all genes specified in arguments are acknowledged
|
||||
* Fixed a bug the `antimicrobials` data set to remove statins (#229)
|
||||
* Fixed a bug the `microorganisms` data set for MycoBank IDs and synonyms (#233)
|
||||
* Fixed ATC J01CR05 to map to piperacillin/tazobactam rather than piperacillin/sulbactam (#230)
|
||||
* Fixed skimmers (`skimr` package) of class `ab`, `sir`, and `disk` (#234)
|
||||
* Fixed all plotting to contain a separate colour for SDD (susceptible dose-dependent) (#223)
|
||||
* Fixed some specific Dutch translations for antimicrobials
|
||||
* Added a warning to `as.ab()` if input resembles antiviral codes or names (#232)
|
||||
* Added all reasons in verbose output of `mdro()` (#227)
|
||||
* Added `names` to `age_groups()` so that custom names can be given (#215)
|
||||
* Added note to `as.sir()` to make it explicit when higher-level taxonomic breakpoints are used (#218)
|
||||
* Added antibiotic codes from the Comprehensive Antibiotic Resistance Database (CARD) to the `antimicrobials` data set (#225)
|
||||
* Updated Fosfomycin to be of antibiotic class 'Phosphonics' (#225)
|
||||
* Updated Fosfomycin to be of antibiotic class Phosphonics (#225)
|
||||
* Updated `random_mic()` and `random_disk()` to set skewedness of the distribution and allow multiple microorganisms
|
||||
|
||||
|
||||
|
||||
@@ -485,11 +485,7 @@ word_wrap <- function(...,
|
||||
}
|
||||
|
||||
# format backticks
|
||||
if (pkg_is_available("cli") &&
|
||||
tryCatch(isTRUE(getExportedValue("ansi_has_hyperlink_support", ns = asNamespace("cli"))()), error = function(e) FALSE) &&
|
||||
tryCatch(getExportedValue("isAvailable", ns = asNamespace("rstudioapi"))(), error = function(e) {
|
||||
return(FALSE)
|
||||
}) &&
|
||||
if (pkg_is_available("cli") && in_rstudio() &&
|
||||
tryCatch(getExportedValue("versionInfo", ns = asNamespace("rstudioapi"))()$version > "2023.6.0.0", error = function(e) {
|
||||
return(FALSE)
|
||||
})) {
|
||||
@@ -1188,6 +1184,13 @@ reset_all_thrown_messages <- function() {
|
||||
)
|
||||
}
|
||||
|
||||
in_rstudio <- function() {
|
||||
identical(Sys.getenv("RSTUDIO"), "1")
|
||||
}
|
||||
in_positron <- function() {
|
||||
identical(Sys.getenv("POSITRON"), "1")
|
||||
}
|
||||
|
||||
has_colour <- function() {
|
||||
if (is.null(AMR_env$supports_colour)) {
|
||||
if (Sys.getenv("EMACS") != "" || Sys.getenv("INSIDE_EMACS") != "") {
|
||||
@@ -1222,7 +1225,7 @@ is_dark <- function() {
|
||||
AMR_env$current_theme <- tryCatch(getExportedValue("getThemeInfo", ns = asNamespace("rstudioapi"))()$editor, error = function(e) NULL)
|
||||
if (!identical(AMR_env$current_theme, AMR_env$former_theme) || is.null(AMR_env$is_dark_theme)) {
|
||||
AMR_env$former_theme <- AMR_env$current_theme
|
||||
AMR_env$is_dark_theme <- !has_colour() || tryCatch(isTRUE(getExportedValue("getThemeInfo", ns = asNamespace("rstudioapi"))()$dark), error = function(e) FALSE)
|
||||
AMR_env$is_dark_theme <- !has_colour() || tryCatch(isTRUE(getExportedValue("getThemeInfo", ns = asNamespace("rstudioapi"))()$dark), error = function(e) TRUE)
|
||||
}
|
||||
isTRUE(AMR_env$is_dark_theme)
|
||||
}
|
||||
@@ -1617,8 +1620,8 @@ get_n_cores <- function(max_cores = Inf) {
|
||||
|
||||
# Support `where()` if tidyselect not installed ----
|
||||
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
|
||||
loadNamespace("tidyselect")
|
||||
# tidyselect::where() exists, retrieve from their namespace to make `where()`s work across the package in default arguments
|
||||
where <- tidyselect::where
|
||||
} else {
|
||||
where <- function(fn) {
|
||||
# based on https://github.com/nathaneastwood/poorman/blob/52eb6947e0b4430cd588976ed8820013eddf955f/R/where.R#L17-L32
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#' @section Options:
|
||||
#' * `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_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_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()].
|
||||
|
||||
21
R/ab.R
21
R/ab.R
@@ -202,6 +202,9 @@ as.ab <- function(x, flag_multiple_results = TRUE, language = get_AMR_locale(),
|
||||
if (sum(already_known) < length(x)) {
|
||||
progress <- progress_ticker(n = sum(!already_known), n_min = 25, print = info) # start if n >= 25
|
||||
on.exit(close(progress))
|
||||
if (any(x_new[!already_known & !is.na(x_new)] %in% unlist(AMR_env$AV_lookup$generalised_all, use.names = FALSE), na.rm = TRUE)) {
|
||||
warning_("in `as.ab()`: some input seems to resemble antiviral drugs - use `as.av()` or e.g. `av_name()` for these, not `as.ab()` or e.g. `ab_name()`.")
|
||||
}
|
||||
}
|
||||
|
||||
for (i in which(!already_known)) {
|
||||
@@ -448,7 +451,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, language = get_AMR_locale(),
|
||||
x_unknown <- x_unknown[!x_unknown %in% c("", NA)]
|
||||
if (length(x_unknown) > 0 && fast_mode == FALSE) {
|
||||
warning_(
|
||||
"in `as.ab()`: these values could not be coerced to a valid antimicrobial ID: ",
|
||||
"in `as.ab()`: ", ifelse(length(unique(x_unknown)) == 1, "this value", "these values"), " could not be coerced to a valid antimicrobial ID: ",
|
||||
vector_and(x_unknown), "."
|
||||
)
|
||||
}
|
||||
@@ -511,7 +514,7 @@ pillar_shaft.ab <- function(x, ...) {
|
||||
out[is.na(x)] <- font_na(NA)
|
||||
|
||||
# add the names to the drugs as mouse-over!
|
||||
if (tryCatch(isTRUE(getExportedValue("ansi_has_hyperlink_support", ns = asNamespace("cli"))()), error = function(e) FALSE)) {
|
||||
if (in_rstudio()) {
|
||||
out[!is.na(x)] <- font_url(
|
||||
url = paste0(x[!is.na(x)], ": ", ab_name(x[!is.na(x)])),
|
||||
txt = out[!is.na(x)]
|
||||
@@ -627,6 +630,20 @@ rep.ab <- function(x, ...) {
|
||||
out
|
||||
}
|
||||
|
||||
# this prevents the requirement for putting the dependency in Imports:
|
||||
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, ab)
|
||||
get_skimmers.ab <- function(column) {
|
||||
ab <- as.ab(column, info = FALSE)
|
||||
ab <- ab[!is.na(ab)]
|
||||
skimr::sfl(
|
||||
skim_type = "ab",
|
||||
n_unique = ~ length(unique(ab)),
|
||||
top_ab = ~ names(sort(-table(ab)))[1L],
|
||||
top_ab_name = ~ names(sort(-table(ab_name(ab, info = FALSE))))[1L],
|
||||
top_group = ~ names(sort(-table(ab_group(ab, info = FALSE))))[1L]
|
||||
)
|
||||
}
|
||||
|
||||
generalise_antibiotic_name <- function(x) {
|
||||
x <- toupper(x)
|
||||
# remove suffices
|
||||
|
||||
@@ -453,7 +453,7 @@ antibiogram.default <- function(x,
|
||||
deprecation_warning("antibiotics", "antimicrobials", fn = "antibiogram", is_argument = TRUE)
|
||||
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)) {
|
||||
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
|
||||
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)) {
|
||||
stop_ifnot(is.character(suppressMessages(antimicrobials)), "`antimicrobials` must be an antimicrobial selector, or a character vector.")
|
||||
antimicrobials.bak <- antimicrobials
|
||||
|
||||
12
R/disk.R
12
R/disk.R
@@ -236,12 +236,14 @@ rep.disk <- function(x, ...) {
|
||||
# this prevents the requirement for putting the dependency in Imports:
|
||||
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, disk)
|
||||
get_skimmers.disk <- function(column) {
|
||||
column <- as.integer(column)
|
||||
skimr::sfl(
|
||||
skim_type = "disk",
|
||||
min = ~ min(as.double(.), na.rm = TRUE),
|
||||
max = ~ max(as.double(.), na.rm = TRUE),
|
||||
median = ~ stats::median(as.double(.), na.rm = TRUE),
|
||||
n_unique = ~ length(unique(stats::na.omit(.))),
|
||||
hist = ~ skimr::inline_hist(stats::na.omit(as.double(.)))
|
||||
p0 = ~ stats::quantile(column, probs = 0, na.rm = TRUE, names = FALSE),
|
||||
p25 = ~ stats::quantile(column, probs = 0.25, na.rm = TRUE, names = FALSE),
|
||||
p50 = ~ stats::quantile(column, probs = 0.5, na.rm = TRUE, names = FALSE),
|
||||
p75 = ~ stats::quantile(column, probs = 0.75, na.rm = TRUE, names = FALSE),
|
||||
p100 = ~ stats::quantile(column, probs = 1, na.rm = TRUE, names = FALSE),
|
||||
hist = ~ skimr::inline_hist(stats::na.omit(column), 10)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
#'
|
||||
#' All isolates with a microbial ID of `NA` will be excluded as first isolate.
|
||||
#'
|
||||
#' ### Different methods
|
||||
#' ## Different methods
|
||||
#'
|
||||
#' According to previously-mentioned sources, there are different methods (algorithms) to select first isolates with increasing reliability: isolate-based, patient-based, episode-based and phenotype-based. All methods select on a combination of the taxonomic genus and species (not subspecies).
|
||||
#'
|
||||
@@ -89,21 +89,29 @@
|
||||
#' | - Major difference in any antimicrobial result | - `first_isolate(x, type = "points")` |
|
||||
#' | - Any difference in key antimicrobial results | - `first_isolate(x, type = "keyantimicrobials")` |
|
||||
#'
|
||||
#' ### Isolate-based
|
||||
#' **Isolate-based**
|
||||
#'
|
||||
#' _Minimum variables required: Microorganism identifier_
|
||||
#'
|
||||
#' This method does not require any selection, as all isolates should be included. It does, however, respect all arguments set in the [first_isolate()] function. For example, the default setting for `include_unknown` (`FALSE`) will omit selection of rows without a microbial ID.
|
||||
#'
|
||||
#' ### Patient-based
|
||||
#' **Patient-based**
|
||||
#'
|
||||
#' To include every genus-species combination per patient once, set the `episode_days` to `Inf`. This method makes sure that no duplicate isolates are selected from the same patient. This method is preferred to e.g. identify the first MRSA finding of each patient to determine the incidence. Conversely, in a large longitudinal data set, this could mean that isolates are *excluded* that were found years after the initial isolate.
|
||||
#' _Minimum variables required: Microorganism identifier, Patient identifier_
|
||||
#'
|
||||
#' ### Episode-based
|
||||
#' This method includes every genus-species combination per patient once. This method makes sure that no duplicate isolates are selected from the same patient. This method is preferred to e.g. identify the first MRSA finding of each patient to determine the incidence. Conversely, in a large longitudinal data set, this could mean that isolates are *excluded* that were found years after the initial isolate.
|
||||
#'
|
||||
#' To include every genus-species combination per patient episode once, set the `episode_days` to a sensible number of days. Depending on the type of analysis, this could be 14, 30, 60 or 365. Short episodes are common for analysing specific hospital or ward data or ICU cases, long episodes are common for analysing regional and national data.
|
||||
#' **Episode-based**
|
||||
#'
|
||||
#' _Minimum variables required: Microorganism identifier, Patient identifier, Date_
|
||||
#'
|
||||
#' To include every genus-species combination per patient episode once, set the `episode_days` to a sensible number of days. Depending on the type of analysis, this could be e.g., 14, 30, 60 or 365. Short episodes are common for analysing specific hospital or ward data or ICU cases, long episodes are common for analysing regional and national data.
|
||||
#'
|
||||
#' This is the most common method to correct for duplicate isolates. Patients are categorised into episodes based on their ID and dates (e.g., the date of specimen receipt or laboratory result). While this is a common method, it does not take into account antimicrobial test results. This means that e.g. a methicillin-resistant *Staphylococcus aureus* (MRSA) isolate cannot be differentiated from a wildtype *Staphylococcus aureus* isolate.
|
||||
#'
|
||||
#' ### Phenotype-based
|
||||
#' **Phenotype-based**
|
||||
#'
|
||||
#' _Minimum variables required: Microorganism identifier, Patient identifier, Date, Antimicrobial test results_
|
||||
#'
|
||||
#' This is a more reliable method, since it also *weighs* the antibiogram (antimicrobial test results) yielding so-called 'first weighted isolates'. There are two different methods to weigh the antibiogram:
|
||||
#'
|
||||
|
||||
3
R/mdro.R
3
R/mdro.R
@@ -1499,12 +1499,13 @@ mdro <- function(x = NULL,
|
||||
any_all = "any",
|
||||
reason = "Enterobacterales: carbapenemase"
|
||||
)
|
||||
c.freundii_complex <- AMR::microorganisms.groups$mo_name[AMR::microorganisms.groups$mo_group_name == "Citrobacter freundii complex"]
|
||||
trans_tbl(
|
||||
3,
|
||||
rows = which(col_values(x, SXT) == "R" &
|
||||
(col_values(x, GEN) == "R" | col_values(x, TOB) == "R" | col_values(x, AMK) == "R") &
|
||||
(col_values(x, CIP) == "R" | col_values(x, NOR) == "R" | col_values(x, LVX) == "R") &
|
||||
(x$genus %in% c("Enterobacter", "Providencia") | paste(x$genus, x$species) %in% c("Citrobacter freundii", "Klebsiella aerogenes", "Hafnia alvei", "Morganella morganii"))),
|
||||
(x$genus %in% c("Enterobacter", "Providencia") | paste(x$genus, x$species) %in% c(c.freundii_complex, "Klebsiella aerogenes", "Hafnia alvei", "Morganella morganii"))),
|
||||
cols = c(SXT, aminoglycosides, fluoroquinolones),
|
||||
any_all = "any",
|
||||
reason = "Enterobacterales group II: aminoglycoside + fluoroquinolone + cotrimoxazol"
|
||||
|
||||
12
R/mic.R
12
R/mic.R
@@ -596,12 +596,12 @@ get_skimmers.mic <- function(column) {
|
||||
column <- as.mic(column) # make sure that currently implemented MIC levels are used
|
||||
skimr::sfl(
|
||||
skim_type = "mic",
|
||||
p0 = ~ stats::quantile(., probs = 0, na.rm = TRUE, names = FALSE),
|
||||
p25 = ~ stats::quantile(., probs = 0.25, na.rm = TRUE, names = FALSE),
|
||||
p50 = ~ stats::quantile(., probs = 0.5, na.rm = TRUE, names = FALSE),
|
||||
p75 = ~ stats::quantile(., probs = 0.75, na.rm = TRUE, names = FALSE),
|
||||
p100 = ~ stats::quantile(., probs = 1, na.rm = TRUE, names = FALSE),
|
||||
hist = ~ skimr::inline_hist(log2(stats::na.omit(.)), 5)
|
||||
p0 = ~ stats::quantile(column, probs = 0, na.rm = TRUE, names = FALSE),
|
||||
p25 = ~ stats::quantile(column, probs = 0.25, na.rm = TRUE, names = FALSE),
|
||||
p50 = ~ stats::quantile(column, probs = 0.5, na.rm = TRUE, names = FALSE),
|
||||
p75 = ~ stats::quantile(column, probs = 0.75, na.rm = TRUE, names = FALSE),
|
||||
p100 = ~ stats::quantile(column, probs = 1, na.rm = TRUE, names = FALSE),
|
||||
hist = ~ skimr::inline_hist(log2(stats::na.omit(column)), 10)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
16
R/mo.R
16
R/mo.R
@@ -675,7 +675,7 @@ pillar_shaft.mo <- function(x, ...) {
|
||||
}
|
||||
|
||||
# add the names to the bugs as mouse-over!
|
||||
if (tryCatch(isTRUE(getExportedValue("ansi_has_hyperlink_support", ns = asNamespace("cli"))()), error = function(e) FALSE)) {
|
||||
if (in_rstudio()) {
|
||||
out[!x %in% c("UNKNOWN", NA)] <- font_url(
|
||||
url = paste0(
|
||||
x[!x %in% c("UNKNOWN", NA)], ": ",
|
||||
@@ -747,13 +747,17 @@ freq.mo <- function(x, ...) {
|
||||
# this prevents the requirement for putting the dependency in Imports:
|
||||
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, mo)
|
||||
get_skimmers.mo <- function(column) {
|
||||
mo <- as.mo(column, keep_synonyms = TRUE, language = NULL, info = FALSE)
|
||||
mo <- mo[!is.na(mo)]
|
||||
spp <- mo[mo_species(mo, keep_synonyms = TRUE, language = NULL, info = FALSE) != ""]
|
||||
skimr::sfl(
|
||||
skim_type = "mo",
|
||||
unique_total = ~ length(unique(stats::na.omit(.))),
|
||||
gram_negative = ~ sum(mo_is_gram_negative(.), na.rm = TRUE),
|
||||
gram_positive = ~ sum(mo_is_gram_positive(.), na.rm = TRUE),
|
||||
top_genus = ~ names(sort(-table(mo_genus(stats::na.omit(.), language = NULL))))[1L],
|
||||
top_species = ~ names(sort(-table(mo_name(stats::na.omit(.), language = NULL))))[1L]
|
||||
n_unique = ~ length(unique(mo)),
|
||||
gram_negative = ~ sum(mo_is_gram_negative(mo, keep_synonyms = TRUE, language = NULL, info = FALSE), na.rm = TRUE),
|
||||
gram_positive = ~ sum(mo_is_gram_positive(mo, keep_synonyms = TRUE, language = NULL, info = FALSE), na.rm = TRUE),
|
||||
yeast = ~ sum(mo_is_yeast(mo, keep_synonyms = TRUE, language = NULL, info = FALSE), na.rm = TRUE),
|
||||
top_genus = ~ names(sort(-table(mo_genus(mo, keep_synonyms = TRUE, language = NULL, info = FALSE))))[1L],
|
||||
top_species = ~ names(sort(-table(mo_name(spp, keep_synonyms = TRUE, language = NULL, info = FALSE))))[1L],
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
72
R/plotting.R
72
R/plotting.R
@@ -52,11 +52,19 @@
|
||||
#' @details
|
||||
#' ### The `scale_*_mic()` Functions
|
||||
#'
|
||||
#' The functions [scale_x_mic()], [scale_y_mic()], [scale_colour_mic()], and [scale_fill_mic()] functions allow to plot the [mic][as.mic()] class (MIC values) on a continuous, logarithmic scale. They also allow to rescale the MIC range with an 'inside' or 'outside' range if required, and retain the operators in MIC values (such as `>=`) if desired. Missing intermediate log2 levels will be plotted too.
|
||||
#' The functions [scale_x_mic()], [scale_y_mic()], [scale_colour_mic()], and [scale_fill_mic()] functions allow to plot the [mic][as.mic()] class (MIC values) on a continuous, logarithmic scale.
|
||||
#'
|
||||
#' There is normally no need to add these scale functions to your plot, as they are applied automatically when plotting values of class [mic][as.mic()].
|
||||
#'
|
||||
#' When manually added though, they allow to rescale the MIC range with an 'inside' or 'outside' range if required, and provide the option to retain the operators in MIC values (such as `>=`). Missing intermediate log2 levels will always be plotted too.
|
||||
#'
|
||||
#' ### The `scale_*_sir()` Functions
|
||||
#'
|
||||
#' The functions [scale_x_sir()], [scale_colour_sir()], and [scale_fill_sir()] functions allow to plot the [sir][as.sir()] class in the right order (`r paste(levels(NA_sir_), collapse = " < ")`). At default, they translate the S/I/R values to an interpretative text ("Susceptible", "Resistant", etc.) in any of the `r length(AMR:::LANGUAGES_SUPPORTED)` supported languages (use `language = NULL` to keep S/I/R). Also, except for [scale_x_sir()], they set colour-blind friendly colours to the `colour` and `fill` aesthetics.
|
||||
#' The functions [scale_x_sir()], [scale_colour_sir()], and [scale_fill_sir()] functions allow to plot the [sir][as.sir()] class in the right order (`r paste(levels(NA_sir_), collapse = " < ")`).
|
||||
#'
|
||||
#' There is normally no need to add these scale functions to your plot, as they are applied automatically when plotting values of class [sir][as.sir()].
|
||||
#'
|
||||
#' At default, they translate the S/I/R values to an interpretative text ("Susceptible", "Resistant", etc.) in any of the `r length(AMR:::LANGUAGES_SUPPORTED)` supported languages (use `language = NULL` to keep S/I/R). Also, except for [scale_x_sir()], they set colour-blind friendly colours to the `colour` and `fill` aesthetics.
|
||||
#'
|
||||
#' ### Additional `ggplot2` Functions
|
||||
#'
|
||||
@@ -114,17 +122,12 @@
|
||||
#' ) +
|
||||
#' geom_col()
|
||||
#' mic_plot +
|
||||
#' labs(title = "without scale_x_mic()")
|
||||
#' labs(title = "scale_x_mic() automatically applied")
|
||||
#' }
|
||||
#' if (require("ggplot2")) {
|
||||
#' mic_plot +
|
||||
#' scale_x_mic() +
|
||||
#' labs(title = "with scale_x_mic()")
|
||||
#' }
|
||||
#' if (require("ggplot2")) {
|
||||
#' mic_plot +
|
||||
#' scale_x_mic(keep_operators = "all") +
|
||||
#' labs(title = "with scale_x_mic() keeping all operators")
|
||||
#' scale_x_mic(keep_operators = "none") +
|
||||
#' labs(title = "with scale_x_mic() keeping no operators")
|
||||
#' }
|
||||
#' if (require("ggplot2")) {
|
||||
#' mic_plot +
|
||||
@@ -151,7 +154,7 @@
|
||||
#' ) +
|
||||
#' geom_boxplot() +
|
||||
#' geom_violin(linetype = 2, colour = "grey30", fill = NA) +
|
||||
#' scale_y_mic()
|
||||
#' labs(title = "scale_y_mic() automatically applied")
|
||||
#' }
|
||||
#' if (require("ggplot2")) {
|
||||
#' ggplot(
|
||||
@@ -183,7 +186,7 @@
|
||||
#'
|
||||
#' # Plotting using scale_y_mic() and scale_colour_sir() ------------------
|
||||
#' if (require("ggplot2")) {
|
||||
#' plain <- ggplot(
|
||||
#' mic_sir_plot <- ggplot(
|
||||
#' data.frame(
|
||||
#' mic = some_mic_values,
|
||||
#' group = some_groups,
|
||||
@@ -197,21 +200,16 @@
|
||||
#' theme_minimal() +
|
||||
#' geom_boxplot(fill = NA, colour = "grey30") +
|
||||
#' geom_jitter(width = 0.25)
|
||||
#' labs(title = "scale_y_mic()/scale_colour_sir() automatically applied")
|
||||
#'
|
||||
#' plain
|
||||
#' mic_sir_plot
|
||||
#' }
|
||||
#' if (require("ggplot2")) {
|
||||
#' # and now with our MIC and SIR scale functions:
|
||||
#' plain +
|
||||
#' scale_y_mic() +
|
||||
#' scale_colour_sir()
|
||||
#' }
|
||||
#' if (require("ggplot2")) {
|
||||
#' plain +
|
||||
#' mic_sir_plot +
|
||||
#' scale_y_mic(mic_range = c(0.005, 32), name = "Our MICs!") +
|
||||
#' scale_colour_sir(
|
||||
#' language = "pt",
|
||||
#' name = "Support in 27 languages"
|
||||
#' language = "pt", # Portuguese
|
||||
#' name = "Support in 28 languages"
|
||||
#' )
|
||||
#' }
|
||||
#' }
|
||||
@@ -229,6 +227,9 @@
|
||||
#' plot(some_sir_values)
|
||||
NULL
|
||||
|
||||
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(ggplot2::scale_type, mic)
|
||||
scale_type.mic <- function(x) c("mic", "discrete")
|
||||
|
||||
create_scale_mic <- function(aest, keep_operators, mic_range = NULL, ...) {
|
||||
ggplot_fn <- getExportedValue(paste0("scale_", aest, "_continuous"),
|
||||
ns = asNamespace("ggplot2")
|
||||
@@ -247,6 +248,7 @@ create_scale_mic <- function(aest, keep_operators, mic_range = NULL, ...) {
|
||||
as.double(rescale_mic(x = as.double(as.mic(x)), keep_operators = keep_operators, mic_range = mic_range, as.mic = TRUE))
|
||||
}
|
||||
scale$transform_df <- function(self, df) {
|
||||
out <- list()
|
||||
if (!aest %in% colnames(df)) {
|
||||
# support for geom_hline(), geom_vline(), etc
|
||||
other_x <- c("xintercept", "xmin", "xmax", "xend", "width")
|
||||
@@ -258,11 +260,11 @@ create_scale_mic <- function(aest, keep_operators, mic_range = NULL, ...) {
|
||||
} else {
|
||||
stop_("No support for plotting df with `scale_", aest, "_mic()` with columns ", vector_and(colnames(df), sort = FALSE))
|
||||
}
|
||||
out <- rescale_mic(x = as.double(as.mic(df[[aest_val]])), keep_operators = "none", mic_range = NULL, as.mic = TRUE)
|
||||
if (!is.null(self$mic_values_rescaled) && any(out < min(self$mic_values_rescaled, na.rm = TRUE) | out > max(self$mic_values_rescaled, na.rm = TRUE), na.rm = TRUE)) {
|
||||
mics <- rescale_mic(x = as.double(as.mic(df[[aest_val]])), keep_operators = "none", mic_range = NULL, as.mic = TRUE)
|
||||
if (!is.null(self$mic_values_rescaled) && any(mics < min(self$mic_values_rescaled, na.rm = TRUE) | mics > max(self$mic_values_rescaled, na.rm = TRUE), na.rm = TRUE)) {
|
||||
warning_("The value for `", aest_val, "` is outside the plotted MIC range, consider using/updating the `mic_range` argument in `scale_", aest, "_mic()`.")
|
||||
}
|
||||
df[[aest_val]] <- log2(as.double(out))
|
||||
out[[aest_val]] <- log2(as.double(mics))
|
||||
} else {
|
||||
self$mic_values_rescaled <- rescale_mic(x = as.double(as.mic(df[[aest]])), keep_operators = keep_operators, mic_range = mic_range, as.mic = TRUE)
|
||||
# create new breaks and labels here
|
||||
@@ -283,14 +285,18 @@ create_scale_mic <- function(aest, keep_operators, mic_range = NULL, ...) {
|
||||
self$mic_values_levels[1] <- paste0("<=", self$mic_values_levels[1])
|
||||
self$mic_values_levels[length(self$mic_values_levels)] <- paste0(">=", self$mic_values_levels[length(self$mic_values_levels)])
|
||||
}
|
||||
|
||||
self$mic_values_log <- log2(as.double(self$mic_values_rescaled))
|
||||
if (aest == "y" && "group" %in% colnames(df) && "x" %in% colnames(df)) {
|
||||
df$group <- as.integer(factor(df$x))
|
||||
|
||||
if (aest == "y" && "group" %in% colnames(df)) {
|
||||
if (!"x" %in% colnames(df) || all(is.na(df$x))) {
|
||||
out$group <- 1
|
||||
} else {
|
||||
out$group <- as.integer(factor(df$x))
|
||||
}
|
||||
}
|
||||
df[[aest]] <- self$mic_values_log
|
||||
out[[aest]] <- self$mic_values_log
|
||||
}
|
||||
df
|
||||
out
|
||||
}
|
||||
|
||||
scale$breaks <- function(..., self) {
|
||||
@@ -317,7 +323,6 @@ create_scale_mic <- function(aest, keep_operators, mic_range = NULL, ...) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scale$limits <- function(x, ..., self) {
|
||||
if (!is.null(self$mic_limits_set)) {
|
||||
if (is.function(self$mic_limits_set)) {
|
||||
@@ -329,7 +334,7 @@ create_scale_mic <- function(aest, keep_operators, mic_range = NULL, ...) {
|
||||
rng <- range(log2(as.mic(self$mic_values_levels)))
|
||||
# add 0.5 extra space
|
||||
rng <- c(rng[1] - 0.5, rng[2] + 0.5)
|
||||
if (!is.na(x[1]) && x[1] == 0) {
|
||||
if (!is.null(x) && !is.na(x[1]) && x[1] == 0) {
|
||||
# scale that start at 0 must remain so, e.g. in case of geom_col()
|
||||
rng[1] <- 0
|
||||
}
|
||||
@@ -377,6 +382,9 @@ scale_fill_mic <- function(keep_operators = "edges", mic_range = NULL, ...) {
|
||||
create_scale_mic("fill", keep_operators = keep_operators, mic_range = mic_range, ...)
|
||||
}
|
||||
|
||||
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(ggplot2::scale_type, sir)
|
||||
scale_type.sir <- function(x) c("sir", "discrete")
|
||||
|
||||
create_scale_sir <- function(aesthetics, colours_SIR, language, eucast_I, ...) {
|
||||
args <- list(...)
|
||||
args[c("value", "labels", "limits")] <- NULL
|
||||
|
||||
267
R/sir.R
267
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:
|
||||
#'
|
||||
#' `"none"`
|
||||
#' * `<=` and `>=` are treated as-is.
|
||||
#' * `<` and `>` are treated as-is.
|
||||
#' * `<=`, `<`, `>` and `>=` are ignored.
|
||||
#'
|
||||
#' `"conservative"`
|
||||
#' * `<=` and `>=` return `"NI"` (non-interpretable) if the MIC is within the breakpoint guideline range.
|
||||
#' * `<` always returns `"S"`, and `>` always returns `"R"`.
|
||||
#' `"conservative"` (default)
|
||||
#' * `<=`, `<`, `>` and `>=` return `"NI"` (non-interpretable) if the *true* MIC could be at either side of the breakpoint.
|
||||
#' * This is the only mode that preserves uncertainty for ECOFFs.
|
||||
#'
|
||||
#' `"standard"` (default)
|
||||
#' * `<=` and `>=` return `"NI"` (non-interpretable) if the MIC is within the breakpoint guideline range.
|
||||
#' * `<` and `>` are treated as-is.
|
||||
#' `"standard"`
|
||||
#' * `<=` and `>=` return `"NI"` (non-interpretable) if the *true* MIC could be at either side of the breakpoint.
|
||||
#' * `<` always returns `"S"`, regardless of the breakpoint.
|
||||
#' * `>` always returns `"R"`, regardless of the breakpoint.
|
||||
#'
|
||||
#' `"inverse"`
|
||||
#' * `<=` and `>=` are treated as-is.
|
||||
#' * `<` always returns `"S"`, and `>` always returns `"R"`.
|
||||
#' `"lenient"`
|
||||
#' * `<=` and `<` always return `"S"`, regardless of the breakpoint.
|
||||
#' * `>=` 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 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].
|
||||
@@ -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 threshold Maximum fraction of invalid antimicrobial interpretations of `x`, see *Examples*.
|
||||
#' @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.
|
||||
#' @details
|
||||
@@ -95,7 +95,7 @@
|
||||
#' # fast processing with parallel computing:
|
||||
#' 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.
|
||||
#'
|
||||
#' 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("<= 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)))
|
||||
#' is.sir(sir_data)
|
||||
#' 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()].
|
||||
# extra param: warn (logical, to never throw a warning)
|
||||
as.sir.default <- function(x,
|
||||
S = "^(S|U)+$",
|
||||
I = "^(I)+$",
|
||||
R = "^(R)+$",
|
||||
NI = "^(N|NI|V)+$",
|
||||
SDD = "^(SDD|D|H)+$",
|
||||
S = "^(S|U|1)+$",
|
||||
I = "^(I|2)+$",
|
||||
R = "^(R|3)+$",
|
||||
NI = "^(N|NI|V|4)+$",
|
||||
SDD = "^(SDD|D|H|5)+$",
|
||||
info = interactive(),
|
||||
...) {
|
||||
meet_criteria(S, allow_class = "character", has_length = 1)
|
||||
meet_criteria(I, allow_class = "character", has_length = 1)
|
||||
meet_criteria(R, allow_class = "character", has_length = 1)
|
||||
meet_criteria(NI, allow_class = "character", has_length = 1)
|
||||
meet_criteria(SDD, allow_class = "character", has_length = 1)
|
||||
meet_criteria(S, allow_class = c("character", "numeric", "integer"), has_length = 1)
|
||||
meet_criteria(I, allow_class = c("character", "numeric", "integer"), has_length = 1)
|
||||
meet_criteria(R, allow_class = c("character", "numeric", "integer"), has_length = 1)
|
||||
meet_criteria(NI, allow_class = c("character", "numeric", "integer"), has_length = 1)
|
||||
meet_criteria(SDD, allow_class = c("character", "numeric", "integer"), has_length = 1)
|
||||
meet_criteria(info, allow_class = "logical", has_length = 1)
|
||||
if (inherits(x, "sir")) {
|
||||
return(as_sir_structure(x))
|
||||
@@ -506,30 +510,14 @@ as.sir.default <- function(x,
|
||||
x.bak <- x
|
||||
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
|
||||
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 == 2] <- names(lbls[lbls == 2])
|
||||
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"
|
||||
x[x.bak == 1] <- names(lbls[lbls == 1])
|
||||
x[x.bak == 2] <- names(lbls[lbls == 2])
|
||||
x[x.bak == 3] <- names(lbls[lbls == 3])
|
||||
} 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
|
||||
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()`.")
|
||||
@@ -569,7 +557,8 @@ as.sir.default <- function(x,
|
||||
x[x %like% "not|non"] <- "NI"
|
||||
x[x %like% "([^a-z]|^)int(er(mediate)?)?|incr.*exp"] <- "I"
|
||||
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
|
||||
x[x %like% S] <- "S"
|
||||
x[x %like% I] <- "I"
|
||||
@@ -580,6 +569,22 @@ as.sir.default <- function(x,
|
||||
na_after <- length(x[is.na(x) | x == ""])
|
||||
|
||||
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) {
|
||||
list_missing <- x.bak[is.na(x) & !is.na(x.bak) & x.bak != ""] %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(guideline, allow_class = "character")
|
||||
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(reference_data, allow_class = "data.frame")
|
||||
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))
|
||||
if (!is.null(col_specimen)) {
|
||||
uti <- x[, col_specimen, drop = TRUE] %like% "urin"
|
||||
values <- sort(unique(x[uti, col_specimen, drop = TRUE]))
|
||||
if (length(values) > 1) {
|
||||
col_values <- sort(unique(x[uti, col_specimen, drop = TRUE]))
|
||||
if (length(col_values) > 1) {
|
||||
plural <- c("s", "", "")
|
||||
} else {
|
||||
plural <- c("", "s", "a ")
|
||||
@@ -804,7 +809,7 @@ as.sir.data.frame <- function(x,
|
||||
if (isTRUE(info)) {
|
||||
message_(
|
||||
"Assuming value", plural[1], " ",
|
||||
vector_and(values, quotes = TRUE),
|
||||
vector_and(col_values, quotes = TRUE),
|
||||
" in column '", font_bold(col_specimen),
|
||||
"' reflect", plural[2], " ", plural[3], "urinary tract infection", plural[1],
|
||||
".\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(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(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(reference_data, allow_class = "data.frame", .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
|
||||
df <- data.frame(
|
||||
values = x,
|
||||
values_bak = x,
|
||||
input_clean = x,
|
||||
input_original = x,
|
||||
guideline = guideline_coerced,
|
||||
mo = mo,
|
||||
ab = ab,
|
||||
@@ -1393,7 +1398,7 @@ as_sir_method <- function(method_short,
|
||||
# CLSI in log 2 ----
|
||||
# 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))])
|
||||
test_values <- df$values
|
||||
test_values <- df$input_clean
|
||||
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
|
||||
@@ -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") {
|
||||
# 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])
|
||||
@@ -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
|
||||
next
|
||||
}
|
||||
values <- df[rows, "values", drop = TRUE]
|
||||
values_bak <- df[rows, "values_bak", drop = TRUE]
|
||||
input_clean <- df[rows, "input_clean", drop = TRUE]
|
||||
input_original <- df[rows, "input_original", drop = TRUE]
|
||||
notes_current <- rep("", 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)),
|
||||
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)),
|
||||
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)),
|
||||
mo = vectorise_log_entry(mo_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)),
|
||||
notes = vectorise_log_entry("No breakpoint available", length(rows)),
|
||||
guideline = vectorise_log_entry(guideline_current, length(rows)),
|
||||
@@ -1734,31 +1739,51 @@ as_sir_method <- function(method_short,
|
||||
""
|
||||
),
|
||||
"\n",
|
||||
ifelse(method == "mic" & capped_mic_handling %in% c("conservative", "inverse") & as.character(values_bak) %like% "^[<][0-9]",
|
||||
paste0("MIC values with the operator '<' are all considered 'S' since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||
ifelse(method == "mic" & capped_mic_handling == "none" & 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("Operators such as '<' and '>' were ignored since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||
""
|
||||
),
|
||||
"\n",
|
||||
ifelse(method == "mic" & capped_mic_handling == "standard" & as.character(input_original) %like% "^[<][0-9]",
|
||||
paste0("MIC values with the operator '<' are considered 'S' since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||
""
|
||||
),
|
||||
"\n",
|
||||
ifelse(method == "mic" & capped_mic_handling %in% c("conservative", "inverse") & as.character(values_bak) %like% "^[>][0-9]",
|
||||
paste0("MIC values with the operator '>' are all considered 'R' since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||
ifelse(method == "mic" & capped_mic_handling == "standard" & as.character(input_original) %like% "^[>][0-9]",
|
||||
paste0("MIC values with the operator '>' are considered 'R' since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||
""
|
||||
),
|
||||
"\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,
|
||||
paste0("MIC values within the breakpoint guideline range with the operator '<=' or '>=' are considered 'NI' (non-interpretable) since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||
ifelse(method == "mic" & capped_mic_handling == "lenient" & as.character(input_original) %like% "^[<]=?[0-9]",
|
||||
paste0("MIC values with the operator '<' or '<=' are considered 'S' since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||
""
|
||||
),
|
||||
"\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,
|
||||
paste0("MIC values at the R breakpoint with the operator '<=' are considered 'NI' (non-interpretable) since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||
ifelse(method == "mic" & capped_mic_handling == "lenient" & as.character(input_original) %like% "^[>]=?[0-9]",
|
||||
paste0("MIC values with the operator '>' or '>=' are considered 'R' since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||
""
|
||||
),
|
||||
"\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,
|
||||
paste0("MIC values at the S breakpoint with the operator '>=' are considered 'NI' (non-interpretable) since capped_mic_handling = \"", capped_mic_handling, "\"."),
|
||||
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)) {
|
||||
# breakpoints_current only has 1 row at this moment
|
||||
breakpoints_current$breakpoint_R <- breakpoints_current$breakpoint_S
|
||||
@@ -1774,27 +1799,62 @@ as_sir_method <- function(method_short,
|
||||
## actual interpretation ----
|
||||
if (method == "mic") {
|
||||
new_sir <- case_when_AMR(
|
||||
is.na(values) ~ 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"),
|
||||
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 %in% c("conservative", "standard") & as.character(values_bak) %like% "^<=[0-9]" & as.double(values) == breakpoints_current$breakpoint_R ~ as.sir("NI"),
|
||||
capped_mic_handling %in% c("conservative", "standard") & as.character(values_bak) %like% "^>=[0-9]" & as.double(values) == breakpoints_current$breakpoint_S ~ as.sir("NI"),
|
||||
values <= breakpoints_current$breakpoint_S ~ as.sir("S"),
|
||||
guideline_current %like% "EUCAST" & values > breakpoints_current$breakpoint_R ~ as.sir("R"),
|
||||
guideline_current %like% "CLSI" & values >= breakpoints_current$breakpoint_R ~ as.sir("R"),
|
||||
is.na(input_clean) ~ NA_sir_,
|
||||
|
||||
# "lenient" for any cap: force S/R
|
||||
capped_mic_handling == "lenient" &
|
||||
as.character(input_original) %like% "^[<]=?[0-9]"
|
||||
~ as.sir("S"),
|
||||
capped_mic_handling == "lenient" &
|
||||
as.character(input_original) %like% "^[>]=?[0-9]"
|
||||
~ 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
|
||||
!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"),
|
||||
|
||||
# and NA otherwise
|
||||
TRUE ~ NA_sir_
|
||||
)
|
||||
} else if (method == "disk") {
|
||||
new_sir <- case_when_AMR(
|
||||
is.na(values) ~ NA_sir_,
|
||||
as.double(values) >= 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% "CLSI" & as.double(values) <= as.double(breakpoints_current$breakpoint_R) ~ as.sir("R"),
|
||||
is.na(input_clean) ~ NA_sir_,
|
||||
as.double(input_clean) >= as.double(breakpoints_current$breakpoint_S) ~ as.sir("S"),
|
||||
guideline_current %like% "EUCAST" & as.double(input_clean) < 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
|
||||
!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"),
|
||||
@@ -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)),
|
||||
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)),
|
||||
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)),
|
||||
mo = vectorise_log_entry(breakpoints_current[, "mo", 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)),
|
||||
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)),
|
||||
@@ -1974,33 +2034,18 @@ freq.sir <- function(x, ...) {
|
||||
# this prevents the requirement for putting the dependency in Imports:
|
||||
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, sir)
|
||||
get_skimmers.sir <- function(column) {
|
||||
# get the variable name 'skim_variable'
|
||||
name_call <- function(.data) {
|
||||
calls <- sys.calls()
|
||||
frms <- sys.frames()
|
||||
calls_txt <- vapply(calls, function(x) paste(deparse(x), collapse = ""), FUN.VALUE = character(1))
|
||||
if (any(calls_txt %like% "skim_variable", na.rm = TRUE)) {
|
||||
ind <- which(calls_txt %like% "skim_variable")[1L]
|
||||
vars <- tryCatch(eval(parse(text = ".data$skim_variable$sir"), envir = frms[[ind]]),
|
||||
error = function(e) NULL
|
||||
)
|
||||
tryCatch(ab_name(as.character(calls[[length(calls)]][[2]]), language = NULL, info = FALSE),
|
||||
error = function(e) NA_character_
|
||||
)
|
||||
} else {
|
||||
NA_character_
|
||||
}
|
||||
}
|
||||
|
||||
# TODO add here in AMR 3.1.0 details about guideline
|
||||
skimr::sfl(
|
||||
skim_type = "sir",
|
||||
ab_name = name_call,
|
||||
count_R = count_R,
|
||||
count_S = count_susceptible,
|
||||
# guideline = function(x) "EUCAST 2025", # or "Multiple"
|
||||
# origin = function(x) "MIC", # or "Multiple"
|
||||
count_S = count_S,
|
||||
count_I = count_I,
|
||||
prop_R = ~ proportion_R(., minimum = 0),
|
||||
prop_S = ~ susceptibility(., minimum = 0),
|
||||
prop_I = ~ proportion_I(., minimum = 0)
|
||||
count_R = count_R,
|
||||
prop_S = ~ round(proportion_S(., minimum = 0) * 100, 1),
|
||||
prop_I = ~ round(proportion_I(., minimum = 0) * 100, 1),
|
||||
prop_R = ~ round(proportion_R(., minimum = 0) * 100, 1),
|
||||
hist = ~ skimr::inline_hist(as.double(stats::na.omit(.)), 3)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
@@ -49,8 +49,11 @@ To install the latest 'beta' version:
|
||||
|
||||
```{r, eval = FALSE}
|
||||
install.packages("AMR", repos = "beta.amr-for-r.org")
|
||||
```
|
||||
|
||||
# if this does not work, try to install directly from GitHub using the 'remotes' package:
|
||||
If this does not work, try to install directly from GitHub using the `remotes` package:
|
||||
|
||||
```{r, eval = FALSE}
|
||||
remotes::install_github("msberends/AMR")
|
||||
```
|
||||
|
||||
|
||||
@@ -58,8 +58,12 @@ To install the latest ‘beta’ version:
|
||||
|
||||
``` r
|
||||
install.packages("AMR", repos = "beta.amr-for-r.org")
|
||||
```
|
||||
|
||||
# if this does not work, try to install directly from GitHub using the 'remotes' package:
|
||||
If this does not work, try to install directly from GitHub using the
|
||||
`remotes` package:
|
||||
|
||||
``` r
|
||||
remotes::install_github("msberends/AMR")
|
||||
```
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ reference:
|
||||
- "`antimicrobials`"
|
||||
- "`clinical_breakpoints`"
|
||||
- "`example_isolates`"
|
||||
- "`esbl_isolates`"
|
||||
# TODO - "`esbl_isolates`"
|
||||
- "`microorganisms.codes`"
|
||||
- "`microorganisms.groups`"
|
||||
- "`intrinsic_resistant`"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
This version is a bugfix release (v3.0.1) following the release of v3.0.0 in June 2025.
|
||||
|
||||
As with all previous >20 releases, some CHECKs on `oldrel` may return a `NOTE` for narrowly exceeding the installation size limit. This has been reduced to a minimum in prior coordination with CRAN maintainers and currently returns only an `INFO` on `release` and `devel`.
|
||||
|
||||
We treat this as a high-impact package: it was published in the *Journal of Statistical Software* (2022), is listed in the CRAN Task View "Epidemiology", and (based on cranlogs download statistics) is used globally. If there is anything to address, we would appreciate being informed before archiving the current version. We conduct extensive automated unit testing and have no indication of unresolved issues.
|
||||
|
||||
@@ -912,6 +912,24 @@ antimicrobials <- antimicrobials %>%
|
||||
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 -------------------------------------
|
||||
|
||||
@@ -35,24 +35,26 @@ library(readr)
|
||||
library(tidyr)
|
||||
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!
|
||||
|
||||
# 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
|
||||
filter(TAXONOMIC_STATUS == "C") |>
|
||||
mutate(ORGANISM_CODE = toupper(WHONET_ORG_CODE))
|
||||
|
||||
whonet_breakpoints <- read_tsv("data-raw/WHONET/Resources/Breakpoints.txt", na = c("", "NA", "-"),
|
||||
show_col_types = FALSE, guess_max = Inf) |>
|
||||
whonet_breakpoints <- read_tsv(file_breakpoints, na = c("", "NA", "-"), show_col_types = FALSE, guess_max = Inf) |>
|
||||
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) |>
|
||||
distinct(WHONET_ABX_CODE, .keep_all = TRUE)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@
|
||||
# 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.
|
||||
# Also used by eucast_rules() to expand group names.
|
||||
|
||||
@@ -36,10 +36,6 @@ library(readr)
|
||||
library(tidyr)
|
||||
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
|
||||
# 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
|
||||
@@ -48,9 +44,14 @@ devtools::load_all()
|
||||
|
||||
# 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
|
||||
filter(TAXONOMIC_STATUS == "C") %>%
|
||||
filter(TAXONOMIC_STATUS == "C") |>
|
||||
mutate(ORGANISM_CODE = toupper(WHONET_ORG_CODE))
|
||||
|
||||
whonet_organisms <- whonet_organisms %>%
|
||||
@@ -87,7 +88,7 @@ microorganisms.groups <- whonet_organisms %>%
|
||||
mo = ifelse(is.na(mo),
|
||||
as.character(as.mo(ORGANISM, keep_synonyms = TRUE, minimum_matching_score = 0)),
|
||||
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")) %>%
|
||||
bind_rows(tibble(mo_group = as.mo("CoNS"), mo = MO_CONS)) %>%
|
||||
filter(mo_group != as.mo("CoPS")) %>%
|
||||
@@ -153,7 +154,7 @@ microorganisms.groups <- whonet_organisms %>%
|
||||
filter(mo_group != "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))) %>%
|
||||
# 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") %>%
|
||||
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)))
|
||||
|
||||
@@ -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"
|
||||
"FPE" 23653540 "Cefepime/enmetazobactam" "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"
|
||||
"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"
|
||||
@@ -442,6 +443,7 @@
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1 +1 @@
|
||||
5908f9e6e7687dfb8301d27fb26d1790
|
||||
6dc4dded108052760bfb626df03435e2
|
||||
|
||||
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{
|
||||
\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_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_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()}}.
|
||||
|
||||
@@ -83,10 +83,10 @@ Other contributors:
|
||||
\item Judith M. Fonville [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 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 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 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]
|
||||
|
||||
@@ -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[=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[=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_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[=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[=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[=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/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), 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/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_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_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[=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)
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
\alias{antimicrobials}
|
||||
\alias{antibiotics}
|
||||
\alias{antivirals}
|
||||
\title{Data Sets with 616 Antimicrobial Drugs}
|
||||
\title{Data Sets with 618 Antimicrobial Drugs}
|
||||
\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{
|
||||
\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.}}
|
||||
@@ -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.
|
||||
}
|
||||
|
||||
@@ -32,8 +32,9 @@ is.sir(x)
|
||||
|
||||
is_sir_eligible(x, threshold = 0.05)
|
||||
|
||||
\method{as.sir}{default}(x, S = "^(S|U)+$", I = "^(I)+$", R = "^(R)+$",
|
||||
NI = "^(N|NI|V)+$", SDD = "^(SDD|D|H)+$", info = interactive(), ...)
|
||||
\method{as.sir}{default}(x, S = "^(S|U|1)+$", I = "^(I|2)+$",
|
||||
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)),
|
||||
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
||||
@@ -75,7 +76,7 @@ sir_interpretation_history(clean = FALSE)
|
||||
\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{...}{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.}
|
||||
|
||||
@@ -97,29 +98,29 @@ Otherwise: arguments passed on to methods.}
|
||||
|
||||
\code{"none"}
|
||||
\itemize{
|
||||
\item \code{<=} and \code{>=} are treated as-is.
|
||||
\item \code{<} and \code{>} are treated as-is.
|
||||
\item \code{<=}, \code{<}, \code{>} and \code{>=} are ignored.
|
||||
}
|
||||
|
||||
\code{"conservative"}
|
||||
\code{"conservative"} (default)
|
||||
\itemize{
|
||||
\item \code{<=} and \code{>=} return \code{"NI"} (non-interpretable) if the MIC is within the breakpoint guideline range.
|
||||
\item \code{<} always returns \code{"S"}, and \code{>} always returns \code{"R"}.
|
||||
\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 This is the only mode that preserves uncertainty for ECOFFs.
|
||||
}
|
||||
|
||||
\code{"standard"} (default)
|
||||
\code{"standard"}
|
||||
\itemize{
|
||||
\item \code{<=} and \code{>=} return \code{"NI"} (non-interpretable) if the MIC is within the breakpoint guideline range.
|
||||
\item \code{<} and \code{>} are treated as-is.
|
||||
\item \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"}, regardless of the breakpoint.
|
||||
\item \code{>} always returns \code{"R"}, regardless of the breakpoint.
|
||||
}
|
||||
|
||||
\code{"inverse"}
|
||||
\code{"lenient"}
|
||||
\itemize{
|
||||
\item \code{<=} and \code{>=} are treated as-is.
|
||||
\item \code{<} always returns \code{"S"}, and \code{>} always returns \code{"R"}.
|
||||
\item \code{<=} and \code{<} always return \code{"S"}, regardless of the breakpoint.
|
||||
\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).}
|
||||
|
||||
@@ -179,7 +180,7 @@ your_data \%>\% mutate_if(is.mic, as.sir, host = "column_with_animal_species", g
|
||||
# fast processing with parallel computing:
|
||||
as.sir(your_data, ..., parallel = TRUE)
|
||||
}\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 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("<= 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)))
|
||||
is.sir(sir_data)
|
||||
plot(sir_data) # for percentages
|
||||
|
||||
@@ -104,16 +104,16 @@ These 35 antimicrobial groups are allowed in the rules (case-insensitive) and ca
|
||||
\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 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_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 carbapenems\cr(biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA, imipenem/relebactam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem acoxil, 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 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/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, 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/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_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_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_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 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)
|
||||
|
||||
@@ -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[=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[=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_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[=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[=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[=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/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, 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/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_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_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[=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
|
||||
|
||||
@@ -108,26 +108,30 @@ All mentioned methods are covered in the \code{\link[=first_isolate]{first_isola
|
||||
- Any difference in key antimicrobial results \tab - \code{first_isolate(x, type = "keyantimicrobials")} \cr
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
\subsection{Isolate-based}{
|
||||
\strong{Isolate-based}
|
||||
|
||||
\emph{Minimum variables required: Microorganism identifier}
|
||||
|
||||
This method does not require any selection, as all isolates should be included. It does, however, respect all arguments set in the \code{\link[=first_isolate]{first_isolate()}} function. For example, the default setting for \code{include_unknown} (\code{FALSE}) will omit selection of rows without a microbial ID.
|
||||
}
|
||||
|
||||
\subsection{Patient-based}{
|
||||
\strong{Patient-based}
|
||||
|
||||
To include every genus-species combination per patient once, set the \code{episode_days} to \code{Inf}. This method makes sure that no duplicate isolates are selected from the same patient. This method is preferred to e.g. identify the first MRSA finding of each patient to determine the incidence. Conversely, in a large longitudinal data set, this could mean that isolates are \emph{excluded} that were found years after the initial isolate.
|
||||
}
|
||||
\emph{Minimum variables required: Microorganism identifier, Patient identifier}
|
||||
|
||||
\subsection{Episode-based}{
|
||||
This method includes every genus-species combination per patient once. This method makes sure that no duplicate isolates are selected from the same patient. This method is preferred to e.g. identify the first MRSA finding of each patient to determine the incidence. Conversely, in a large longitudinal data set, this could mean that isolates are \emph{excluded} that were found years after the initial isolate.
|
||||
|
||||
To include every genus-species combination per patient episode once, set the \code{episode_days} to a sensible number of days. Depending on the type of analysis, this could be 14, 30, 60 or 365. Short episodes are common for analysing specific hospital or ward data or ICU cases, long episodes are common for analysing regional and national data.
|
||||
\strong{Episode-based}
|
||||
|
||||
\emph{Minimum variables required: Microorganism identifier, Patient identifier, Date}
|
||||
|
||||
To include every genus-species combination per patient episode once, set the \code{episode_days} to a sensible number of days. Depending on the type of analysis, this could be e.g., 14, 30, 60 or 365. Short episodes are common for analysing specific hospital or ward data or ICU cases, long episodes are common for analysing regional and national data.
|
||||
|
||||
This is the most common method to correct for duplicate isolates. Patients are categorised into episodes based on their ID and dates (e.g., the date of specimen receipt or laboratory result). While this is a common method, it does not take into account antimicrobial test results. This means that e.g. a methicillin-resistant \emph{Staphylococcus aureus} (MRSA) isolate cannot be differentiated from a wildtype \emph{Staphylococcus aureus} isolate.
|
||||
}
|
||||
|
||||
\subsection{Phenotype-based}{
|
||||
\strong{Phenotype-based}
|
||||
|
||||
\emph{Minimum variables required: Microorganism identifier, Patient identifier, Date, Antimicrobial test results}
|
||||
|
||||
This is a more reliable method, since it also \emph{weighs} the antibiogram (antimicrobial test results) yielding so-called 'first weighted isolates'. There are two different methods to weigh the antibiogram:
|
||||
\enumerate{
|
||||
|
||||
@@ -18,7 +18,7 @@ A \link[tibble:tibble]{tibble} with 78 679 observations and 26 variables:
|
||||
\item \code{lpsn}\cr Identifier ('Record number') of List of Prokaryotic names with Standing in Nomenclature (LPSN). This will be the first/highest LPSN identifier to keep one identifier per row. For example, \emph{Acetobacter ascendens} has LPSN Record number 7864 and 11011. Only the first is available in the \code{microorganisms} data set. \emph{\strong{This is a unique identifier}}, though available for only ~33 000 records.
|
||||
\item \code{lpsn_parent}\cr LPSN identifier of the parent taxon
|
||||
\item \code{lpsn_renamed_to}\cr LPSN identifier of the currently valid taxon
|
||||
\item \code{mycobank}\cr Identifier ('MycoBank #') of MycoBank. \emph{\strong{This is a unique identifier}}, though available for only ~18 000 records.
|
||||
\item \code{mycobank}\cr Identifier ('MycoBank #') of MycoBank. \emph{\strong{This is a unique identifier}}, though available for only ~19 000 records.
|
||||
\item \code{mycobank_parent}\cr MycoBank identifier of the parent taxon
|
||||
\item \code{mycobank_renamed_to}\cr MycoBank identifier of the currently valid taxon
|
||||
\item \code{gbif}\cr Identifier ('taxonID') of Global Biodiversity Information Facility (GBIF). \emph{\strong{This is a unique identifier}}, though available for only ~49 000 records.
|
||||
@@ -70,7 +70,7 @@ Included taxonomic data from \href{https://lpsn.dsmz.de}{LPSN}, \href{https://ww
|
||||
\item ~28 000 species from the kingdom of Fungi. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package. Only relevant fungi are covered (such as all species of \emph{Aspergillus}, \emph{Candida}, \emph{Cryptococcus}, \emph{Histoplasma}, \emph{Pneumocystis}, \emph{Saccharomyces} and \emph{Trichophyton}).
|
||||
\item ~8 100 (sub)species from the kingdom of Protozoa
|
||||
\item ~1 600 (sub)species from 39 other relevant genera from the kingdom of Animalia (such as \emph{Strongyloides} and \emph{Taenia})
|
||||
\item All ~22 000 previously accepted names of all included (sub)species (these were taxonomically renamed)
|
||||
\item All ~26 000 previously accepted names of all included (sub)species (these were taxonomically renamed)
|
||||
\item The complete taxonomic tree of all included (sub)species: from kingdom to subspecies
|
||||
\item The identifier of the parent taxons
|
||||
\item The year and first author of the related scientific publication
|
||||
|
||||
42
man/plot.Rd
42
man/plot.Rd
@@ -172,12 +172,20 @@ Especially the \verb{scale_*_mic()} functions are relevant wrappers to plot MIC
|
||||
\details{
|
||||
\subsection{The \verb{scale_*_mic()} Functions}{
|
||||
|
||||
The functions \code{\link[=scale_x_mic]{scale_x_mic()}}, \code{\link[=scale_y_mic]{scale_y_mic()}}, \code{\link[=scale_colour_mic]{scale_colour_mic()}}, and \code{\link[=scale_fill_mic]{scale_fill_mic()}} functions allow to plot the \link[=as.mic]{mic} class (MIC values) on a continuous, logarithmic scale. They also allow to rescale the MIC range with an 'inside' or 'outside' range if required, and retain the operators in MIC values (such as \code{>=}) if desired. Missing intermediate log2 levels will be plotted too.
|
||||
The functions \code{\link[=scale_x_mic]{scale_x_mic()}}, \code{\link[=scale_y_mic]{scale_y_mic()}}, \code{\link[=scale_colour_mic]{scale_colour_mic()}}, and \code{\link[=scale_fill_mic]{scale_fill_mic()}} functions allow to plot the \link[=as.mic]{mic} class (MIC values) on a continuous, logarithmic scale.
|
||||
|
||||
There is normally no need to add these scale functions to your plot, as they are applied automatically when plotting values of class \link[=as.mic]{mic}.
|
||||
|
||||
When manually added though, they allow to rescale the MIC range with an 'inside' or 'outside' range if required, and provide the option to retain the operators in MIC values (such as \code{>=}). Missing intermediate log2 levels will always be plotted too.
|
||||
}
|
||||
|
||||
\subsection{The \verb{scale_*_sir()} Functions}{
|
||||
|
||||
The functions \code{\link[=scale_x_sir]{scale_x_sir()}}, \code{\link[=scale_colour_sir]{scale_colour_sir()}}, and \code{\link[=scale_fill_sir]{scale_fill_sir()}} functions allow to plot the \link[=as.sir]{sir} class in the right order (S < SDD < I < R < NI). At default, they translate the S/I/R values to an interpretative text ("Susceptible", "Resistant", etc.) in any of the 28 supported languages (use \code{language = NULL} to keep S/I/R). Also, except for \code{\link[=scale_x_sir]{scale_x_sir()}}, they set colour-blind friendly colours to the \code{colour} and \code{fill} aesthetics.
|
||||
The functions \code{\link[=scale_x_sir]{scale_x_sir()}}, \code{\link[=scale_colour_sir]{scale_colour_sir()}}, and \code{\link[=scale_fill_sir]{scale_fill_sir()}} functions allow to plot the \link[=as.sir]{sir} class in the right order (S < SDD < I < R < NI).
|
||||
|
||||
There is normally no need to add these scale functions to your plot, as they are applied automatically when plotting values of class \link[=as.sir]{sir}.
|
||||
|
||||
At default, they translate the S/I/R values to an interpretative text ("Susceptible", "Resistant", etc.) in any of the 28 supported languages (use \code{language = NULL} to keep S/I/R). Also, except for \code{\link[=scale_x_sir]{scale_x_sir()}}, they set colour-blind friendly colours to the \code{colour} and \code{fill} aesthetics.
|
||||
}
|
||||
|
||||
\subsection{Additional \code{ggplot2} Functions}{
|
||||
@@ -235,17 +243,12 @@ if (require("ggplot2")) {
|
||||
) +
|
||||
geom_col()
|
||||
mic_plot +
|
||||
labs(title = "without scale_x_mic()")
|
||||
labs(title = "scale_x_mic() automatically applied")
|
||||
}
|
||||
if (require("ggplot2")) {
|
||||
mic_plot +
|
||||
scale_x_mic() +
|
||||
labs(title = "with scale_x_mic()")
|
||||
}
|
||||
if (require("ggplot2")) {
|
||||
mic_plot +
|
||||
scale_x_mic(keep_operators = "all") +
|
||||
labs(title = "with scale_x_mic() keeping all operators")
|
||||
scale_x_mic(keep_operators = "none") +
|
||||
labs(title = "with scale_x_mic() keeping no operators")
|
||||
}
|
||||
if (require("ggplot2")) {
|
||||
mic_plot +
|
||||
@@ -272,7 +275,7 @@ if (require("ggplot2")) {
|
||||
) +
|
||||
geom_boxplot() +
|
||||
geom_violin(linetype = 2, colour = "grey30", fill = NA) +
|
||||
scale_y_mic()
|
||||
labs(title = "scale_y_mic() automatically applied")
|
||||
}
|
||||
if (require("ggplot2")) {
|
||||
ggplot(
|
||||
@@ -304,7 +307,7 @@ if (require("ggplot2")) {
|
||||
|
||||
# Plotting using scale_y_mic() and scale_colour_sir() ------------------
|
||||
if (require("ggplot2")) {
|
||||
plain <- ggplot(
|
||||
mic_sir_plot <- ggplot(
|
||||
data.frame(
|
||||
mic = some_mic_values,
|
||||
group = some_groups,
|
||||
@@ -318,21 +321,16 @@ if (require("ggplot2")) {
|
||||
theme_minimal() +
|
||||
geom_boxplot(fill = NA, colour = "grey30") +
|
||||
geom_jitter(width = 0.25)
|
||||
labs(title = "scale_y_mic()/scale_colour_sir() automatically applied")
|
||||
|
||||
plain
|
||||
mic_sir_plot
|
||||
}
|
||||
if (require("ggplot2")) {
|
||||
# and now with our MIC and SIR scale functions:
|
||||
plain +
|
||||
scale_y_mic() +
|
||||
scale_colour_sir()
|
||||
}
|
||||
if (require("ggplot2")) {
|
||||
plain +
|
||||
mic_sir_plot +
|
||||
scale_y_mic(mic_range = c(0.005, 32), name = "Our MICs!") +
|
||||
scale_colour_sir(
|
||||
language = "pt",
|
||||
name = "Support in 27 languages"
|
||||
language = "pt", # Portuguese
|
||||
name = "Support in 28 languages"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ $(function () {
|
||||
x = x.replace("Kathryn", "Prof. Kathryn");
|
||||
x = x.replace("Larisse", "Dr. Larisse");
|
||||
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("Rogier", "Dr. Rogier");
|
||||
x = x.replace("Sofia", "Dr. Sofia");
|
||||
|
||||
@@ -70,14 +70,14 @@ test_that("test-misc.R", {
|
||||
}
|
||||
|
||||
df <- example_isolates[, check_df("x")]
|
||||
expect_true(is_right, info = "the environmental data cannot be found for base/x (1)")
|
||||
expect_true(is_right, info = "the environmental data cannot be found for base `x`")
|
||||
|
||||
if (getRversion() < "4.0.0") {
|
||||
# should work on R >=3.6.3 or so
|
||||
df <- example_isolates[c(1:3), check_df("x")]
|
||||
if (!is_right) {
|
||||
# otherwise, this is needed for older versions
|
||||
df <- example_isolates[c(1:3), check_df("xx")]
|
||||
expect_true(is_right, info = "the environmental data cannot be found for base/xx")
|
||||
} else {
|
||||
df <- example_isolates[c(1:3), check_df("x")]
|
||||
expect_true(is_right, info = "the environmental data cannot be found for base/x (2)")
|
||||
expect_true(is_right, info = "the environmental data cannot be found for base `x` or `xx`")
|
||||
}
|
||||
|
||||
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0", also_load = TRUE)) {
|
||||
|
||||
@@ -96,6 +96,14 @@ test_that("test-ab.R", {
|
||||
rep("GEH", 8)
|
||||
)
|
||||
|
||||
# skimr
|
||||
if (AMR:::pkg_is_available("skimr", min_version = "2.0.0", also_load = TRUE)) {
|
||||
expect_named(
|
||||
skim(clinical_breakpoints$ab),
|
||||
c("skim_type", "skim_variable", "n_missing", "complete_rate", "ab.n_unique", "ab.top_ab", "ab.top_ab_name", "ab.top_group")
|
||||
)
|
||||
}
|
||||
|
||||
# assigning and subsetting
|
||||
x <- AMR::antimicrobials$ab
|
||||
expect_inherits(x[1], "ab")
|
||||
|
||||
@@ -32,6 +32,9 @@ test_that("test-antibiogram.R", {
|
||||
|
||||
# Traditional antibiogram ----------------------------------------------
|
||||
|
||||
|
||||
ab0 <- antibiogram(example_isolates)
|
||||
|
||||
ab1 <- antibiogram(example_isolates,
|
||||
antimicrobials = c(aminoglycosides(), carbapenems())
|
||||
)
|
||||
|
||||
@@ -60,4 +60,12 @@ test_that("test-disk.R", {
|
||||
if (AMR:::pkg_is_available("tibble")) {
|
||||
expect_output(print(tibble::tibble(d = as.disk(12))))
|
||||
}
|
||||
|
||||
# skimr
|
||||
if (AMR:::pkg_is_available("skimr", min_version = "2.0.0", also_load = TRUE)) {
|
||||
expect_named(
|
||||
skim(random_disk(100)),
|
||||
c("skim_type", "skim_variable", "n_missing", "complete_rate", "disk.p0", "disk.p25", "disk.p50", "disk.p75", "disk.p100", "disk.hist")
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -81,6 +81,14 @@ test_that("test-mic.R", {
|
||||
expect_output(print(tibble::tibble(m = as.mic(2:4))))
|
||||
}
|
||||
|
||||
# skimr
|
||||
if (AMR:::pkg_is_available("skimr", min_version = "2.0.0", also_load = TRUE)) {
|
||||
expect_named(
|
||||
skim(random_mic(100)),
|
||||
c("skim_type", "skim_variable", "n_missing", "complete_rate", "mic.p0", "mic.p25", "mic.p50", "mic.p75", "mic.p100", "mic.hist")
|
||||
)
|
||||
}
|
||||
|
||||
# all mathematical operations
|
||||
x <- random_mic(50)
|
||||
x_double <- as.double(gsub("[<=>]+", "", as.character(x)))
|
||||
|
||||
@@ -321,4 +321,12 @@ test_that("test-mo.R", {
|
||||
if (AMR:::pkg_is_available("cleaner")) {
|
||||
expect_inherits(cleaner::freq(example_isolates$mo), "freq")
|
||||
}
|
||||
|
||||
# skimr
|
||||
if (AMR:::pkg_is_available("skimr", min_version = "2.0.0", also_load = TRUE)) {
|
||||
expect_named(
|
||||
skim(example_isolates$mo),
|
||||
c("skim_type", "skim_variable", "n_missing", "complete_rate", "mo.n_unique", "mo.gram_negative", "mo.gram_positive", "mo.yeast", "mo.top_genus", "mo.top_species")
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -115,7 +115,7 @@ test_that("test-mo_property.R", {
|
||||
|
||||
expect_equal(
|
||||
as.character(table(mo_pathogenicity(example_isolates$mo))),
|
||||
c("1911", "72", "1", "16")
|
||||
c("1911", "66", "1", "22")
|
||||
)
|
||||
|
||||
expect_equal(mo_ref("Escherichia coli"), "Castellani et al., 1919")
|
||||
|
||||
@@ -103,22 +103,13 @@ test_that("test-sir.R", {
|
||||
pull(MEM) %>%
|
||||
is.sir())
|
||||
}
|
||||
|
||||
# skimr
|
||||
if (AMR:::pkg_is_available("skimr", min_version = "2.0.0", also_load = TRUE)) {
|
||||
expect_inherits(
|
||||
skim(example_isolates),
|
||||
"data.frame"
|
||||
expect_named(
|
||||
skim(example_isolates$PEN),
|
||||
c("skim_type", "skim_variable", "n_missing", "complete_rate", "sir.count_S", "sir.count_I", "sir.count_R", "sir.prop_S", "sir.prop_I", "sir.prop_R", "sir.hist")
|
||||
)
|
||||
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0", also_load = TRUE)) {
|
||||
expect_inherits(
|
||||
example_isolates %>%
|
||||
mutate(
|
||||
m = as.mic(2),
|
||||
d = as.disk(20)
|
||||
) %>%
|
||||
skim(),
|
||||
"data.frame"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
expect_equal(as.sir(c("", "-", NA, "NULL")), c(NA_sir_, NA_sir_, NA_sir_, NA_sir_))
|
||||
@@ -400,6 +391,17 @@ test_that("test-sir.R", {
|
||||
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 ----------------------------------------------------
|
||||
|
||||
# MB 29 Apr 2025: I have run the code of AVC, PEI, Canada (dataset of 2854x65), and compared it like this:
|
||||
|
||||
@@ -221,142 +221,16 @@ In this second example, we demonstrate how to use `<mic>` columns directly in `t
|
||||
|
||||
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).
|
||||
|
||||
### **Objective**
|
||||
> NOTE: THIS EXAMPLE WILL BE AVAILABLE IN A NEXT VERSION (#TODO)
|
||||
>
|
||||
> The new AMR package version will contain new tidymodels selectors such as `step_mic_log2()`.
|
||||
|
||||
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(testing_data)
|
||||
|
||||
# Evaluate model performance
|
||||
our_metrics <- metric_set(accuracy, kap, 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.
|
||||
|
||||
It appears we can predict ESBL gene presence with a positive predictive value (PPV) of `r round(metrics$.estimate[3], 3) * 100`% and a negative predictive value (NPV) of `r round(metrics$.estimate[4], 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()
|
||||
```
|
||||
|
||||
### **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 ordered MICs to log2-transformed numerics, improving compatibility with classification models.
|
||||
|
||||
This pipeline enables realistic, reproducible, and interpretable modelling of antimicrobial resistance data.
|
||||
<!-- TODO for AMR v3.1.0: add info from here: https://github.com/msberends/AMR/blob/2461631bcefa78ebdb37bdfad359be74cdd9165a/vignettes/AMR_with_tidymodels.Rmd#L212-L291 -->
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Example 3: Predicting AMR Over Time
|
||||
## Example 2: 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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user