eucast update

This commit is contained in:
dr. M.S. (Matthijs) Berends 2018-11-01 20:23:33 +01:00
parent f7687557c9
commit 5476fecc73
16 changed files with 82 additions and 69 deletions

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 0.4.0.9008
Date: 2018-10-31
Date: 2018-11-01
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(

View File

@ -168,6 +168,7 @@ importFrom(crayon,black)
importFrom(crayon,blue)
importFrom(crayon,bold)
importFrom(crayon,green)
importFrom(crayon,italic)
importFrom(crayon,red)
importFrom(crayon,silver)
importFrom(curl,nslookup)

View File

@ -13,6 +13,7 @@
* Better error handling when rules cannot be applied (i.e. new values could not be inserted)
* The number of affected values will now only be measured once per row/column combination
* Data set `septic_patients` now reflects these changes
* Added parameter `pipe` for piperacillin (J01CA12), also to the `MDRO` function
* Small fixes to EUCAST clinical breakpoint rules
* Tremendous speed improvement for `as.mo` (and subsequently all `mo_*` functions), as empty values wil be ignored *a priori*
* Fewer than 3 characters as input for `as.mo` will return NA
@ -22,11 +23,11 @@
* Using `portion_*` functions now throws a warning when total available isolate is below parameter `minimum`
* Functions `as.mo`, `as.rsi`, `as.mic`, `as.atc` and `freq` will not set package name as attribute anymore
* Frequency tables - `freq()`:
* Check for `hms::is.hms` in frequency tables (`freq()`)
* Check for `hms::is.hms`
* Now prints in markdown at default in non-interactive sessions
* No longer adds the factor level column and sorts factors on count again
* Gained `na` parameter, to choose with character to print for empty values
* Support for class `difftime`
* New parameter `na`, to choose with character to print for empty values
* New parameter `header` to turn it off (default when `markdown = TRUE`)
* New parameter `title` to replace the automatically set title
* `first_isolate` now tries to find columns to use as input when parameters are left blank

View File

@ -23,9 +23,9 @@
#' @param col_mo column name of the microbial ID in \code{tbl} - values in this column should be present in \code{microorganisms$mo}, see \code{\link{microorganisms}}
#' @param info print progress
#' @param rules a character vector that specifies which rules should be applied - one or more of \code{c("breakpoints", "expert", "other", "all")}
#' @param verbose a logical to indicate whether extensive info should be returned as a \code{data.frame} with info about which rows and columns are effected
#' @param amcl,amik,amox,ampi,azit,azlo,aztr,cefa,cfep,cfot,cfox,cfra,cfta,cftr,cfur,chlo,cipr,clar,clin,clox,coli,czol,dapt,doxy,erta,eryt,fosf,fusi,gent,imip,kana,levo,linc,line,mero,mezl,mino,moxi,nali,neom,neti,nitr,norf,novo,oflo,oxac,peni,pipe,pita,poly,pris,qida,rifa,roxi,siso,teic,tetr,tica,tige,tobr,trim,trsu,vanc column name of an antibiotic, see Details
#' @param col_bactid Deprecated. Use \code{col_mo} instead.
#' @param verbose a logical to indicate whether extensive info should be returned as a \code{data.frame} with info about which rows and columns are effected
#' @param ... parameters that are passed on to \code{EUCAST_rules}
#' @details To define antibiotics column names, input a text or use \code{NA} to skip a column (e.g. \code{tica = NA}). Non-existing columns will anyway be skipped with a warning. See the Antibiotics section for an explanation of the abbreviations.
#' @section Antibiotics:
@ -97,7 +97,7 @@
#' @rdname EUCAST
#' @export
#' @importFrom dplyr %>% select pull mutate_at vars
#' @importFrom crayon bold bgGreen bgYellow bgRed black green blue
#' @importFrom crayon bold bgGreen bgYellow bgRed black green blue italic
#' @return The input of \code{tbl}, possibly with edited values of antibiotics. Or, if \code{verbose = TRUE}, a \code{data.frame} with verbose info.
#' @source
#' \itemize{
@ -150,9 +150,10 @@
#' # 4 Klebsiella pneumoniae R R - - - R S
#' # 5 Pseudomonas aeruginosa R R - - R R R
EUCAST_rules <- function(tbl,
col_mo = 'mo',
col_mo = NULL,
info = TRUE,
rules = c("breakpoints", "expert", "other", "all"),
verbose = FALSE,
amcl = 'amcl',
amik = 'amik',
amox = 'amox',
@ -216,24 +217,33 @@ EUCAST_rules <- function(tbl,
trim = 'trim',
trsu = 'trsu',
vanc = 'vanc',
col_bactid = 'bactid',
verbose = FALSE) {
col_bactid = NULL) {
EUCAST_VERSION_BREAKPOINTS <- "8.1, 2018"
EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016"
if (col_bactid %in% colnames(tbl)) {
if (!is.data.frame(tbl)) {
stop("`tbl` must be a data frame.", call. = FALSE)
}
# try to find columns based on type
# -- mo
if (!is.null(col_bactid)) {
col_mo <- col_bactid
warning("Use of `col_bactid` is deprecated. Use `col_mo` instead.")
}
if (!col_mo %in% colnames(tbl)) {
stop('Column ', col_mo, ' not found.', call. = FALSE)
} else if (is.null(col_mo) & "mo" %in% lapply(tbl, class)) {
col_mo <- colnames(tbl)[lapply(tbl, class) == "mo"]
message("NOTE: Using column `", col_mo, "` as input for `col_mo`.")
}
if (!all(rules %in% c("breakpoints", "expert", "other", "all"))) {
stop("Parameter `rules` must be one or more of: 'breakpoints', 'expert', 'other', 'all'.")
}
if (is.null(col_mo)) {
stop("Parameter `col_mo` must be set")
}
warned <- FALSE
changed_results <- 0
@ -474,7 +484,7 @@ EUCAST_rules <- function(tbl,
txt_ok()
}
# Staphylococcus ----
rule <- 'Staphylococcus'
rule <- italic('Staphylococcus')
if (info == TRUE) {
warned <- FALSE
changed_results <- 0
@ -561,7 +571,7 @@ EUCAST_rules <- function(tbl,
txt_ok()
}
# Enterococcus ----
rule <- 'Enterococcus'
rule <- italic('Enterococcus')
if (info == TRUE) {
warned <- FALSE
changed_results <- 0
@ -611,8 +621,8 @@ EUCAST_rules <- function(tbl,
if (info == TRUE) {
txt_ok()
}
# Streptococcus A, B, C, G----
rule <- 'Streptococcus A, B, C, G'
# Streptococcus groups A, B, C, G----
rule <- paste(italic('Streptococcus'), 'groups A, B, C, G')
if (info == TRUE) {
warned <- FALSE
changed_results <- 0
@ -670,7 +680,7 @@ EUCAST_rules <- function(tbl,
txt_ok()
}
# Streptococcus pneumoniae ----
rule <- 'Streptococcus pneumoniae'
rule <- italic('Streptococcus pneumoniae')
if (info == TRUE) {
warned <- FALSE
changed_results <- 0
@ -774,7 +784,7 @@ EUCAST_rules <- function(tbl,
txt_ok()
}
# Haemophilus influenzae ----
rule <- 'Haemophilus influenzae'
rule <- italic('Haemophilus influenzae')
if (info == TRUE) {
warned <- FALSE
changed_results <- 0
@ -839,7 +849,7 @@ EUCAST_rules <- function(tbl,
txt_ok()
}
# Moraxella catarrhalis ----
rule <- 'Moraxella catarrhalis'
rule <- italic('Moraxella catarrhalis')
if (info == TRUE) {
warned <- FALSE
changed_results <- 0
@ -963,7 +973,7 @@ EUCAST_rules <- function(tbl,
txt_ok()
}
# Pasteurella multocida ----
rule <- 'Pasteurella multocida'
rule <- italic('Pasteurella multocida')
if (info == TRUE) {
warned <- FALSE
changed_results <- 0
@ -990,7 +1000,7 @@ EUCAST_rules <- function(tbl,
txt_ok()
}
# Campylobacter jejuni and coli ----
rule <- 'Campylobacter jejuni and coli'
rule <- paste(italic('Campylobacter jejuni'), 'and', italic('C. coli'))
if (info == TRUE) {
warned <- FALSE
changed_results <- 0
@ -1034,7 +1044,7 @@ EUCAST_rules <- function(tbl,
txt_ok()
}
# Aerococcus sanguinicola/urinae ----
rule <- 'Aerococcus sanguinicola/urinae'
rule <- paste(italic('Aerococcus sanguinicola'), 'and', italic('A. urinae'))
if (info == TRUE) {
warned <- FALSE
changed_results <- 0
@ -1078,7 +1088,7 @@ EUCAST_rules <- function(tbl,
txt_ok()
}
# Kingella kingae ----
rule <- 'Kingella kingae'
rule <- italic('Kingella kingae')
if (info == TRUE) {
warned <- FALSE
changed_results <- 0
@ -1140,7 +1150,7 @@ EUCAST_rules <- function(tbl,
rule_group <- "Expert Rules"
# Table 1: Intrinsic resistance in Enterobacteriaceae ----
rule <- 'Table 1: Intrinsic resistance in Enterobacteriaceae'
rule <- paste('Table 1: Intrinsic resistance in', italic('Enterobacteriaceae'))
if (info == TRUE) {
warned <- FALSE
changed_results <- 0

View File

@ -198,11 +198,10 @@ first_isolate <- function(tbl,
check_columns_existance(col_keyantibiotics)
if (!is.null(col_mo)) {
if (!tbl %>% pull(col_mo) %>% is.mo()) {
tbl[, col_mo] <- as.mo(tbl[, col_mo])
}
# join to microorganisms data set
tbl <- tbl %>% left_join_microorganisms(by = col_mo)
tbl <- tbl %>%
mutate_at(vars(col_mo), as.mo) %>%
left_join_microorganisms(by = col_mo)
col_genus <- "genus"
col_species <- "species"
}

View File

@ -87,6 +87,7 @@ MDRO <- function(tbl,
norf = 'norf',
oflo = 'oflo',
peni = 'peni',
pipe = 'pipe',
pita = 'pita',
poly = 'poly',
qida = 'qida',

2
R/mo.R
View File

@ -71,7 +71,7 @@
#' \if{html}{\figure{itis_logo.jpg}{options: height=60px style=margin-bottom:5px} \cr}
#' This package contains the \strong{complete microbial taxonomic data} (with all seven taxonomic ranks - from subkingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, \url{https://www.itis.gov}).
#'
#' All (sub)species from the \strong{taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This \strong{allows users to use authoritative taxonomic information} for their data analysis on any microorganism, not only human pathogens. It also helps to \strong{quickly determine the Gram stain of bacteria}, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
#' All (sub)species from the \strong{taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
#'
#' ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists [3].
#'

View File

@ -83,7 +83,7 @@ The `AMR` package basically does four important things:
This package contains the **complete microbial taxonomic data** (with all seven taxonomic ranks - from subkingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, https://www.itis.gov).
All (sub)species from the **taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package**, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This **allows users to use authoritative taxonomic information** for their data analysis on any microorganism, not only human pathogens. It also helps to **quickly determine the Gram stain of bacteria**, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
All (sub)species from the **taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package**, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists.

View File

@ -35,8 +35,8 @@ on_failure:
- 7z a failure.zip *.Rcheck\*
- appveyor PushArtifact failure.zip
on_success:
- Rscript -e "covr::codecov(token = '50ffa0aa-fee0-4f8b-a11d-8c7edc6d32ca')"
#on_success:
# - Rscript -e "covr::codecov(token = '50ffa0aa-fee0-4f8b-a11d-8c7edc6d32ca')"
artifacts:
- path: '*.Rcheck\**\*.log'

View File

@ -22,25 +22,24 @@
}
}
\usage{
EUCAST_rules(tbl, col_mo = "mo", info = TRUE,
rules = c("breakpoints", "expert", "other", "all"), amcl = "amcl",
amik = "amik", amox = "amox", ampi = "ampi", azit = "azit",
azlo = "azlo", aztr = "aztr", cefa = "cefa", cfep = "cfep",
cfot = "cfot", cfox = "cfox", cfra = "cfra", 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", mezl = "mezl", mino = "mino",
moxi = "moxi", nali = "nali", neom = "neom", neti = "neti",
nitr = "nitr", norf = "norf", novo = "novo", oflo = "oflo",
oxac = "oxac", peni = "peni", pipe = "pipe", pita = "pita",
poly = "poly", pris = "pris", qida = "qida", rifa = "rifa",
roxi = "roxi", siso = "siso", teic = "teic", tetr = "tetr",
tica = "tica", tige = "tige", tobr = "tobr", trim = "trim",
trsu = "trsu", vanc = "vanc", col_bactid = "bactid",
verbose = FALSE)
EUCAST_rules(tbl, col_mo = NULL, info = TRUE,
rules = c("breakpoints", "expert", "other", "all"), verbose = FALSE,
amcl = "amcl", amik = "amik", amox = "amox", ampi = "ampi",
azit = "azit", azlo = "azlo", aztr = "aztr", cefa = "cefa",
cfep = "cfep", cfot = "cfot", cfox = "cfox", cfra = "cfra",
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", mezl = "mezl",
mino = "mino", moxi = "moxi", nali = "nali", neom = "neom",
neti = "neti", nitr = "nitr", norf = "norf", novo = "novo",
oflo = "oflo", oxac = "oxac", peni = "peni", pipe = "pipe",
pita = "pita", poly = "poly", pris = "pris", qida = "qida",
rifa = "rifa", roxi = "roxi", siso = "siso", teic = "teic",
tetr = "tetr", tica = "tica", tige = "tige", tobr = "tobr",
trim = "trim", trsu = "trsu", vanc = "vanc", col_bactid = NULL)
interpretive_reading(...)
}
@ -53,12 +52,12 @@ interpretive_reading(...)
\item{rules}{a character vector that specifies which rules should be applied - one or more of \code{c("breakpoints", "expert", "other", "all")}}
\item{verbose}{a logical to indicate whether extensive info should be returned as a \code{data.frame} with info about which rows and columns are effected}
\item{amcl, amik, amox, ampi, azit, azlo, aztr, cefa, cfep, cfot, cfox, cfra, cfta, cftr, cfur, chlo, cipr, clar, clin, clox, coli, czol, dapt, doxy, erta, eryt, fosf, fusi, gent, imip, kana, levo, linc, line, mero, mezl, mino, moxi, nali, neom, neti, nitr, norf, novo, oflo, oxac, peni, pipe, pita, poly, pris, qida, rifa, roxi, siso, teic, tetr, tica, tige, tobr, trim, trsu, vanc}{column name of an antibiotic, see Details}
\item{col_bactid}{Deprecated. Use \code{col_mo} instead.}
\item{verbose}{a logical to indicate whether extensive info should be returned as a \code{data.frame} with info about which rows and columns are effected}
\item{...}{parameters that are passed on to \code{EUCAST_rules}}
}
\value{

View File

@ -19,10 +19,11 @@ MDRO(tbl, country = NULL, col_mo = NULL, info = TRUE,
line = "line", mero = "mero", metr = "metr", 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", col_bactid = NULL)
peni = "peni", pipe = "pipe", 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",
col_bactid = NULL)
BRMO(tbl, country = "nl", ...)
@ -129,6 +130,8 @@ EUCAST_exceptional_phenotypes(tbl, country = "EUCAST", ...)
\item{peni}{column name of an antibiotic, see Details}
\item{pipe}{column name of an antibiotic, see Details}
\item{pita}{column name of an antibiotic, see Details}
\item{poly}{column name of an antibiotic, see Details}

View File

@ -78,7 +78,7 @@ This means that looking up human pathogenic microorganisms takes less time than
\if{html}{\figure{itis_logo.jpg}{options: height=60px style=margin-bottom:5px} \cr}
This package contains the \strong{complete microbial taxonomic data} (with all seven taxonomic ranks - from subkingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, \url{https://www.itis.gov}).
All (sub)species from the \strong{taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This \strong{allows users to use authoritative taxonomic information} for their data analysis on any microorganism, not only human pathogens. It also helps to \strong{quickly determine the Gram stain of bacteria}, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
All (sub)species from the \strong{taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists [3].
}

View File

@ -36,7 +36,7 @@ A data set containing the complete microbial taxonomy of the kingdoms Bacteria,
\if{html}{\figure{itis_logo.jpg}{options: height=60px style=margin-bottom:5px} \cr}
This package contains the \strong{complete microbial taxonomic data} (with all seven taxonomic ranks - from subkingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, \url{https://www.itis.gov}).
All (sub)species from the \strong{taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This \strong{allows users to use authoritative taxonomic information} for their data analysis on any microorganism, not only human pathogens. It also helps to \strong{quickly determine the Gram stain of bacteria}, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
All (sub)species from the \strong{taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists [3].
}

View File

@ -25,7 +25,7 @@ A data set containing old (previously valid or accepted) taxonomic names accordi
\if{html}{\figure{itis_logo.jpg}{options: height=60px style=margin-bottom:5px} \cr}
This package contains the \strong{complete microbial taxonomic data} (with all seven taxonomic ranks - from subkingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, \url{https://www.itis.gov}).
All (sub)species from the \strong{taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This \strong{allows users to use authoritative taxonomic information} for their data analysis on any microorganism, not only human pathogens. It also helps to \strong{quickly determine the Gram stain of bacteria}, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
All (sub)species from the \strong{taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists [3].
}

View File

@ -71,7 +71,7 @@ Use these functions to return a specific property of a microorganism from the \c
\if{html}{\figure{itis_logo.jpg}{options: height=60px style=margin-bottom:5px} \cr}
This package contains the \strong{complete microbial taxonomic data} (with all seven taxonomic ranks - from subkingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, \url{https://www.itis.gov}).
All (sub)species from the \strong{taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This \strong{allows users to use authoritative taxonomic information} for their data analysis on any microorganism, not only human pathogens. It also helps to \strong{quickly determine the Gram stain of bacteria}, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
All (sub)species from the \strong{taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists [3].
}

View File

@ -2,8 +2,7 @@ context("eucast.R")
test_that("EUCAST rules work", {
expect_error(EUCAST_rules(septic_patients, col_mo = "Non-existing"))
expect_error(suppressWarnings(EUCAST_rules(septic_patients, col_mo = "Non-existing")))
expect_identical(colnames(septic_patients),
colnames(suppressWarnings(EUCAST_rules(septic_patients))))
@ -18,8 +17,8 @@ test_that("EUCAST rules work", {
"ENTAER"), # Enterobacter aerogenes
amox = "R", # Amoxicillin
stringsAsFactors = FALSE)
expect_identical(suppressWarnings(EUCAST_rules(a, info = FALSE)), b)
expect_identical(suppressWarnings(interpretive_reading(a, info = TRUE)), b)
expect_identical(suppressWarnings(EUCAST_rules(a, "mo", info = FALSE)), b)
expect_identical(suppressWarnings(interpretive_reading(a, "mo", info = TRUE)), b)
a <- data.frame(mo = c("STAAUR", # Staphylococcus aureus
"STCGRA"), # Streptococcus pyognenes (Lancefield Group A)
@ -29,18 +28,18 @@ test_that("EUCAST rules work", {
"STCGRA"), # Streptococcus pyognenes (Lancefield Group A)
coli = "R", # Colistin
stringsAsFactors = FALSE)
expect_equal(suppressWarnings(EUCAST_rules(a, info = FALSE)), b)
expect_equal(suppressWarnings(EUCAST_rules(a, "mo", info = FALSE)), b)
# pita must be R in Enterobacteriaceae when tica is R
# piperacillin must be R in Enterobacteriaceae when tica is R
library(dplyr)
expect_equal(suppressWarnings(
septic_patients %>%
mutate(tica = as.rsi("R"),
pita = as.rsi("S")) %>%
pipe = as.rsi("S")) %>%
EUCAST_rules(col_mo = "mo") %>%
left_join_microorganisms() %>%
filter(family == "Enterobacteriaceae") %>%
pull(pita) %>%
pull(pipe) %>%
unique() %>%
as.character()),
"R")