mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 22:06:11 +01:00
documentation
This commit is contained in:
parent
9148a2dcf4
commit
9de19fdc49
@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 2.0.0.9012
|
Version: 2.0.0.9013
|
||||||
Date: 2023-04-20
|
Date: 2023-04-21
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||||
data analysis and to work with microbial and antimicrobial properties by
|
data analysis and to work with microbial and antimicrobial properties by
|
||||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# AMR 2.0.0.9012
|
# AMR 2.0.0.9013
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
* formatting fix for `sir_interpretation_history()`
|
* formatting fix for `sir_interpretation_history()`
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||||
# ==================================================================== #
|
# ==================================================================== #
|
||||||
|
|
||||||
expect_identical(mo_genus("B_GRAMP", language = "pt"), "(Gram positivos desconhecidos)")
|
expect_identical(mo_genus("B_GRAMP", language = "pt"), "(gênero desconhecido)")
|
||||||
|
|
||||||
expect_identical(mo_fullname("CoNS", "cs"), "Koaguláza-negativní stafylokok (KNS)")
|
expect_identical(mo_fullname("CoNS", "cs"), "Koaguláza-negativní stafylokok (KNS)")
|
||||||
expect_identical(mo_fullname("CoNS", "da"), "Koagulase-negative stafylokokker (KNS)")
|
expect_identical(mo_fullname("CoNS", "da"), "Koagulase-negative stafylokokker (KNS)")
|
||||||
|
@ -247,60 +247,79 @@ our_data_1st[all(betalactams() == "R"), ]
|
|||||||
|
|
||||||
## Generate antibiograms
|
## Generate antibiograms
|
||||||
|
|
||||||
This package comes with `antibiogram()`, a function that automatically generates traditional, combined, syndromic, and even weighted-incidence syndromic combination antibiograms (WISCA). For R Markdown (such as this page) it automatically prints in the right table format.
|
Since AMR v2.0 (March 2023), it is very easy to create different types of antibiograms, with support for 20 different languages.
|
||||||
|
|
||||||
Below are some suggestions for how to generate the different antibiograms:
|
There are four antibiogram types, as proposed by Klinker *et al.* (2021, [DOI 10.1177/20499361211011373](https://doi.org/10.1177/20499361211011373)), and they are all supported by the new `antibiogram()` function:
|
||||||
|
|
||||||
|
1. **Traditional Antibiogram (TA)** e.g, for the susceptibility of *Pseudomonas aeruginosa* to piperacillin/tazobactam (TZP)
|
||||||
|
2. **Combination Antibiogram (CA)** e.g, for the sdditional susceptibility of *Pseudomonas aeruginosa* to TZP + tobramycin versus TZP alone
|
||||||
|
3. **Syndromic Antibiogram (SA)** e.g, for the susceptibility of *Pseudomonas aeruginosa* to TZP among respiratory specimens (obtained among ICU patients only)
|
||||||
|
4. **Weighted-Incidence Syndromic Combination Antibiogram (WISCA)** e.g, for the susceptibility of *Pseudomonas aeruginosa* to TZP among respiratory specimens (obtained among ICU patients only) for male patients age >=65 years with heart failure
|
||||||
|
|
||||||
|
In this section, we show how to use the `antibiogram()` function to create any of the above antibiogram types. For starters, this is what the included `example_isolates` data set looks like:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
# traditional:
|
example_isolates
|
||||||
antibiogram(our_data_1st)
|
|
||||||
antibiogram(our_data_1st,
|
|
||||||
ab_transform = "name"
|
|
||||||
)
|
|
||||||
antibiogram(our_data_1st,
|
|
||||||
ab_transform = "name",
|
|
||||||
language = "es"
|
|
||||||
) # support for 20 languages
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```{r}
|
### Traditional Antibiogram
|
||||||
# combined:
|
|
||||||
antibiogram(our_data_1st,
|
To create a traditional antibiogram, simply state which antibiotics should be used. The `antibiotics` argument in the `antibiogram()` function supports any (combination) of the previously mentioned antibiotic class selectors:
|
||||||
antibiotics = c("AMC", "AMC+CIP", "AMC+GEN")
|
|
||||||
)
|
```{r trad}
|
||||||
|
antibiogram(example_isolates,
|
||||||
|
antibiotics = c(aminoglycosides(), carbapenems()))
|
||||||
```
|
```
|
||||||
|
|
||||||
```{r}
|
Notice that the `antibiogram()` function automatically prints in the right format when using Quarto or R Markdown (such as this page), and even applies italics for taxonomic names (by using `italicise_taxonomy()` internally).
|
||||||
# for a syndromic antibiogram, we must fake some clinical conditions:
|
|
||||||
our_data_1st$condition <- sample(c("Cardial", "Respiratory", "Rheumatic"),
|
|
||||||
size = nrow(our_data_1st),
|
|
||||||
replace = TRUE
|
|
||||||
)
|
|
||||||
|
|
||||||
# syndromic:
|
It also uses the language of your OS if this is either `r AMR:::vector_or(vapply(FUN.VALUE = character(1), AMR:::LANGUAGES_SUPPORTED_NAMES, function(x) x$exonym), quotes = FALSE, sort = FALSE)`. In this next example, we force the language to be Spanish using the `language` argument:
|
||||||
antibiogram(our_data_1st,
|
|
||||||
syndromic_group = "condition"
|
```{r trad2}
|
||||||
)
|
antibiogram(example_isolates,
|
||||||
antibiogram(our_data_1st,
|
mo_transform = "gramstain",
|
||||||
# you can use AB selectors here as well:
|
antibiotics = aminoglycosides(),
|
||||||
antibiotics = c(penicillins(), aminoglycosides()),
|
ab_transform = "name",
|
||||||
syndromic_group = "condition",
|
language = "es")
|
||||||
mo_transform = "gramstain"
|
|
||||||
)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```{r}
|
### Combined Antibiogram
|
||||||
# WISCA:
|
|
||||||
# (we lack some details, but it could contain a filter on e.g. >65 year-old males)
|
To create a combined antibiogram, use antibiotic codes or names with a plus `+` character like this:
|
||||||
wisca <- antibiogram(our_data_1st,
|
|
||||||
antibiotics = c("AMC", "AMC+CIP", "AMC+GEN"),
|
```{r comb}
|
||||||
syndromic_group = "condition",
|
antibiogram(example_isolates,
|
||||||
mo_transform = "gramstain"
|
antibiotics = c("TZP", "TZP+TOB", "TZP+GEN"))
|
||||||
)
|
```
|
||||||
|
|
||||||
|
### Syndromic Antibiogram
|
||||||
|
|
||||||
|
To create a syndromic antibiogram, the `syndromic_group` argument must be used. This can be any column in the data, or e.g. an `ifelse()` with calculations based on certain columns:
|
||||||
|
|
||||||
|
```{r synd}
|
||||||
|
antibiogram(example_isolates,
|
||||||
|
antibiotics = c(aminoglycosides(), carbapenems()),
|
||||||
|
syndromic_group = "ward")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Weighted-Incidence Syndromic Combination Antibiogram (WISCA)
|
||||||
|
|
||||||
|
To create a WISCA, you must state combination therapy in the `antibiotics` argument (similar to the Combination Antibiogram), define a syndromic group with the `syndromic_group` argument (similar to the Syndromic Antibiogram) in which cases are predefined based on clinical or demographic characteristics (e.g., endocarditis in 75+ females). This next example is a simplification without clinical characteristics, but just gives an idea of how a WISCA can be created:
|
||||||
|
|
||||||
|
```{r wisca}
|
||||||
|
wisca <- antibiogram(example_isolates,
|
||||||
|
antibiotics = c("AMC", "AMC+CIP", "TZP", "TZP+TOB"),
|
||||||
|
mo_transform = "gramstain",
|
||||||
|
minimum = 10, # this should be >= 30, but now just as example
|
||||||
|
syndromic_group = ifelse(example_isolates$age >= 65 &
|
||||||
|
example_isolates$gender == "M",
|
||||||
|
"WISCA Group 1", "WISCA Group 2"))
|
||||||
wisca
|
wisca
|
||||||
```
|
```
|
||||||
|
|
||||||
Antibiograms can be plotted using `autoplot()` from the `ggplot2` packages, since this package provides an extension to that function:
|
### Plotting antibiograms
|
||||||
|
|
||||||
|
Antibiograms can be plotted using `autoplot()` from the `ggplot2` packages, since this `AMR` package provides an extension to that function:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
autoplot(wisca)
|
autoplot(wisca)
|
||||||
|
Loading…
Reference in New Issue
Block a user