mirror of
https://github.com/msberends/AMR.git
synced 2025-06-07 19:54:01 +02:00
Compare commits
2 Commits
80f08f91da
...
5667ce3eae
Author | SHA1 | Date | |
---|---|---|---|
5667ce3eae | |||
e70f3de02e |
1
.github/prehooks/commit-msg
vendored
1
.github/prehooks/commit-msg
vendored
@ -60,6 +60,7 @@ else
|
||||
fi
|
||||
|
||||
git add data-raw/*
|
||||
git add data/*
|
||||
git add -u
|
||||
|
||||
exit 0
|
||||
|
2
.github/prehooks/pre-commit
vendored
2
.github/prehooks/pre-commit
vendored
@ -51,6 +51,7 @@ if command -v Rscript > /dev/null; then
|
||||
currentpkg=$(Rscript -e "cat(pkgload::pkg_name())")
|
||||
echo "- Adding changed files in ./data-raw and ./man to this commit"
|
||||
git add data-raw/*
|
||||
git add data/*
|
||||
git add man/*
|
||||
git add R/sysdata.rda
|
||||
git add NAMESPACE
|
||||
@ -112,6 +113,7 @@ echo ""
|
||||
echo "${currentversion}" > .git/commit_version.tmp
|
||||
|
||||
git add data-raw/*
|
||||
git add data/*
|
||||
git add -u
|
||||
|
||||
exit 0
|
||||
|
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 2.1.1.9285
|
||||
Date: 2025-05-21
|
||||
Version: 2.1.1.9287
|
||||
Date: 2025-06-01
|
||||
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
|
||||
|
@ -1,12 +1,14 @@
|
||||
# Generated by roxygen2: do not edit by hand
|
||||
|
||||
S3method("!=",amr_selector)
|
||||
S3method("$",deprecated_amr_dataset)
|
||||
S3method("&",amr_selector)
|
||||
S3method("+",ab)
|
||||
S3method("+",amr_selector)
|
||||
S3method("==",amr_selector)
|
||||
S3method("[",ab)
|
||||
S3method("[",av)
|
||||
S3method("[",deprecated_amr_dataset)
|
||||
S3method("[",disk)
|
||||
S3method("[",mic)
|
||||
S3method("[",mo)
|
||||
@ -18,6 +20,7 @@ S3method("[<-",mo)
|
||||
S3method("[<-",sir)
|
||||
S3method("[[",ab)
|
||||
S3method("[[",av)
|
||||
S3method("[[",deprecated_amr_dataset)
|
||||
S3method("[[",disk)
|
||||
S3method("[[",mic)
|
||||
S3method("[[",mo)
|
||||
@ -40,6 +43,7 @@ S3method(any,amr_selector)
|
||||
S3method(any,amr_selector_any_all)
|
||||
S3method(as.data.frame,ab)
|
||||
S3method(as.data.frame,av)
|
||||
S3method(as.data.frame,deprecated_amr_dataset)
|
||||
S3method(as.data.frame,mic)
|
||||
S3method(as.data.frame,mo)
|
||||
S3method(as.double,mic)
|
||||
@ -93,6 +97,7 @@ S3method(print,av)
|
||||
S3method(print,bug_drug_combinations)
|
||||
S3method(print,custom_eucast_rules)
|
||||
S3method(print,custom_mdro_guideline)
|
||||
S3method(print,deprecated_amr_dataset)
|
||||
S3method(print,disk)
|
||||
S3method(print,mic)
|
||||
S3method(print,mo)
|
||||
@ -161,7 +166,6 @@ export(amr_distance_from_row)
|
||||
export(amr_selector)
|
||||
export(anti_join_microorganisms)
|
||||
export(antibiogram)
|
||||
export(antibiotics)
|
||||
export(antifungals)
|
||||
export(antimicrobials_equal)
|
||||
export(antimycobacterials)
|
||||
|
43
NEWS.md
43
NEWS.md
@ -1,50 +1,9 @@
|
||||
# AMR 2.1.1.9285
|
||||
# AMR 2.1.1.9287
|
||||
|
||||
*(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).)*
|
||||
|
||||
This package now supports not only tools for AMR data analysis in clinical settings, but also for veterinary and environmental microbiology. This was made possible through a collaboration with the [University of Prince Edward Island's Atlantic Veterinary College](https://www.upei.ca/avc), Canada. To celebrate this great improvement of the package, we also updated the package logo to reflect this change.
|
||||
|
||||
## tl;dr
|
||||
|
||||
- Scope Expansion: One Health support (Human + Veterinary + Environmental microbiology).
|
||||
- Data Updates:
|
||||
- `antibiotics` renamed to `antimicrobials`.
|
||||
- Veterinary antimicrobials and WHOCC codes added.
|
||||
- MycoBank fungal taxonomy integrated (+20,000 fungi).
|
||||
- Breakpoints & Interpretations:
|
||||
- CLSI/EUCAST 2024-2025 breakpoints added; EUCAST 2025 default.
|
||||
- `as.sir()` supports NI/SDD levels; parallel computation enabled.
|
||||
- Custom S/I/R/SDD/NI definitions allowed.
|
||||
- Improved handling of capped MICs.
|
||||
- New Tools & Functions:
|
||||
- WISCA antibiogram support (`antibiogram()`, `wisca()`).
|
||||
- New ggplot2 extensions: `scale_*_mic()`, `scale_*_sir()`, `rescale_mic()`.
|
||||
- New utility functions: `top_n_microorganisms()`, `mo_group_members()`, `mic_p50()`, `mic_p90()`.
|
||||
- Predictive Modelling:
|
||||
- Full tidymodels compatibility for antimicrobial selectors.
|
||||
- Deprecated `resistance_predict()` and `sir_predict()`.
|
||||
- Python Compatibility: AMR R package now runs in Python.
|
||||
- Selector Improvements:
|
||||
* Added selectors (`isoxazolylpenicillins()`, `monobactams()`, `nitrofurans()`, `phenicols()`, `rifamycins()`, and `sulfonamides()`)
|
||||
- Selectors renamed from `ab_*` to `amr_*`; old names deprecated.
|
||||
- MIC/Disks Handling:
|
||||
- MIC strict comparisons, added levels.
|
||||
- Disk diffusion range expanded (0–50 mm).
|
||||
- EUCAST Rules and MDROs:
|
||||
- EUCAST v12–v15 rules implemented.
|
||||
- Dutch MDRO 2024 guideline support in `mdro()`.
|
||||
- Infrastructure:
|
||||
- New website: https://amr-for-r.org.
|
||||
- Improved `vctrs` integration for tidyverse workflows.
|
||||
- Dropped SAS `.xpt` file support.
|
||||
- Other Fixes & Enhancements:
|
||||
- Support for 8 new languages, adding to a total of 28 languages.
|
||||
- Faster microorganism identification.
|
||||
- Improved antimicrobial and MIC handling.
|
||||
- Extended documentation, additional contributors acknowledged.
|
||||
|
||||
## Full Changelog
|
||||
|
||||
### Breaking
|
||||
* Dataset `antibiotics` has been renamed to `antimicrobials` as the data set contains more than just antibiotics. Using `antibiotics` will still work, but now returns a warning.
|
||||
* Removed all functions and references that used the deprecated `rsi` class, which were all replaced with their `sir` equivalents over two years ago.
|
||||
|
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
@ -35,10 +35,35 @@
|
||||
#' @rdname AMR-deprecated
|
||||
NULL
|
||||
|
||||
#' @rdname AMR-deprecated
|
||||
#' @usage NULL
|
||||
.amr_deprecation_warn <- function() {
|
||||
deprecation_warning(old = "antibiotics", new = "antimicrobials", is_dataset = TRUE)
|
||||
invisible(NULL)
|
||||
}
|
||||
#' @export
|
||||
"antibiotics"
|
||||
`[.deprecated_amr_dataset` <- function(x, ...) {
|
||||
.amr_deprecation_warn()
|
||||
NextMethod("[")
|
||||
}
|
||||
#' @export
|
||||
`[[.deprecated_amr_dataset` <- function(x, ...) {
|
||||
.amr_deprecation_warn()
|
||||
NextMethod("[[")
|
||||
}
|
||||
#' @export
|
||||
`$.deprecated_amr_dataset` <- function(x, name) {
|
||||
.amr_deprecation_warn()
|
||||
NextMethod("$")
|
||||
}
|
||||
#' @export
|
||||
print.deprecated_amr_dataset <- function(x, ...) {
|
||||
.amr_deprecation_warn()
|
||||
NextMethod("print")
|
||||
}
|
||||
#' @export
|
||||
as.data.frame.deprecated_amr_dataset <- function(x, ...) {
|
||||
.amr_deprecation_warn()
|
||||
NextMethod("as.data.frame")
|
||||
}
|
||||
|
||||
# REMEMBER to search for `deprecation_warning` in the package code to find all instances.
|
||||
# currently deprecated arguments at least:
|
||||
|
8
R/zzz.R
8
R/zzz.R
@ -110,14 +110,6 @@ AMR_env$cross_icon <- if (isTRUE(base::l10n_info()$`UTF-8`)) "\u00d7" else "x"
|
||||
AB_LOOKUP <- create_AB_AV_lookup(AMR::antimicrobials)
|
||||
}
|
||||
|
||||
# deprecated antibiotics data set
|
||||
makeActiveBinding("antibiotics", function() {
|
||||
if (interactive()) {
|
||||
deprecation_warning(old = "antibiotics", new = "antimicrobials", is_dataset = TRUE)
|
||||
}
|
||||
AMR::antimicrobials
|
||||
}, env = asNamespace(pkgname))
|
||||
|
||||
AMR_env$AB_lookup <- cbind(AMR::antimicrobials, AB_LOOKUP)
|
||||
AMR_env$AV_lookup <- cbind(AMR::antivirals, AV_LOOKUP)
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
As with all previous >20 releases, some CHECKs might return a NOTE for *just* hitting the installation size limit, though its size has been brought down to a minimum in collaboration with CRAN maintainers previously.
|
||||
As with all previous >20 releases, some CHECKs on `oldrel` may return a `NOTE` for narrowly exceeding the installation size limit. This has been reduced to a minimum in prior coordination with CRAN maintainers and currently returns only an `INFO` on `release` and `devel`.
|
||||
|
||||
We consider this a high-impact package: it was published in the Journal of Statistical Software (2022), is included in a CRAN Task View (Epidemiology), and is according to download stats (cranlogs) used in almost all countries in the world. If there is anything to note, please let us know up-front without directly archiving the current version. That said, we continually unit test our package extensively and have no reason to assume that anything is wrong.
|
||||
We treat this as a high-impact package: it was published in the *Journal of Statistical Software* (2022), is listed in the CRAN Task View "Epidemiology", and (based on cranlogs download statistics) is used globally. If there is anything to address, we would appreciate being informed before archiving the current version. We conduct extensive automated unit testing and have no indication of unresolved issues.
|
||||
|
||||
Thanks for maintaining and hosting CRAN! It's empowering R and its use enormously!
|
||||
Thank you for your continued maintenance of CRAN, it plays a central role in the success and growth of the R ecosystem.
|
||||
|
@ -625,6 +625,11 @@ if (changed_md5(dosage)) {
|
||||
try(arrow::write_parquet(dosage, "data-raw/datasets/dosage.parquet"), silent = TRUE)
|
||||
}
|
||||
|
||||
# Set `antibiotics` as a deprecated data set
|
||||
antibiotics <- structure(antimicrobials, class = c("deprecated_amr_dataset", class(antimicrobials)))
|
||||
usethis::use_data(antibiotics, internal = FALSE, overwrite = TRUE, compress = "xz", version = 2)
|
||||
rm(antibiotics)
|
||||
|
||||
suppressMessages(reset_AMR_locale())
|
||||
|
||||
devtools::load_all(quiet = TRUE)
|
||||
|
@ -948,6 +948,8 @@ get_atc_code <- function(ab) {
|
||||
# exception for imipenem
|
||||
if (ab_name == "imipenem") ab_name <- "imipenem/cilastatin"
|
||||
if (ab_name == "imipenem/relebactam") ab_name <- "imipenem/cilastatin/relebactam"
|
||||
if (ab_name == "ceftaroline") ab_name <- "ceftaroline fosamil"
|
||||
ab_name.bak <- ab_name
|
||||
if (ab_name %like% "/") {
|
||||
ab_name <- strsplit(ab_name, "[/ ]")[[1]]
|
||||
}
|
||||
@ -971,28 +973,33 @@ get_atc_code <- function(ab) {
|
||||
} else if (ab_name_full %like% " and " && ab_name_bla %in% atc_tbl[[2]]) {
|
||||
out <- atc_tbl[[1]][which(atc_tbl[[2]] == ab_name_bla)]
|
||||
} else {
|
||||
if (any(atc_tbl_human$X1 %like% ab_name.bak, na.rm = TRUE)) {
|
||||
message("returning NA, but DO MIND: ", ab_name.bak, " resembles ATC name(s) ", toString(atc_tbl_human$X1), appendLF = FALSE)
|
||||
}
|
||||
out <- NA_character_
|
||||
}
|
||||
unique(out)
|
||||
}
|
||||
|
||||
# update all:
|
||||
to_update <- 1:nrow(antimicrobials)
|
||||
# or just the empty ones:
|
||||
to_update <- which(sapply(antimicrobials$atc, function(x) length(x[!is.na(x)])) == 0)
|
||||
|
||||
updated_atc <- lapply(seq_len(length(to_update)),
|
||||
function(x) NA_character_)
|
||||
|
||||
to_update <- 1:nrow(antimicrobials)
|
||||
# or just the empty ones:
|
||||
to_update <- which(sapply(antimicrobials$atc, length) == 0)
|
||||
|
||||
# this takes around 10 minutes (some are skipped and go faster)
|
||||
# this takes around 10 minutes for the whole table (some ABx are skipped and go faster)
|
||||
for (i in to_update) {
|
||||
message(percentage(i / length(updated_atc), digits = 1),
|
||||
message(percentage(which(to_update == i) / length(updated_atc), digits = 1),
|
||||
" - Downloading ", antimicrobials$name[i],
|
||||
appendLF = FALSE
|
||||
)
|
||||
atcs <- get_atc_code(antimicrobials$name[i])
|
||||
if (length(atcs[!is.na(atcs)]) > 0) {
|
||||
updated_atc[[i]] <- atcs
|
||||
message(" (", length(atcs[!is.na(atcs)]), " results: ", toString(atcs[!is.na(atcs)]), ")")
|
||||
message(font_blue(paste0(" (", length(atcs[!is.na(atcs)]), " results: ", toString(atcs[!is.na(atcs)]), ")")))
|
||||
# let the WHO server rest for a second - they might have a limitation on the queries per second
|
||||
Sys.sleep(1)
|
||||
} else {
|
||||
@ -1001,7 +1008,8 @@ for (i in to_update) {
|
||||
}
|
||||
|
||||
updated_atc <- lapply(updated_atc, function(x) sort(x[!is.na(x)]))
|
||||
antimicrobials$atc <- updated_atc
|
||||
antimicrobials$atc[to_update] <- updated_atc[to_update]
|
||||
|
||||
# DO NOT FORGET TO UPDATE R/aa_globals.R!
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
959459b92fe6ff57c02bab08381a73a8
|
||||
228840b3941753c4adee2b781d901590
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -114,7 +114,7 @@
|
||||
"CRD" 5284529 "Cefroxadine" "Cephalosporins (1st gen.)" "J01DB11,QJ01DB11" "Other beta-lactam antibacterials" "First-generation cephalosporins" "ceftix" "cefroxadin,cefroxadino,cefroxadinum,oraspor" 2.1 "g" "NA"
|
||||
"CFS" 656575 "Cefsulodin" "Cephalosporins (3rd gen.)" "J01DD03,QJ01DD03" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cefsul,cfsl,cfsu" "cefomonil,cefonomil,cefsulodine,cefsulodinhydrate,cefsulodino,cefsulodinum,pseudocef,pseudomonil,pyocefal,sulcephalosporin,takesulin,tilmapor,ulfaret" 4 "g" "127-1,128-9,129-7,130-5,131-3,18892-0,25242-9,55647-2"
|
||||
"CSU" 68718 "Cefsumide" "Cephalosporins (unclassified gen.)" "NA" "NA" "cefsulmid,cefsumido,cefsumidum" "NA"
|
||||
"CPT" 56841980 "Ceftaroline" "Cephalosporins (5th gen.)" "NA" "ceftar,cfro" "ceftaroine,teflaro,zinforo" "73604-1,73605-8,73626-4,73627-2,73649-6,73650-4,74170-2"
|
||||
"CPT" 56841980 "Ceftaroline" "Cephalosporins (5th gen.)" "J01DI02,QJ01DI02" "ceftar,cfro" "ceftaroine,teflaro,zinforo" "73604-1,73605-8,73626-4,73627-2,73649-6,73650-4,74170-2"
|
||||
"CPA" "Ceftaroline/avibactam" "Cephalosporins (5th gen.)" "NA" "NA" "NA" "73604-1,73626-4,73649-6"
|
||||
"CAZ" 5481173 "Ceftazidime" "Cephalosporins (3rd gen.)" "J01DD02,QJ01DD02" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "caz,cefta,ceftaz,cfta,cftz,taz,tz,xtz" "ceftazimide,ceptaz,fortam,fortaz,fortum,glazidim,kefazim,modacin,pentacef,tazicef,tizime" 4 "g" "101481-0,101482-8,101483-6,132-1,133-9,134-7,135-4,18893-8,21151-6,3449-6,35774-9,35775-6,35776-4,42352-5,55648-0,55649-8,55650-6,55651-4,58705-5,6995-5,73603-3,73625-6,73648-8,80960-8,87734-0,90850-9"
|
||||
"CZA" 90643431 "Ceftazidime/avibactam" "Cephalosporins (3rd gen.)" "J01DD52,QJ01DD52" "cfav" "avycaz,zavicefta" 6 "g" "101483-6,73603-3,73625-6,73648-8,87734-0"
|
||||
|
Binary file not shown.
BIN
data/antibiotics.rda
Normal file
BIN
data/antibiotics.rda
Normal file
Binary file not shown.
Binary file not shown.
@ -192,7 +192,7 @@ out %>% set_ab_names(property = "atc")
|
||||
|
||||
This package was intended as a comprehensive toolbox for integrated AMR data analysis. 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]((https://lpsn.dsmz.de))) and the Global Biodiversity Information Facility ([GBIF](https://www.gbif.org)) ([manual](./reference/mo_property.html))
|
||||
* 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](./reference/mo_property.html))
|
||||
* Interpreting raw MIC and disk diffusion values, based on any CLSI or EUCAST guideline ([manual](./reference/as.sir.html))
|
||||
* Retrieving antimicrobial drug names, doses and forms of administration from clinical health care records ([manual](./reference/ab_from_text.html))
|
||||
* Determining first isolates to be used for AMR data analysis ([manual](./reference/first_isolate.html))
|
||||
|
2
index.md
2
index.md
@ -387,7 +387,7 @@ data analysis. 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]((https://lpsn.dsmz.de))) and the
|
||||
with Standing in Nomenclature ([LPSN](https://lpsn.dsmz.de)) and the
|
||||
Global Biodiversity Information Facility
|
||||
([GBIF](https://www.gbif.org))
|
||||
([manual](./reference/mo_property.html))
|
||||
|
@ -1,15 +1,10 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/zz_deprecated.R
|
||||
\docType{data}
|
||||
\name{AMR-deprecated}
|
||||
\alias{AMR-deprecated}
|
||||
\alias{antibiotics}
|
||||
\alias{ab_class}
|
||||
\alias{ab_selector}
|
||||
\title{Deprecated Functions, Arguments, or Datasets}
|
||||
\format{
|
||||
An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 497 rows and 14 columns.
|
||||
}
|
||||
\usage{
|
||||
ab_class(...)
|
||||
|
||||
@ -18,5 +13,4 @@ ab_selector(...)
|
||||
\description{
|
||||
These objects are so-called '\link{Deprecated}'. \strong{They will be removed in a future version of this package.} Using these will give a warning with the name of the alternative object it has been replaced by (if there is one).
|
||||
}
|
||||
\keyword{datasets}
|
||||
\keyword{internal}
|
||||
|
@ -36,7 +36,7 @@ The `AMR` package is available in `r AMR:::vector_and(vapply(FUN.VALUE = charact
|
||||
|
||||
This package was intended as a comprehensive toolbox for integrated AMR data analysis. 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]((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))
|
||||
* 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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user