This commit is contained in:
dr. M.S. (Matthijs) Berends 2018-02-22 21:37:10 +01:00
parent d8da8daf9a
commit 10380bcfae
No known key found for this signature in database
GPG Key ID: 904E4D816D2F58BA
4 changed files with 117 additions and 58 deletions

6
NEWS Normal file
View File

@ -0,0 +1,6 @@
## 0.1.1
- EUCAST_rules applies for amoxicillin even if ampicillin is missing
- Edited column names to comply with GLIMS, the laboratory information system
## 0.1.0
- First submission to CRAN.

View File

@ -37,11 +37,19 @@
#' EUCAST Expert Rules Version 3.1: \cr #' EUCAST Expert Rules Version 3.1: \cr
#' \url{http://www.eucast.org/expert_rules_and_intrinsic_resistance} #' \url{http://www.eucast.org/expert_rules_and_intrinsic_resistance}
#' @examples #' @examples
#' \dontrun{ #' a <- data.frame(bactid = c("STAAUR", "ESCCOL", "KLEPNE", "PSEAER"),
#' tbl <- EUCAST_rules(tbl) #' vanc = "-",
#' } #' amox = "-",
#' coli = "-",
#' cfta = "-",
#' cfur = "-",
#' stringsAsFactors = FALSE)
#' a
#'
#' b <- EUCAST_rules(a)
#' b
EUCAST_rules <- function(tbl, EUCAST_rules <- function(tbl,
col_bactcode = 'bacteriecode', col_bactcode = 'bactid',
info = TRUE, info = TRUE,
amcl = 'amcl', amcl = 'amcl',
amik = 'amik', amik = 'amik',
@ -232,61 +240,61 @@ EUCAST_rules <- function(tbl,
# Citrobacter # Citrobacter
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Citrobacter (koseri|amalonaticus|sedlakii|farmeri|rodentium)'), rows = which(tbl$fullname %like% '^Citrobacter (koseri|amalonaticus|sedlakii|farmeri|rodentium)'),
cols = c(ampi, tica)) cols = c(aminopenicillines, tica))
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Citrobacter (freundii|braakii|murliniae|werkmanii|youngae)'), rows = which(tbl$fullname %like% '^Citrobacter (freundii|braakii|murliniae|werkmanii|youngae)'),
cols = c(ampi, amcl, czol, cfox)) cols = c(aminopenicillines, amcl, czol, cfox))
# Enterobacter # Enterobacter
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Enterobacter cloacae'), rows = which(tbl$fullname %like% '^Enterobacter cloacae'),
cols = c(ampi, amcl, czol, cfox)) cols = c(aminopenicillines, amcl, czol, cfox))
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Enterobacter aerogenes'), rows = which(tbl$fullname %like% '^Enterobacter aerogenes'),
cols = c(ampi, amcl, czol, cfox)) cols = c(aminopenicillines, amcl, czol, cfox))
# Escherichia # Escherichia
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Escherichia hermanni'), rows = which(tbl$fullname %like% '^Escherichia hermanni'),
cols = c(ampi, tica)) cols = c(aminopenicillines, tica))
# Hafnia # Hafnia
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Hafnia alvei'), rows = which(tbl$fullname %like% '^Hafnia alvei'),
cols = c(ampi, amcl, czol, cfox)) cols = c(aminopenicillines, amcl, czol, cfox))
# Klebsiella # Klebsiella
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Klebsiella'), rows = which(tbl$fullname %like% '^Klebsiella'),
cols = c(ampi, tica)) cols = c(aminopenicillines, tica))
# Morganella / Proteus # Morganella / Proteus
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Morganella morganii'), rows = which(tbl$fullname %like% '^Morganella morganii'),
cols = c(ampi, amcl, czol, tetracyclines, polymyxines, nitr)) cols = c(aminopenicillines, amcl, czol, tetracyclines, polymyxines, nitr))
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Proteus mirabilis'), rows = which(tbl$fullname %like% '^Proteus mirabilis'),
cols = c(tetracyclines, tige, polymyxines, nitr)) cols = c(tetracyclines, tige, polymyxines, nitr))
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Proteus penneri'), rows = which(tbl$fullname %like% '^Proteus penneri'),
cols = c(ampi, czol, cfur, tetracyclines, tige, polymyxines, nitr)) cols = c(aminopenicillines, czol, cfur, tetracyclines, tige, polymyxines, nitr))
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Proteus vulgaris'), rows = which(tbl$fullname %like% '^Proteus vulgaris'),
cols = c(ampi, czol, cfur, tetracyclines, tige, polymyxines, nitr)) cols = c(aminopenicillines, czol, cfur, tetracyclines, tige, polymyxines, nitr))
# Providencia # Providencia
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Providencia rettgeri'), rows = which(tbl$fullname %like% '^Providencia rettgeri'),
cols = c(ampi, amcl, czol, cfur, tetracyclines, tige, polymyxines, nitr)) cols = c(aminopenicillines, amcl, czol, cfur, tetracyclines, tige, polymyxines, nitr))
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Providencia stuartii'), rows = which(tbl$fullname %like% '^Providencia stuartii'),
cols = c(ampi, amcl, czol, cfur, tetracyclines, tige, polymyxines, nitr)) cols = c(aminopenicillines, amcl, czol, cfur, tetracyclines, tige, polymyxines, nitr))
# Raoultella # Raoultella
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Raoultella'), rows = which(tbl$fullname %like% '^Raoultella'),
cols = c(ampi, tica)) cols = c(aminopenicillines, tica))
# Serratia # Serratia
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Serratia marcescens'), rows = which(tbl$fullname %like% '^Serratia marcescens'),
cols = c(ampi, amcl, czol, cfox, cfur, tetracyclines[tetracyclines != 'mino'], polymyxines, nitr)) cols = c(aminopenicillines, amcl, czol, cfox, cfur, tetracyclines[tetracyclines != 'mino'], polymyxines, nitr))
# Yersinia # Yersinia
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Yersinia enterocolitica'), rows = which(tbl$fullname %like% '^Yersinia enterocolitica'),
cols = c(ampi, amcl, tica, czol, cfox)) cols = c(aminopenicillines, amcl, tica, czol, cfox))
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Yersinia pseudotuberculosis'), rows = which(tbl$fullname %like% '^Yersinia pseudotuberculosis'),
cols = c(poly, coli)) cols = c(poly, coli))
@ -313,32 +321,32 @@ EUCAST_rules <- function(tbl,
# Acinetobacter # Acinetobacter
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Acinetobacter (baumannii|pittii|nosocomialis|calcoaceticus)'), rows = which(tbl$fullname %like% '^Acinetobacter (baumannii|pittii|nosocomialis|calcoaceticus)'),
cols = c(ampi, amcl, czol, cfot, cftr, aztr, erta, trim, fosf, tetracyclines[tetracyclines != 'mino'])) cols = c(aminopenicillines, amcl, czol, cfot, cftr, aztr, erta, trim, fosf, tetracyclines[tetracyclines != 'mino']))
# Achromobacter # Achromobacter
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Achromobacter (xylosoxydans|xylosoxidans)'), rows = which(tbl$fullname %like% '^Achromobacter (xylosoxydans|xylosoxidans)'),
cols = c(ampi, czol, cfot, cftr, erta)) cols = c(aminopenicillines, czol, cfot, cftr, erta))
# Burkholderia # Burkholderia
edit_rsi(to = 'R', edit_rsi(to = 'R',
# onder 'Burkholderia cepacia complex' vallen deze species allemaal: PMID 16217180. # onder 'Burkholderia cepacia complex' vallen deze species allemaal: PMID 16217180.
rows = which(tbl$fullname %like% '^Burkholderia (cepacia|multivorans|cenocepacia|stabilis|vietnamiensis|dolosa|ambifaria|anthina|pyrrocinia|ubonensis)'), rows = which(tbl$fullname %like% '^Burkholderia (cepacia|multivorans|cenocepacia|stabilis|vietnamiensis|dolosa|ambifaria|anthina|pyrrocinia|ubonensis)'),
cols = c(ampi, amcl, tica, pita, czol, cfot, cftr, aztr, erta, cipr, chlo, aminoglycosiden, trim, fosf, polymyxines)) cols = c(aminopenicillines, amcl, tica, pita, czol, cfot, cftr, aztr, erta, cipr, chlo, aminoglycosiden, trim, fosf, polymyxines))
# Elizabethkingia # Elizabethkingia
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Elizabethkingia meningoseptic(a|um)'), rows = which(tbl$fullname %like% '^Elizabethkingia meningoseptic(a|um)'),
cols = c(ampi, amcl, tica, czol, cfot, cftr, cfta, cfep, aztr, erta, imip, mero, polymyxines)) cols = c(aminopenicillines, amcl, tica, czol, cfot, cftr, cfta, cfep, aztr, erta, imip, mero, polymyxines))
# Ochrobactrum # Ochrobactrum
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Ochrobactrum anthropi'), rows = which(tbl$fullname %like% '^Ochrobactrum anthropi'),
cols = c(ampi, amcl, tica, pita, czol, cfot, cftr, cfta, cfep, aztr, erta)) cols = c(aminopenicillines, amcl, tica, pita, czol, cfot, cftr, cfta, cfep, aztr, erta))
# Pseudomonas # Pseudomonas
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Pseudomonas aeruginosa'), rows = which(tbl$fullname %like% '^Pseudomonas aeruginosa'),
cols = c(ampi, amcl, czol, cfot, cftr, erta, chlo, kana, neom, trim, trsu, tetracyclines, tige)) cols = c(aminopenicillines, amcl, czol, cfot, cftr, erta, chlo, kana, neom, trim, trsu, tetracyclines, tige))
# Stenotrophomonas # Stenotrophomonas
edit_rsi(to = 'R', edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Stenotrophomonas maltophilia'), rows = which(tbl$fullname %like% '^Stenotrophomonas maltophilia'),
cols = c(ampi, amcl, tica, pita, czol, cfot, cftr, cfta, aztr, erta, imip, mero, aminoglycosiden, trim, fosf, tetr)) cols = c(aminopenicillines, amcl, tica, pita, czol, cfot, cftr, cfta, aztr, erta, imip, mero, aminoglycosiden, trim, fosf, tetr))
# Table 3: Intrinsic resistance in other Gram-negative bacteria ---- # Table 3: Intrinsic resistance in other Gram-negative bacteria ----
@ -448,6 +456,12 @@ EUCAST_rules <- function(tbl,
& tbl[, ampi] == 'R'), & tbl[, ampi] == 'R'),
cols = c(ureidopenicillines, carbapenems)) cols = c(ureidopenicillines, carbapenems))
} }
if (!is.na(amox)) {
edit_rsi(to = 'R',
rows = which(tbl$genus == 'Enterococcus'
& tbl[, amox] == 'R'),
cols = c(ureidopenicillines, carbapenems))
}
# Table 9: Interpretive rules for B-lactam agents and Gram-negative rods ---- # Table 9: Interpretive rules for B-lactam agents and Gram-negative rods ----
if (info == TRUE) { if (info == TRUE) {
@ -579,7 +593,7 @@ EUCAST_rules <- function(tbl,
cols = trim) cols = trim)
} }
if (!is.na(ampi) & !is.na(amox)) { if (!is.na(ampi) & !is.na(amox)) {
tbl[, amox] <- tbl[, ampi] tbl[, amox] <- tbl %>% pull(ampi)
} }
# Toegevoegde kolommen weer verwijderen # Toegevoegde kolommen weer verwijderen
@ -596,6 +610,7 @@ EUCAST_rules <- function(tbl,
tbl tbl
} }
#' @name EUCAST
#' @rdname EUCAST #' @rdname EUCAST
#' @export #' @export
interpretive_reading <- function(...) { interpretive_reading <- function(...) {

View File

@ -40,14 +40,37 @@ library(AMR)
# For a list of functions: # For a list of functions:
help(package = "AMR") help(package = "AMR")
``` ```
### Overwrite/force resistance based on EUCAST rules
### Databases included in package This is also called *interpretive reading*.
```r ```r
# Dataset with ATC antibiotics codes, official names and DDD's (oral and parenteral) before <- data.frame(bactid = c("STAAUR", # Staphylococcus aureus
ablist # A tibble: 420 x 12 "ENCFAE" # Enterococcus faecalis
"ESCCOL", # Escherichia coli
"KLEPNE", # Klebsiella pneumoniae
"PSEAER"), # Pseudomonas aeruginosa
vanc = "-", # Vancomycin
amox = "-", # Amoxicillin
coli = "-", # Colistin
cfta = "-", # Ceftazidime
cfur = "-", # Cefuroxime
stringsAsFactors = FALSE)
before
# bactid vanc amox coli cfta cfur
# 1 STAAUR - - - - -
# 2 ENCFAE - - - - -
# 3 ESCCOL - - - - -
# 4 KLEPNE - - - - -
# 5 PSEAER - - - - -
# Dataset with bacteria codes and properties like gram stain and aerobic/anaerobic # Now apply those rules; just need a column with bacteria ID's and antibiotic results:
bactlist # A tibble: 2,507 x 10 after <- EUCAST_rules(before)
after
# bactid vanc amox coli cfta cfur
# 1 STAAUR - - R R -
# 2 ENCFAE - - R R R
# 3 ESCCOL R - - - -
# 4 KLEPNE R R - - -
# 5 PSEAER R R - - R
``` ```
### New classes ### New classes
@ -94,18 +117,13 @@ plot(rsi_data)
Other epidemiological functions: Other epidemiological functions:
```r ```r
# Apply EUCAST Expert Rules v3.1 (latest) to antibiotic columns
EUCAST_rules(...)
# Determine key antibiotic based on bacteria ID # Determine key antibiotic based on bacteria ID
key_antibiotics(...) key_antibiotics(...)
# Check if key antibiotics are equal
key_antibiotics_equal(...)
# Selection of first isolates of any patient # Selection of first isolates of any patient
first_isolate(...) first_isolate(...)
# Calculate resistance levels of antibiotics # Calculate resistance levels of antibiotics, can be used with `summarise` (dplyr)
rsi(...) rsi(...)
# Predict resistance levels of antibiotics # Predict resistance levels of antibiotics
rsi_predict(...) rsi_predict(...)
@ -115,6 +133,17 @@ abname(...)
abname("J01CR02", from = "atc", to = "umcg") # "AMCL" abname("J01CR02", from = "atc", to = "umcg") # "AMCL"
``` ```
### Databases included in package
Datasets to work with antibiotics and bacteria properties.
```r
# Dataset with ATC antibiotics codes, official names and DDD's (oral and parenteral)
ablist # A tibble: 420 x 12
# Dataset with bacteria codes and properties like gram stain and aerobic/anaerobic
bactlist # A tibble: 2,507 x 10
```
## Authors ## Authors
- [Berends MS](https://github.com/msberends)<sup>1,2</sup>, PhD Student - [Berends MS](https://github.com/msberends)<sup>1,2</sup>, PhD Student

View File

@ -3,6 +3,7 @@
\name{EUCAST} \name{EUCAST}
\alias{EUCAST} \alias{EUCAST}
\alias{EUCAST_rules} \alias{EUCAST_rules}
\alias{EUCAST}
\alias{interpretive_reading} \alias{interpretive_reading}
\title{EUCAST expert rules} \title{EUCAST expert rules}
\source{ \source{
@ -14,22 +15,22 @@ EUCAST Expert Rules Version 2.0: \cr
\url{http://www.eucast.org/expert_rules_and_intrinsic_resistance} \url{http://www.eucast.org/expert_rules_and_intrinsic_resistance}
} }
\usage{ \usage{
EUCAST_rules(tbl, col_bactcode = "bacteriecode", info = TRUE, EUCAST_rules(tbl, col_bactcode = "bactid", info = TRUE, amcl = "amcl",
amcl = "amcl", amik = "amik", amox = "amox", ampi = "ampi", amik = "amik", amox = "amox", ampi = "ampi", azit = "azit",
azit = "azit", aztr = "aztr", cefa = "cefa", cfra = "cfra", aztr = "aztr", cefa = "cefa", cfra = "cfra", cfep = "cfep",
cfep = "cfep", cfot = "cfot", cfox = "cfox", cfta = "cfta", cfot = "cfot", cfox = "cfox", cfta = "cfta", cftr = "cftr",
cftr = "cftr", cfur = "cfur", chlo = "chlo", cipr = "cipr", cfur = "cfur", chlo = "chlo", cipr = "cipr", clar = "clar",
clar = "clar", clin = "clin", clox = "clox", coli = "coli", clin = "clin", clox = "clox", coli = "coli", czol = "czol",
czol = "czol", dapt = "dapt", doxy = "doxy", erta = "erta", dapt = "dapt", doxy = "doxy", erta = "erta", eryt = "eryt",
eryt = "eryt", fosf = "fosf", fusi = "fusi", gent = "gent", fosf = "fosf", fusi = "fusi", gent = "gent", imip = "imip",
imip = "imip", kana = "kana", levo = "levo", linc = "linc", kana = "kana", levo = "levo", linc = "linc", line = "line",
line = "line", mero = "mero", mino = "mino", moxi = "moxi", mero = "mero", mino = "mino", moxi = "moxi", nali = "nali",
nali = "nali", neom = "neom", neti = "neti", nitr = "nitr", neom = "neom", neti = "neti", nitr = "nitr", novo = "novo",
novo = "novo", norf = "norf", oflo = "oflo", peni = "peni", norf = "norf", oflo = "oflo", peni = "peni", pita = "pita",
pita = "pita", poly = "poly", qida = "qida", rifa = "rifa", poly = "poly", qida = "qida", rifa = "rifa", roxi = "roxi",
roxi = "roxi", siso = "siso", teic = "teic", tetr = "tetr", siso = "siso", teic = "teic", tetr = "tetr", tica = "tica",
tica = "tica", tige = "tige", tobr = "tobr", trim = "trim", tige = "tige", tobr = "tobr", trim = "trim", trsu = "trsu",
trsu = "trsu", vanc = "vanc") vanc = "vanc")
interpretive_reading(...) interpretive_reading(...)
} }
@ -51,7 +52,15 @@ table with edited variables of antibiotics.
Apply expert rules (like intrinsic resistance), as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, \url{http://eucast.org}), see \emph{Source}. Apply expert rules (like intrinsic resistance), as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, \url{http://eucast.org}), see \emph{Source}.
} }
\examples{ \examples{
\dontrun{ a <- data.frame(bactid = c("STAAUR", "ESCCOL", "KLEPNE", "PSEAER"),
tbl <- EUCAST_rules(tbl) vanc = "-",
} amox = "-",
coli = "-",
cfta = "-",
cfur = "-",
stringsAsFactors = FALSE)
a
b <- EUCAST_rules(a)
b
} }