mirror of
https://github.com/msberends/AMR.git
synced 2025-05-01 07:03:48 +02:00
(v2.1.1.9260) fix antibiogram
This commit is contained in:
parent
6819473457
commit
faa9ae0d85
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 2.1.1.9259
|
||||
Date: 2025-04-27
|
||||
Version: 2.1.1.9260
|
||||
Date: 2025-04-29
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
data analysis and to work with microbial and antimicrobial properties by
|
||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
||||
# AMR 2.1.1.9259
|
||||
# AMR 2.1.1.9260
|
||||
|
||||
*(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://amr-for-r.org/#get-this-package).)*
|
||||
|
||||
|
@ -32,11 +32,11 @@
|
||||
#' @description
|
||||
#' Welcome to the `AMR` package.
|
||||
#'
|
||||
#' The `AMR` package is a peer-reviewed, [free and open-source](https://amr-for-r.org/#copyright) R package with [zero dependencies](https://en.wikipedia.org/wiki/Dependency_hell) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. **Our aim is to provide a standard** for clean and reproducible AMR data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting. [Many different researchers](https://amr-for-r.org/authors.html) from around the globe are continually helping us to make this a successful and durable project!
|
||||
#' The `AMR` package is a peer-reviewed, [free and open-source](https://amr-for-r.org/#copyright) R package with [zero dependencies](https://en.wikipedia.org/wiki/Dependency_hell) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. **Our aim is to provide a standard** for clean and reproducible AMR data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting. We are a team of [many different researchers](https://amr-for-r.org/authors.html) from around the globe to make this a successful and durable project!
|
||||
#'
|
||||
#' This work was published in the Journal of Statistical Software (Volume 104(3); \doi{10.18637/jss.v104.i03}) and formed the basis of two PhD theses (\doi{10.33612/diss.177417131} and \doi{10.33612/diss.192486375}).
|
||||
#'
|
||||
#' After installing this package, R knows [**`r format_included_data_number(AMR::microorganisms)` microorganisms**](https://amr-for-r.org/reference/microorganisms.html) (updated `r format(TAXONOMY_VERSION$GBIF$accessed_date, "%B %Y")`) and all [**`r format_included_data_number(nrow(AMR::antimicrobials) + nrow(AMR::antivirals))` antibiotic, antimycotic and antiviral drugs**](https://amr-for-r.org/reference/antimicrobials.html) by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI and EUCAST are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). **It was designed to work in any setting, including those with very limited resources**. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the public [University of Groningen](https://www.rug.nl), in collaboration with non-profit organisations [Certe Medical Diagnostics and Advice Foundation](https://www.certe.nl) and [University Medical Center Groningen](https://www.umcg.nl).
|
||||
#' After installing this package, R knows [**`r AMR:::format_included_data_number(AMR::microorganisms)` distinct microbial species**](https://amr-for-r.org/reference/microorganisms.html) (updated June 2024) and all [**`r AMR:::format_included_data_number(NROW(AMR::antimicrobials) + NROW(AMR::antivirals))` antimicrobial and antiviral drugs**](https://amr-for-r.org/reference/antimicrobials.html) by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, grepl("CLSI", guideline))$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, grepl("CLSI", guideline))$guideline)))` and EUCAST `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, grepl("EUCAST", guideline))$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, grepl("EUCAST", guideline))$guideline)))` are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). **It was designed to work in any setting, including those with very limited resources**. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the [University of Groningen](https://www.rug.nl) and the [University Medical Center Groningen](https://www.umcg.nl).
|
||||
#'
|
||||
#' The `AMR` package is available in `r vector_and(vapply(FUN.VALUE = character(1), LANGUAGES_SUPPORTED_NAMES, function(x) x$exonym), quotes = FALSE, sort = FALSE)`. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages.
|
||||
#' @section Download Our Reference Data:
|
||||
@ -44,7 +44,7 @@
|
||||
#'
|
||||
#' For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
#'
|
||||
#' Visit [our website for direct download links](https://amr-for-r.org/articles/datasets.html), or explore the actual files in [our GitHub repository](https://github.com/msberends/AMR/tree/main/data-raw).
|
||||
#' Visit [our website for direct download links](https://amr-for-r.org/articles/datasets.html), or explore the actual files in [our GitHub repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
|
||||
#' @source
|
||||
#' To cite AMR in publications use:
|
||||
#'
|
||||
|
@ -538,9 +538,9 @@ word_wrap <- function(...,
|
||||
txt = parts[parts %in% c("antimicrobials", "microorganisms", "microorganisms.codes", "microorganisms.groups")]
|
||||
)
|
||||
# text starting with `?` must also lead to the help page
|
||||
parts[parts %like% "^[?]"] <- font_url(
|
||||
url = paste0("ide:help:AMR::", gsub("?", "", parts[parts %like% "^[?]"], fixed = TRUE)),
|
||||
txt = parts[parts %like% "^[?]"]
|
||||
parts[parts %like% "^[?].+"] <- font_url(
|
||||
url = paste0("ide:help:AMR::", gsub("?", "", parts[parts %like% "^[?].+"], fixed = TRUE)),
|
||||
txt = parts[parts %like% "^[?].+"]
|
||||
)
|
||||
msg <- paste0(parts, collapse = "`")
|
||||
}
|
||||
|
139
R/antibiogram.R
139
R/antibiogram.R
@ -682,9 +682,8 @@ antibiogram.default <- function(x,
|
||||
|
||||
wisca_parameters <- data.frame()
|
||||
|
||||
# WISCA START
|
||||
if (wisca == TRUE) {
|
||||
# WISCA ----
|
||||
|
||||
if (isTRUE(has_syndromic_group)) {
|
||||
colnames(out)[1] <- "syndromic_group"
|
||||
out_wisca <- out %pm>%
|
||||
@ -708,9 +707,6 @@ antibiogram.default <- function(x,
|
||||
warning_("Number of tested isolates should exceed ", minimum, " for each regimen (and group). WISCA coverage estimates might be inaccurate.", call = FALSE)
|
||||
}
|
||||
|
||||
out_wisca$p_susceptible <- out_wisca$n_susceptible / out_wisca$n_tested
|
||||
out_wisca$p_susceptible[is.nan(out_wisca$p_susceptible)] <- 0
|
||||
|
||||
if (isTRUE(has_syndromic_group)) {
|
||||
out$group <- paste(out$syndromic_group, out$ab)
|
||||
out_wisca$group <- paste(out_wisca$syndromic_group, out_wisca$ab)
|
||||
@ -719,31 +715,6 @@ antibiogram.default <- function(x,
|
||||
out_wisca$group <- out_wisca$ab
|
||||
}
|
||||
|
||||
# create the WISCA parameters, including our priors/posteriors
|
||||
out$gamma_posterior <- NA_real_
|
||||
out$beta_posterior_1 <- NA_real_
|
||||
out$beta_posterior_2 <- NA_real_
|
||||
|
||||
for (i in seq_len(NROW(out))) {
|
||||
out_current <- out[i, , drop = FALSE]
|
||||
|
||||
## calculate priors ----
|
||||
# pathogen incidence (Dirichlet distribution)
|
||||
gamma_prior <- rep(1, length(unique(out_current$mo))) # Dirichlet prior
|
||||
gamma_posterior <- gamma_prior + out_current$n_total # Posterior parameters
|
||||
|
||||
# regimen susceptibility (Beta distribution)
|
||||
beta_prior <- rep(1, length(unique(out_current$mo))) # Beta prior
|
||||
r <- out_current$n_susceptible
|
||||
n <- out_current$n_tested
|
||||
beta_posterior_1 <- beta_prior + r # Posterior alpha
|
||||
beta_posterior_2 <- beta_prior + (n - r) # Posterior beta
|
||||
|
||||
out$gamma_posterior[i] <- gamma_posterior
|
||||
out$beta_posterior_1[i] <- beta_posterior_1
|
||||
out$beta_posterior_2[i] <- beta_posterior_2
|
||||
}
|
||||
|
||||
wisca_parameters <- out
|
||||
|
||||
progress <- progress_ticker(
|
||||
@ -754,42 +725,28 @@ antibiogram.default <- function(x,
|
||||
)
|
||||
on.exit(close(progress))
|
||||
|
||||
# run WISCA
|
||||
# run WISCA per group
|
||||
for (group in unique(wisca_parameters$group)) {
|
||||
params_current <- wisca_parameters[which(wisca_parameters$group == group), , drop = FALSE]
|
||||
params_current <- wisca_parameters[wisca_parameters$group == group, , drop = FALSE]
|
||||
if (sum(params_current$n_tested, na.rm = TRUE) == 0) {
|
||||
next
|
||||
}
|
||||
|
||||
# Monte Carlo simulation
|
||||
coverage_simulations <- replicate(simulations, {
|
||||
progress$tick()
|
||||
# prepare priors
|
||||
priors_current <- create_wisca_priors(params_current)
|
||||
|
||||
# simulate pathogen incidence
|
||||
# = Dirichlet (Gamma) parameters
|
||||
random_incidence <- stats::runif(n = 1, min = 0, max = 1)
|
||||
simulated_incidence <- stats::qgamma(
|
||||
p = random_incidence,
|
||||
shape = params_current$gamma_posterior,
|
||||
scale = 1
|
||||
)
|
||||
# Monte Carlo simulations
|
||||
coverage_simulations <- vapply(
|
||||
FUN.VALUE = double(1),
|
||||
seq_len(simulations), function(i) {
|
||||
progress$tick()
|
||||
simulate_coverage(priors_current)
|
||||
}
|
||||
)
|
||||
|
||||
# normalise
|
||||
simulated_incidence <- simulated_incidence / sum(simulated_incidence, na.rm = TRUE)
|
||||
|
||||
# simulate susceptibility
|
||||
# = Beta parameters
|
||||
random_susceptibity <- stats::runif(n = 1, min = 0, max = 1)
|
||||
simulated_susceptibility <- stats::qbeta(
|
||||
p = random_susceptibity,
|
||||
shape1 = params_current$beta_posterior_1,
|
||||
shape2 = params_current$beta_posterior_2
|
||||
)
|
||||
sum(simulated_incidence * simulated_susceptibility, na.rm = TRUE)
|
||||
})
|
||||
|
||||
# calculate coverage statistics
|
||||
# summarise results
|
||||
coverage_mean <- mean(coverage_simulations)
|
||||
|
||||
if (interval_side == "two-tailed") {
|
||||
probs <- c((1 - conf_interval) / 2, 1 - (1 - conf_interval) / 2)
|
||||
} else if (interval_side == "left") {
|
||||
@ -797,17 +754,20 @@ antibiogram.default <- function(x,
|
||||
} else if (interval_side == "right") {
|
||||
probs <- c(1 - conf_interval, 1)
|
||||
}
|
||||
|
||||
coverage_ci <- unname(stats::quantile(coverage_simulations, probs = probs))
|
||||
|
||||
out_wisca$coverage[which(out_wisca$group == group)] <- coverage_mean
|
||||
out_wisca$lower_ci[which(out_wisca$group == group)] <- coverage_ci[1]
|
||||
out_wisca$upper_ci[which(out_wisca$group == group)] <- coverage_ci[2]
|
||||
out_wisca$coverage[out_wisca$group == group] <- coverage_mean
|
||||
out_wisca$lower_ci[out_wisca$group == group] <- coverage_ci[1]
|
||||
out_wisca$upper_ci[out_wisca$group == group] <- coverage_ci[2]
|
||||
}
|
||||
# remove progress bar from console
|
||||
|
||||
close(progress)
|
||||
# prepare for definitive output
|
||||
|
||||
# final output preparation
|
||||
out <- out_wisca
|
||||
wisca_parameters <- wisca_parameters[, colnames(wisca_parameters)[!colnames(wisca_parameters) %in% c(levels(NA_sir_), "lower_ci", "upper_ci", "group")], drop = FALSE]
|
||||
|
||||
if (isTRUE(has_syndromic_group)) {
|
||||
long_numeric <- out_wisca %pm>%
|
||||
pm_ungroup() %pm>%
|
||||
@ -1346,3 +1306,56 @@ knit_print.antibiogram <- function(x, italicise = TRUE, na = getOption("knitr.ka
|
||||
out <- paste(c("", "", knitr::kable(x, ..., output = FALSE)), collapse = "\n")
|
||||
knitr::asis_output(out)
|
||||
}
|
||||
|
||||
create_wisca_priors <- function(data) {
|
||||
pathogens <- unique(data$mo)
|
||||
n_pathogens <- length(pathogens)
|
||||
|
||||
# Dirichlet prior (gamma parameters)
|
||||
gamma_prior <- rep(1, times = n_pathogens)
|
||||
multinomial_obs <- data$n_total
|
||||
gamma_posterior <- gamma_prior + multinomial_obs
|
||||
|
||||
# beta priors
|
||||
beta_prior_alpha <- rep(1, times = n_pathogens)
|
||||
beta_prior_beta <- rep(1, times = n_pathogens)
|
||||
|
||||
r <- data$n_susceptible
|
||||
n <- data$n_tested
|
||||
diff_nr <- n - r
|
||||
|
||||
beta_posterior_1 <- beta_prior_alpha + r
|
||||
beta_posterior_2 <- beta_prior_beta + diff_nr
|
||||
|
||||
list(
|
||||
gamma_posterior = gamma_posterior,
|
||||
beta_posterior_1 = beta_posterior_1,
|
||||
beta_posterior_2 = beta_posterior_2
|
||||
)
|
||||
}
|
||||
|
||||
simulate_coverage <- function(params) {
|
||||
n_pathogens <- length(params$gamma_posterior)
|
||||
|
||||
# random draws per pathogen
|
||||
random_incidence <- runif(n = n_pathogens)
|
||||
random_susceptibility <- runif(n = n_pathogens)
|
||||
|
||||
simulated_incidence <- stats::qgamma(
|
||||
p = random_incidence,
|
||||
shape = params$gamma_posterior,
|
||||
scale = 1
|
||||
)
|
||||
|
||||
# normalise incidence
|
||||
simulated_incidence <- simulated_incidence / sum(simulated_incidence, na.rm = TRUE)
|
||||
|
||||
simulated_susceptibility <- stats::qbeta(
|
||||
p = random_susceptibility,
|
||||
shape1 = params$beta_posterior_1,
|
||||
shape2 = params$beta_posterior_2
|
||||
)
|
||||
|
||||
# weighted coverage
|
||||
sum(simulated_incidence * simulated_susceptibility, na.rm = TRUE)
|
||||
}
|
||||
|
54
R/sir.R
54
R/sir.R
@ -729,7 +729,7 @@ as.sir.data.frame <- function(x,
|
||||
# -- MO
|
||||
col_mo.bak <- col_mo
|
||||
if (is.null(col_mo)) {
|
||||
col_mo <- search_type_in_df(x = x, type = "mo", info = FALSE)
|
||||
col_mo <- search_type_in_df(x = x, type = "mo", info = info)
|
||||
}
|
||||
|
||||
# -- host
|
||||
@ -742,7 +742,7 @@ as.sir.data.frame <- function(x,
|
||||
}
|
||||
if (breakpoint_type == "animal") {
|
||||
if (is.null(host)) {
|
||||
host <- search_type_in_df(x = x, type = "host", add_col_prefix = FALSE)
|
||||
host <- search_type_in_df(x = x, type = "host", add_col_prefix = FALSE, info = info)
|
||||
} else if (length(host) == 1 && as.character(host) %in% colnames(x)) {
|
||||
host <- x[[as.character(host)]]
|
||||
}
|
||||
@ -753,7 +753,7 @@ as.sir.data.frame <- function(x,
|
||||
# -- UTIs
|
||||
col_uti <- uti
|
||||
if (is.null(col_uti)) {
|
||||
col_uti <- search_type_in_df(x = x, type = "uti", add_col_prefix = FALSE)
|
||||
col_uti <- search_type_in_df(x = x, type = "uti", add_col_prefix = FALSE, info = info)
|
||||
}
|
||||
if (!is.null(col_uti)) {
|
||||
if (is.logical(col_uti)) {
|
||||
@ -773,7 +773,7 @@ as.sir.data.frame <- function(x,
|
||||
}
|
||||
} else {
|
||||
# col_uti is still NULL - look for specimen column and make logicals of the urines
|
||||
col_specimen <- suppressMessages(search_type_in_df(x = x, type = "specimen"))
|
||||
col_specimen <- suppressMessages(search_type_in_df(x = x, type = "specimen", info = info))
|
||||
if (!is.null(col_specimen)) {
|
||||
uti <- x[, col_specimen, drop = TRUE] %like% "urin"
|
||||
values <- sort(unique(x[uti, col_specimen, drop = TRUE]))
|
||||
@ -846,7 +846,7 @@ as.sir.data.frame <- function(x,
|
||||
stop_if(is.null(col_mo), "`col_mo` must be set")
|
||||
# if not null, we already found it, now find again so a message will show
|
||||
if (is.null(col_mo.bak)) {
|
||||
col_mo <- search_type_in_df(x = x, type = "mo")
|
||||
col_mo <- search_type_in_df(x = x, type = "mo", info = info)
|
||||
}
|
||||
x_mo <- as.mo(x[, col_mo, drop = TRUE], info = info)
|
||||
}
|
||||
@ -854,10 +854,17 @@ as.sir.data.frame <- function(x,
|
||||
# set up parallel computing
|
||||
n_cores <- get_n_cores(max_cores = max_cores)
|
||||
n_cores <- min(n_cores, length(ab_cols)) # never more cores than variables required
|
||||
if (isTRUE(parallel) && .Platform$OS.type != "windows" && getRversion() < "4.0.0") {
|
||||
n_cores <- 1
|
||||
if (isTRUE(info)) {
|
||||
warning("Parallel computing is not available on unix in R < 4.0", call. = FALSE)
|
||||
if (isTRUE(parallel) && (.Platform$OS.type == "windows" || getRversion() < "4.0.0")) {
|
||||
cl <- tryCatch(parallel::makeCluster(n_cores, type = "PSOCK"),
|
||||
error = function(e) {
|
||||
if (isTRUE(info)) {
|
||||
message_("Could not create parallel cluster, using single-core computation. Error message: ", e$message, add_fn = font_red)
|
||||
}
|
||||
return(NULL)
|
||||
}
|
||||
)
|
||||
if (is.null(cl)) {
|
||||
n_cores <- 1
|
||||
}
|
||||
}
|
||||
|
||||
@ -959,10 +966,10 @@ as.sir.data.frame <- function(x,
|
||||
if (isTRUE(parallel) && n_cores > 1 && length(ab_cols) > 1) {
|
||||
if (isTRUE(info)) {
|
||||
message()
|
||||
message_("Running in parallel mode using ", n_cores, " out of ", get_n_cores(Inf), " cores, on columns ", vector_and(font_bold(ab_cols, collapse = NULL), quotes = "'", sort = FALSE), "...", as_note = FALSE, appendLF = FALSE, add_fn = font_red)
|
||||
message_("Running in parallel mode using ", n_cores, " out of ", get_n_cores(Inf), " cores, on columns ", vector_and(font_bold(ab_cols, collapse = NULL), quotes = "'", sort = FALSE), "...", as_note = FALSE, appendLF = FALSE)
|
||||
}
|
||||
if (.Platform$OS.type == "windows" || getRversion() < "4.0.0") {
|
||||
cl <- parallel::makeCluster(n_cores, type = "PSOCK")
|
||||
# `cl` has been created in the part above before the `run_as_sir_column` function
|
||||
on.exit(parallel::stopCluster(cl), add = TRUE)
|
||||
parallel::clusterExport(cl, varlist = c(
|
||||
"x", "x.bak", "x_mo", "ab_cols", "types",
|
||||
@ -974,12 +981,13 @@ as.sir.data.frame <- function(x,
|
||||
), envir = environment())
|
||||
result_list <- parallel::parLapply(cl, seq_along(ab_cols), run_as_sir_column)
|
||||
} else {
|
||||
# R>=4.0 on unix
|
||||
result_list <- parallel::mclapply(seq_along(ab_cols), run_as_sir_column, mc.cores = n_cores)
|
||||
}
|
||||
if (isTRUE(info)) {
|
||||
message_(" Done.", appendLF = TRUE, as_note = FALSE, add_fn = font_red)
|
||||
message_(font_green_bg(" DONE "), as_note = FALSE)
|
||||
message()
|
||||
message_("Run `sir_interpretation_history()` to retrieve a logbook with all the details of the breakpoint interpretations.", add_fn = font_green)
|
||||
message_("Run `sir_interpretation_history()` to retrieve a logbook with all details of the breakpoint interpretations.", add_fn = font_green)
|
||||
}
|
||||
} else {
|
||||
# sequential mode (non-parallel)
|
||||
@ -1116,7 +1124,7 @@ as_sir_method <- function(method_short,
|
||||
|
||||
if (isTRUE(info) && message_not_thrown_before("as.sir", "sir_interpretation_history")) {
|
||||
message()
|
||||
message_("Run `sir_interpretation_history()` afterwards to retrieve a logbook with all the details of the breakpoint interpretations.\n\n", add_fn = font_green)
|
||||
message_("Run `sir_interpretation_history()` afterwards to retrieve a logbook with all details of the breakpoint interpretations.\n\n", add_fn = font_green)
|
||||
}
|
||||
|
||||
current_df <- tryCatch(get_current_data(NA, 0), error = function(e) NULL)
|
||||
@ -1200,7 +1208,7 @@ as_sir_method <- function(method_short,
|
||||
mo <- NULL
|
||||
try(
|
||||
{
|
||||
mo <- suppressMessages(search_type_in_df(df, "mo", add_col_prefix = FALSE))
|
||||
mo <- suppressMessages(search_type_in_df(df, "mo", add_col_prefix = FALSE, info = info))
|
||||
},
|
||||
silent = TRUE
|
||||
)
|
||||
@ -1236,7 +1244,7 @@ as_sir_method <- function(method_short,
|
||||
uti <- NULL
|
||||
try(
|
||||
{
|
||||
uti <- suppressMessages(search_type_in_df(df, "uti", add_col_prefix = FALSE))
|
||||
uti <- suppressMessages(search_type_in_df(df, "uti", add_col_prefix = FALSE, info = info))
|
||||
},
|
||||
silent = TRUE
|
||||
)
|
||||
@ -1441,14 +1449,7 @@ as_sir_method <- function(method_short,
|
||||
if (nrow(breakpoints) == 0) {
|
||||
# apparently no breakpoints found
|
||||
if (isTRUE(info)) {
|
||||
message(
|
||||
paste0(font_rose_bg(" WARNING "), "\n"),
|
||||
font_black(paste0(
|
||||
" ", AMR_env$bullet_icon, " No ", method_coerced, " breakpoints available for ",
|
||||
suppressMessages(suppressWarnings(ab_name(unique(ab_coerced), language = NULL, tolower = TRUE, info = info))),
|
||||
" (", unique(ab_coerced), ")."
|
||||
), collapse = "\n")
|
||||
)
|
||||
message(font_grey_bg(font_black(" NO BREAKPOINTS ")))
|
||||
}
|
||||
|
||||
load_mo_uncertainties(metadata_mo)
|
||||
@ -1829,12 +1830,13 @@ as_sir_method <- function(method_short,
|
||||
message(font_yellow_bg(" NOTE "))
|
||||
}
|
||||
notes <- unique(notes)
|
||||
if (isTRUE(verbose) || length(notes) == 1 || NROW(AMR_env$sir_interpretation_history) == 0) {
|
||||
# if (isTRUE(verbose) || length(notes) == 1 || NROW(AMR_env$sir_interpretation_history) == 0) {
|
||||
if (isTRUE(verbose)) {
|
||||
for (i in seq_along(notes)) {
|
||||
message(word_wrap(" ", AMR_env$bullet_icon, " ", notes[i], add_fn = font_black))
|
||||
}
|
||||
} else {
|
||||
message(word_wrap(" ", AMR_env$bullet_icon, " There were multiple notes. Print or View `sir_interpretation_history()` to examine them, or use `as.sir(..., verbose = TRUE)` next time to directly print them here.", add_fn = font_black))
|
||||
# message(word_wrap(" ", AMR_env$bullet_icon, " There were multiple notes. Print or View `sir_interpretation_history()` to examine them, or use `as.sir(..., verbose = TRUE)` next time to directly print them here.", add_fn = font_black))
|
||||
}
|
||||
} else {
|
||||
message(font_green_bg(" OK "))
|
||||
|
File diff suppressed because it is too large
Load Diff
23
data-raw/wisca_reprex.R
Normal file
23
data-raw/wisca_reprex.R
Normal file
@ -0,0 +1,23 @@
|
||||
df <- example_isolates |>
|
||||
filter_first_isolate(method = "e", episode_days = 14) |>
|
||||
mutate(mo = ifelse(mo_genus(mo) == "Klebsiella", as.mo("Klebsiella"), mo)) |>
|
||||
top_n_microorganisms(10)
|
||||
|
||||
out_new <- df |> antibiogram(c("TZP","TZP+GEN","TZP+TOB"), wisca = TRUE, syndromic_group = "ward")
|
||||
out_nonwisca <- df |> antibiogram(c("TZP","TZP+GEN","TZP+TOB"),
|
||||
syndromic_group = "ward",
|
||||
mo_transform = function(x) "",
|
||||
digits = 1,
|
||||
minimum = 10,
|
||||
formatting_type = 14) |>
|
||||
as_tibble() |>
|
||||
select(-Pathogen)
|
||||
|
||||
# parameters_amr.R#L110: no filter on ward, so pts are only in 1 ward, depending on order of data
|
||||
# parameters_amr.R: number of first isolates are determined on the whole data set, while Klebsiella is aggregated afterwards (=duplicates on genus level)
|
||||
|
||||
source("~/Downloads/estimate_definition_amr.R")
|
||||
|
||||
|
||||
|
||||
|
18
index.md
18
index.md
@ -155,8 +155,10 @@ example_isolates %>%
|
||||
#> ℹ Using column 'mo' as input for mo_fullname()
|
||||
#> ℹ Using column 'mo' as input for mo_is_gram_negative()
|
||||
#> ℹ Using column 'mo' as input for mo_is_intrinsic_resistant()
|
||||
#> ℹ Determining intrinsic resistance based on 'EUCAST Expected Resistant Phenotypes' v1.2 (2023). This note will be shown once per session.
|
||||
#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB' (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
|
||||
#> ℹ Determining intrinsic resistance based on 'EUCAST Expected Resistant
|
||||
#> Phenotypes' v1.2 (2023). This note will be shown once per session.
|
||||
#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'
|
||||
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
|
||||
#> ℹ For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)
|
||||
#> # A tibble: 35 × 7
|
||||
#> bacteria GEN TOB AMK KAN IPM MEM
|
||||
@ -194,9 +196,9 @@ output format automatically (such as markdown, LaTeX, HTML, etc.).
|
||||
``` r
|
||||
antibiogram(example_isolates,
|
||||
antimicrobials = c(aminoglycosides(), carbapenems()))
|
||||
#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB' (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
|
||||
#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'
|
||||
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
|
||||
#> ℹ For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)
|
||||
#> ℹ 502 combinations had less than minimum = 30 results and were ignored
|
||||
```
|
||||
|
||||
| Pathogen | Amikacin | Gentamicin | Imipenem | Kanamycin | Meropenem | Tobramycin |
|
||||
@ -219,7 +221,6 @@ yield higher empiric coverage:
|
||||
antibiogram(example_isolates,
|
||||
antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"),
|
||||
mo_transform = "gramstain")
|
||||
#> ℹ 3 combinations had less than minimum = 30 results and were ignored
|
||||
```
|
||||
|
||||
| Pathogen | Piperacillin/tazobactam | Piperacillin/tazobactam + Gentamicin | Piperacillin/tazobactam + Tobramycin |
|
||||
@ -237,7 +238,6 @@ antibiogram(example_isolates,
|
||||
mo_transform = "gramstain",
|
||||
ab_transform = "name",
|
||||
language = "uk") # Ukrainian
|
||||
#> ℹ 3 combinations had less than minimum = 30 results and were ignored
|
||||
```
|
||||
|
||||
| Збудник | Гентаміцин | Тобраміцин | Ципрофлоксацин |
|
||||
@ -321,13 +321,15 @@ out <- example_isolates %>%
|
||||
# calculate AMR using resistance(), over all aminoglycosides and polymyxins:
|
||||
summarise(across(c(aminoglycosides(), polymyxins()),
|
||||
resistance))
|
||||
#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB' (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
|
||||
#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'
|
||||
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
|
||||
#> ℹ For polymyxins() using column 'COL' (colistin)
|
||||
#> Warning: There was 1 warning in `summarise()`.
|
||||
#> ℹ In argument: `across(c(aminoglycosides(), polymyxins()), resistance)`.
|
||||
#> ℹ In group 3: `ward = "Outpatient"`.
|
||||
#> Caused by warning:
|
||||
#> ! Introducing NA: only 23 results available for KAN in group: ward = "Outpatient" (minimum = 30).
|
||||
#> ! Introducing NA: only 23 results available for KAN in group: ward =
|
||||
#> "Outpatient" (minimum = 30).
|
||||
out
|
||||
#> # A tibble: 3 × 6
|
||||
#> ward GEN TOB AMK KAN COL
|
||||
|
@ -28,11 +28,11 @@ A BibTeX entry for LaTeX users is:
|
||||
\description{
|
||||
Welcome to the \code{AMR} package.
|
||||
|
||||
The \code{AMR} package is a peer-reviewed, \href{https://amr-for-r.org/#copyright}{free and open-source} R package with \href{https://en.wikipedia.org/wiki/Dependency_hell}{zero dependencies} to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. \strong{Our aim is to provide a standard} for clean and reproducible AMR data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting. \href{https://amr-for-r.org/authors.html}{Many different researchers} from around the globe are continually helping us to make this a successful and durable project!
|
||||
The \code{AMR} package is a peer-reviewed, \href{https://amr-for-r.org/#copyright}{free and open-source} R package with \href{https://en.wikipedia.org/wiki/Dependency_hell}{zero dependencies} to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. \strong{Our aim is to provide a standard} for clean and reproducible AMR data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting. We are a team of \href{https://amr-for-r.org/authors.html}{many different researchers} from around the globe to make this a successful and durable project!
|
||||
|
||||
This work was published in the Journal of Statistical Software (Volume 104(3); \doi{10.18637/jss.v104.i03}) and formed the basis of two PhD theses (\doi{10.33612/diss.177417131} and \doi{10.33612/diss.192486375}).
|
||||
|
||||
After installing this package, R knows \href{https://amr-for-r.org/reference/microorganisms.html}{\strong{~79 000 microorganisms}} (updated June 2024) and all \href{https://amr-for-r.org/reference/antimicrobials.html}{\strong{~620 antibiotic, antimycotic and antiviral drugs}} by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI and EUCAST are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). \strong{It was designed to work in any setting, including those with very limited resources}. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the public \href{https://www.rug.nl}{University of Groningen}, in collaboration with non-profit organisations \href{https://www.certe.nl}{Certe Medical Diagnostics and Advice Foundation} and \href{https://www.umcg.nl}{University Medical Center Groningen}.
|
||||
After installing this package, R knows \href{https://amr-for-r.org/reference/microorganisms.html}{\strong{~79 000 distinct microbial species}} (updated June 2024) and all \href{https://amr-for-r.org/reference/antimicrobials.html}{\strong{~620 antimicrobial and antiviral drugs}} by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI 2011-2025 and EUCAST 2011-2025 are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). \strong{It was designed to work in any setting, including those with very limited resources}. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the \href{https://www.rug.nl}{University of Groningen} and the \href{https://www.umcg.nl}{University Medical Center Groningen}.
|
||||
|
||||
The \code{AMR} package is available in English, Chinese, Czech, Danish, Dutch, Finnish, French, German, Greek, Italian, Japanese, Norwegian, Polish, Portuguese, Romanian, Russian, Spanish, Swedish, Turkish, and Ukrainian. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages.
|
||||
}
|
||||
@ -42,7 +42,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\seealso{
|
||||
|
@ -47,7 +47,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -103,7 +103,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -219,7 +219,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -69,7 +69,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\section{WHOCC}{
|
||||
|
@ -72,7 +72,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -64,7 +64,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -208,7 +208,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -264,7 +264,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -83,7 +83,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -69,7 +69,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -30,7 +30,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -111,7 +111,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -28,7 +28,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -26,7 +26,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -32,7 +32,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -96,7 +96,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -23,7 +23,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -25,7 +25,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -62,7 +62,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -233,7 +233,7 @@ All reference data sets in the AMR package - including information on microorgan
|
||||
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
Visit \href{https://amr-for-r.org/articles/datasets.html}{our website for direct download links}, or explore the actual files in \href{https://github.com/msberends/AMR/tree/main/data-raw/datasets}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -22,42 +22,42 @@ knitr::opts_chunk$set(
|
||||
)
|
||||
```
|
||||
|
||||
Note: to keep the package size as small as possible, we only include this vignette on CRAN. You can read more vignettes on our website about how to conduct AMR data analysis, determine MDROs, find explanation of EUCAST and CLSI breakpoints, and much more: <https://amr-for-r.org/articles/>.
|
||||
Note: to keep the package size as small as possible, we only include this vignette on CRAN. You can read more vignettes on our website about how to conduct AMR data analysis, determine MDROs, find explanation of EUCAST and CLSI breakpoints, and much more: <https://amr-for-r.org>.
|
||||
|
||||
----
|
||||
|
||||
The `AMR` package is a [free and open-source](https://amr-for-r.org/) R package with [zero dependencies](https://en.wikipedia.org/wiki/Dependency_hell) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. **Our aim is to provide a standard** for clean and reproducible AMR data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting. [Many different researchers](https://amr-for-r.org/authors.html) from around the globe are continually helping us to make this a successful and durable project!
|
||||
The `AMR` package is a peer-reviewed, [free and open-source](https://amr-for-r.org/#copyright) R package with [zero dependencies](https://en.wikipedia.org/wiki/Dependency_hell) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. **Our aim is to provide a standard** for clean and reproducible AMR data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting. We are a team of [many different researchers](https://amr-for-r.org/authors.html) from around the globe to make this a successful and durable project!
|
||||
|
||||
This work was published in the Journal of Statistical Software (Volume 104(3); [DOI 10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03)) and formed the basis of two PhD theses ([DOI 10.33612/diss.177417131](https://doi.org/10.33612/diss.177417131) and [DOI 10.33612/diss.192486375](https://doi.org/10.33612/diss.192486375)).
|
||||
This work was published in the Journal of Statistical Software (Volume 104(3); \doi{10.18637/jss.v104.i03}) and formed the basis of two PhD theses (\doi{10.33612/diss.177417131} and \doi{10.33612/diss.192486375}).
|
||||
|
||||
After installing this package, R knows `r AMR:::format_included_data_number(AMR::microorganisms)` distinct microbial species and all `r AMR:::format_included_data_number(rbind(AMR::antimicrobials[, "atc", drop = FALSE], AMR::antivirals[, "atc", drop = FALSE]))` antibiotic, antimycotic and antiviral drugs by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral breakpoint guidelines from CLSI and EUCAST are included from the last 10 years. It supports and can read any data format, including WHONET data.
|
||||
After installing this package, R knows [**`r AMR:::format_included_data_number(AMR::microorganisms)` distinct microbial species**](https://amr-for-r.org/reference/microorganisms.html) (updated June 2024) and all [**`r AMR:::format_included_data_number(NROW(AMR::antimicrobials) + NROW(AMR::antivirals))` antimicrobial and antiviral drugs**](https://amr-for-r.org/reference/antimicrobials.html) by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, grepl("CLSI", guideline))$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, grepl("CLSI", guideline))$guideline)))` and EUCAST `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, grepl("EUCAST", guideline))$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, grepl("EUCAST", guideline))$guideline)))` are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). **It was designed to work in any setting, including those with very limited resources**. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the [University of Groningen](https://www.rug.nl) and the [University Medical Center Groningen](https://www.umcg.nl).
|
||||
|
||||
With the help of contributors from all corners of the world, the `AMR` package is available in English, Czech, Chinese, Danish, Dutch, Finnish, French, German, Greek, Italian, Japanese, Norwegian, Polish, Portuguese, Romanian, Russian, Spanish, Swedish, Turkish, and Ukrainian. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages.
|
||||
The `AMR` package is available in `r vector_and(vapply(FUN.VALUE = character(1), LANGUAGES_SUPPORTED_NAMES, function(x) x$exonym), quotes = FALSE, sort = FALSE)`. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages.
|
||||
|
||||
This package is fully independent of any other R package and works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). **It was designed to work in any setting, including those with very limited resources**. Since its first public release in early 2018, this package has been downloaded from more than 175 countries.
|
||||
This package was intended as a comprehensive toolbox for integrated AMR data analysis. This package can be used for:
|
||||
|
||||
This package can be used for:
|
||||
|
||||
* Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the List of Prokaryotic names with Standing in Nomenclature (LPSN) and the Global Biodiversity Information Facility (GBIF)
|
||||
* Interpreting raw MIC and disk diffusion values, based on the latest CLSI or EUCAST guidelines
|
||||
* Retrieving antimicrobial drug names, doses and forms of administration from clinical health care records
|
||||
* Determining first isolates to be used for AMR data analysis
|
||||
* Calculating antimicrobial resistance
|
||||
* Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO)
|
||||
* Calculating (empirical) susceptibility of both mono therapy and combination therapies
|
||||
* Predicting future antimicrobial resistance using regression models
|
||||
* Getting properties for any microorganism (like Gram stain, species, genus or family)
|
||||
* Getting properties for any antibiotic (like name, code of EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name)
|
||||
* Plotting antimicrobial resistance
|
||||
* Applying EUCAST expert rules
|
||||
* Getting SNOMED codes of a microorganism, or getting properties of a microorganism based on a SNOMED code
|
||||
* Getting LOINC codes of an antibiotic, or getting properties of an antibiotic based on a LOINC code
|
||||
* Machine reading the EUCAST and CLSI guidelines from 2011-2020 to translate MIC values and disk diffusion diameters to SIR
|
||||
* Principal component analysis for AMR
|
||||
* Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the List of Prokaryotic names with Standing in Nomenclature ([LPSN]((https://lpsn.dsmz.de))) and the Global Biodiversity Information Facility ([GBIF](https://www.gbif.org)) ([manual](https://amr-for-r.org/reference/mo_property.html))
|
||||
* Interpreting raw MIC and disk diffusion values, based on any CLSI or EUCAST guideline ([manual](https://amr-for-r.org/reference/as.sir.html))
|
||||
* Retrieving antimicrobial drug names, doses and forms of administration from clinical health care records ([manual](https://amr-for-r.org/reference/ab_from_text.html))
|
||||
* Determining first isolates to be used for AMR data analysis ([manual](https://amr-for-r.org/reference/first_isolate.html))
|
||||
* Calculating antimicrobial resistance ([tutorial](https://amr-for-r.org/articles/AMR.html))
|
||||
* Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO) ([tutorial](https://amr-for-r.org/articles/MDR.html))
|
||||
* Calculating (empirical) susceptibility of both mono therapy and combination therapies ([tutorial](https://amr-for-r.org/articles/AMR.html))
|
||||
* Apply AMR function in predictive modelling ([tutorial](https://amr-for-r.org/articles/AMR_with_tidymodels.html))
|
||||
* Getting properties for any microorganism (like Gram stain, species, genus or family) ([manual](https://amr-for-r.org/reference/mo_property.html))
|
||||
* Getting properties for any antimicrobial (like name, code of EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name) ([manual](https://amr-for-r.org/reference/ab_property.html))
|
||||
* Plotting antimicrobial resistance ([tutorial](https://amr-for-r.org/articles/AMR.html))
|
||||
* Applying EUCAST expert rules ([manual](https://amr-for-r.org/reference/eucast_rules.html))
|
||||
* Getting SNOMED codes of a microorganism, or getting properties of a microorganism based on a SNOMED code ([manual](https://amr-for-r.org/reference/mo_property.html))
|
||||
* Getting LOINC codes of an antibiotic, or getting properties of an antibiotic based on a LOINC code ([manual](https://amr-for-r.org/reference/ab_property.html))
|
||||
* Machine reading the EUCAST and CLSI guidelines from 2011-2021 to translate MIC values and disk diffusion diameters to SIR ([link](https://amr-for-r.org/articles/datasets.html))
|
||||
* Principal component analysis for AMR ([tutorial](https://amr-for-r.org/articles/PCA.html))
|
||||
|
||||
All reference data sets (about microorganisms, antimicrobials, SIR interpretation, EUCAST rules, etc.) in this `AMR` package are publicly and freely available. We continually export our data sets to formats for use in R, SPSS, Stata and Excel. We also supply flat files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please find [all download links on our website](https://amr-for-r.org/articles/datasets.html), which is automatically updated with every code change.
|
||||
All reference data sets in the AMR package - including information on microorganisms, antimicrobials, and clinical breakpoints - are freely available for download in multiple formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata.
|
||||
|
||||
This R package was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the [University of Groningen](https://www.rug.nl), in collaboration with non-profit organisations [Certe Medical Diagnostics and Advice Foundation](https://www.certe.nl) and [University Medical Center Groningen](https://www.umcg.nl), and is being [actively and durably maintained](https://amr-for-r.org/news/) by two public healthcare organisations in the Netherlands.
|
||||
For maximum compatibility, we also provide machine-readable, tab-separated plain text files suitable for use in any software, including laboratory information systems.
|
||||
|
||||
Visit [our website for direct download links](https://amr-for-r.org/articles/datasets.html), or explore the actual files in [our GitHub repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
|
||||
|
||||
----
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user