mirror of
https://github.com/msberends/AMR.git
synced 2025-04-19 08:33:49 +02:00
(v2.1.1.9203) unit tests
This commit is contained in:
parent
f758ab60f3
commit
7f1ae1f474
@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 2.1.1.9202
|
Version: 2.1.1.9203
|
||||||
Date: 2025-03-14
|
Date: 2025-03-15
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||||
data analysis and to work with microbial and antimicrobial properties by
|
data analysis and to work with microbial and antimicrobial properties by
|
||||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# AMR 2.1.1.9202
|
# AMR 2.1.1.9203
|
||||||
|
|
||||||
*(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).)*
|
||||||
|
|
||||||
|
@ -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.9203
|
||||||
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
|
||||||
|
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.
Binary file not shown.
BIN
PythonPackage/AMR/dist/amr-2.1.1.9203.tar.gz
vendored
Normal file
BIN
PythonPackage/AMR/dist/amr-2.1.1.9203.tar.gz
vendored
Normal file
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.9203',
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'rpy2',
|
'rpy2',
|
||||||
|
60
R/sir.R
60
R/sir.R
@ -45,14 +45,22 @@
|
|||||||
#' @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 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:
|
||||||
#' - `"standard"` (default)\cr
|
#'
|
||||||
#' `<=` and `>=` return `"NI"` if the value is **within** the breakpoint guideline range, while `<` and `>` are interpreted normally.
|
#' `"none"`
|
||||||
#' - `"strict"`\cr
|
#' * `<=` and `>=` are treated as-is.
|
||||||
#' Enforces conservative handling; `<` always returns `"S"`, `>` always returns `"R"`, and `<=`/`>=` return `"NI"` when within breakpoint guideline range.
|
#' * `<` and `>` are treated as-is.
|
||||||
#' - `"relaxed"`\cr
|
#'
|
||||||
#' Ignores all signs, treating values as their numeric equivalents (e.g., `>0.5` is regarded `0.5`).
|
#' `"conservative"`
|
||||||
#' - `"inverse"`\cr
|
#' * `<=` and `>=` return `"NI"` (non-interpretable) if the MIC is within the breakpoint guideline range.
|
||||||
#' Opposite of `"standard"`; `<` always returns `"S"`, `>` always returns `"R"`, and `<=`/`>=` are treated as their numeric equivalents
|
#' * `<` always returns `"S"`, and `>` always returns `"R"`.
|
||||||
|
#'
|
||||||
|
#' `"standard"` (default)
|
||||||
|
#' * `<=` and `>=` return `"NI"` (non-interpretable) if the MIC is within the breakpoint guideline range.
|
||||||
|
#' * `<` and `>` are treated as-is.
|
||||||
|
#'
|
||||||
|
#' `"inverse"`
|
||||||
|
#' * `<=` and `>=` are treated as-is.
|
||||||
|
#' * `<` always returns `"S"`, and `>` always returns `"R"`.
|
||||||
#'
|
#'
|
||||||
#' 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 `"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)`.
|
||||||
@ -64,6 +72,7 @@
|
|||||||
#' @param verbose a [logical] to indicate that all notes should be printed during interpretation of MIC values or disk diffusion values.
|
#' @param verbose a [logical] to indicate that all notes should be printed during interpretation of MIC values or disk diffusion values.
|
||||||
#' @param reference_data a [data.frame] to be used for interpretation, which defaults to the [clinical_breakpoints] data set. Changing this argument allows for using own interpretation guidelines. This argument must contain a data set that is equal in structure to the [clinical_breakpoints] data set (same column names and column types). Please note that the `guideline` argument will be ignored when `reference_data` is manually set.
|
#' @param reference_data a [data.frame] to be used for interpretation, which defaults to the [clinical_breakpoints] data set. Changing this argument allows for using own interpretation guidelines. This argument must contain a data set that is equal in structure to the [clinical_breakpoints] data set (same column names and column types). Please note that the `guideline` argument will be ignored when `reference_data` is manually set.
|
||||||
#' @param threshold maximum fraction of invalid antimicrobial interpretations of `x`, see *Examples*
|
#' @param threshold maximum fraction of invalid antimicrobial interpretations of `x`, see *Examples*
|
||||||
|
#' @param conserve_capped_values deprecated, use `capped_mic_handling` instead
|
||||||
#' @param ... for using on a [data.frame]: names of columns to apply [as.sir()] on (supports tidy selection such as `column1:column4`). Otherwise: arguments passed on to methods.
|
#' @param ... for using on a [data.frame]: names of columns to apply [as.sir()] on (supports tidy selection such as `column1:column4`). Otherwise: arguments passed on to methods.
|
||||||
#' @details
|
#' @details
|
||||||
#' *Note: The clinical breakpoints in this package were validated through, and imported from, [WHONET](https://whonet.org). The public use of this `AMR` package has been endorsed by both CLSI and EUCAST. See [clinical_breakpoints] for more information.*
|
#' *Note: The clinical breakpoints in this package were validated through, and imported from, [WHONET](https://whonet.org). The public use of this `AMR` package has been endorsed by both CLSI and EUCAST. See [clinical_breakpoints] for more information.*
|
||||||
@ -85,7 +94,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 `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".
|
||||||
#' 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
|
||||||
@ -582,6 +591,7 @@ as.sir.mic <- function(x,
|
|||||||
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
|
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
|
||||||
host = NULL,
|
host = NULL,
|
||||||
verbose = FALSE,
|
verbose = FALSE,
|
||||||
|
conserve_capped_values = NULL,
|
||||||
...) {
|
...) {
|
||||||
as_sir_method(
|
as_sir_method(
|
||||||
method_short = "mic",
|
method_short = "mic",
|
||||||
@ -656,16 +666,13 @@ as.sir.data.frame <- function(x,
|
|||||||
include_PKPD = getOption("AMR_include_PKPD", TRUE),
|
include_PKPD = getOption("AMR_include_PKPD", TRUE),
|
||||||
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)) {
|
conserve_capped_values = NULL) {
|
||||||
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(capped_mic_handling, allow_class = "character", has_length = 1, is_in = c("standard", "conservative", "none", "inverse"))
|
||||||
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)
|
||||||
@ -956,17 +963,18 @@ as_sir_method <- function(method_short,
|
|||||||
breakpoint_type,
|
breakpoint_type,
|
||||||
host,
|
host,
|
||||||
verbose,
|
verbose,
|
||||||
|
conserve_capped_values = NULL,
|
||||||
...) {
|
...) {
|
||||||
if (isTRUE(list(...)$converse_capped_values)) {
|
if (isTRUE(conserve_capped_values)) {
|
||||||
deprecation_warning(old = "converse_capped_values", new = "capped_mic_handling", fn = "as.sir", is_argument = TRUE)
|
deprecation_warning(old = "conserve_capped_values", new = "capped_mic_handling", fn = "as.sir", is_argument = TRUE)
|
||||||
capped_mic_handling <- "strict"
|
capped_mic_handling <- "conservative"
|
||||||
}
|
}
|
||||||
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(capped_mic_handling, allow_class = "character", has_length = 1, is_in = c("standard", "conservative", "none", "inverse"), .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)
|
||||||
@ -979,7 +987,7 @@ 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)
|
||||||
}
|
}
|
||||||
@ -1526,13 +1534,13 @@ 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 (capped_mic_handling %in% c("conservative", "inverse") && 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, paste0("MIC values with the sign '<' are all considered 'S' since capped_mic_handling = \"", capped_mic_handling, "\""))
|
||||||
}
|
}
|
||||||
if (capped_mic_handling %in% c("strict", "inverse") && any(as.character(values) %like% "^[>][0-9]")) {
|
if (capped_mic_handling %in% c("conservative", "inverse") && 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, paste0("MIC values with the sign '>' are all considered 'R' since capped_mic_handling = \"", capped_mic_handling, "\""))
|
||||||
}
|
}
|
||||||
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)) {
|
if (capped_mic_handling %in% c("conservative", "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, "\""))
|
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)) {
|
||||||
@ -1543,9 +1551,9 @@ 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"),
|
capped_mic_handling %in% c("conservative", "inverse") & 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"),
|
capped_mic_handling %in% c("conservative", "inverse") & 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"),
|
capped_mic_handling %in% c("conservative", "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"),
|
||||||
|
@ -62,7 +62,7 @@ footer:
|
|||||||
|
|
||||||
home:
|
home:
|
||||||
sidebar:
|
sidebar:
|
||||||
structure: [toc, links, authors]
|
structure: [toc, authors]
|
||||||
|
|
||||||
navbar:
|
navbar:
|
||||||
title: "AMR (for R)"
|
title: "AMR (for R)"
|
||||||
|
@ -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.9203. 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.
|
||||||
----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
||||||
@ -3348,7 +3348,7 @@ is_sir_eligible(x, threshold = 0.05)
|
|||||||
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
||||||
include_PKPD = getOption("AMR_include_PKPD", TRUE),
|
include_PKPD = getOption("AMR_include_PKPD", TRUE),
|
||||||
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
|
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
|
||||||
verbose = FALSE, ...)
|
verbose = FALSE, conserve_capped_values = NULL, ...)
|
||||||
|
|
||||||
\method{as.sir}{disk}(x, mo = NULL, ab = deparse(substitute(x)),
|
\method{as.sir}{disk}(x, mo = NULL, ab = deparse(substitute(x)),
|
||||||
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
||||||
@ -3369,7 +3369,7 @@ is_sir_eligible(x, threshold = 0.05)
|
|||||||
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
||||||
include_PKPD = getOption("AMR_include_PKPD", TRUE),
|
include_PKPD = getOption("AMR_include_PKPD", TRUE),
|
||||||
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
|
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
|
||||||
verbose = FALSE)
|
verbose = FALSE, conserve_capped_values = NULL)
|
||||||
|
|
||||||
sir_interpretation_history(clean = FALSE)
|
sir_interpretation_history(clean = FALSE)
|
||||||
}
|
}
|
||||||
@ -3391,15 +3391,29 @@ 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{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:
|
||||||
|
|
||||||
|
\code{"none"}
|
||||||
\itemize{
|
\itemize{
|
||||||
\item \code{"standard"} (default)\cr
|
\item \code{<=} and \code{>=} are treated as-is.
|
||||||
\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{<} and \code{>} are treated as-is.
|
||||||
\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
|
\code{"conservative"}
|
||||||
Ignores all signs, treating values as their numeric equivalents (e.g., \verb{>0.5} is regarded \code{0.5}).
|
\itemize{
|
||||||
\item \code{"inverse"}\cr
|
\item \code{<=} and \code{>=} return \code{"NI"} (non-interpretable) if the MIC is within the breakpoint guideline range.
|
||||||
Opposite of \code{"standard"}; \code{<} always returns \code{"S"}, \code{>} always returns \code{"R"}, and \code{<=}/\code{>=} are treated as their numeric equivalents
|
\item \code{<} always returns \code{"S"}, and \code{>} always returns \code{"R"}.
|
||||||
|
}
|
||||||
|
|
||||||
|
\code{"standard"} (default)
|
||||||
|
\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.
|
||||||
|
}
|
||||||
|
|
||||||
|
\code{"inverse"}
|
||||||
|
\itemize{
|
||||||
|
\item \code{<=} and \code{>=} are treated as-is.
|
||||||
|
\item \code{<} always returns \code{"S"}, and \code{>} always returns \code{"R"}.
|
||||||
}
|
}
|
||||||
|
|
||||||
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{"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}}.}
|
||||||
@ -3420,6 +3434,8 @@ The default \code{"standard"} setting ensures cautious handling of uncertain val
|
|||||||
|
|
||||||
\item{verbose}{a \link{logical} to indicate that all notes should be printed during interpretation of MIC values or disk diffusion values.}
|
\item{verbose}{a \link{logical} to indicate that all notes should be printed during interpretation of MIC values or disk diffusion values.}
|
||||||
|
|
||||||
|
\item{conserve_capped_values}{deprecated, use \code{capped_mic_handling} instead}
|
||||||
|
|
||||||
\item{col_mo}{column name of the names or codes of the microorganisms (see \code{\link[=as.mo]{as.mo()}}) - the default is the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
|
\item{col_mo}{column name of the names or codes of the microorganisms (see \code{\link[=as.mo]{as.mo()}}) - the default is the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
|
||||||
|
|
||||||
\item{clean}{a \link{logical} to indicate whether previously stored results should be forgotten after returning the 'logbook' with results}
|
\item{clean}{a \link{logical} to indicate whether previously stored results should be forgotten after returning the 'logbook' with results}
|
||||||
@ -3458,7 +3474,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{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 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{
|
@ -44,7 +44,7 @@ is_sir_eligible(x, threshold = 0.05)
|
|||||||
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
||||||
include_PKPD = getOption("AMR_include_PKPD", TRUE),
|
include_PKPD = getOption("AMR_include_PKPD", TRUE),
|
||||||
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
|
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
|
||||||
verbose = FALSE, ...)
|
verbose = FALSE, conserve_capped_values = NULL, ...)
|
||||||
|
|
||||||
\method{as.sir}{disk}(x, mo = NULL, ab = deparse(substitute(x)),
|
\method{as.sir}{disk}(x, mo = NULL, ab = deparse(substitute(x)),
|
||||||
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
|
||||||
@ -65,7 +65,7 @@ is_sir_eligible(x, threshold = 0.05)
|
|||||||
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
|
||||||
include_PKPD = getOption("AMR_include_PKPD", TRUE),
|
include_PKPD = getOption("AMR_include_PKPD", TRUE),
|
||||||
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
|
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
|
||||||
verbose = FALSE)
|
verbose = FALSE, conserve_capped_values = NULL)
|
||||||
|
|
||||||
sir_interpretation_history(clean = FALSE)
|
sir_interpretation_history(clean = FALSE)
|
||||||
}
|
}
|
||||||
@ -87,15 +87,29 @@ 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{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:
|
||||||
|
|
||||||
|
\code{"none"}
|
||||||
\itemize{
|
\itemize{
|
||||||
\item \code{"standard"} (default)\cr
|
\item \code{<=} and \code{>=} are treated as-is.
|
||||||
\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{<} and \code{>} are treated as-is.
|
||||||
\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
|
\code{"conservative"}
|
||||||
Ignores all signs, treating values as their numeric equivalents (e.g., \verb{>0.5} is regarded \code{0.5}).
|
\itemize{
|
||||||
\item \code{"inverse"}\cr
|
\item \code{<=} and \code{>=} return \code{"NI"} (non-interpretable) if the MIC is within the breakpoint guideline range.
|
||||||
Opposite of \code{"standard"}; \code{<} always returns \code{"S"}, \code{>} always returns \code{"R"}, and \code{<=}/\code{>=} are treated as their numeric equivalents
|
\item \code{<} always returns \code{"S"}, and \code{>} always returns \code{"R"}.
|
||||||
|
}
|
||||||
|
|
||||||
|
\code{"standard"} (default)
|
||||||
|
\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.
|
||||||
|
}
|
||||||
|
|
||||||
|
\code{"inverse"}
|
||||||
|
\itemize{
|
||||||
|
\item \code{<=} and \code{>=} are treated as-is.
|
||||||
|
\item \code{<} always returns \code{"S"}, and \code{>} always returns \code{"R"}.
|
||||||
}
|
}
|
||||||
|
|
||||||
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{"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}}.}
|
||||||
@ -116,6 +130,8 @@ The default \code{"standard"} setting ensures cautious handling of uncertain val
|
|||||||
|
|
||||||
\item{verbose}{a \link{logical} to indicate that all notes should be printed during interpretation of MIC values or disk diffusion values.}
|
\item{verbose}{a \link{logical} to indicate that all notes should be printed during interpretation of MIC values or disk diffusion values.}
|
||||||
|
|
||||||
|
\item{conserve_capped_values}{deprecated, use \code{capped_mic_handling} instead}
|
||||||
|
|
||||||
\item{col_mo}{column name of the names or codes of the microorganisms (see \code{\link[=as.mo]{as.mo()}}) - the default is the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
|
\item{col_mo}{column name of the names or codes of the microorganisms (see \code{\link[=as.mo]{as.mo()}}) - the default is the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
|
||||||
|
|
||||||
\item{clean}{a \link{logical} to indicate whether previously stored results should be forgotten after returning the 'logbook' with results}
|
\item{clean}{a \link{logical} to indicate whether previously stored results should be forgotten after returning the 'logbook' with results}
|
||||||
@ -154,7 +170,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{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 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{
|
||||||
|
@ -101,12 +101,22 @@ body.amr-for-python * {
|
|||||||
.navbar-nav .nav-item > .nav-link:hover {
|
.navbar-nav .nav-item > .nav-link:hover {
|
||||||
background: none !important;
|
background: none !important;
|
||||||
}
|
}
|
||||||
|
.navbar .algolia-autocomplete .aa-dropdown-menu {
|
||||||
|
background-color: var(--amr-green-dark) !important;
|
||||||
|
}
|
||||||
input[type="search"] {
|
input[type="search"] {
|
||||||
|
color: var(--bs-tertiary-bg) !important;
|
||||||
background-color: var(--amr-green-light) !important;
|
background-color: var(--amr-green-light) !important;
|
||||||
max-width: 160px;
|
max-width: 160px;
|
||||||
border-color: var(--amr-green-dark) !important;
|
border-color: var(--amr-green-dark) !important;
|
||||||
border-radius: 2px !important;
|
border-radius: 2px !important;
|
||||||
}
|
}
|
||||||
|
.dropdown-item:hover,
|
||||||
|
.dropdown-item:focus {
|
||||||
|
background-color: var(--bs-tertiary-bg) !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
color: var(--bs-body-color) !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