mirror of
https://github.com/msberends/AMR.git
synced 2026-11-16 00:10:57 +01:00
* Update taxonomy of microorganisms (2026-10) Rebuild of the microorganisms data set from COL 2026-04-18 XR, LPSN and BacDive of October 2026 and MycoBank of January 2026, with v3.0.1 as the previous data set: 111,103 records (v3.0.1: 78,679), 0 changed MO codes of existing names, 522 released codes retired (275 to be reviewed). Script fixes (data-raw/_reproduction_scripts/reproduction_of_microorganisms.R): - previous data set from the last release; COL read as COL Data Package (NameUsage.tsv) - keep COL records without authors (a filter on NA dropped them, e.g. Balamuthia mandrillaris) - genus homonyms: unclassified MycoBank entries are not authoritative; the released domain of a genus wins if a source supports it (e.g. Moorella, Serpula, Pirella stay Bacteria) - protect current names of relevant species instead of whole current genera (data set tripled) - current names and synonyms only within the same domain and for known names (Brugia -> Lycoperdon) - MycoBank names in Latin script only; old records outside their source's scope become manually added - Graphium butterflies of v3.0.1 are not carried over, re-added or restored - restore released taxa by name and rank; retire older cross-domain homonyms for review - fill empty families from COL and a commented override list (Ascaris, Balamuthia) - add Brugia malayi and B. timori; remove Salmonella species synonyms that are serovars - BacDive: a minority of facultative strain records no longer decides (C. difficile) - translate codes of other data sets with the development version; review unmatched codes - scope decisions: COL XR names only if relevant or released; Protozoa follow the Fungi rules Also: all checkpoints (data-raw/taxonomy*.rds), updated data sets, Bartlett et al. list, accessed dates in TAXONOMY_VERSION, NEWS, two staphylococci added to CoNS, tests updated for real taxonomic changes, known defects file removed (all solved), and the findings report with all review files in data-raw/taxonomy_review/2026-10/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Taxonomy review report: note on the .dta export and the single commit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix as.mo() for Salmonella serovars written with the species; add S. xeri to CoNS - "Salmonella enterica (subsp. enterica) serovar Typhi" returned S. bongori, and "S. enterica Typhimurium" S. enterica diarizonae; "Paratyphi A/B/C" became serogroups - Staphylococcus xeri and S. parequorum confirmed as coagulase-negative Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Taxonomy build: remove lichens (decision of 5 October 2026) Fungi in the lichen-forming classes and the order Verrucariales are removed unless their genus is clinically relevant, with the synonyms that point to them (4,155 records); released lichens are restored. microorganisms now has 107,126 records (Fungi 45,739); all tests pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Taxonomy review decisions: microsporidia in Fungi, accepted names, missing protozoa - all microsporidia in the Fungi (1,394 names of v3.0.1 from P_ to F_, old codes translated by name) - Enterocytozoon bieneusi and Encephalitozoon cuniculi as accepted names (accepted_name_override) - Balantidium and Isospora added to MO_RELEVANT_GENERA; Cystoisospora belli as synonym of Isospora belli - synonym cycles decided: Capillidium and Scolecobasidium are the current genera - removed the stale data-raw/taxonomy_lpsn0.rds - microorganisms now has 107,253 records; all tests pass Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Taxonomy review report: all items reviewed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Rule matching by accepted taxon; Erysipelatoclostridium as synonym of Thomasclavelia - interpretive_rules(): species named in a rule (literal names, genus_species/fullname) now also match all other names of the same accepted taxon, e.g. 'Clostridium ramosum' for Thomasclavelia ramosa; not for genera or regex rules - Erysipelatoclostridium and its species are synonyms of Thomasclavelia (accepted_name_override); E. merdavium is retired by decision of 6 October 2026, and the build removes taxa retired by a human decision - microorganisms patched with the same logic as the build script (no full rebuild): 107,252 records - intrinsic_resistant regenerated with the new taxonomy and rule matching: 308,646 rows - clinical_breakpoints: EUCAST workbook rows merged again, 24 EUCAST 2026 rows moved from C. ramosum to T. ramosa Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Taxonomy: correct records for names listed twice, no synonyms without a current name, strict data tests - one record per name keeps the accepted record (e.g. Eggerthella lenta, Gordonia amarae, Anisakis simplex and Enterobius vermicularis were synonyms without a current name), links to dropped records are moved - LPSN lookup reads the taxonomic status and correct name; validly published synonyms are no longer 'accepted' - synonyms without a current name: linked via LPSN or removed, released codes retired (3,668); records with kept children become 'unknown'; the M. tuberculosis complex is protected (decisions of 7 October 2026) - subspecies codes reserved, current names of synonyms kept when pruning, missing parent records added or moved, higher taxonomy harmonised, shared identifiers resolved per domain and rank, pointers and parent links cleaned - data sets refer only to current names (except intrinsic_resistant); group members only from current names; internal CoNS/CoPS/streptococcal lists keep a synonym only with its current name - intrinsic_resistant, clinical_breakpoints (EUCAST workbooks) and microorganisms.groups regenerated - 28 new tests in test-data.R; devtools::test(): 1,581 expectations, 0 failures - open decisions listed in data-raw/taxonomy_review/2026-10/REPORT.md, section 6 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Taxonomy: protect WHO priority genera, follow LPSN for the M. tuberculosis complex, place protist groups in one domain - all taxa of the genera in MO_WHO_PRIORITY_GENERA are protected, also names that are not validly published (replaces the hard-coded M. tuberculosis complex; keeps e.g. Klebsiella quasivariicola, M. canettii, M. orygis) - LPSN is followed for the M. tuberculosis complex: M. bovis, M. africanum, M. caprae, M. microti and M. pinnipedii are heterotypic synonyms of M. tuberculosis (Riojas et al. 2018); a test enforces this - labyrinthulids in the Chromista (Aplanochytrium), Dictydiaethalium in the Protozoa (genus_domain_move), and the rank suffix also between domains ('Acantharia {class}' next to the fungal genus Acantharia) - devtools::test(): 1,582 expectations, 0 failures Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Taxonomy build no longer depends on the previous build - intrinsic_resistant is no input of the microorganisms build anymore (it is computed from it); the genera named in the interpretive rules are read from the rules instead - the previous data set no longer makes genera relevant; Debaryomyces added to MO_RELEVANT_GENERA - new run_after_microorganisms_build.R recreates microorganisms.groups, the EUCAST breakpoints and intrinsic_resistant in the right order, and the build runs it at its end - reproduction_of_intrinsic_resistant.R uses devtools::load_all() instead of the installed package - effect: 24 never released, not relevant COL records less; devtools::test(): 1,582 expectations, 0 failures Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Taxonomy review report: summary updated to the second round Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * MO code retirements: mark the 265 reviewed retirements as reviewed The Graphium and v2.x Protozoa retirements were reviewed and accepted on 6 October 2026 (see the taxonomy review report, section 5); 'NEEDS REVIEW' is replaced by 'reviewed by Matthijs S. Berends on 2026-10-06'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
180 lines
12 KiB
R
180 lines
12 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/interpretive_rules.R
|
|
\name{interpretive_rules}
|
|
\alias{interpretive_rules}
|
|
\alias{EUCAST}
|
|
\alias{eucast_rules}
|
|
\alias{clsi_rules}
|
|
\alias{eucast_dosage}
|
|
\title{Apply Interpretive Rules}
|
|
\usage{
|
|
interpretive_rules(
|
|
x,
|
|
col_mo = NULL,
|
|
info = interactive(),
|
|
rules = getOption("AMR_interpretive_rules", default = c("breakpoints",
|
|
"expected_phenotypes")),
|
|
guideline = getOption("AMR_guideline", "EUCAST"),
|
|
verbose = FALSE,
|
|
version_breakpoints = 16,
|
|
version_expected_phenotypes = 1.2,
|
|
version_expertrules = 3.3,
|
|
ampc_cephalosporin_resistance = NA,
|
|
only_sir_columns = any(is.sir(x)),
|
|
custom_rules = NULL,
|
|
overwrite = FALSE,
|
|
add_if_missing = TRUE,
|
|
...
|
|
)
|
|
|
|
eucast_rules(
|
|
x,
|
|
col_mo = NULL,
|
|
info = interactive(),
|
|
rules = getOption("AMR_interpretive_rules", default = c("breakpoints",
|
|
"expected_phenotypes")),
|
|
...
|
|
)
|
|
|
|
clsi_rules(
|
|
x,
|
|
col_mo = NULL,
|
|
info = interactive(),
|
|
rules = getOption("AMR_interpretive_rules", default = c("breakpoints",
|
|
"expected_phenotypes")),
|
|
...
|
|
)
|
|
|
|
eucast_dosage(ab, administration = "iv", version_breakpoints = 15)
|
|
}
|
|
\arguments{
|
|
\item{x}{A data set with antimicrobials columns, such as \code{amox}, \code{AMX} and \code{AMC}.}
|
|
|
|
\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{info}{A \link{logical} to indicate whether progress should be printed to the console - the default is only print while in interactive sessions.}
|
|
|
|
\item{rules}{A \link{character} vector that specifies which rules should be applied. Must be one or more of \code{"breakpoints"}, \code{"expected_phenotypes"}, \code{"expert"}, \code{"other"}, \code{"custom"}, \code{"all"}, and defaults to \code{c("breakpoints", "expected_phenotypes")}. The default value can be set to another value using the package option \code{\link[=AMR-options]{AMR_interpretive_rules}}: \code{options(AMR_interpretive_rules = "all")}. If using \code{"custom"}, be sure to fill in argument \code{custom_rules} too. Custom rules can be created with \code{\link[=custom_interpretive_rules]{custom_interpretive_rules()}}.}
|
|
|
|
\item{guideline}{A guideline name, either "EUCAST" (default) or "CLSI". This can be set with the package option \code{\link[=AMR-options]{AMR_guideline}}.}
|
|
|
|
\item{verbose}{A \link{logical} to turn Verbose mode on and off (default is off). In Verbose mode, the function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way. Using Verbose mode takes a lot more time.}
|
|
|
|
\item{version_breakpoints}{The version number to use for the EUCAST Clinical Breakpoints guideline. Can be \code{"16.0"}, \code{"15.0"}, \code{"14.0"}, \code{"13.1"}, \code{"12.0"}, \code{"11.0"}, or \code{"10.0"}.}
|
|
|
|
\item{version_expected_phenotypes}{The version number to use for the EUCAST Expected Phenotypes. Can be \code{"1.2"}.}
|
|
|
|
\item{version_expertrules}{The version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be \code{"3.3"}.}
|
|
|
|
\item{ampc_cephalosporin_resistance}{(only applies when \code{rules} contains \code{"expert"} or \code{"all"}) a \link{character} value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants - the default is \code{NA}. Currently only works when \code{version_expertrules} is \code{3.2} and higher; these versions of '\emph{EUCAST Expert Rules on Enterobacterales}' state that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these three drugs. A value of \code{NA} (the default) for this argument will remove results for these three drugs, while e.g. a value of \code{"R"} will make the results for these drugs resistant. Use \code{NULL} or \code{FALSE} to not alter results for these three drugs of AmpC de-repressed cephalosporin-resistant mutants. Using \code{TRUE} is equal to using \code{"R"}. \cr For \emph{EUCAST Expert Rules} v3.2, this rule applies to: \emph{Citrobacter braakii}, \emph{Citrobacter freundii}, \emph{Citrobacter gillenii}, \emph{Citrobacter murliniae}, \emph{Citrobacter rodenticum}, \emph{Citrobacter sedlakii}, \emph{Citrobacter werkmanii}, \emph{Citrobacter youngae}, \emph{Enterobacter}, \emph{Hafnia alvei}, and \emph{Klebsiella aerogenes}.}
|
|
|
|
\item{only_sir_columns}{A \link{logical} to indicate whether only antimicrobial columns must be included that were transformed to class \link[=as.sir]{sir} on beforehand. Defaults to \code{FALSE} if no columns of \code{x} have a class \link[=as.sir]{sir}.}
|
|
|
|
\item{custom_rules}{Custom rules to apply, created with \code{\link[=custom_interpretive_rules]{custom_interpretive_rules()}}.}
|
|
|
|
\item{overwrite}{A \link{logical} indicating whether to overwrite existing SIR values (default: \code{FALSE}). When \code{FALSE}, only non-SIR values are modified (i.e., any value that is not already S, I or R). To ensure compliance with EUCAST guidelines, \strong{this should remain} \code{FALSE}, as EUCAST notes often state that an organism "should be tested for susceptibility to individual agents or be reported resistant".}
|
|
|
|
\item{add_if_missing}{A \link{logical} indicating whether rules should also be applied to missing (\code{NA}) values (default: \code{TRUE}). When \code{FALSE}, rules are only applied to cells that already contain an SIR value; cells with \code{NA} are left untouched. This is particularly useful when using \code{overwrite = TRUE} with custom rules and you want to update reported results without imputing values for untested drugs.}
|
|
|
|
\item{...}{Column names of antimicrobials. To automatically detect antimicrobial column names, do not provide any named arguments; \code{\link[=guess_ab_col]{guess_ab_col()}} will then be used for detection. To manually specify a column, provide its name (case-insensitive) as an argument, e.g. \code{AMX = "amoxicillin"}. To skip a specific antimicrobial, set it to \code{NULL}, e.g. \code{TIC = NULL} to exclude ticarcillin. If a manually defined column does not exist in the data, it will be skipped with a warning.}
|
|
|
|
\item{ab}{Any (vector of) text that can be coerced to a valid antimicrobial drug code with \code{\link[=as.ab]{as.ab()}}.}
|
|
|
|
\item{administration}{Route of administration, either \code{""}, \code{"im"}, \code{"iv"}, \code{"oral"}, or NA.}
|
|
}
|
|
\value{
|
|
The input of \code{x}, possibly with edited values of antimicrobials. Or, if \code{verbose = TRUE}, a \link{data.frame} with all original and new values of the affected bug-drug combinations.
|
|
}
|
|
\description{
|
|
Apply rules from clinical breakpoints notes and expected resistant phenotypes as defined by e.g. the European Committee on Antimicrobial Susceptibility Testing (EUCAST, \url{https://www.eucast.org}), see \emph{Source}. Use \code{\link[=eucast_dosage]{eucast_dosage()}} to get a \link{data.frame} with advised dosages of a certain bug-drug combination, which is based on the \link{dosage} data set.
|
|
|
|
To improve the interpretation of the antibiogram before CLSI/EUCAST interpretive rules are applied, some AMR-specific rules can be applied at default, see \emph{Details}.
|
|
}
|
|
\details{
|
|
\strong{Note:} This function does not translate MIC or disk values to SIR values. Use \code{\link[=as.sir]{as.sir()}} for that. \cr
|
|
\strong{Note:} When ampicillin (AMP, J01CA01) is not available but amoxicillin (AMX, J01CA04) is, the latter will be used for all rules where there is a dependency on ampicillin. These drugs are interchangeable when it comes to expression of antimicrobial resistance. \cr
|
|
|
|
The file containing all interpretive rules is located here: \url{https://github.com/msberends/AMR/blob/main/data-raw/interpretive_rules.tsv}. \strong{Note:} Old taxonomic names are replaced with the current taxonomy where applicable. For example, \emph{Ochrobactrum anthropi} was renamed to \emph{Brucella anthropi} in 2020; older interpretive rules may not yet contain this new taxonomic name. The \code{AMR} package contains the full microbial taxonomy updated until 5th of October, 2026, see \link{microorganisms}.
|
|
\subsection{Custom Rules}{
|
|
|
|
Custom rules can be created using \code{\link[=custom_interpretive_rules]{custom_interpretive_rules()}}, e.g.:
|
|
|
|
\if{html}{\out{<div class="sourceCode r">}}\preformatted{x <- custom_interpretive_rules(AMC == "R" & genus == "Klebsiella" ~ aminopenicillins == "R",
|
|
AMC == "I" & genus == "Klebsiella" ~ aminopenicillins == "I")
|
|
|
|
interpretive_rules(example_isolates, rules = "custom", custom_rules = x)
|
|
}\if{html}{\out{</div>}}
|
|
}
|
|
|
|
\subsection{'Other' Rules}{
|
|
|
|
Before further processing, two non-EUCAST rules about drug combinations can be applied to improve the efficacy of the EUCAST rules, and the reliability of your data (analysis). These rules are:
|
|
\enumerate{
|
|
\item A drug \strong{with} enzyme inhibitor will be set to S if the same drug \strong{without} enzyme inhibitor is S
|
|
\item A drug \strong{without} enzyme inhibitor will be set to R if the same drug \strong{with} enzyme inhibitor is R
|
|
}
|
|
|
|
Important examples include amoxicillin and amoxicillin/clavulanic acid, and trimethoprim and trimethoprim/sulfamethoxazole. Needless to say, for these rules to work, both drugs must be available in the data set.
|
|
|
|
Since these rules are not officially approved by EUCAST, they are not applied at default. To use these rules, include \code{"other"} to the \code{rules} argument, or use \code{interpretive_rules(..., rules = "all")}. You can also set the package option \code{\link[=AMR-options]{AMR_interpretive_rules}}, i.e. run \code{options(AMR_interpretive_rules = "all")}.
|
|
}
|
|
}
|
|
\section{Download Our Reference Data}{
|
|
|
|
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.
|
|
|
|
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/datasets}{our GitHub repository}.
|
|
}
|
|
|
|
\examples{
|
|
\donttest{
|
|
a <- data.frame(
|
|
mo = c(
|
|
"Staphylococcus aureus",
|
|
"Enterococcus faecalis",
|
|
"Escherichia coli",
|
|
"Klebsiella pneumoniae",
|
|
"Pseudomonas aeruginosa"
|
|
),
|
|
VAN = "-", # Vancomycin
|
|
AMX = "-", # Amoxicillin
|
|
COL = "-", # Colistin
|
|
CAZ = "-", # Ceftazidime
|
|
CXM = "-", # Cefuroxime
|
|
PEN = "S", # Benzylpenicillin
|
|
FOX = "S", # Cefoxitin
|
|
stringsAsFactors = FALSE
|
|
)
|
|
|
|
head(a)
|
|
|
|
|
|
# apply EUCAST rules: some results wil be changed
|
|
b <- eucast_rules(a, overwrite = TRUE)
|
|
|
|
head(b)
|
|
|
|
|
|
# do not apply EUCAST rules, but rather get a data.frame
|
|
# containing all details about the transformations:
|
|
c <- eucast_rules(a, overwrite = TRUE, verbose = TRUE)
|
|
head(c)
|
|
}
|
|
|
|
# Dosage guidelines:
|
|
|
|
eucast_dosage(c("tobra", "genta", "cipro"), "iv")
|
|
|
|
eucast_dosage(c("tobra", "genta", "cipro"), "iv", version_breakpoints = 10)
|
|
}
|
|
\references{
|
|
\itemize{
|
|
\item EUCAST Expert Rules. Version 2.0, 2012.\cr
|
|
Leclercq et al. \strong{EUCAST expert rules in antimicrobial susceptibility testing.} \emph{Clin Microbiol Infect.} 2013;19(2):141-60; \doi{https://doi.org/10.1111/j.1469-0691.2011.03703.x}
|
|
\item EUCAST Expected Phenotypes. \href{https://www.eucast.org/bacteria/important-additional-information/expected-phenotypes/}{(link)}
|
|
\item EUCAST Breakpoint tables for interpretation of MICs and zone diameters. \href{https://www.eucast.org/bacteria/clinical-breakpoints-and-interpretation/clinical-breakpoint-tables/}{(link)}
|
|
}
|
|
}
|