mirror of
https://github.com/msberends/AMR.git
synced 2025-04-22 06:03:47 +02:00
Compare commits
No commits in common. "6cc273bbc798fe6c7452e4ac0f269704a0a12c79" and "58d7aa87907408320d36d585b99d8afdc5e36088" have entirely different histories.
6cc273bbc7
...
58d7aa8790
1
.github/workflows/website.yaml
vendored
1
.github/workflows/website.yaml
vendored
@ -40,6 +40,7 @@ name: Update website
|
|||||||
jobs:
|
jobs:
|
||||||
update-website:
|
update-website:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 2.1.1.9201
|
Version: 2.1.1.9199
|
||||||
Date: 2025-03-14
|
Date: 2025-03-14
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||||
|
4
NEWS.md
4
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# AMR 2.1.1.9201
|
# AMR 2.1.1.9199
|
||||||
|
|
||||||
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://msberends.github.io/AMR/#latest-development-version).)*
|
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://msberends.github.io/AMR/#latest-development-version).)*
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ This package now supports not only tools for AMR data analysis in clinical setti
|
|||||||
* It is now possible to use column names for argument `ab`, `mo`, and `uti`: `as.sir(..., ab = "column1", mo = "column2", uti = "column3")`. This greatly improves the flexibility for users.
|
* It is now possible to use column names for argument `ab`, `mo`, and `uti`: `as.sir(..., ab = "column1", mo = "column2", uti = "column3")`. This greatly improves the flexibility for users.
|
||||||
* Users can now set their own criteria (using regular expressions) as to what should be considered S, I, R, SDD, and NI.
|
* Users can now set their own criteria (using regular expressions) as to what should be considered S, I, R, SDD, and NI.
|
||||||
* To get quantitative values, `as.double()` on a `sir` object will return 1 for S, 2 for SDD/I, and 3 for R (NI will become `NA`). Other functions using `sir` classes (e.g., `summary()`) are updated to reflect the change to contain NI and SDD.
|
* To get quantitative values, `as.double()` on a `sir` object will return 1 for S, 2 for SDD/I, and 3 for R (NI will become `NA`). Other functions using `sir` classes (e.g., `summary()`) are updated to reflect the change to contain NI and SDD.
|
||||||
* The argument `conserve_capped_values` in `as.sir()` has been replaced with `capped_mic_handling`, which allows greater flexibility in handling capped MIC values (`<`, `<=`, `>`, `>=`). The four available options (`"standard"`, `"strict"`, `"relaxed"`, `"inverse"`) provide full control over whether these values should be interpreted conservatively or ignored. Using `conserve_capped_values` is now deprecated and returns a warning.
|
* Fix for `conserve_capped_values`, which now again works as expected: in MIC values, `<x` will always be S, `>x` will always be R
|
||||||
* `antibiogram()` function
|
* `antibiogram()` function
|
||||||
* Argument `antibiotics` has been renamed to `antimicrobials`. Using `antibiotics` will still work, but now returns a warning.
|
* Argument `antibiotics` has been renamed to `antimicrobials`. Using `antibiotics` will still work, but now returns a warning.
|
||||||
* Added argument `formatting_type` to set any of the 22 options for the formatting of all 'cells'. This defaults to `18` for non-WISCA and `14` for WISCA, changing the output of antibiograms to cells with more info.
|
* Added argument `formatting_type` to set any of the 22 options for the formatting of all 'cells'. This defaults to `18` for non-WISCA and `14` for WISCA, changing the output of antibiograms to cells with more info.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Metadata-Version: 2.2
|
Metadata-Version: 2.2
|
||||||
Name: AMR
|
Name: AMR
|
||||||
Version: 2.1.1.9201
|
Version: 2.1.1.9199
|
||||||
Summary: A Python wrapper for the AMR R package
|
Summary: A Python wrapper for the AMR R package
|
||||||
Home-page: https://github.com/msberends/AMR
|
Home-page: https://github.com/msberends/AMR
|
||||||
Author: Matthijs Berends
|
Author: Matthijs Berends
|
||||||
|
Binary file not shown.
BIN
PythonPackage/AMR/dist/amr-2.1.1.9199.tar.gz
vendored
Normal file
BIN
PythonPackage/AMR/dist/amr-2.1.1.9199.tar.gz
vendored
Normal file
Binary file not shown.
BIN
PythonPackage/AMR/dist/amr-2.1.1.9201.tar.gz
vendored
BIN
PythonPackage/AMR/dist/amr-2.1.1.9201.tar.gz
vendored
Binary file not shown.
@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='AMR',
|
name='AMR',
|
||||||
version='2.1.1.9201',
|
version='2.1.1.9199',
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'rpy2',
|
'rpy2',
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#' @section Options:
|
#' @section Options:
|
||||||
#' * `AMR_antibiogram_formatting_type` \cr A [numeric] (1-22) to use in [antibiogram()], to indicate which formatting type to use.
|
#' * `AMR_antibiogram_formatting_type` \cr A [numeric] (1-22) to use in [antibiogram()], to indicate which formatting type to use.
|
||||||
#' * `AMR_breakpoint_type` \cr A [character] to use in [as.sir()], to indicate which breakpoint type to use. This must be either `r vector_or(clinical_breakpoints$type)`.
|
#' * `AMR_breakpoint_type` \cr A [character] to use in [as.sir()], to indicate which breakpoint type to use. This must be either `r vector_or(clinical_breakpoints$type)`.
|
||||||
#' * `AMR_capped_mic_handling` \cr A [character] to use in [as.sir()], to indicate how capped MIC values (`<`, `<=`, `>`, `>=`) should be interpreted. Must be one of `"standard"`, `"strict"`, `"relaxed"`, or `"inverse"` - the default is `"standard"`.
|
|
||||||
#' * `AMR_cleaning_regex` \cr A [regular expression][base::regex] (case-insensitive) to use in [as.mo()] and all [`mo_*`][mo_property()] functions, to clean the user input. The default is the outcome of [mo_cleaning_regex()], which removes texts between brackets and texts such as "species" and "serovar".
|
#' * `AMR_cleaning_regex` \cr A [regular expression][base::regex] (case-insensitive) to use in [as.mo()] and all [`mo_*`][mo_property()] functions, to clean the user input. The default is the outcome of [mo_cleaning_regex()], which removes texts between brackets and texts such as "species" and "serovar".
|
||||||
#' * `AMR_custom_ab` \cr A file location to an RDS file, to use custom antimicrobial drugs with this package. This is explained in [add_custom_antimicrobials()].
|
#' * `AMR_custom_ab` \cr A file location to an RDS file, to use custom antimicrobial drugs with this package. This is explained in [add_custom_antimicrobials()].
|
||||||
#' * `AMR_custom_mo` \cr A file location to an RDS file, to use custom microorganisms with this package. This is explained in [add_custom_microorganisms()].
|
#' * `AMR_custom_mo` \cr A file location to an RDS file, to use custom microorganisms with this package. This is explained in [add_custom_microorganisms()].
|
||||||
|
8
R/ab.R
8
R/ab.R
@ -172,11 +172,11 @@ as.ab <- function(x, flag_multiple_results = TRUE, language = get_AMR_locale(),
|
|||||||
x_new[known_codes_cid] <- AMR_env$AB_lookup$ab[match(x[known_codes_cid], AMR_env$AB_lookup$cid)]
|
x_new[known_codes_cid] <- AMR_env$AB_lookup$ab[match(x[known_codes_cid], AMR_env$AB_lookup$cid)]
|
||||||
previously_coerced <- x %in% AMR_env$ab_previously_coerced$x
|
previously_coerced <- x %in% AMR_env$ab_previously_coerced$x
|
||||||
x_new[previously_coerced & is.na(x_new)] <- AMR_env$ab_previously_coerced$ab[match(x[is.na(x_new) & x %in% AMR_env$ab_previously_coerced$x], AMR_env$ab_previously_coerced$x)]
|
x_new[previously_coerced & is.na(x_new)] <- AMR_env$ab_previously_coerced$ab[match(x[is.na(x_new) & x %in% AMR_env$ab_previously_coerced$x], AMR_env$ab_previously_coerced$x)]
|
||||||
if (any(previously_coerced) && isTRUE(info) && message_not_thrown_before("as.ab", entire_session = TRUE)) {
|
prev <- x_bak[which(x[which(previously_coerced)] %in% x_bak_clean)]
|
||||||
|
if (any(previously_coerced) && isTRUE(info) && message_not_thrown_before("as.ab", prev, entire_session = TRUE)) {
|
||||||
message_(
|
message_(
|
||||||
"Returning previously coerced ",
|
"Returning previously coerced value", ifelse(length(unique(prev)) > 1, "s", ""),
|
||||||
ifelse(length(unique(which(x[which(previously_coerced)] %in% x_bak_clean))) > 1, "value for an antimicrobial", "values for various antimicrobials"),
|
" for ", vector_and(prev), ". Run `ab_reset_session()` to reset this. This note will be shown once per session for this input."
|
||||||
". Run `ab_reset_session()` to reset this. This note will be shown once per session."
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
71
R/sir.R
71
R/sir.R
@ -44,17 +44,7 @@
|
|||||||
#' @param uti (Urinary Tract Infection) a vector (or column name) with [logical]s (`TRUE` or `FALSE`) to specify whether a UTI specific interpretation from the guideline should be chosen. For using [as.sir()] on a [data.frame], this can also be a column containing [logical]s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See *Examples*.
|
#' @param uti (Urinary Tract Infection) a vector (or column name) with [logical]s (`TRUE` or `FALSE`) to specify whether a UTI specific interpretation from the guideline should be chosen. For using [as.sir()] on a [data.frame], this can also be a column containing [logical]s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See *Examples*.
|
||||||
#' @inheritParams first_isolate
|
#' @inheritParams first_isolate
|
||||||
#' @param guideline defaults to `r AMR::clinical_breakpoints$guideline[1]` (the latest implemented EUCAST guideline in the [AMR::clinical_breakpoints] data set), but can be set with the package option [`AMR_guideline`][AMR-options]. Currently supports EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`), see *Details*.
|
#' @param guideline defaults to `r AMR::clinical_breakpoints$guideline[1]` (the latest implemented EUCAST guideline in the [AMR::clinical_breakpoints] data set), but can be set with the package option [`AMR_guideline`][AMR-options]. Currently supports EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`), see *Details*.
|
||||||
#' @param capped_mic_handling A [character] string that controls how MIC values with a cap (i.e., starting with `<`, `<=`, `>`, or `>=`) are interpreted. Supports the following options:
|
#' @param conserve_capped_values a [logical] to indicate that MIC values starting with `">"` (but not `">="`) must always return "R" , and that MIC values starting with `"<"` (but not `"<="`) must always return "S"
|
||||||
#' - `"standard"` (default)\cr
|
|
||||||
#' `<=` and `>=` return `"NI"` if the value is **within** the breakpoint guideline range, while `<` and `>` are interpreted normally.
|
|
||||||
#' - `"strict"`\cr
|
|
||||||
#' Enforces conservative handling; `<` always returns `"S"`, `>` always returns `"R"`, and `<=`/`>=` return `"NI"` when within breakpoint guideline range.
|
|
||||||
#' - `"relaxed"`\cr
|
|
||||||
#' Ignores all signs, treating values as their numeric equivalents (e.g., `>0.5` is regarded `0.5`).
|
|
||||||
#' - `"inverse"`\cr
|
|
||||||
#' Opposite of `"standard"`; `<` always returns `"S"`, `>` always returns `"R"`, and `<=`/`>=` are treated as their numeric equivalents
|
|
||||||
#'
|
|
||||||
#' 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].
|
|
||||||
#' @param add_intrinsic_resistance *(only useful when using a EUCAST guideline)* a [logical] to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in *Klebsiella* species. Determination is based on the [intrinsic_resistant] data set, that itself is based on `r format_eucast_version_nr(3.3)`.
|
#' @param add_intrinsic_resistance *(only useful when using a EUCAST guideline)* a [logical] to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in *Klebsiella* species. Determination is based on the [intrinsic_resistant] data set, that itself is based on `r format_eucast_version_nr(3.3)`.
|
||||||
#' @param substitute_missing_r_breakpoint a [logical] to indicate that a missing clinical breakpoints for R (resistant) must be substituted with R - the default is `FALSE`. Some (especially CLSI) breakpoints only have a breakpoint for S, meaning the outcome can only be `"S"` or `NA`. Setting this to `TRUE` will convert the `NA`s to `"R"` only if the R breakpoint is missing. Can also be set with the package option [`AMR_substitute_missing_r_breakpoint`][AMR-options].
|
#' @param substitute_missing_r_breakpoint a [logical] to indicate that a missing clinical breakpoints for R (resistant) must be substituted with R - the default is `FALSE`. Some (especially CLSI) breakpoints only have a breakpoint for S, meaning the outcome can only be `"S"` or `NA`. Setting this to `TRUE` will convert the `NA`s to `"R"` only if the R breakpoint is missing. Can also be set with the package option [`AMR_substitute_missing_r_breakpoint`][AMR-options].
|
||||||
#' @param include_screening a [logical] to indicate that clinical breakpoints for screening are allowed - the default is `FALSE`. Can also be set with the package option [`AMR_include_screening`][AMR-options].
|
#' @param include_screening a [logical] to indicate that clinical breakpoints for screening are allowed - the default is `FALSE`. Can also be set with the package option [`AMR_include_screening`][AMR-options].
|
||||||
@ -85,7 +75,7 @@
|
|||||||
#' # for veterinary breakpoints, also set `host`:
|
#' # for veterinary breakpoints, also set `host`:
|
||||||
#' your_data %>% mutate_if(is.mic, as.sir, host = "column_with_animal_species", guideline = "CLSI")
|
#' your_data %>% mutate_if(is.mic, as.sir, host = "column_with_animal_species", guideline = "CLSI")
|
||||||
#' ```
|
#' ```
|
||||||
#' * Operators like "<=" will be stripped before interpretation. When using `capped_mic_handling = "strict"`, 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 stripped before interpretation. When using `conserve_capped_values = TRUE`, 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 (`conserve_capped_values = FALSE`) considers ">2" to be lower than ">=4" and might in this case return "S" or "I".
|
||||||
#' 3. For **interpreting disk diffusion diameters** according to EUCAST or CLSI. You must clean your disk zones first using [as.disk()], that also gives your columns the new data class [`disk`]. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the `mo` argument.
|
#' 3. For **interpreting disk diffusion diameters** according to EUCAST or CLSI. You must clean your disk zones first using [as.disk()], that also gives your columns the new data class [`disk`]. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the `mo` argument.
|
||||||
#' * Using `dplyr`, SIR interpretation can be done very easily with either:
|
#' * Using `dplyr`, SIR interpretation can be done very easily with either:
|
||||||
#' ```r
|
#' ```r
|
||||||
@ -571,7 +561,7 @@ as.sir.mic <- function(x,
|
|||||||
ab = deparse(substitute(x)),
|
ab = deparse(substitute(x)),
|
||||||
guideline = getOption("AMR_guideline", "EUCAST"),
|
guideline = getOption("AMR_guideline", "EUCAST"),
|
||||||
uti = NULL,
|
uti = NULL,
|
||||||
capped_mic_handling = getOption("AMR_capped_mic_handling", "standard"),
|
conserve_capped_values = FALSE,
|
||||||
add_intrinsic_resistance = FALSE,
|
add_intrinsic_resistance = FALSE,
|
||||||
reference_data = AMR::clinical_breakpoints,
|
reference_data = AMR::clinical_breakpoints,
|
||||||
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint", FALSE),
|
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint", FALSE),
|
||||||
@ -589,7 +579,7 @@ as.sir.mic <- function(x,
|
|||||||
ab = ab,
|
ab = ab,
|
||||||
guideline = guideline,
|
guideline = guideline,
|
||||||
uti = uti,
|
uti = uti,
|
||||||
capped_mic_handling = capped_mic_handling,
|
conserve_capped_values = conserve_capped_values,
|
||||||
add_intrinsic_resistance = add_intrinsic_resistance,
|
add_intrinsic_resistance = add_intrinsic_resistance,
|
||||||
reference_data = reference_data,
|
reference_data = reference_data,
|
||||||
substitute_missing_r_breakpoint = substitute_missing_r_breakpoint,
|
substitute_missing_r_breakpoint = substitute_missing_r_breakpoint,
|
||||||
@ -626,7 +616,7 @@ as.sir.disk <- function(x,
|
|||||||
ab = ab,
|
ab = ab,
|
||||||
guideline = guideline,
|
guideline = guideline,
|
||||||
uti = uti,
|
uti = uti,
|
||||||
capped_mic_handling = "standard", # will be ignored for non-MIC anyway
|
conserve_capped_values = FALSE,
|
||||||
add_intrinsic_resistance = add_intrinsic_resistance,
|
add_intrinsic_resistance = add_intrinsic_resistance,
|
||||||
reference_data = reference_data,
|
reference_data = reference_data,
|
||||||
substitute_missing_r_breakpoint = substitute_missing_r_breakpoint,
|
substitute_missing_r_breakpoint = substitute_missing_r_breakpoint,
|
||||||
@ -646,7 +636,7 @@ as.sir.data.frame <- function(x,
|
|||||||
col_mo = NULL,
|
col_mo = NULL,
|
||||||
guideline = getOption("AMR_guideline", "EUCAST"),
|
guideline = getOption("AMR_guideline", "EUCAST"),
|
||||||
uti = NULL,
|
uti = NULL,
|
||||||
capped_mic_handling = getOption("AMR_capped_mic_handling", "standard"),
|
conserve_capped_values = FALSE,
|
||||||
add_intrinsic_resistance = FALSE,
|
add_intrinsic_resistance = FALSE,
|
||||||
reference_data = AMR::clinical_breakpoints,
|
reference_data = AMR::clinical_breakpoints,
|
||||||
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint", FALSE),
|
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint", FALSE),
|
||||||
@ -655,15 +645,11 @@ as.sir.data.frame <- function(x,
|
|||||||
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
|
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
|
||||||
host = NULL,
|
host = NULL,
|
||||||
verbose = FALSE) {
|
verbose = FALSE) {
|
||||||
if (isTRUE(list(...)$converse_capped_values)) {
|
|
||||||
deprecation_warning(old = "converse_capped_values", new = "capped_mic_handling", fn = "as.sir", is_argument = TRUE)
|
|
||||||
capped_mic_handling <- "strict"
|
|
||||||
}
|
|
||||||
meet_criteria(x, allow_class = "data.frame") # will also check for dimensions > 0
|
meet_criteria(x, allow_class = "data.frame") # will also check for dimensions > 0
|
||||||
meet_criteria(col_mo, allow_class = "character", is_in = colnames(x), allow_NULL = TRUE)
|
meet_criteria(col_mo, allow_class = "character", is_in = colnames(x), allow_NULL = TRUE)
|
||||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||||
meet_criteria(uti, allow_class = c("logical", "character"), allow_NULL = TRUE, allow_NA = TRUE)
|
meet_criteria(uti, allow_class = c("logical", "character"), allow_NULL = TRUE, allow_NA = TRUE)
|
||||||
meet_criteria(capped_mic_handling, allow_class = "character", has_length = 1, is_in = c("standard", "strict", "relaxed", "inverse"))
|
meet_criteria(conserve_capped_values, allow_class = "logical", has_length = 1)
|
||||||
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1)
|
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1)
|
||||||
meet_criteria(reference_data, allow_class = "data.frame")
|
meet_criteria(reference_data, allow_class = "data.frame")
|
||||||
meet_criteria(substitute_missing_r_breakpoint, allow_class = "logical", has_length = 1)
|
meet_criteria(substitute_missing_r_breakpoint, allow_class = "logical", has_length = 1)
|
||||||
@ -815,7 +801,7 @@ as.sir.data.frame <- function(x,
|
|||||||
ab = ab_cols[i],
|
ab = ab_cols[i],
|
||||||
guideline = guideline,
|
guideline = guideline,
|
||||||
uti = uti,
|
uti = uti,
|
||||||
capped_mic_handling = capped_mic_handling,
|
conserve_capped_values = conserve_capped_values,
|
||||||
add_intrinsic_resistance = add_intrinsic_resistance,
|
add_intrinsic_resistance = add_intrinsic_resistance,
|
||||||
reference_data = reference_data,
|
reference_data = reference_data,
|
||||||
substitute_missing_r_breakpoint = substitute_missing_r_breakpoint,
|
substitute_missing_r_breakpoint = substitute_missing_r_breakpoint,
|
||||||
@ -945,7 +931,7 @@ as_sir_method <- function(method_short,
|
|||||||
ab,
|
ab,
|
||||||
guideline,
|
guideline,
|
||||||
uti,
|
uti,
|
||||||
capped_mic_handling,
|
conserve_capped_values,
|
||||||
add_intrinsic_resistance,
|
add_intrinsic_resistance,
|
||||||
reference_data,
|
reference_data,
|
||||||
substitute_missing_r_breakpoint,
|
substitute_missing_r_breakpoint,
|
||||||
@ -955,16 +941,12 @@ as_sir_method <- function(method_short,
|
|||||||
host,
|
host,
|
||||||
verbose,
|
verbose,
|
||||||
...) {
|
...) {
|
||||||
if (isTRUE(list(...)$converse_capped_values)) {
|
|
||||||
deprecation_warning(old = "converse_capped_values", new = "capped_mic_handling", fn = "as.sir", is_argument = TRUE)
|
|
||||||
capped_mic_handling <- "strict"
|
|
||||||
}
|
|
||||||
meet_criteria(x, allow_NA = TRUE, .call_depth = -2)
|
meet_criteria(x, allow_NA = TRUE, .call_depth = -2)
|
||||||
meet_criteria(mo, allow_class = c("mo", "character"), has_length = c(1, length(x)), allow_NULL = TRUE, .call_depth = -2)
|
meet_criteria(mo, allow_class = c("mo", "character"), has_length = c(1, length(x)), allow_NULL = TRUE, .call_depth = -2)
|
||||||
meet_criteria(ab, allow_class = c("ab", "character"), has_length = c(1, length(x)), .call_depth = -2)
|
meet_criteria(ab, allow_class = c("ab", "character"), has_length = c(1, length(x)), .call_depth = -2)
|
||||||
meet_criteria(guideline, allow_class = "character", has_length = 1, .call_depth = -2)
|
meet_criteria(guideline, allow_class = "character", has_length = 1, .call_depth = -2)
|
||||||
meet_criteria(uti, allow_class = c("logical", "character"), has_length = c(1, length(x)), allow_NULL = TRUE, allow_NA = TRUE, .call_depth = -2)
|
meet_criteria(uti, allow_class = c("logical", "character"), has_length = c(1, length(x)), allow_NULL = TRUE, allow_NA = TRUE, .call_depth = -2)
|
||||||
meet_criteria(capped_mic_handling, allow_class = "character", has_length = 1, is_in = c("standard", "strict", "relaxed", "inverse"), .call_depth = -2)
|
meet_criteria(conserve_capped_values, allow_class = "logical", has_length = 1, .call_depth = -2)
|
||||||
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1, .call_depth = -2)
|
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1, .call_depth = -2)
|
||||||
meet_criteria(reference_data, allow_class = "data.frame", .call_depth = -2)
|
meet_criteria(reference_data, allow_class = "data.frame", .call_depth = -2)
|
||||||
meet_criteria(substitute_missing_r_breakpoint, allow_class = "logical", has_length = 1, .call_depth = -2)
|
meet_criteria(substitute_missing_r_breakpoint, allow_class = "logical", has_length = 1, .call_depth = -2)
|
||||||
@ -977,13 +959,11 @@ as_sir_method <- function(method_short,
|
|||||||
|
|
||||||
# backward compatibilty
|
# backward compatibilty
|
||||||
dots <- list(...)
|
dots <- list(...)
|
||||||
dots <- dots[which(!names(dots) %in% c("warn", "mo.bak", "is_data.frame", "conserve_capped_values"))]
|
dots <- dots[which(!names(dots) %in% c("warn", "mo.bak", "is_data.frame"))]
|
||||||
if (length(dots) != 0) {
|
if (length(dots) != 0) {
|
||||||
warning_("These arguments in `as.sir()` are no longer used: ", vector_and(names(dots), quotes = "`"), ".", call = FALSE)
|
warning_("These arguments in `as.sir()` are no longer used: ", vector_and(names(dots), quotes = "`"), ".", call = FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
current_sir_interpretation_history <- NROW(AMR_env$sir_interpretation_history)
|
|
||||||
|
|
||||||
guideline_coerced <- get_guideline(guideline, reference_data)
|
guideline_coerced <- get_guideline(guideline, reference_data)
|
||||||
|
|
||||||
if (message_not_thrown_before("as.sir", "sir_interpretation_history")) {
|
if (message_not_thrown_before("as.sir", "sir_interpretation_history")) {
|
||||||
@ -1524,14 +1504,11 @@ as_sir_method <- function(method_short,
|
|||||||
if (any(breakpoints_current$site %like% "screen", na.rm = TRUE) | any(breakpoints_current$ref_tbl %like% "screen", na.rm = TRUE)) {
|
if (any(breakpoints_current$site %like% "screen", na.rm = TRUE) | any(breakpoints_current$ref_tbl %like% "screen", na.rm = TRUE)) {
|
||||||
notes_current <- c(notes_current, "Some screening breakpoints were applied - use `include_screening = FALSE` to prevent this")
|
notes_current <- c(notes_current, "Some screening breakpoints were applied - use `include_screening = FALSE` to prevent this")
|
||||||
}
|
}
|
||||||
if (capped_mic_handling %in% c("strict", "inverse") && any(as.character(values) %like% "^[<][0-9]")) {
|
if (method == "mic" && conserve_capped_values == TRUE && any(as.character(values) %like% "^[<][0-9]")) {
|
||||||
notes_current <- c(notes_current, paste0("MIC values with the sign '<' are all considered 'S' since capped_mic_handling = \"", capped_mic_handling, "\""))
|
notes_current <- c(notes_current, "MIC values 'lower than' are all considered 'S' since conserve_capped_values = TRUE")
|
||||||
}
|
}
|
||||||
if (capped_mic_handling %in% c("strict", "inverse") && any(as.character(values) %like% "^[>][0-9]")) {
|
if (method == "mic" && conserve_capped_values == TRUE && any(as.character(values) %like% "^[>][0-9]")) {
|
||||||
notes_current <- c(notes_current, paste0("MIC values with the sign '>' are all considered 'R' since capped_mic_handling = \"", capped_mic_handling, "\""))
|
notes_current <- c(notes_current, "MIC values 'greater than' are all considered 'R' since conserve_capped_values = TRUE")
|
||||||
}
|
|
||||||
if (capped_mic_handling %in% c("strict", "standard") && any(as.character(values) %like% "^[><]=[0-9]" & as.double(values) > breakpoints_current$breakpoint_S & as.double(values) < breakpoints_current$breakpoint_R, na.rm = TRUE)) {
|
|
||||||
notes_current <- c(notes_current, paste0("MIC values within the breakpoint guideline range with the sign '<=' or '>=' are considered 'NI' since capped_mic_handling = \"", capped_mic_handling, "\""))
|
|
||||||
}
|
}
|
||||||
if (isTRUE(substitute_missing_r_breakpoint) && !is.na(breakpoints_current$breakpoint_S) && is.na(breakpoints_current$breakpoint_R)) {
|
if (isTRUE(substitute_missing_r_breakpoint) && !is.na(breakpoints_current$breakpoint_S) && is.na(breakpoints_current$breakpoint_R)) {
|
||||||
breakpoints_current$breakpoint_R <- breakpoints_current$breakpoint_S # breakpoints_current only has 1 row at this moment
|
breakpoints_current$breakpoint_R <- breakpoints_current$breakpoint_S # breakpoints_current only has 1 row at this moment
|
||||||
@ -1541,9 +1518,8 @@ as_sir_method <- function(method_short,
|
|||||||
if (method == "mic") {
|
if (method == "mic") {
|
||||||
new_sir <- case_when_AMR(
|
new_sir <- case_when_AMR(
|
||||||
is.na(values) ~ NA_sir_,
|
is.na(values) ~ NA_sir_,
|
||||||
capped_mic_handling %in% c("strict", "inverse") & as.character(values) %like% "^[<][0-9]" ~ as.sir("S"),
|
conserve_capped_values == TRUE & as.character(values) %like% "^[<][0-9]" ~ as.sir("S"),
|
||||||
capped_mic_handling %in% c("strict", "inverse") & as.character(values) %like% "^[>][0-9]" ~ as.sir("R"),
|
conserve_capped_values == TRUE & as.character(values) %like% "^[>][0-9]" ~ as.sir("R"),
|
||||||
capped_mic_handling %in% c("strict", "standard") & as.character(values) %like% "^[><]=[0-9]" & as.double(values) > breakpoints_current$breakpoint_S & as.double(values) < breakpoints_current$breakpoint_R ~ as.sir("NI"),
|
|
||||||
values <= breakpoints_current$breakpoint_S ~ as.sir("S"),
|
values <= breakpoints_current$breakpoint_S ~ as.sir("S"),
|
||||||
guideline_coerced %like% "EUCAST" & values > breakpoints_current$breakpoint_R ~ as.sir("R"),
|
guideline_coerced %like% "EUCAST" & values > breakpoints_current$breakpoint_R ~ as.sir("R"),
|
||||||
guideline_coerced %like% "CLSI" & values >= breakpoints_current$breakpoint_R ~ as.sir("R"),
|
guideline_coerced %like% "CLSI" & values >= breakpoints_current$breakpoint_R ~ as.sir("R"),
|
||||||
@ -1623,12 +1599,6 @@ as_sir_method <- function(method_short,
|
|||||||
|
|
||||||
load_mo_uncertainties(metadata_mo)
|
load_mo_uncertainties(metadata_mo)
|
||||||
|
|
||||||
# reorder AMR_env$sir_interpretation_history to get a clean ordering on index
|
|
||||||
old_part <- AMR_env$sir_interpretation_history[seq_len(current_sir_interpretation_history), , drop = FALSE]
|
|
||||||
new_part <- AMR_env$sir_interpretation_history[c((current_sir_interpretation_history + 1):NROW(AMR_env$sir_interpretation_history)), , drop = FALSE]
|
|
||||||
new_part <- new_part[order(new_part$index), , drop = FALSE]
|
|
||||||
AMR_env$sir_interpretation_history <- rbind_AMR(old_part, new_part)
|
|
||||||
|
|
||||||
df$result
|
df$result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1637,11 +1607,18 @@ as_sir_method <- function(method_short,
|
|||||||
#' @export
|
#' @export
|
||||||
sir_interpretation_history <- function(clean = FALSE) {
|
sir_interpretation_history <- function(clean = FALSE) {
|
||||||
meet_criteria(clean, allow_class = "logical", has_length = 1)
|
meet_criteria(clean, allow_class = "logical", has_length = 1)
|
||||||
|
|
||||||
out <- AMR_env$sir_interpretation_history
|
out <- AMR_env$sir_interpretation_history
|
||||||
out$outcome <- as.sir(out$outcome)
|
out$outcome <- as.sir(out$outcome)
|
||||||
|
if (NROW(out) > 0) {
|
||||||
|
# sort descending on time
|
||||||
|
out <- out[order(format(out$datetime, "%Y%m%d%H%M"), out$index, decreasing = TRUE), , drop = FALSE]
|
||||||
|
}
|
||||||
|
|
||||||
if (isTRUE(clean)) {
|
if (isTRUE(clean)) {
|
||||||
AMR_env$sir_interpretation_history <- AMR_env$sir_interpretation_history[0, , drop = FALSE]
|
AMR_env$sir_interpretation_history <- AMR_env$sir_interpretation_history[0, , drop = FALSE]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pkg_is_available("tibble")) {
|
if (pkg_is_available("tibble")) {
|
||||||
out <- import_fn("as_tibble", "tibble")(out)
|
out <- import_fn("as_tibble", "tibble")(out)
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@ NULL
|
|||||||
"antibiotics"
|
"antibiotics"
|
||||||
|
|
||||||
# REMEMBER to also remove the deprecated `antibiotics` argument in `antibiogram()`
|
# REMEMBER to also remove the deprecated `antibiotics` argument in `antibiogram()`
|
||||||
# REMEMBER to also remove the deprecated `converse_capped_values` argument in `as.sir()`
|
|
||||||
|
|
||||||
#' @rdname AMR-deprecated
|
#' @rdname AMR-deprecated
|
||||||
#' @export
|
#' @export
|
||||||
|
118
_pkgdown.yml
118
_pkgdown.yml
@ -65,70 +65,70 @@ home:
|
|||||||
structure: [toc, links, authors]
|
structure: [toc, links, authors]
|
||||||
|
|
||||||
navbar:
|
navbar:
|
||||||
title: "AMR (for R)"
|
|
||||||
left:
|
|
||||||
- text: "How to"
|
|
||||||
icon: "fa-question-circle"
|
|
||||||
menu:
|
|
||||||
- text: "Conduct AMR Analysis"
|
|
||||||
icon: "fa-directions"
|
|
||||||
href: "articles/AMR.html"
|
|
||||||
- text: "Generate Antibiogram (Trad./Syndromic/WISCA)"
|
|
||||||
icon: "fa-file-prescription"
|
|
||||||
href: "reference/antibiogram.html" # reference instead of an article
|
|
||||||
- text: "Predict Antimicrobial Resistance"
|
|
||||||
icon: "fa-dice"
|
|
||||||
href: "articles/resistance_predict.html"
|
|
||||||
- text: "Download Data Sets for Own Use"
|
|
||||||
icon: "fa-database"
|
|
||||||
href: "articles/datasets.html"
|
|
||||||
- text: "Use AMR for Predictive Modelling (tidymodels)"
|
|
||||||
icon: "fa-square-root-variable"
|
|
||||||
href: "articles/AMR_with_tidymodels.html"
|
|
||||||
- text: "Set User- Or Team-specific Package Settings"
|
|
||||||
icon: "fa-gear"
|
|
||||||
href: "reference/AMR-options.html"
|
|
||||||
- text: "Conduct Principal Component Analysis for AMR"
|
|
||||||
icon: "fa-compress"
|
|
||||||
href: "articles/PCA.html"
|
|
||||||
- text: "Determine Multi-Drug Resistance (MDR)"
|
|
||||||
icon: "fa-skull-crossbones"
|
|
||||||
href: "articles/MDR.html"
|
|
||||||
- text: "Work with WHONET Data"
|
|
||||||
icon: "fa-globe-americas"
|
|
||||||
href: "articles/WHONET.html"
|
|
||||||
- text: "Apply Eucast Rules"
|
|
||||||
icon: "fa-exchange-alt"
|
|
||||||
href: "articles/EUCAST.html"
|
|
||||||
- text: "Get Taxonomy of a Microorganism"
|
|
||||||
icon: "fa-bug"
|
|
||||||
href: "reference/mo_property.html" # reference instead of an article
|
|
||||||
- text: "Get Properties of an Antibiotic Drug"
|
|
||||||
icon: "fa-capsules"
|
|
||||||
href: "reference/ab_property.html" # reference instead of an article
|
|
||||||
- text: "Get Properties of an Antiviral Drug"
|
|
||||||
icon: "fa-capsules"
|
|
||||||
href: "reference/av_property.html" # reference instead of an article
|
|
||||||
- text: "AMR for Python"
|
|
||||||
icon: "fab fa-python"
|
|
||||||
href: "articles/AMR_for_Python.html"
|
|
||||||
- text: "Manual"
|
|
||||||
icon: "fa-book-open"
|
|
||||||
href: "reference/index.html"
|
|
||||||
- text: "Authors"
|
|
||||||
icon: "fa-users"
|
|
||||||
href: "authors.html"
|
|
||||||
structure:
|
structure:
|
||||||
|
title: "AMR (for R)"
|
||||||
|
left:
|
||||||
|
- text: "How to"
|
||||||
|
icon: "fa-question-circle"
|
||||||
|
menu:
|
||||||
|
- text: "Conduct AMR Analysis"
|
||||||
|
icon: "fa-directions"
|
||||||
|
href: "articles/AMR.html"
|
||||||
|
- text: "Generate Antibiogram (Trad./Syndromic/WISCA)"
|
||||||
|
icon: "fa-file-prescription"
|
||||||
|
href: "reference/antibiogram.html" # reference instead of an article
|
||||||
|
- text: "Predict Antimicrobial Resistance"
|
||||||
|
icon: "fa-dice"
|
||||||
|
href: "articles/resistance_predict.html"
|
||||||
|
- text: "Download Data Sets for Own Use"
|
||||||
|
icon: "fa-database"
|
||||||
|
href: "articles/datasets.html"
|
||||||
|
- text: "Use AMR for Predictive Modelling (tidymodels)"
|
||||||
|
icon: "fa-square-root-variable"
|
||||||
|
href: "articles/AMR_with_tidymodels.html"
|
||||||
|
- text: "Set User- Or Team-specific Package Settings"
|
||||||
|
icon: "fa-gear"
|
||||||
|
href: "reference/AMR-options.html"
|
||||||
|
- text: "Conduct Principal Component Analysis for AMR"
|
||||||
|
icon: "fa-compress"
|
||||||
|
href: "articles/PCA.html"
|
||||||
|
- text: "Determine Multi-Drug Resistance (MDR)"
|
||||||
|
icon: "fa-skull-crossbones"
|
||||||
|
href: "articles/MDR.html"
|
||||||
|
- text: "Work with WHONET Data"
|
||||||
|
icon: "fa-globe-americas"
|
||||||
|
href: "articles/WHONET.html"
|
||||||
|
- text: "Apply Eucast Rules"
|
||||||
|
icon: "fa-exchange-alt"
|
||||||
|
href: "articles/EUCAST.html"
|
||||||
|
- text: "Get Taxonomy of a Microorganism"
|
||||||
|
icon: "fa-bug"
|
||||||
|
href: "reference/mo_property.html" # reference instead of an article
|
||||||
|
- text: "Get Properties of an Antibiotic Drug"
|
||||||
|
icon: "fa-capsules"
|
||||||
|
href: "reference/ab_property.html" # reference instead of an article
|
||||||
|
- text: "Get Properties of an Antiviral Drug"
|
||||||
|
icon: "fa-capsules"
|
||||||
|
href: "reference/av_property.html" # reference instead of an article
|
||||||
|
- text: "AMR for Python"
|
||||||
|
icon: "fab fa-python"
|
||||||
|
href: "articles/AMR_for_Python.html"
|
||||||
|
- text: "Manual"
|
||||||
|
icon: "fa-book-open"
|
||||||
|
href: "reference/index.html"
|
||||||
|
- text: "Authors"
|
||||||
|
icon: "fa-users"
|
||||||
|
href: "authors.html"
|
||||||
right: [search, amrchangelog, amrgit]
|
right: [search, amrchangelog, amrgit]
|
||||||
components:
|
components:
|
||||||
amrchangelog:
|
amrchangelog:
|
||||||
text: "Changelog"
|
icon: fa-newspaper
|
||||||
icon: "fa-newspaper"
|
href: news/index.html
|
||||||
href: "news/index.html"
|
aria-label: Changelog
|
||||||
amrgit:
|
amrgit:
|
||||||
text: "Source Code"
|
icon: fa-github
|
||||||
icon: "fa-github"
|
href: https://github.com/msberends/AMR"
|
||||||
href: "https://github.com/msberends/AMR"
|
aria-label: Source Code
|
||||||
|
|
||||||
reference:
|
reference:
|
||||||
- title: "Introduction to the package"
|
- title: "Introduction to the package"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
This knowledge base contains all context you must know about the AMR package for R. You are a GPT trained to be an assistant for the AMR package in R. You are an incredible R specialist, especially trained in this package and in the tidyverse.
|
This knowledge base contains all context you must know about the AMR package for R. You are a GPT trained to be an assistant for the AMR package in R. You are an incredible R specialist, especially trained in this package and in the tidyverse.
|
||||||
|
|
||||||
First and foremost, you are trained on version 2.1.1.9201. Remember this whenever someone asks which AMR package version you’re at.
|
First and foremost, you are trained on version 2.1.1.9199. Remember this whenever someone asks which AMR package version you’re at.
|
||||||
|
|
||||||
Below are the contents of the file, the file, and all the files (documentation) in the package. Every file content is split using 100 hypens.
|
Below are the contents of the file, the file, and all the files (documentation) in the package. Every file content is split using 100 hypens.
|
||||||
----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
||||||
@ -764,7 +764,6 @@ This is an overview of all the package-specific \code{\link[=options]{options()}
|
|||||||
\itemize{
|
\itemize{
|
||||||
\item \code{AMR_antibiogram_formatting_type} \cr A \link{numeric} (1-22) to use in \code{\link[=antibiogram]{antibiogram()}}, to indicate which formatting type to use.
|
\item \code{AMR_antibiogram_formatting_type} \cr A \link{numeric} (1-22) to use in \code{\link[=antibiogram]{antibiogram()}}, to indicate which formatting type to use.
|
||||||
\item \code{AMR_breakpoint_type} \cr A \link{character} to use in \code{\link[=as.sir]{as.sir()}}, to indicate which breakpoint type to use. This must be either "ECOFF", "animal", or "human".
|
\item \code{AMR_breakpoint_type} \cr A \link{character} to use in \code{\link[=as.sir]{as.sir()}}, to indicate which breakpoint type to use. This must be either "ECOFF", "animal", or "human".
|
||||||
\item \code{AMR_capped_mic_handling} \cr A \link{character} to use in \code{\link[=as.sir]{as.sir()}}, to indicate how capped MIC values (\code{<}, \code{<=}, \code{>}, \code{>=}) should be interpreted. Must be one of \code{"standard"}, \code{"strict"}, \code{"relaxed"}, or \code{"inverse"} - the default is \code{"standard"}.
|
|
||||||
\item \code{AMR_cleaning_regex} \cr A \link[base:regex]{regular expression} (case-insensitive) to use in \code{\link[=as.mo]{as.mo()}} and all \code{\link[=mo_property]{mo_*}} functions, to clean the user input. The default is the outcome of \code{\link[=mo_cleaning_regex]{mo_cleaning_regex()}}, which removes texts between brackets and texts such as "species" and "serovar".
|
\item \code{AMR_cleaning_regex} \cr A \link[base:regex]{regular expression} (case-insensitive) to use in \code{\link[=as.mo]{as.mo()}} and all \code{\link[=mo_property]{mo_*}} functions, to clean the user input. The default is the outcome of \code{\link[=mo_cleaning_regex]{mo_cleaning_regex()}}, which removes texts between brackets and texts such as "species" and "serovar".
|
||||||
\item \code{AMR_custom_ab} \cr A file location to an RDS file, to use custom antimicrobial drugs with this package. This is explained in \code{\link[=add_custom_antimicrobials]{add_custom_antimicrobials()}}.
|
\item \code{AMR_custom_ab} \cr A file location to an RDS file, to use custom antimicrobial drugs with this package. This is explained in \code{\link[=add_custom_antimicrobials]{add_custom_antimicrobials()}}.
|
||||||
\item \code{AMR_custom_mo} \cr A file location to an RDS file, to use custom microorganisms with this package. This is explained in \code{\link[=add_custom_microorganisms]{add_custom_microorganisms()}}.
|
\item \code{AMR_custom_mo} \cr A file location to an RDS file, to use custom microorganisms with this package. This is explained in \code{\link[=add_custom_microorganisms]{add_custom_microorganisms()}}.
|
||||||
@ -3341,8 +3340,7 @@ is_sir_eligible(x, threshold = 0.05)
|
|||||||
|
|
||||||
\method{as.sir}{mic}(x, mo = NULL, ab = deparse(substitute(x)),
|
\method{as.sir}{mic}(x, mo = NULL, ab = deparse(substitute(x)),
|
||||||
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
||||||
capped_mic_handling = getOption("AMR_capped_mic_handling", "standard"),
|
conserve_capped_values = FALSE, add_intrinsic_resistance = FALSE,
|
||||||
add_intrinsic_resistance = FALSE,
|
|
||||||
reference_data = AMR::clinical_breakpoints,
|
reference_data = AMR::clinical_breakpoints,
|
||||||
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
|
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
|
||||||
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
||||||
@ -3362,8 +3360,7 @@ is_sir_eligible(x, threshold = 0.05)
|
|||||||
|
|
||||||
\method{as.sir}{data.frame}(x, ..., col_mo = NULL,
|
\method{as.sir}{data.frame}(x, ..., col_mo = NULL,
|
||||||
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
||||||
capped_mic_handling = getOption("AMR_capped_mic_handling", "standard"),
|
conserve_capped_values = FALSE, add_intrinsic_resistance = FALSE,
|
||||||
add_intrinsic_resistance = FALSE,
|
|
||||||
reference_data = AMR::clinical_breakpoints,
|
reference_data = AMR::clinical_breakpoints,
|
||||||
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
|
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
|
||||||
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
||||||
@ -3390,19 +3387,7 @@ sir_interpretation_history(clean = FALSE)
|
|||||||
|
|
||||||
\item{uti}{(Urinary Tract Infection) a vector (or column name) with \link{logical}s (\code{TRUE} or \code{FALSE}) to specify whether a UTI specific interpretation from the guideline should be chosen. For using \code{\link[=as.sir]{as.sir()}} on a \link{data.frame}, this can also be a column containing \link{logical}s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See \emph{Examples}.}
|
\item{uti}{(Urinary Tract Infection) a vector (or column name) with \link{logical}s (\code{TRUE} or \code{FALSE}) to specify whether a UTI specific interpretation from the guideline should be chosen. For using \code{\link[=as.sir]{as.sir()}} on a \link{data.frame}, this can also be a column containing \link{logical}s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See \emph{Examples}.}
|
||||||
|
|
||||||
\item{capped_mic_handling}{A \link{character} string that controls how MIC values with a cap (i.e., starting with \code{<}, \code{<=}, \code{>}, or \code{>=}) are interpreted. Supports the following options:
|
\item{conserve_capped_values}{a \link{logical} to indicate that MIC values starting with \code{">"} (but not \code{">="}) must always return "R" , and that MIC values starting with \code{"<"} (but not \code{"<="}) must always return "S"}
|
||||||
\itemize{
|
|
||||||
\item \code{"standard"} (default)\cr
|
|
||||||
\code{<=} and \code{>=} return \code{"NI"} if the value is \strong{within} the breakpoint guideline range, while \code{<} and \code{>} are interpreted normally.
|
|
||||||
\item \code{"strict"}\cr
|
|
||||||
Enforces conservative handling; \code{<} always returns \code{"S"}, \code{>} always returns \code{"R"}, and \code{<=}/\code{>=} return \code{"NI"} when within breakpoint guideline range.
|
|
||||||
\item \code{"relaxed"}\cr
|
|
||||||
Ignores all signs, treating values as their numeric equivalents (e.g., \verb{>0.5} is regarded \code{0.5}).
|
|
||||||
\item \code{"inverse"}\cr
|
|
||||||
Opposite of \code{"standard"}; \code{<} always returns \code{"S"}, \code{>} always returns \code{"R"}, and \code{<=}/\code{>=} are treated as their numeric equivalents
|
|
||||||
}
|
|
||||||
|
|
||||||
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}}.}
|
|
||||||
|
|
||||||
\item{add_intrinsic_resistance}{\emph{(only useful when using a EUCAST guideline)} a \link{logical} to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in \emph{Klebsiella} species. Determination is based on the \link{intrinsic_resistant} data set, that itself is based on \href{https://www.eucast.org/expert_rules_and_expected_phenotypes}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3} (2021).}
|
\item{add_intrinsic_resistance}{\emph{(only useful when using a EUCAST guideline)} a \link{logical} to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in \emph{Klebsiella} species. Determination is based on the \link{intrinsic_resistant} data set, that itself is based on \href{https://www.eucast.org/expert_rules_and_expected_phenotypes}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3} (2021).}
|
||||||
|
|
||||||
@ -3458,7 +3443,7 @@ your_data \%>\% mutate_if(is.mic, as.sir, ab = c("cipro", "ampicillin", ...), mo
|
|||||||
# for veterinary breakpoints, also set `host`:
|
# for veterinary breakpoints, also set `host`:
|
||||||
your_data \%>\% mutate_if(is.mic, as.sir, host = "column_with_animal_species", guideline = "CLSI")
|
your_data \%>\% mutate_if(is.mic, as.sir, host = "column_with_animal_species", guideline = "CLSI")
|
||||||
}\if{html}{\out{</div>}}
|
}\if{html}{\out{</div>}}
|
||||||
\item Operators like "<=" will be stripped before interpretation. When using \code{capped_mic_handling = "strict"}, 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 stripped before interpretation. When using \code{conserve_capped_values = TRUE}, 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{conserve_capped_values = FALSE}) considers ">2" to be lower than ">=4" and might in this case return "S" or "I".
|
||||||
}
|
}
|
||||||
\item For \strong{interpreting disk diffusion diameters} according to EUCAST or CLSI. You must clean your disk zones first using \code{\link[=as.disk]{as.disk()}}, that also gives your columns the new data class \code{\link{disk}}. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the \code{mo} argument.
|
\item For \strong{interpreting disk diffusion diameters} according to EUCAST or CLSI. You must clean your disk zones first using \code{\link[=as.disk]{as.disk()}}, that also gives your columns the new data class \code{\link{disk}}. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the \code{mo} argument.
|
||||||
\itemize{
|
\itemize{
|
@ -11,7 +11,6 @@ This is an overview of all the package-specific \code{\link[=options]{options()}
|
|||||||
\itemize{
|
\itemize{
|
||||||
\item \code{AMR_antibiogram_formatting_type} \cr A \link{numeric} (1-22) to use in \code{\link[=antibiogram]{antibiogram()}}, to indicate which formatting type to use.
|
\item \code{AMR_antibiogram_formatting_type} \cr A \link{numeric} (1-22) to use in \code{\link[=antibiogram]{antibiogram()}}, to indicate which formatting type to use.
|
||||||
\item \code{AMR_breakpoint_type} \cr A \link{character} to use in \code{\link[=as.sir]{as.sir()}}, to indicate which breakpoint type to use. This must be either "ECOFF", "animal", or "human".
|
\item \code{AMR_breakpoint_type} \cr A \link{character} to use in \code{\link[=as.sir]{as.sir()}}, to indicate which breakpoint type to use. This must be either "ECOFF", "animal", or "human".
|
||||||
\item \code{AMR_capped_mic_handling} \cr A \link{character} to use in \code{\link[=as.sir]{as.sir()}}, to indicate how capped MIC values (\code{<}, \code{<=}, \code{>}, \code{>=}) should be interpreted. Must be one of \code{"standard"}, \code{"strict"}, \code{"relaxed"}, or \code{"inverse"} - the default is \code{"standard"}.
|
|
||||||
\item \code{AMR_cleaning_regex} \cr A \link[base:regex]{regular expression} (case-insensitive) to use in \code{\link[=as.mo]{as.mo()}} and all \code{\link[=mo_property]{mo_*}} functions, to clean the user input. The default is the outcome of \code{\link[=mo_cleaning_regex]{mo_cleaning_regex()}}, which removes texts between brackets and texts such as "species" and "serovar".
|
\item \code{AMR_cleaning_regex} \cr A \link[base:regex]{regular expression} (case-insensitive) to use in \code{\link[=as.mo]{as.mo()}} and all \code{\link[=mo_property]{mo_*}} functions, to clean the user input. The default is the outcome of \code{\link[=mo_cleaning_regex]{mo_cleaning_regex()}}, which removes texts between brackets and texts such as "species" and "serovar".
|
||||||
\item \code{AMR_custom_ab} \cr A file location to an RDS file, to use custom antimicrobial drugs with this package. This is explained in \code{\link[=add_custom_antimicrobials]{add_custom_antimicrobials()}}.
|
\item \code{AMR_custom_ab} \cr A file location to an RDS file, to use custom antimicrobial drugs with this package. This is explained in \code{\link[=add_custom_antimicrobials]{add_custom_antimicrobials()}}.
|
||||||
\item \code{AMR_custom_mo} \cr A file location to an RDS file, to use custom microorganisms with this package. This is explained in \code{\link[=add_custom_microorganisms]{add_custom_microorganisms()}}.
|
\item \code{AMR_custom_mo} \cr A file location to an RDS file, to use custom microorganisms with this package. This is explained in \code{\link[=add_custom_microorganisms]{add_custom_microorganisms()}}.
|
||||||
|
@ -37,8 +37,7 @@ is_sir_eligible(x, threshold = 0.05)
|
|||||||
|
|
||||||
\method{as.sir}{mic}(x, mo = NULL, ab = deparse(substitute(x)),
|
\method{as.sir}{mic}(x, mo = NULL, ab = deparse(substitute(x)),
|
||||||
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
||||||
capped_mic_handling = getOption("AMR_capped_mic_handling", "standard"),
|
conserve_capped_values = FALSE, add_intrinsic_resistance = FALSE,
|
||||||
add_intrinsic_resistance = FALSE,
|
|
||||||
reference_data = AMR::clinical_breakpoints,
|
reference_data = AMR::clinical_breakpoints,
|
||||||
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
|
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
|
||||||
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
||||||
@ -58,8 +57,7 @@ is_sir_eligible(x, threshold = 0.05)
|
|||||||
|
|
||||||
\method{as.sir}{data.frame}(x, ..., col_mo = NULL,
|
\method{as.sir}{data.frame}(x, ..., col_mo = NULL,
|
||||||
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
||||||
capped_mic_handling = getOption("AMR_capped_mic_handling", "standard"),
|
conserve_capped_values = FALSE, add_intrinsic_resistance = FALSE,
|
||||||
add_intrinsic_resistance = FALSE,
|
|
||||||
reference_data = AMR::clinical_breakpoints,
|
reference_data = AMR::clinical_breakpoints,
|
||||||
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
|
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
|
||||||
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
||||||
@ -86,19 +84,7 @@ sir_interpretation_history(clean = FALSE)
|
|||||||
|
|
||||||
\item{uti}{(Urinary Tract Infection) a vector (or column name) with \link{logical}s (\code{TRUE} or \code{FALSE}) to specify whether a UTI specific interpretation from the guideline should be chosen. For using \code{\link[=as.sir]{as.sir()}} on a \link{data.frame}, this can also be a column containing \link{logical}s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See \emph{Examples}.}
|
\item{uti}{(Urinary Tract Infection) a vector (or column name) with \link{logical}s (\code{TRUE} or \code{FALSE}) to specify whether a UTI specific interpretation from the guideline should be chosen. For using \code{\link[=as.sir]{as.sir()}} on a \link{data.frame}, this can also be a column containing \link{logical}s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See \emph{Examples}.}
|
||||||
|
|
||||||
\item{capped_mic_handling}{A \link{character} string that controls how MIC values with a cap (i.e., starting with \code{<}, \code{<=}, \code{>}, or \code{>=}) are interpreted. Supports the following options:
|
\item{conserve_capped_values}{a \link{logical} to indicate that MIC values starting with \code{">"} (but not \code{">="}) must always return "R" , and that MIC values starting with \code{"<"} (but not \code{"<="}) must always return "S"}
|
||||||
\itemize{
|
|
||||||
\item \code{"standard"} (default)\cr
|
|
||||||
\code{<=} and \code{>=} return \code{"NI"} if the value is \strong{within} the breakpoint guideline range, while \code{<} and \code{>} are interpreted normally.
|
|
||||||
\item \code{"strict"}\cr
|
|
||||||
Enforces conservative handling; \code{<} always returns \code{"S"}, \code{>} always returns \code{"R"}, and \code{<=}/\code{>=} return \code{"NI"} when within breakpoint guideline range.
|
|
||||||
\item \code{"relaxed"}\cr
|
|
||||||
Ignores all signs, treating values as their numeric equivalents (e.g., \verb{>0.5} is regarded \code{0.5}).
|
|
||||||
\item \code{"inverse"}\cr
|
|
||||||
Opposite of \code{"standard"}; \code{<} always returns \code{"S"}, \code{>} always returns \code{"R"}, and \code{<=}/\code{>=} are treated as their numeric equivalents
|
|
||||||
}
|
|
||||||
|
|
||||||
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}}.}
|
|
||||||
|
|
||||||
\item{add_intrinsic_resistance}{\emph{(only useful when using a EUCAST guideline)} a \link{logical} to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in \emph{Klebsiella} species. Determination is based on the \link{intrinsic_resistant} data set, that itself is based on \href{https://www.eucast.org/expert_rules_and_expected_phenotypes}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3} (2021).}
|
\item{add_intrinsic_resistance}{\emph{(only useful when using a EUCAST guideline)} a \link{logical} to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in \emph{Klebsiella} species. Determination is based on the \link{intrinsic_resistant} data set, that itself is based on \href{https://www.eucast.org/expert_rules_and_expected_phenotypes}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3} (2021).}
|
||||||
|
|
||||||
@ -154,7 +140,7 @@ your_data \%>\% mutate_if(is.mic, as.sir, ab = c("cipro", "ampicillin", ...), mo
|
|||||||
# for veterinary breakpoints, also set `host`:
|
# for veterinary breakpoints, also set `host`:
|
||||||
your_data \%>\% mutate_if(is.mic, as.sir, host = "column_with_animal_species", guideline = "CLSI")
|
your_data \%>\% mutate_if(is.mic, as.sir, host = "column_with_animal_species", guideline = "CLSI")
|
||||||
}\if{html}{\out{</div>}}
|
}\if{html}{\out{</div>}}
|
||||||
\item Operators like "<=" will be stripped before interpretation. When using \code{capped_mic_handling = "strict"}, 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 stripped before interpretation. When using \code{conserve_capped_values = TRUE}, 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{conserve_capped_values = FALSE}) considers ">2" to be lower than ">=4" and might in this case return "S" or "I".
|
||||||
}
|
}
|
||||||
\item For \strong{interpreting disk diffusion diameters} according to EUCAST or CLSI. You must clean your disk zones first using \code{\link[=as.disk]{as.disk()}}, that also gives your columns the new data class \code{\link{disk}}. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the \code{mo} argument.
|
\item For \strong{interpreting disk diffusion diameters} according to EUCAST or CLSI. You must clean your disk zones first using \code{\link[=as.disk]{as.disk()}}, that also gives your columns the new data class \code{\link{disk}}. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the \code{mo} argument.
|
||||||
\itemize{
|
\itemize{
|
||||||
|
@ -98,14 +98,12 @@ body.amr-for-python * {
|
|||||||
.bg-primary .navbar-nav .nav-link:focus {
|
.bg-primary .navbar-nav .nav-link:focus {
|
||||||
color: var(--amr-green-light) !important;
|
color: var(--amr-green-light) !important;
|
||||||
}
|
}
|
||||||
.navbar-nav .nav-item > .nav-link:hover {
|
.navbar-dark .navbar-nav .nav-item > .nav-link:hover,
|
||||||
|
.navbar-light .navbar-nav .nav-item>.nav-link:hover {
|
||||||
background: none !important;
|
background: none !important;
|
||||||
}
|
}
|
||||||
input[type="search"] {
|
.navbar-dark input[type="search"] {
|
||||||
background-color: var(--amr-green-light) !important;
|
background-color: var(--amr-green-light) !important;
|
||||||
max-width: 160px;
|
|
||||||
border-color: var(--amr-green-dark) !important;
|
|
||||||
border-radius: 2px !important;
|
|
||||||
}
|
}
|
||||||
.navbar-nav .nav-item > .nav-link {
|
.navbar-nav .nav-item > .nav-link {
|
||||||
border-radius: 0 !important;
|
border-radius: 0 !important;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user