AMR/vignettes/MDR.Rmd

127 lines
4.9 KiB
Plaintext

---
title: "How to determine multi-drug resistance (MDR)"
author: "Matthijs S. Berends"
date: '`r format(Sys.Date(), "%d %B %Y")`'
output:
rmarkdown::html_vignette:
toc: true
vignette: >
%\VignetteIndexEntry{How to determine multi-drug resistance (MDR)}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{knitr::rmarkdown}
editor_options:
chunk_output_type: console
---
```{r setup, include = FALSE, results = 'markup'}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#"
)
library(AMR)
```
With the function `mdro()`, you can determine multi-drug resistant organisms (MDRO).
#### Type of input
The `mdro()` takes a data set as input, such as a regular `data.frame`. It automatically determines the right columns for info about your isolates, like the name of the species and all columns with results of antimicrobial agents. See the help page for more info about how to set the right settings for your data with the command `?mdro`.
For WHONET data (and most other data), all settings are automatically set correctly.
#### Guidelines
The function support multiple guidelines. You can select a guideline with the `guideline` parameter. Currently supported guidelines are (case-insensitive):
* `guideline = "CMI2012"` (default)
Magiorakos AP, Srinivasan A *et al.* "Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance." Clinical Microbiology and Infection (2012) ([link](https://www.clinicalmicrobiologyandinfection.com/article/S1198-743X(14)61632-3/fulltext))
* `guideline = "EUCAST"`
The European international guideline - EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" ([link](http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf))
* `guideline = "TB"`
The international guideline for multi-drug resistant tuberculosis - World Health Organization "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis" ([link](https://www.who.int/tb/publications/pmdt_companionhandbook/en/))
* `guideline = "MRGN"`
The German national guideline - Mueller et al. (2015) Antimicrobial Resistance and Infection Control 4:7. ([link](https://doi.org/10.1186/s13756-015-0047-6))
* `guideline = "BRMO"`
The Dutch national guideline - Rijksinstituut voor Volksgezondheid en Milieu "WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]" ([link](https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH))
#### Examples
The `mdro()` function always returns an ordered `factor`. For example, the output of the default guideline by Magiorakos *et al.* returns a `factor` with levels 'Negative', 'MDR', 'XDR' or 'PDR' in that order. If we test that guideline on the included `example_isolates` data set, we get:
```{r, message = FALSE}
library(dplyr) # to support pipes: %>%
```
```{r, results = 'hide'}
example_isolates %>%
mdro() %>%
freq() # show frequency table of the result
```
```{r, echo = FALSE, results = 'asis', message = FALSE, warning = FALSE}
library(dplyr) # to support pipes: %>%
example_isolates %>%
mdro(info = FALSE) %>%
freq() # show frequency table of the result
```
For another example, I will create a data set to determine multi-drug resistant TB:
```{r}
# a helper function to get a random vector with values S, I and R
# with the probabilities 50% - 10% - 40%
sample_rsi <- function() {
sample(c("S", "I", "R"),
size = 5000,
prob = c(0.5, 0.1, 0.4),
replace = TRUE)
}
my_TB_data <- data.frame(rifampicin = sample_rsi(),
isoniazid = sample_rsi(),
gatifloxacin = sample_rsi(),
ethambutol = sample_rsi(),
pyrazinamide = sample_rsi(),
moxifloxacin = sample_rsi(),
kanamycin = sample_rsi())
```
Because all column names are automatically verified for valid drug names or codes, this would have worked exactly the same:
```{r, eval = FALSE}
my_TB_data <- data.frame(RIF = sample_rsi(),
INH = sample_rsi(),
GAT = sample_rsi(),
ETH = sample_rsi(),
PZA = sample_rsi(),
MFX = sample_rsi(),
KAN = sample_rsi())
```
The data set now looks like this:
```{r}
head(my_TB_data)
```
We can now add the interpretation of MDR-TB to our data set. You can use:
```r
mdro(my_TB_data, guideline = "TB")
```
or its shortcut `mdr_tb()`:
```{r}
my_TB_data$mdr <- mdr_tb(my_TB_data)
```
Create a frequency table of the results:
```{r, results = 'asis'}
freq(my_TB_data$mdr)
```