1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 18:46:11 +01:00
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
#' \url{http://www.eucast.org/expert_rules_and_intrinsic_resistance}
#' @examples
#' \dontrun{
#' tbl <- EUCAST_rules(tbl)
#' }
#' a <- data.frame(bactid = c("STAAUR", "ESCCOL", "KLEPNE", "PSEAER"),
#' vanc = "-",
#' amox = "-",
#' coli = "-",
#' cfta = "-",
#' cfur = "-",
#' stringsAsFactors = FALSE)
#' a
#'
#' b <- EUCAST_rules(a)
#' b
EUCAST_rules <- function(tbl,
col_bactcode = 'bacteriecode',
col_bactcode = 'bactid',
info = TRUE,
amcl = 'amcl',
amik = 'amik',
@ -232,61 +240,61 @@ EUCAST_rules <- function(tbl,
# Citrobacter
edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Citrobacter (koseri|amalonaticus|sedlakii|farmeri|rodentium)'),
cols = c(ampi, tica))
cols = c(aminopenicillines, tica))
edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Citrobacter (freundii|braakii|murliniae|werkmanii|youngae)'),
cols = c(ampi, amcl, czol, cfox))
cols = c(aminopenicillines, amcl, czol, cfox))
# Enterobacter
edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Enterobacter cloacae'),
cols = c(ampi, amcl, czol, cfox))
cols = c(aminopenicillines, amcl, czol, cfox))
edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Enterobacter aerogenes'),
cols = c(ampi, amcl, czol, cfox))
cols = c(aminopenicillines, amcl, czol, cfox))
# Escherichia
edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Escherichia hermanni'),
cols = c(ampi, tica))
cols = c(aminopenicillines, tica))
# Hafnia
edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Hafnia alvei'),
cols = c(ampi, amcl, czol, cfox))
cols = c(aminopenicillines, amcl, czol, cfox))
# Klebsiella
edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Klebsiella'),
cols = c(ampi, tica))
cols = c(aminopenicillines, tica))
# Morganella / Proteus
edit_rsi(to = 'R',
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',
rows = which(tbl$fullname %like% '^Proteus mirabilis'),
cols = c(tetracyclines, tige, polymyxines, nitr))
edit_rsi(to = 'R',
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',
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
edit_rsi(to = 'R',
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',
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
edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Raoultella'),
cols = c(ampi, tica))
cols = c(aminopenicillines, tica))
# Serratia
edit_rsi(to = 'R',
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
edit_rsi(to = 'R',
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',
rows = which(tbl$fullname %like% '^Yersinia pseudotuberculosis'),
cols = c(poly, coli))
@ -313,32 +321,32 @@ EUCAST_rules <- function(tbl,
# Acinetobacter
edit_rsi(to = 'R',
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
edit_rsi(to = 'R',
rows = which(tbl$fullname %like% '^Achromobacter (xylosoxydans|xylosoxidans)'),
cols = c(ampi, czol, cfot, cftr, erta))
cols = c(aminopenicillines, czol, cfot, cftr, erta))
# Burkholderia
edit_rsi(to = 'R',
# 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)'),
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
edit_rsi(to = 'R',
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
edit_rsi(to = 'R',
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
edit_rsi(to = 'R',
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
edit_rsi(to = 'R',
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 ----
@ -448,6 +456,12 @@ EUCAST_rules <- function(tbl,
& tbl[, ampi] == 'R'),
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 ----
if (info == TRUE) {
@ -579,7 +593,7 @@ EUCAST_rules <- function(tbl,
cols = trim)
}
if (!is.na(ampi) & !is.na(amox)) {
tbl[, amox] <- tbl[, ampi]
tbl[, amox] <- tbl %>% pull(ampi)
}
# Toegevoegde kolommen weer verwijderen
@ -596,6 +610,7 @@ EUCAST_rules <- function(tbl,
tbl
}
#' @name EUCAST
#' @rdname EUCAST
#' @export
interpretive_reading <- function(...) {

View File

@ -40,14 +40,37 @@ library(AMR)
# For a list of functions:
help(package = "AMR")
```
### Databases included in package
### Overwrite/force resistance based on EUCAST rules
This is also called *interpretive reading*.
```r
# Dataset with ATC antibiotics codes, official names and DDD's (oral and parenteral)
ablist # A tibble: 420 x 12
before <- data.frame(bactid = c("STAAUR", # Staphylococcus aureus
"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
bactlist # A tibble: 2,507 x 10
# Now apply those rules; just need a column with bacteria ID's and antibiotic results:
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
@ -94,18 +117,13 @@ plot(rsi_data)
Other epidemiological functions:
```r
# Apply EUCAST Expert Rules v3.1 (latest) to antibiotic columns
EUCAST_rules(...)
# Determine key antibiotic based on bacteria ID
key_antibiotics(...)
# Check if key antibiotics are equal
key_antibiotics_equal(...)
# Selection of first isolates of any patient
first_isolate(...)
# Calculate resistance levels of antibiotics
# Calculate resistance levels of antibiotics, can be used with `summarise` (dplyr)
rsi(...)
# Predict resistance levels of antibiotics
rsi_predict(...)
@ -115,6 +133,17 @@ abname(...)
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
- [Berends MS](https://github.com/msberends)<sup>1,2</sup>, PhD Student

View File

@ -3,6 +3,7 @@
\name{EUCAST}
\alias{EUCAST}
\alias{EUCAST_rules}
\alias{EUCAST}
\alias{interpretive_reading}
\title{EUCAST expert rules}
\source{
@ -14,22 +15,22 @@ EUCAST Expert Rules Version 2.0: \cr
\url{http://www.eucast.org/expert_rules_and_intrinsic_resistance}
}
\usage{
EUCAST_rules(tbl, col_bactcode = "bacteriecode", info = TRUE,
amcl = "amcl", amik = "amik", amox = "amox", ampi = "ampi",
azit = "azit", aztr = "aztr", cefa = "cefa", cfra = "cfra",
cfep = "cfep", cfot = "cfot", cfox = "cfox", cfta = "cfta",
cftr = "cftr", cfur = "cfur", chlo = "chlo", cipr = "cipr",
clar = "clar", clin = "clin", clox = "clox", coli = "coli",
czol = "czol", dapt = "dapt", doxy = "doxy", erta = "erta",
eryt = "eryt", fosf = "fosf", fusi = "fusi", gent = "gent",
imip = "imip", kana = "kana", levo = "levo", linc = "linc",
line = "line", mero = "mero", mino = "mino", moxi = "moxi",
nali = "nali", neom = "neom", neti = "neti", nitr = "nitr",
novo = "novo", norf = "norf", oflo = "oflo", peni = "peni",
pita = "pita", poly = "poly", qida = "qida", rifa = "rifa",
roxi = "roxi", siso = "siso", teic = "teic", tetr = "tetr",
tica = "tica", tige = "tige", tobr = "tobr", trim = "trim",
trsu = "trsu", vanc = "vanc")
EUCAST_rules(tbl, col_bactcode = "bactid", info = TRUE, amcl = "amcl",
amik = "amik", amox = "amox", ampi = "ampi", azit = "azit",
aztr = "aztr", cefa = "cefa", cfra = "cfra", cfep = "cfep",
cfot = "cfot", cfox = "cfox", cfta = "cfta", cftr = "cftr",
cfur = "cfur", chlo = "chlo", cipr = "cipr", clar = "clar",
clin = "clin", clox = "clox", coli = "coli", czol = "czol",
dapt = "dapt", doxy = "doxy", erta = "erta", eryt = "eryt",
fosf = "fosf", fusi = "fusi", gent = "gent", imip = "imip",
kana = "kana", levo = "levo", linc = "linc", line = "line",
mero = "mero", mino = "mino", moxi = "moxi", nali = "nali",
neom = "neom", neti = "neti", nitr = "nitr", novo = "novo",
norf = "norf", oflo = "oflo", peni = "peni", pita = "pita",
poly = "poly", qida = "qida", rifa = "rifa", roxi = "roxi",
siso = "siso", teic = "teic", tetr = "tetr", tica = "tica",
tige = "tige", tobr = "tobr", trim = "trim", trsu = "trsu",
vanc = "vanc")
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}.
}
\examples{
\dontrun{
tbl <- EUCAST_rules(tbl)
}
a <- data.frame(bactid = c("STAAUR", "ESCCOL", "KLEPNE", "PSEAER"),
vanc = "-",
amox = "-",
coli = "-",
cfta = "-",
cfur = "-",
stringsAsFactors = FALSE)
a
b <- EUCAST_rules(a)
b
}