Files
AMR/index.md
T
Matthijs BerendsandClaude Opus 5.5 0ca43df459 Update taxonomy of microorganisms (2026-10) (#312)
* 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>
2026-10-07 12:55:12 +02:00

543 lines
25 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- index.md is generated from index.Rmd; please edit that file. -->
# The `AMR` Package for R <a href="https://amr-for-r.org/"><img src="./logo.svg" align="right" height="139" /></a>
- Provides an **all-in-one solution** for antimicrobial resistance (AMR)
data analysis in a One Health approach
- **Peer-reviewed**, used in over 175 countries, cited over 100 times,
available in 28 languages
- Generates **antibiograms** - WISCA for empiric coverage estimates, or
traditional/syndromic for AMR surveillance
- Provides the **full microbiological taxonomy** of ~103 000 distinct
species and extensive info of ~620 antimicrobial drugs
- Applies **CLSI 2011-2026** and **EUCAST 2011-2026** clinical and
veterinary breakpoints, and ECOFFs, for MIC and disk zone
interpretation
- Corrects for duplicate isolates, **calculates** and **predicts** AMR
per antimicrobial class
- Integrates with **WHONET**, ATC, **EARS-Net**, PubChem, **LOINC**,
**SNOMED CT**, and **NCBI**
- 100% free of costs and dependencies, highly suitable for places with
**limited resources**
> Available for Python too! [Click here](./articles/AMR_for_Python.html)
> to read more.
<div style="display: flex; font-size: 0.8em;">
<p style="text-align:left; width: 50%;">
<small><a href="https://amr-for-r.org/">amr-for-r.org</a></small>
</p>
<p style="text-align:right; width: 50%;">
<small><a href="https://doi.org/10.18637/jss.v104.i03" target="_blank">doi.org/10.18637/jss.v104.i03</a></small>
</p>
</div>
<a href="./reference/clinical_breakpoints.html#response-from-clsi-and-eucast"><img src="./endorsement_clsi_eucast.jpg" class="endorse_img" align="right" height="120" /></a>
------------------------------------------------------------------------
## Introduction
The `AMR` package is a peer-reviewed, [free and open-source](#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 has always been 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](./authors.html) from around the globe to make this a
successful and durable project! The `AMR` package was already cited
[over 100
times](https://scholar.google.com/citations?view_op=view_citation&hl=en&citation_for_view=sAoHvIgAAAAJ:0EnyYjriUFMC)
in scientific research.
After installing this package, R knows [**~103 000 distinct microbial
species**](./reference/microorganisms.html) (updated april 2026) and all
[**~620 antimicrobial and antiviral
drugs**](./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 2011-2026 and EUCAST 2011-2026 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).
### Used in over 175 countries, available in 28 languages
<a href="./countries_large.png" target="_blank"><img src="./countries.png" align="right" style="max-width: 300px;" /></a>
Since its first public release in early 2018, this R package has been
used in almost all countries in the world. Click the map to enlarge and
to see the country names.
With the help of contributors from all corners of the world, the `AMR`
package is available in
<img src="lang_en.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
English,
<img src="lang_ar.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Arabic,
<img src="lang_bn.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Bengali,
<img src="lang_zh.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Chinese,
<img src="lang_cs.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Czech,
<img src="lang_da.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Danish,
<img src="lang_nl.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Dutch,
<img src="lang_fi.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Finnish,
<img src="lang_fr.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
French,
<img src="lang_de.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
German,
<img src="lang_el.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Greek,
<img src="lang_hi.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Hindi,
<img src="lang_id.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Indonesian,
<img src="lang_it.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Italian,
<img src="lang_ja.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Japanese,
<img src="lang_ko.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Korean,
<img src="lang_no.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Norwegian,
<img src="lang_pl.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Polish,
<img src="lang_pt.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Portuguese,
<img src="lang_ro.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Romanian,
<img src="lang_ru.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Russian,
<img src="lang_es.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Spanish,
<img src="lang_sw.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Swahili,
<img src="lang_sv.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Swedish,
<img src="lang_tr.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Turkish,
<img src="lang_uk.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Ukrainian,
<img src="lang_ur.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Urdu, and
<img src="lang_vi.svg" style="height: 13px !important; border: 1px solid #cccccc; vertical-align: initial !important;">
Vietnamese. Antimicrobial drug (group) names and colloquial
microorganism names are provided in these languages.
## Practical examples
### Filtering and selecting data
One of the most powerful functions of this package, aside from
calculating and plotting AMR, is selecting and filtering based on
antimicrobial columns. This can be done using the so-called
[antimicrobial
selectors](https://amr-for-r.org/reference/antimicrobial_selectors.html),
which work in base R, `dplyr` and `data.table`.
``` r
# AMR works great with dplyr, but it's not required or neccesary
library(AMR)
library(dplyr, warn.conflicts = FALSE)
example_isolates %>%
mutate(bacteria = mo_fullname()) %>%
# filtering functions for microorganisms:
filter(mo_is_gram_negative(),
mo_is_intrinsic_resistant(ab = "cefotax")) %>%
# antimicrobial selectors:
select(bacteria,
aminoglycosides(),
carbapenems())
#> ℹ 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)
#> ℹ For `carbapenems()` using columns IPM (imipenem) and MEM (meropenem)
#> # A tibble: 35 × 7
#> bacteria GEN TOB AMK KAN IPM MEM
#> <chr> <sir> <sir> <sir> <sir> <sir> <sir>
#> 1 Pseudomonas aeruginosa I S NA R S NA
#> 2 Pseudomonas aeruginosa I S NA R S NA
#> 3 Pseudomonas aeruginosa I S NA R S NA
#> 4 Pseudomonas aeruginosa S S S R NA S
#> 5 Pseudomonas aeruginosa S S S R S S
#> 6 Pseudomonas aeruginosa S S S R S S
#> 7 Stenotrophomonas maltophilia R R R R R R
#> 8 Pseudomonas aeruginosa S S S R NA S
#> 9 Pseudomonas aeruginosa S S S R NA S
#> 10 Pseudomonas aeruginosa S S S R S S
#> # ℹ 25 more rows
```
With only having defined a row filter on Gram-negative bacteria with
intrinsic resistance to cefotaxime (`mo_is_gram_negative()` and
`mo_is_intrinsic_resistant()`) and a column selection on two antibiotic
groups (`aminoglycosides()` and `carbapenems()`), the reference data
about [all microorganisms](./reference/microorganisms.html) and [all
antimicrobials](./reference/antimicrobials.html) in the `AMR` package
make sure you get what you meant.
### Generating antibiograms
The `AMR` package supports four types of antibiograms, with support for
28 languages. If used inside [R Markdown](https://rmarkdown.rstudio.com)
or [Quarto](https://quarto.org), the table will be printed in the right
output format automatically (such as markdown, LaTeX, HTML, etc.).
**For empirical therapy guidance (i.e., coverage estimates), use WISCA**
(Weighted-Incidence Syndromic Combination Antibiogram). When a clinician
starts empirical treatment, the causative pathogen is unknown. The
relevant question is not *“what percentage of E. coli is susceptible?”*
but *“what is the probability that this regimen will cover whatever
pathogen is causing the infection?”*. WISCA answers that question
directly, weighting susceptibility by pathogen incidence and providing
credible intervals via Bayesian simulation. See `vignette("WISCA")` for
the full explanation.
``` r
wisca(example_isolates,
antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"),
minimum = 10) # Recommended threshold: >=30
#> Warning: invalid microorganism code, NA generated
```
| Piperacillin/tazobactam | Piperacillin/tazobactam + Gentamicin | Piperacillin/tazobactam + Tobramycin |
|:------------------------|:-------------------------------------|:-------------------------------------|
| 70% (64.7-75.3%) | 93.6% (92.1-95%) | 89.8% (86.7-92.4%) |
WISCA supports stratification by any clinical variable, so you can
generate syndrome-specific or ward-specific coverage estimates:
``` r
wisca(example_isolates,
antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"),
syndromic_group = "ward",
minimum = 10) # Recommended threshold: >=30
#> Warning: invalid microorganism code, NA generated
```
| Syndromic Group | Piperacillin/tazobactam | Piperacillin/tazobactam + Gentamicin | Piperacillin/tazobactam + Tobramycin |
|:----------------|:------------------------|:-------------------------------------|:-------------------------------------|
| Clinical | 74.7% (68.7-80.4%) | 93.6% (91.9-95.2%) | 90.4% (86.9-93.1%) |
| ICU | 56.9% (48.5-65.6%) | 86.7% (83.2-89.7%) | 83% (78.2-87.2%) |
| Outpatient | 57.4% (46-68.9%) | 76.6% (70.7-82.3%) | 67.5% (57.2-77.3%) |
**For AMR surveillance**, traditional antibiograms remain the right tool
for tracking resistance per species over time:
``` r
antibiogram(example_isolates,
mo_transform = "gramstain",
antimicrobials = c("AMC", carbapenems(), "TZP"))
#> ℹ For `carbapenems()` using columns IPM (imipenem) and MEM (meropenem)
```
| Pathogen | Amoxicillin/clavulanic acid | Imipenem | Meropenem | Piperacillin/tazobactam |
|:--------------|:----------------------------|:--------------------|:---------------------|:------------------------|
| Gram-negative | 76% (73-79%,N=726) | 99% (98-100%,N=631) | 100% (99-100%,N=626) | 88% (85-91%,N=641) |
| Gram-positive | 76% (74-79%,N=1138) | 81% (75-85%,N=257) | 77% (70-82%,N=203) | 86% (82-89%,N=345) |
Combination antibiograms show the additional coverage gained by adding a
second agent, stratified by species:
``` r
antibiogram(example_isolates,
mo_transform = "gramstain",
antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"))
```
| Pathogen | Piperacillin/tazobactam | Piperacillin/tazobactam + Gentamicin | Piperacillin/tazobactam + Tobramycin |
|:--------------|:------------------------|:-------------------------------------|:-------------------------------------|
| Gram-negative | 88% (85-91%,N=641) | 99% (97-99%,N=691) | 98% (97-99%,N=693) |
| Gram-positive | 86% (82-89%,N=345) | 98% (96-98%,N=1044) | 95% (93-97%,N=550) |
Like many other functions in this package, `antibiogram()` and `wisca()`
come with support for 28 languages that are often detected automatically
based on system language:
``` r
antibiogram(example_isolates,
antimicrobials = c("cipro", "tobra", "genta"), # any arbitrary name or code will work
mo_transform = "gramstain",
ab_transform = "name",
language = "uk") # Ukrainian
```
| Збудник | Гентаміцин | Тобраміцин | Ципрофлоксацин |
|:--------------|:--------------------|:-------------------|:-------------------|
| Грамнегативні | 96% (95-98%,N=684) | 96% (94-97%,N=686) | 91% (88-93%,N=684) |
| Грампозитивні | 63% (60-66%,N=1170) | 34% (31-38%,N=665) | 77% (74-80%,N=724) |
### Interpreting and plotting MIC and SIR values
The `AMR` package allows interpretation of MIC and disk diffusion values
based on CLSI and EUCAST. Moreover, the `ggplot2` package is extended
with new scale functions, to allow plotting of log2-distributed MIC
values and SIR values.
``` r
library(ggplot2)
library(AMR)
# generate some random values
some_mic_values <- random_mic(size = 100)
some_groups <- sample(LETTERS[1:5], 20, replace = TRUE)
interpretation <- as.sir(some_mic_values,
guideline = "EUCAST 2024",
mo = "E. coli", # or any code or name resembling a known species
ab = "Cipro") # or any code or name resembling an antibiotic
# create the plot
ggplot(data.frame(mic = some_mic_values,
group = some_groups,
sir = interpretation),
aes(x = group, y = mic, colour = sir)) +
theme_minimal() +
geom_boxplot(fill = NA, colour = "grey30") +
geom_jitter(width = 0.25) +
# NEW scale function: plot MIC values to x, y, colour or fill
scale_y_mic() +
# NEW scale function: write out S/I/R in any of the 20 supported languages
# and set colourblind-friendly colours
scale_colour_sir()
```
<a href="./reference/plotting.html" title="Plotting Helpers for AMR Data Analysis">
<img src="./plot_readme.png" style="width: 1400px; max-width: 100%;">
</a>
### Calculating resistance per group
For a manual approach, you can use the `resistance` or
`susceptibility()` function:
``` r
example_isolates %>%
# group by ward:
group_by(ward) %>%
# calculate AMR using resistance() for gentamicin and tobramycin
# and get their 95% confidence intervals using sir_confidence_interval():
summarise(across(c(GEN, TOB),
list(total_R = resistance,
conf_int = function(x) sir_confidence_interval(x, collapse = "-"))))
#> # A tibble: 3 × 5
#> ward GEN_total_R GEN_conf_int TOB_total_R TOB_conf_int
#> <chr> <dbl> <chr> <dbl> <chr>
#> 1 Clinical 0.229 0.205-0.254 0.315 0.284-0.347
#> 2 ICU 0.290 0.253-0.33 0.400 0.353-0.449
#> 3 Outpatient 0.2 0.131-0.285 0.368 0.254-0.493
```
Or use [antimicrobial
selectors](https://amr-for-r.org/reference/antimicrobial_selectors.html)
to select a series of antibiotic columns:
``` r
library(AMR)
library(dplyr)
out <- example_isolates %>%
# group by ward:
group_by(ward) %>%
# 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 `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" (whilst `minimum =
#> 30`).
out
#> # A tibble: 3 × 6
#> ward GEN TOB AMK KAN COL
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Clinical 0.229 0.315 0.626 1 0.780
#> 2 ICU 0.290 0.400 0.662 1 0.857
#> 3 Outpatient 0.2 0.368 0.605 NA 0.889
```
``` r
# transform the antibiotic columns to names:
out %>% set_ab_names()
#> # A tibble: 3 × 6
#> ward gentamicin tobramycin amikacin kanamycin colistin
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Clinical 0.229 0.315 0.626 1 0.780
#> 2 ICU 0.290 0.400 0.662 1 0.857
#> 3 Outpatient 0.2 0.368 0.605 NA 0.889
```
``` r
# transform the antibiotic column to ATC codes:
out %>% set_ab_names(property = "atc")
#> # A tibble: 3 × 6
#> ward J01GB03 J01GB01 J01GB06 J01GB04 J01XB01
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Clinical 0.229 0.315 0.626 1 0.780
#> 2 ICU 0.290 0.400 0.662 1 0.857
#> 3 Outpatient 0.2 0.368 0.605 NA 0.889
```
## What else can you do with this package?
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))
- 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))
- Calculating antimicrobial resistance ([tutorial](./articles/AMR.html))
- Determining multi-drug resistance (MDR) / multi-drug resistant
organisms (MDRO) ([tutorial](./reference/mdro.html))
- Calculating (empirical) susceptibility of both mono therapy and
combination therapies ([tutorial](./articles/AMR.html))
- Apply AMR functions in predictive modelling
([tutorial](./articles/AMR_with_tidymodels.html))
- Getting properties for any microorganism (like Gram stain, species,
genus or family) ([manual](./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](./reference/ab_property.html))
- Plotting antimicrobial resistance ([tutorial](./articles/AMR.html))
- Applying EUCAST expert rules ([manual](./reference/eucast_rules.html))
- Getting SNOMED codes of a microorganism, or getting properties of a
microorganism based on a SNOMED code
([manual](./reference/mo_property.html))
- Getting LOINC codes of an antibiotic, or getting properties of an
antibiotic based on a LOINC code
([manual](./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](./articles/datasets.html))
- Principal component analysis for AMR ([tutorial](./articles/PCA.html))
## Get this package
### Latest official version
[![CRAN](https://www.r-pkg.org/badges/version-ago/AMR)](https://cran.r-project.org/package=AMR)
[![CRANlogs](https://cranlogs.r-pkg.org/badges/grand-total/AMR)](https://cran.r-project.org/package=AMR)
This package is available [here on the official R network
(CRAN)](https://cran.r-project.org/package=AMR). Install this package in
R from CRAN by using the command:
``` r
install.packages("AMR")
```
It will be downloaded and installed automatically. For RStudio, click on
the menu *Tools* \> *Install Packages…* and then type in “AMR” and press
<kbd>Install</kbd>.
**Note:** Not all functions on this website may be available in this
latest release. To use all functions and data sets mentioned on this
website, install the latest beta version.
### Latest beta version
[![check-old](https://github.com/msberends/AMR/actions/workflows/check-old-tinytest.yaml/badge.svg?branch=main)](https://github.com/msberends/AMR/actions/workflows/check-old-tinytest.yaml)
[![check-recent](https://github.com/msberends/AMR/actions/workflows/check-current-testthat.yaml/badge.svg?branch=main)](https://github.com/msberends/AMR/actions/workflows/check-current-testthat.yaml)
[![CodeFactor](https://www.codefactor.io/repository/github/msberends/amr/badge)](https://www.codefactor.io/repository/github/msberends/amr)
[![Codecov](https://codecov.io/gh/msberends/AMR/branch/main/graph/badge.svg)](https://codecov.io/gh/msberends/AMR?branch=main)
Please read our [Developer Guideline
here](https://github.com/msberends/AMR/wiki/Developer-Guideline).
To install the latest and unpublished beta version:
``` r
install.packages("AMR", repos = "beta.amr-for-r.org")
# if this does not work, try to install directly from GitHub using the 'remotes' package:
remotes::install_github("msberends/AMR")
```
## Get started
To find out how to conduct AMR data analysis, please [continue reading
here to get started](./articles/AMR.html) or click a link in the [‘How
to’ menu](./articles/).
## Partners
The initial development of this package was part of, related to, or made
possible by the following non-profit organisations and initiatives:
<div align="center">
<a href="https://www.rug.nl" title="University of Groningen"><img src="./logo_rug.svg" style="max-width: 200px;"></a>
<a href="https://www.umcg.nl" title="University Medical Center Groningen"><img src="./logo_umcg.svg" style="max-width: 200px;"></a>
<a href="https://www.certe.nl" title="Certe Medical Diagnostics and Advice Foundation"><img src="./logo_certe.svg" style="max-width: 200px;"></a>
<a href="https://www.deutschland-nederland.eu" title="EurHealth-1-Health"><img src="./logo_eh1h.png" style="max-width: 200px;"></a>
<a href="https://www.deutschland-nederland.eu" title="INTERREG"><img src="./logo_interreg.png" style="max-width: 200px;"></a>
</div>
## Copyright
This R package is free, open-source software and licensed under the [GNU
General Public License v2.0 (GPL-2)](./LICENSE-text.html). In a
nutshell, this means that this package:
- May be used for commercial purposes
- May be used for private purposes
- May **not** be used for patent purposes
- May be modified, although:
- Modifications **must** be released under the same license when
distributing the package
- Changes made to the code **must** be documented
- May be distributed, although:
- Source code **must** be made available when the package is
distributed
- A copy of the license and copyright notice **must** be included with
the package.
- Comes with a LIMITATION of liability
- Comes with NO warranty