From 970e3ed7f1b17c64742bc26c599d4c34d1db71b5 Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Wed, 25 Apr 2018 15:33:58 +0200 Subject: [PATCH] EUCAST rules for MDRO --- DESCRIPTION | 2 +- NAMESPACE | 2 + NEWS.md | 29 ++-- R/atc.R | 84 +++++++++++ R/classes.R | 23 +-- R/data.R | 173 ++++++++++++++++++++++ R/eucast.R | 143 ++++++++---------- R/first_isolates.R | 4 + R/globals.R | 3 + R/mdro.R | 295 ++++++++++++++++++++++++++++++++----- R/misc.R | 1 + README.md | 15 +- data/antibiotics.rda | Bin 11069 -> 12694 bytes man/MDRO.Rd | 44 ++++-- man/antibiotics.Rd | 2 + man/as.mic.Rd | 2 +- man/as.rsi.Rd | 2 +- man/guess_atc.Rd | 35 +++++ tests/testthat/test-mdro.R | 8 +- 19 files changed, 694 insertions(+), 173 deletions(-) create mode 100644 man/guess_atc.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 0bcd64b0..e032519e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR Version: 0.2.0 -Date: 2018-04-19 +Date: 2018-04-23 Title: Antimicrobial Resistance Analysis Authors@R: c( person( diff --git a/NAMESPACE b/NAMESPACE index 0e0c60bf..4388652b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -16,6 +16,7 @@ S3method(summary,mic) S3method(summary,rsi) export("%like%") export(BRMO) +export(EUCAST_exceptional_phenotypes) export(EUCAST_rules) export(MDRO) export(MRGN) @@ -30,6 +31,7 @@ export(first_isolate) export(freq) export(frequency_tbl) export(full_join_microorganisms) +export(guess_atc) export(guess_bactid) export(inner_join_microorganisms) export(interpretive_reading) diff --git a/NEWS.md b/NEWS.md index 47d167ed..4d6f62ef 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,31 +1,36 @@ # 0.2.0 #### New * Full support for Windows, Linux and macOS -* Full support for old R versions, only R-3.0.0 (April 2013) or later is needed -* Function `guess_bactid` to determine the ID of a microorganism based on genus/species or known abbreviations like MRSA -* Functions `clipboard_import` and `clipboard_export` as helper functions to quickly copy and paste from/to software like Excel and SPSS -* Function `MDRO` to determine Multi Drug Resistant Organisms (MDRO) with support for country-specific guidelines. Suggest your own via [this link](https://github.com/msberends/AMR/issues/new?title=New%20guideline%20for%20MDRO&body=%3C--%20Please%20add%20your%20country%20code,%20guideline%20name,%20version%20and%20source%20below%20and%20remove%20this%20line--%3E). Functions `BRMO` and `MRGN` are wrappers for Dutch and German guidelines, respectively -* Function `freq` to create frequency tables, with additional info in a header +* Full support for old R versions, only R-3.0.0 (April 2013) or later is needed (needed packages may have other dependencies) +* Function `guess_bactid` to **determine the ID** of a microorganism based on genus/species or known abbreviations like MRSA +* Function `guess_atc` to **determine the ATC** of an antibiotic based on name, trade name, or known abbreviations +* Functions `clipboard_import` and `clipboard_export` as helper functions to **quickly copy and paste** from/to software like Excel and SPSS +* Function `freq` to create **frequency tables**, with additional info in a header +* Function `MDRO` to **determine Multi Drug Resistant Organisms (MDRO)** with support for country-specific guidelines. + * Suggest your own via [https://github.com/msberends/AMR/issues/new](https://github.com/msberends/AMR/issues/new?title=New%20guideline%20for%20MDRO&body=%3C--%20Please%20add%20your%20country%20code,%20guideline%20name,%20version%20and%20source%20below%20and%20remove%20this%20line--%3E) + * [Exceptional resistances defined by EUCAST](http://www.eucast.org/expert_rules_and_intrinsic_resistance) are also supported instead of countries alone + * Functions `BRMO` and `MRGN` are wrappers for Dutch and German guidelines, respectively * New algorithm to determine weighted isolates, can now be `"points"` or `"keyantibiotics"`, see `?first_isolate` -* New print format for tibbles and data.tables +* New print format for `tibble`s and `data.table`s #### Changed * Renamed dataset `ablist` to `antibiotics` * Renamed dataset `bactlist` to `microorganisms` -* Added more microorganisms to `bactlist` +* Added common abbreviations and trade names to the `antibiotics` dataset +* Added more microorganisms to the `microorganisms` dataset * Added analysis examples on help page of dataset `septic_patients` * Added support for character vector in `join` functions * Added warnings when a join results in more rows after than before the join * Altered `%like%` to make it case insensitive -* For parameters of functions `first_isolate` and `EUCAST_rules` the column names are now case-insensitive -* Functions `as.rsi` and `as.mic` now add the package name and version as attribute +* For parameters of functions `first_isolate` and `EUCAST_rules` column names are now case-insensitive +* Functions `as.rsi` and `as.mic` now add the package name and version as attributes #### Other -* Expanded README.md with more examples -* Added ORC IDs of authors to DESCRIPTION file +* Expanded `README.md` with more examples +* Added [ORCID](https://orcid.org) of authors to DESCRIPTION file * Added unit testing with the `testthat` package * Added build tests for Linux and macOS using Travis CI (https://travis-ci.org/msberends/AMR) -* Added Line coverage checking using CodeCov (https://codecov.io/gh/msberends/AMR/tree/master/R) +* Added line coverage checking using CodeCov (https://codecov.io/gh/msberends/AMR/tree/master/R) # 0.1.1 * `EUCAST_rules` applies for amoxicillin even if ampicillin is missing diff --git a/R/atc.R b/R/atc.R index cdfe4386..6a14b349 100644 --- a/R/atc.R +++ b/R/atc.R @@ -367,3 +367,87 @@ guess_bactid <- function(x) { } x } + +#' Find ATC code based on antibiotic property +#' +#' Use this function to determine the ATC code of one or more antibiotics. The dataset \code{\link{antibiotics}} will be searched for abbreviations, official names and trade names. +#' @param x character vector to determine \code{ATC} code +#' @export +#' @importFrom dplyr %>% filter slice pull +#' @details In the ATC classification system, the active substances are classified in a hierarchy with five different levels. The system has fourteen main anatomical/pharmacological groups or 1st levels. Each ATC main group is divided into 2nd levels which could be either pharmacological or therapeutic groups. The 3rd and 4th levels are chemical, pharmacological or therapeutic subgroups and the 5th level is the chemical substance. The 2nd, 3rd and 4th levels are often used to identify pharmacological subgroups when that is considered more appropriate than therapeutic or chemical subgroups. +#' Source: \url{https://www.whocc.no/atc/structure_and_principles/} +#' @return Character (vector). +#' @seealso \code{\link{antibiotics}} for the dataframe that is being used to determine ATC's. +#' @examples +#' # These examples all return "J01FA01", the ATC code of Erythromycin: +#' guess_atc("J01FA01") +#' guess_atc("Erythromycin") +#' guess_atc("eryt") +#' guess_atc("ERYT") +#' guess_atc("ERY") +#' guess_atc("Erythrocin") # Trade name +#' guess_atc("Eryzole") # Trade name +#' guess_atc("Pediamycin") # Trade name +guess_atc <- function(x) { + + # use this later to further fill AMR::antibiotics + + # drug <- "Ciprofloxacin" + # url <- xml2::read_html(paste0("https://www.ncbi.nlm.nih.gov/pccompound?term=", drug)) %>% + # html_nodes(".rslt") %>% + # .[[1]] %>% + # html_nodes(".title a") %>% + # html_attr("href") %>% + # gsub("/compound/", "/rest/pug_view/data/compound/", ., fixed = TRUE) %>% + # paste0("/XML/?response_type=display") + # synonyms <- url %>% + # read_xml() %>% + # xml_contents() %>% .[[6]] %>% + # xml_contents() %>% .[[8]] %>% + # xml_contents() %>% .[[3]] %>% + # xml_contents() %>% .[[3]] %>% + # xml_contents() %>% + # paste() %>% + # .[. %like% "StringValueList"] %>% + # gsub("[]", "", .) + + + for (i in 1:length(x)) { + + # first try atc + found <- AMR::antibiotics %>% filter(atc == x[i]) + + if (nrow(found) == 0) { + # try abbreviation of molis and glims + found <- AMR::antibiotics %>% filter(molis == x[i] | umcg == x[i]) + } + + if (nrow(found) == 0) { + # try exact official name + found <- AMR::antibiotics[which(AMR::antibiotics$official == x[i]),] + } + + if (nrow(found) == 0) { + # try trade name + found <- AMR::antibiotics[which(paste0("(", AMR::antibiotics$trade_name, ")") %like% x[i]),] + } + + if (nrow(found) == 0) { + # try abbreviation + found <- AMR::antibiotics[which(paste0("(", AMR::antibiotics$abbr, ")") %like% x[i]),] + } + # if (nrow(found) == 0) { + # # loosely try official name + # found <- AMR::antibiotics[which(AMR::antibiotics$official %like% x[i]),] + # } + + if (nrow(found) != 0) { + x[i] <- found %>% + slice(1) %>% + pull(atc) + } else { + x[i] <- NA + } + } + x +} diff --git a/R/classes.R b/R/classes.R index feed7b1d..cb0aa73a 100644 --- a/R/classes.R +++ b/R/classes.R @@ -21,7 +21,7 @@ #' This transforms a vector to a new class \code{rsi}, which is an ordered factor with levels \code{S < I < R}. Invalid antimicrobial interpretations will be translated as \code{NA} with a warning. #' @rdname as.rsi #' @param x vector -#' @return New class \code{rsi} +#' @return Ordered factor with new class \code{rsi} and new attributes \code{package} and \code{package.version} #' @export #' @importFrom dplyr %>% #' @importFrom utils packageDescription @@ -92,20 +92,13 @@ print.rsi <- function(x, ...) { I <- x[x == 'I'] %>% length() R <- x[x == 'R'] %>% length() IR <- x[x %in% c('I', 'R')] %>% length() - cat("Class 'rsi': ", n, " isolates\n", sep = '') + cat("Class 'rsi'\n") + cat(n, " results (missing: ", n_total - n, ' = ', percent((n_total - n) / n, force_zero = TRUE), ')\n', sep = "") cat('\n') - cat(': ', n_total - n, '\n') - cat('Sum of S: ', S, '\n') - cat('Sum of IR: ', IR, '\n') - cat('- Sum of R:', R, '\n') - cat('- Sum of I:', I, '\n') - cat('\n') - print(c( - `%S` = round((S / n) * 100, 1), - `%IR` = round((IR / n) * 100, 1), - `%I` = round((I / n) * 100, 1), - `%R` = round((R / n) * 100, 1) - )) + cat('Sum of S: ', S, ' (', percent(S / n, force_zero = TRUE), ')\n', sep = "") + cat('Sum of IR: ', IR, ' (', percent(IR / n, force_zero = TRUE), ')\n', sep = "") + cat('- Sum of R: ', R, ' (', percent(R / n, force_zero = TRUE), ')\n', sep = "") + cat('- Sum of I: ', I, ' (', percent(I / n, force_zero = TRUE), ')\n', sep = "") } #' @exportMethod summary.rsi @@ -197,7 +190,7 @@ barplot.rsi <- function(height, ...) { #' @rdname as.mic #' @param x vector #' @param na.rm a logical indicating whether missing values should be removed -#' @return New class \code{mic} +#' @return Ordered factor with new class \code{mic} and new attributes \code{package} and \code{package.version} #' @export #' @importFrom dplyr %>% #' @importFrom utils packageDescription diff --git a/R/data.R b/R/data.R index 91c7a527..9fc7c588 100644 --- a/R/data.R +++ b/R/data.R @@ -24,9 +24,11 @@ #' \item{\code{atc}}{ATC code, like \code{J01CR02}} #' \item{\code{molis}}{MOLIS code, like \code{amcl}} #' \item{\code{umcg}}{UMCG code, like \code{AMCL}} +#' \item{\code{abbr}}{Abbreviation as used by many countries, to be used for \code{\link{guess_atc}}} #' \item{\code{official}}{Official name by the WHO, like \code{"Amoxicillin and enzyme inhibitor"}} #' \item{\code{official_nl}}{Official name in the Netherlands, like \code{"Amoxicilline met enzymremmer"}} #' \item{\code{trivial_nl}}{Trivial name in Dutch, like \code{"Amoxicilline/clavulaanzuur"}} +#' \item{\code{trade_name}}{Trade name as used by many countries, to be used for \code{\link{guess_atc}}} #' \item{\code{oral_ddd}}{Defined Daily Dose (DDD), oral treatment} #' \item{\code{oral_units}}{Units of \code{ddd_units}} #' \item{\code{iv_ddd}}{Defined Daily Dose (DDD), parenteral treatment} @@ -40,6 +42,177 @@ #' } #' @source - World Health Organization: \url{https://www.whocc.no/atc_ddd_index/} \cr - EUCAST - Expert rules intrinsic exceptional V3.1 \cr - MOLIS (LIS of Certe): \url{https://www.certe.nl} \cr - GLIMS (LIS of UMCG): \url{https://www.umcg.nl} #' @seealso \code{\link{microorganisms}} +# abbr and trade_name created with: +# https://hs.unr.edu/Documents/dhs/chs/NVPHTC/antibiotic_refeference_guide.pdf +# antibiotics %>% +# mutate(abbr = +# case_when( +# official == 'Amikacin' ~ 'Ak|AN|AMI|AMK', +# official == 'Amoxicillin' ~ 'AMX|AMOX|AC', +# official == 'Amoxicillin and beta-lactamase inhibitor' ~ 'AUG|A/C|XL|AML', +# official == 'Ampicillin' ~ 'AM|AMP', +# official == 'Ampicillin and beta-lactamase inhibitor' ~ 'A/S|SAM|AMS|AB', +# official == 'Azithromycin' ~ 'Azi|AZM|AZ', +# official == 'Azlocillin' ~ 'AZ|AZL', +# official == 'Aztreonam' ~ 'Azt|ATM|AT|AZM', +# official == 'Carbenicillin' ~ 'Cb|BAR', +# official == 'Cefaclor' ~ 'Ccl|CEC|Cfr|FAC|CF', +# official == 'Cefadroxil' ~ 'CFR|FAD', +# official == 'Cefazolin' ~ 'Cfz|CZ|FAZ|KZ', +# official == 'Cefdinir' ~ 'Cdn|CDR|DIN|CD|CFD', +# official == 'Cefditoren' ~ 'CDN', +# official == 'Cefepime' ~ 'Cpe|FEP|PM|CPM', +# official == 'Cefixime' ~ 'Cfe|DCFM|FIX|IX', +# official == 'Cefoperazone' ~ 'Cfp|CPZ|PER|FOP|CP', +# official == 'Cefotaxime' ~ 'Cft|CTX|TAX|FOT|CT', +# official == 'Cefotetan' ~ 'Ctn|CTT|CTE|TANS|CN', +# official == 'Cefoxitin' ~ 'Cfx|FOX|CX|FX', +# official == 'Cefpodoxime' ~ 'Cpd|POD|PX', +# official == 'Cefprozil' ~ 'Cpz|CPR|FP', +# official == 'Ceftaroline' ~ 'CPT', +# official == 'Ceftazidime' ~ 'Caz|TAZ|TZ', +# official == 'Ceftibuten' ~ 'CTB|TIB|CB', +# official == 'Ceftizoxime' ~ 'Cz|ZOX|CZX|CZ|CTZ|TIZ', +# official == 'Ceftriaxone' ~ 'Cax|CRO|CTR|FRX|AXO|TX', +# official == 'Cefuroxime' ~ 'Crm|CXM|CFX|ROX|FUR|XM', +# official == 'Cephalexin' ~ 'CN|LX|CFL', +# official == 'Cephalothin' ~ 'Cf', +# official == 'Chloramphenicol' ~ 'C|CHL|CL', +# official == 'Ciprofloxacin' ~ 'Cp|CIP|CI', +# official == 'Clarithromycin' ~ 'Cla|CLR|CLM|CH', +# official == 'Clindamycin' ~ 'Cd|CC|CM|CLI|DA', +# official == 'Colistin' ~ 'CL|CS|CT', +# official == 'Daptomycin' ~ 'Dap', +# official == 'Doxycycline' ~ 'Dox', +# official == 'Doripenem' ~ 'DOR|Dor', +# official == 'Ertapenem' ~ 'Etp', +# official == 'Erythromycin' ~ 'E|ERY|EM', +# official == 'Fosfomycin' ~ 'FOS|FF|FO|FM', +# official == 'Flucloxacillin' ~ 'CLOX', +# official == 'Gentamicin' ~ 'Gm|CN|GEN', +# official == 'Imipenem' ~ 'Imp|IPM|IMI|IP', +# official == 'Kanamycin' ~ 'K|KAN|HLK|KM', +# official == 'Levofloxacin' ~ 'Lvx|LEV|LEVO|LE', +# official == 'Linezolid' ~ 'Lzd|LNZ|LZ', +# official == 'Lomefloxacin' ~ 'Lmf|LOM', +# official == 'Meropenem' ~ 'Mer|MEM|MERO|MRP|MP', +# official == 'Metronidazole' ~ 'MNZ', +# official == 'Mezlocillin' ~ 'Mz|MEZ', +# official == 'Minocycline' ~ 'Min|MI|MN|MNO|MC|MH', +# official == 'Moxifloxacin' ~ 'Mox|MXF', +# official == 'Mupirocin' ~ 'MUP', +# official == 'Nafcillin' ~ 'Naf|NF', +# official == 'Nalidixic acid' ~ 'NA|NAL', +# official == 'Nitrofurantoin' ~ 'Fd|F/M|FT|NIT|NI|F', +# official == 'Norfloxacin' ~ 'Nxn|NOR|NX', +# official == 'Ofloxacin' ~ 'Ofl|OFX|OF', +# official == 'Oxacillin' ~ 'Ox|OXS|OXA', +# official == 'Benzylpenicillin' ~ 'P|PEN|PV', +# official == 'Penicillins, combinations with other antibacterials' ~ 'P|PEN|PV', +# official == 'Piperacillin' ~ 'Pi|PIP|PP', +# official == 'Piperacillin and beta-lactamase inhibitor' ~ 'PT|TZP|PTZ|P/T|PTc', +# official == 'Polymyxin B' ~ 'PB', +# official == 'Quinupristin/dalfopristin' ~ 'Syn|Q/D|QDA|RP', +# official == 'Rifampin' ~ 'Rif|RA|RI|RD', +# official == 'Spectinomycin' ~ 'SPT|SPE|SC', +# official == 'Streptomycin' ~ 'S|STR', +# official == 'Teicoplanin' ~ 'Tei|TEC|TPN|TP|TPL', +# official == 'Telavancin' ~ 'TLV', +# official == 'Telithromcyin' ~ 'Tel', +# official == 'Tetracycline' ~ 'Te|TET|TC', +# official == 'Ticarcillin' ~ 'Ti|TIC|TC', +# official == 'Ticarcillin and beta-lactamase inhibitor' ~ 'Tim|T/C|TCC|TLc', +# official == 'Tigecycline' ~ 'TGC', +# official == 'Tobramycin' ~ 'To|NN|TM|TOB', +# official == 'Trimethoprim' ~ 'T|TMP|TR|W', +# official == 'Sulfamethoxazole and trimethoprim' ~ 'T/S|SXT|SxT|TS|COT', +# official == 'Vancomycin' ~ 'Va|VAN', +# TRUE ~ NA_character_), +# +# trade_name = +# case_when( +# official == 'Amikacin' ~ 'Amikin', +# official == 'Amoxicillin' ~ 'Amoxil|Dispermox|Larotid|Trimox', +# official == 'Amoxicillin and beta-lactamase inhibitor' ~ 'Augmentin', +# official == 'Ampicillin' ~ 'Pfizerpen-A|Principen', +# official == 'Ampicillin and beta-lactamase inhibitor' ~ 'Unasyn', +# official == 'Azithromycin' ~ 'Zithromax', +# official == 'Azlocillin' ~ 'Azlin', +# official == 'Aztreonam' ~ 'Azactam', +# official == 'Carbenicillin' ~ 'Geocillin', +# official == 'Cefaclor' ~ 'Ceclor', +# official == 'Cefadroxil' ~ 'Duricef', +# official == 'Cefazolin' ~ 'Ancef', +# official == 'Cefdinir' ~ 'Omnicef', +# official == 'Cefditoren' ~ 'Spectracef', +# official == 'Cefepime' ~ 'Maxipime', +# official == 'Cefixime' ~ 'Suprax', +# official == 'Cefoperazone' ~ 'Cefobid', +# official == 'Cefotaxime' ~ 'Claforan', +# official == 'Cefotetan' ~ 'Cefotan', +# official == 'Cefoxitin' ~ 'Mefoxin', +# official == 'Cefpodoxime' ~ 'Vantin', +# official == 'Cefprozil' ~ 'Cefzil', +# official == 'Ceftaroline' ~ 'Teflaro', +# official == 'Ceftazidime' ~ 'Fortaz|Tazicef|Tazidime', +# official == 'Ceftibuten' ~ 'Cedax', +# official == 'Ceftizoxime' ~ 'Cefizox', +# official == 'Ceftriaxone' ~ 'Rocephin', +# official == 'Cefuroxime' ~ 'Ceftin|Zinacef', +# official == 'Cephalexin' ~ 'Keflex|Panixine', +# official == 'Cephalothin' ~ 'Keflin', +# official == 'Chloramphenicol' ~ 'Chloromycetin', +# official == 'Ciprofloxacin' ~ 'Cipro|Ciloxan|Ciproxin', +# official == 'Clarithromycin' ~ 'Biaxin', +# official == 'Clindamycin' ~ 'Cleocin|Clinda-Derm|Clindagel|Clindesse|Clindets|Evoclin', +# official == 'Colistin' ~ 'Coly-Mycin', +# official == 'Daptomycin' ~ 'Cubicin', +# official == 'Doxycycline' ~ 'Doryx|Monodox|Vibramycin|Atridox|Oracea|Periostat|Vibra-Tabs', +# official == 'Doripenem' ~ 'Doribax', +# official == 'Ertapenem' ~ 'Invanz', +# official == 'Erythromycin' ~ 'Eryc|EryPed|Erythrocin|E-Base|E-Glades|E-Mycin|E.E.S.|Ery-Tab|Eryderm|Erygel|Erythra-derm|Eryzole|Pediamycin', +# official == 'Fosfomycin' ~ 'Monurol', +# official == 'Flucloxacillin' ~ 'Flopen|Floxapen|Fluclox|Sesamol|Softapen|Staphylex', +# official == 'Gentamicin' ~ 'Garamycin|Genoptic', +# official == 'Imipenem' ~ 'Primaxin', +# official == 'Kanamycin' ~ 'Kantrex', +# official == 'Levofloxacin' ~ 'Levaquin|Quixin', +# official == 'Linezolid' ~ 'Zyvox', +# official == 'Lomefloxacin' ~ 'Maxaquin', +# official == 'Meropenem' ~ 'Merrem', +# official == 'Metronidazole' ~ 'Flagyl|MetroGel|MetroCream|MetroLotion', +# official == 'Mezlocillin' ~ 'Mezlin', +# official == 'Minocycline' ~ 'Arestin|Solodyn', +# official == 'Moxifloxacin' ~ 'Avelox|Vigamox', +# official == 'Mupirocin' ~ 'Bactroban|Centany', +# official == 'Nafcillin' ~ 'Unipen', +# official == 'Nalidixic acid' ~ 'NegGram', +# official == 'Nitrofurantoin' ~ 'Furadantin|Macrobid|Macrodantin', +# official == 'Norfloxacin' ~ 'Noroxin', +# official == 'Ofloxacin' ~ 'Floxin|Ocuflox|Ophthalmic', +# official == 'Oxacillin' ~ 'Bactocill', +# official == 'Benzylpenicillin' ~ 'Permapen|Pfizerpen|Veetids', +# official == 'Penicillins, combinations with other antibacterials' ~ 'Permapen|Pfizerpen|Veetids', +# official == 'Piperacillin' ~ 'Pipracil', +# official == 'Piperacillin and beta-lactamase inhibitor' ~ 'Zosyn', +# official == 'Polymyxin B' ~ 'Poly-RX', +# official == 'Quinupristin/dalfopristin' ~ 'Synercid', +# official == 'Rifampin' ~ 'Rifadin|Rifamate|Rimactane', +# official == 'Spectinomycin' ~ 'Trobicin', +# official == 'Streptomycin' ~ 'Streptomycin Sulfate', +# official == 'Teicoplanin' ~ 'Targocid', +# official == 'Telavancin' ~ 'Vibativ', +# official == 'Telithromcyin' ~ 'Ketek', +# official == 'Tetracycline' ~ 'Sumycin|Bristacycline|Tetrex', +# official == 'Ticarcillin' ~ 'Ticar', +# official == 'Ticarcillin and beta-lactamase inhibitor' ~ 'Timentin', +# official == 'Tigecycline' ~ 'Tygacil', +# official == 'Tobramycin' ~ 'Tobi|Aktob|Tobre', +# official == 'Trimethoprim' ~ 'Primsol|Proloprim', +# official == 'Sulfamethoxazole and trimethoprim' ~ 'Bactrim|Septra|Sulfatrim', +# official == 'Vancomycin' ~ 'Vancocin|Vancomycin Hydrochloride', +# TRUE ~ NA_character_) +# ) # last two columns created with: # antibiotics %>% # mutate(useful_gramnegative = diff --git a/R/eucast.R b/R/eucast.R index 2e6582ec..01c3cc5c 100644 --- a/R/eucast.R +++ b/R/eucast.R @@ -116,7 +116,7 @@ EUCAST_rules <- function(tbl, EUCAST_VERSION <- "3.1" if (!col_bactid %in% colnames(tbl)) { - stop('Column ', col_bactid, ' not found.') + stop('Column ', col_bactid, ' not found.', call. = FALSE) } # check columns @@ -126,88 +126,65 @@ EUCAST_rules <- function(tbl, levo, linc, line, mero, mino, moxi, nali, neom, neti, nitr, novo, norf, oflo, peni, pita, poly, qida, rifa, roxi, siso, teic, tetr, tica, tige, tobr, trim, trsu, vanc) - col.list <- col.list[!is.na(col.list)] - col.list.bak <- col.list - # are they available as upper case or lower case then? - for (i in 1:length(col.list)) { - if (toupper(col.list[i]) %in% colnames(tbl)) { - col.list[i] <- toupper(col.list[i]) - } else if (tolower(col.list[i]) %in% colnames(tbl)) { - col.list[i] <- tolower(col.list[i]) - } else if (!col.list[i] %in% colnames(tbl)) { - col.list[i] <- NA - } - } - if (!all(col.list %in% colnames(tbl))) { - if (info == TRUE) { - cat('\n') - } - if (info == TRUE) { - warning('These columns do not exist and will be ignored: ', - col.list.bak[!(col.list %in% colnames(tbl))] %>% toString(), - immediate. = TRUE, - call. = FALSE) - } - } - - amcl <- col.list[1] - amik <- col.list[2] - amox <- col.list[3] - ampi <- col.list[4] - azit <- col.list[5] - aztr <- col.list[6] - cefa <- col.list[7] - cfra <- col.list[8] - cfep <- col.list[9] - cfot <- col.list[10] - cfox <- col.list[11] - cfta <- col.list[12] - cftr <- col.list[13] - cfur <- col.list[14] - chlo <- col.list[15] - cipr <- col.list[16] - clar <- col.list[17] - clin <- col.list[18] - clox <- col.list[19] - coli <- col.list[20] - czol <- col.list[21] - dapt <- col.list[22] - doxy <- col.list[23] - erta <- col.list[24] - eryt <- col.list[25] - fosf <- col.list[26] - fusi <- col.list[27] - gent <- col.list[28] - imip <- col.list[29] - kana <- col.list[30] - levo <- col.list[31] - linc <- col.list[32] - line <- col.list[33] - mero <- col.list[34] - mino <- col.list[35] - moxi <- col.list[36] - nali <- col.list[37] - neom <- col.list[38] - neti <- col.list[39] - nitr <- col.list[40] - novo <- col.list[41] - norf <- col.list[42] - oflo <- col.list[43] - peni <- col.list[44] - pita <- col.list[45] - poly <- col.list[46] - qida <- col.list[47] - rifa <- col.list[48] - roxi <- col.list[49] - siso <- col.list[50] - teic <- col.list[51] - tetr <- col.list[52] - tica <- col.list[53] - tige <- col.list[54] - tobr <- col.list[55] - trim <- col.list[56] - trsu <- col.list[57] - vanc <- col.list[58] + col.list <- check_available_columns(tbl = tbl, col.list = col.list, info = info) + amcl <- col.list[amcl] + amik <- col.list[amik] + amox <- col.list[amox] + ampi <- col.list[ampi] + azit <- col.list[azit] + aztr <- col.list[aztr] + cefa <- col.list[cefa] + cfra <- col.list[cfra] + cfep <- col.list[cfep] + cfot <- col.list[cfot] + cfox <- col.list[cfox] + cfta <- col.list[cfta] + cftr <- col.list[cftr] + cfur <- col.list[cfur] + chlo <- col.list[chlo] + cipr <- col.list[cipr] + clar <- col.list[clar] + clin <- col.list[clin] + clox <- col.list[clox] + coli <- col.list[coli] + czol <- col.list[czol] + dapt <- col.list[dapt] + doxy <- col.list[doxy] + erta <- col.list[erta] + eryt <- col.list[eryt] + fosf <- col.list[fosf] + fusi <- col.list[fusi] + gent <- col.list[gent] + imip <- col.list[imip] + kana <- col.list[kana] + levo <- col.list[levo] + linc <- col.list[linc] + line <- col.list[line] + mero <- col.list[mero] + mino <- col.list[mino] + moxi <- col.list[moxi] + nali <- col.list[nali] + neom <- col.list[neom] + neti <- col.list[neti] + nitr <- col.list[nitr] + novo <- col.list[novo] + norf <- col.list[norf] + oflo <- col.list[oflo] + peni <- col.list[peni] + pita <- col.list[pita] + poly <- col.list[poly] + qida <- col.list[qida] + rifa <- col.list[rifa] + roxi <- col.list[roxi] + siso <- col.list[siso] + teic <- col.list[teic] + tetr <- col.list[tetr] + tica <- col.list[tica] + tige <- col.list[tige] + tobr <- col.list[tobr] + trim <- col.list[trim] + trsu <- col.list[trsu] + vanc <- col.list[vanc] total <- 0 total_rows <- integer(0) diff --git a/R/first_isolates.R b/R/first_isolates.R index e8294cd2..d8109e81 100644 --- a/R/first_isolates.R +++ b/R/first_isolates.R @@ -436,6 +436,10 @@ key_antibiotics <- function(tbl, keylist <- character(length = nrow(tbl)) + if (!col_bactid %in% colnames(tbl)) { + stop('Column ', col_bactid, ' not found.', call. = FALSE) + } + # check columns col.list <- c(amox, cfot, cfta, cftr, cfur, cipr, clar, clin, clox, doxy, gent, line, mero, peni, diff --git a/R/globals.R b/R/globals.R index fe977831..c9d7e9c6 100644 --- a/R/globals.R +++ b/R/globals.R @@ -17,6 +17,7 @@ # ==================================================================== # globalVariables(c('abname', + 'atc', 'bactid', 'cnt', 'Count', @@ -35,6 +36,7 @@ globalVariables(c('abname', 'key_ab_other', 'mic', 'mocode', + 'molis', 'n', 'other_pat_or_mo', 'patient_id', @@ -42,5 +44,6 @@ globalVariables(c('abname', 'quantile', 'real_first_isolate', 'species', + 'umcg', 'y', '.')) diff --git a/R/mdro.R b/R/mdro.R index 53ee1521..48d35c14 100644 --- a/R/mdro.R +++ b/R/mdro.R @@ -20,42 +20,112 @@ #' #' Determine which isolates are multidrug-resistant organisms (MDRO) according to country-specific guidelines. #' @param tbl table with antibiotic columns, like e.g. \code{amox} and \code{amcl} -#' @param country country to determine guidelines. Should be a code from the \href{https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements}{list of ISO 3166-1 alpha-2 country codes}. Case-insensitive. Currently supported are \code{de} (Germany) and \code{nl} (the Netherlands). +#' @param country country code to determine guidelines. EUCAST rules will be used when left empty, see Details. Should be or a code from the \href{https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements}{list of ISO 3166-1 alpha-2 country codes}. Case-insensitive. Currently supported are \code{de} (Germany) and \code{nl} (the Netherlands). #' @param col_bactid column name of the bacteria ID in \code{tbl} - values of this column should be present in \code{microorganisms$bactid}, see \code{\link{microorganisms}} #' @param info print progress -#' @param aminoglycosides,quinolones,carbapenems character vector with column names of antibiotics -#' @param ceftazidime,piperacillin,trimethoprim_sulfa,penicillin,vancomycin column names of antibiotics -#' @param ... parameters that are passed on to \code{MDR} -#' @return Ordered factor with values \code{Positive}, \code{Unconfirmed}, \code{Negative}. +#' @param amcl,amik,amox,ampi,azit,aztr,cefa,cfra,cfep,cfot,cfox,cfta,cftr,cfur,chlo,cipr,clar,clin,clox,coli,czol,dapt,doxy,erta,eryt,fosf,fusi,gent,imip,kana,levo,linc,line,mero,metr,mino,moxi,nali,neom,neti,nitr,novo,norf,oflo,peni,pita,poly,qida,rifa,roxi,siso,teic,tetr,tica,tige,tobr,trim,trsu,vanc column names of antibiotics. column names of antibiotics +#' @param ... parameters that are passed on to methods +#' @details When \code{country} will be left blank, guidelines will be taken from EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" (\url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf}). +#' @return Ordered factor with levels \code{Unknown < Negative < Unconfirmed < Positive}. #' @rdname MDRO #' @export +#' @examples +#' library(dplyr) +#' +#' septic_patients %>% +#' mutate(EUCAST = MDRO(.), +#' BRMO = MDRO(., "nl")) MDRO <- function(tbl, - country, + country = NULL, col_bactid = 'bactid', info = TRUE, - aminoglycosides = c('gent', 'tobr', 'kana'), - quinolones = c('cipr', 'norf'), - carbapenems = c('imip', 'mero', 'erta'), - ceftazidime = 'cfta', - piperacillin = 'pita', - trimethoprim_sulfa = 'trsu', - penicillin = 'peni', - vancomycin = 'vanc') { + 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', + 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') { + + if (!col_bactid %in% colnames(tbl)) { + stop('Column ', col_bactid, ' not found.', call. = FALSE) + } # strip whitespaces - country <- trimws(country) if (length(country) > 1) { stop('`country` must be a length one character string.', call. = FALSE) } - if (!country %like% '^[a-z]{2}$') { + + if (is.null(country)) { + country <- 'EUCAST' + } + country <- trimws(country) + if (country != 'EUCAST' & !country %like% '^[a-z]{2}$') { stop('This is not a valid ISO 3166-1 alpha-2 country code: "', country, '". Please see ?MDRO.', call. = FALSE) } # create list and make country code case-independent guideline <- list(country = list(code = tolower(country))) - # support per country - if (guideline$country$code == 'de') { + if (guideline$country$code == 'eucast') { + guideline$country$name <- '(European guidelines)' + guideline$name <- 'EUCAST Expert Rules, "Intrinsic Resistance and Exceptional Phenotypes Tables"' + guideline$version <- 'Version 3.1' + guideline$source <- 'http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf' + # support per country: + } else if (guideline$country$code == 'de') { guideline$country$name <- 'Germany' guideline$name <- '' guideline$version <- '' @@ -79,38 +149,177 @@ MDRO <- function(tbl, ANSI_reset <- "\033[0m" if (info == TRUE) { - cat("Determining Highly Resistant Microorganisms (MDRO), according to:\n", + cat("Determining multidrug-resistant organisms (MDRO), according to:\n", "Guideline: ", ANSI_red, guideline$name, ", ", guideline$version, ANSI_reset, "\n", "Country : ", ANSI_red, guideline$country$name, ANSI_reset, "\n", "Source : ", ANSI_blue, guideline$source, ANSI_reset, "\n", "\n", sep = "") } + # check columns + col.list <- c(amcl, amik, amox, ampi, azit, aztr, cefa, cfra, cfep, cfot, + cfox, cfta, cftr, cfur, chlo, cipr, clar, clin, clox, coli, + czol, dapt, doxy, erta, eryt, fosf, fusi, gent, imip, kana, + levo, linc, line, mero, metr, mino, moxi, nali, neom, neti, nitr, + novo, norf, oflo, peni, pita, poly, qida, rifa, roxi, siso, + teic, tetr, tica, tige, tobr, trim, trsu, vanc) + col.list <- check_available_columns(tbl = tbl, col.list = col.list, info = info) + amcl <- col.list[amcl] + amik <- col.list[amik] + amox <- col.list[amox] + ampi <- col.list[ampi] + azit <- col.list[azit] + aztr <- col.list[aztr] + cefa <- col.list[cefa] + cfra <- col.list[cfra] + cfep <- col.list[cfep] + cfot <- col.list[cfot] + cfox <- col.list[cfox] + cfta <- col.list[cfta] + cftr <- col.list[cftr] + cfur <- col.list[cfur] + chlo <- col.list[chlo] + cipr <- col.list[cipr] + clar <- col.list[clar] + clin <- col.list[clin] + clox <- col.list[clox] + coli <- col.list[coli] + czol <- col.list[czol] + dapt <- col.list[dapt] + doxy <- col.list[doxy] + erta <- col.list[erta] + eryt <- col.list[eryt] + fosf <- col.list[fosf] + fusi <- col.list[fusi] + gent <- col.list[gent] + imip <- col.list[imip] + kana <- col.list[kana] + levo <- col.list[levo] + linc <- col.list[linc] + line <- col.list[line] + mero <- col.list[mero] + metr <- col.list[metr] + mino <- col.list[mino] + moxi <- col.list[moxi] + nali <- col.list[nali] + neom <- col.list[neom] + neti <- col.list[neti] + nitr <- col.list[nitr] + novo <- col.list[novo] + norf <- col.list[norf] + oflo <- col.list[oflo] + peni <- col.list[peni] + pita <- col.list[pita] + poly <- col.list[poly] + qida <- col.list[qida] + rifa <- col.list[rifa] + roxi <- col.list[roxi] + siso <- col.list[siso] + teic <- col.list[teic] + tetr <- col.list[tetr] + tica <- col.list[tica] + tige <- col.list[tige] + tobr <- col.list[tobr] + trim <- col.list[trim] + trsu <- col.list[trsu] + vanc <- col.list[vanc] + + # antibiotic classes + aminoglycosides <- c(tobr, gent, kana, neom, neti, siso) + tetracyclines <- c(doxy, mino, tetr) # since EUCAST v3.1 tige(cycline) is set apart + polymyxins <- c(poly, coli) + macrolides <- c(eryt, azit, roxi, clar) # since EUCAST v3.1 clin(damycin) is set apart + glycopeptides <- c(vanc, teic) + streptogramins <- qida # should officially also be pristinamycin and quinupristin/dalfopristin + cephalosporins <- c(cfep, cfot, cfox, cfra, cfta, cftr, cfur, czol) + cephalosporins_3rd <- c(cfot, cftr, cfta) + carbapenems <- c(erta, imip, mero) + aminopenicillins <- c(ampi, amox) + ureidopenicillins <- pita # should officially also be azlo and mezlo + fluoroquinolones <- c(oflo, cipr, norf, levo, moxi) + + # helper function for editing the table + trans_tbl <- function(to, rows, cols) { + cols <- cols[!is.na(cols)] + if (length(rows) > 0 & length(cols) > 0) { + col_filter <- which(tbl[, cols] == 'R') + rows <- rows[rows %in% col_filter] + tbl[rows, 'MDRO'] <<- to + } + } + # join microorganisms tbl <- tbl %>% left_join_microorganisms(col_bactid) - tbl$MDRO <- 1 + tbl$MDRO <- NA_integer_ + + if (guideline$country$code == 'eucast') { + # EUCAST ------------------------------------------------------------------ + # Table 5 + trans_tbl(4, + which(tbl$family == 'Enterobacteriaceae' + | tbl$fullname %like% '^Pseudomonas aeruginosa' + | tbl$genus == 'Acinetobacter'), + coli) + trans_tbl(4, + which(tbl$fullname %like% '^Salmonella Typhi'), + c(carbapenems, fluoroquinolones)) + trans_tbl(4, + which(tbl$fullname %like% '^Haemophilus influenzae'), + c(cephalosporins_3rd, carbapenems, fluoroquinolones)) + trans_tbl(4, + which(tbl$fullname %like% '^Moraxella catarrhalis'), + c(cephalosporins_3rd, fluoroquinolones)) + trans_tbl(4, + which(tbl$fullname %like% '^Neisseria meningitidis'), + c(cephalosporins_3rd, fluoroquinolones)) + trans_tbl(4, + which(tbl$fullname %like% '^Neisseria gonorrhoeae'), + azit) + # Table 6 + trans_tbl(4, + which(tbl$fullname %like% '^Staphylococcus (aureus|epidermidis|coagulase negatief|hominis|haemolyticus|intermedius|pseudointermedius)'), + c(vanc, teic, dapt, line, qida, tige)) + trans_tbl(4, + which(tbl$genus == 'Corynebacterium'), + c(vanc, teic, dapt, line, qida, tige)) + trans_tbl(4, + which(tbl$fullname %like% '^Streptococcus pneumoniae'), + c(carbapenems, vanc, teic, dapt, line, qida, tige, rifa)) + trans_tbl(4, # Sr. groups A/B/C/G + which(tbl$fullname %like% '^Streptococcus (pyogenes|agalactiae|equisimilis|equi|zooepidemicus|dysgalactiae|anginosus)'), + c(peni, cephalosporins, vanc, teic, dapt, line, qida, tige)) + trans_tbl(4, + which(tbl$genus == 'Enterococcus'), + c(dapt, line, tige, teic)) + trans_tbl(4, + which(tbl$fullname %like% '^Enterococcus faecalis'), + c(ampi, amox)) + # Table 7 + trans_tbl(4, + which(tbl$genus == 'Bacteroides'), + metr) + trans_tbl(4, + which(tbl$fullname %like% '^Clostridium difficile'), + c(metr, vanc)) + } if (guideline$country$code == 'de') { + # Germany ----------------------------------------------------------------- stop("We are still working on German guidelines in this beta version.", call. = FALSE) } if (guideline$country$code == 'nl') { - # BRMO; Bijzonder Resistente Micro-Organismen - aminoglycosides <- aminoglycosides[aminoglycosides %in% colnames(tbl)] - quinolones <- quinolones[quinolones %in% colnames(tbl)] - carbapenems <- carbapenems[carbapenems %in% colnames(tbl)] - if (!ceftazidime %in% colnames(tbl)) { ceftazidime <- NA } - if (!piperacillin %in% colnames(tbl)) { piperacillin <- NA } - if (!trimethoprim_sulfa %in% colnames(tbl)) { trimethoprim_sulfa <- NA } - if (!penicillin %in% colnames(tbl)) { penicillin <- NA } - if (!vancomycin %in% colnames(tbl)) { vancomycin <- NA } + # Netherlands ------------------------------------------------------------- + aminoglycosides <- aminoglycosides[!is.na(aminoglycosides)] + fluoroquinolones <- fluoroquinolones[!is.na(fluoroquinolones)] + carbapenems <- carbapenems[!is.na(carbapenems)] # Table 1 tbl[which( tbl$family == 'Enterobacteriaceae' & rowSums(tbl[, aminoglycosides] == 'R', na.rm = TRUE) >= 1 - & rowSums(tbl[, quinolones] == 'R', na.rm = TRUE) >= 1 + & rowSums(tbl[, fluoroquinolones] == 'R', na.rm = TRUE) >= 1 ), 'MDRO'] <- 4 tbl[which( tbl$family == 'Enterobacteriaceae' @@ -130,7 +339,7 @@ MDRO <- function(tbl, tbl[which( tbl$genus == 'Acinetobacter' & rowSums(tbl[, aminoglycosides] == 'R', na.rm = TRUE) >= 1 - & rowSums(tbl[, quinolones] == 'R', na.rm = TRUE) >= 1 + & rowSums(tbl[, fluoroquinolones] == 'R', na.rm = TRUE) >= 1 ), 'MDRO'] <- 4 # rest of Acinetobacter is negative tbl[which( @@ -140,7 +349,7 @@ MDRO <- function(tbl, tbl[which( tbl$fullname %like% 'Stenotrophomonas maltophilia' - & tbl[, trimethoprim_sulfa] == 'R' + & tbl[, trsu] == 'R' ), 'MDRO'] <- 4 # rest of Stenotrophomonas is negative tbl[which( @@ -152,9 +361,9 @@ MDRO <- function(tbl, tbl$fullname %like% 'Pseudomonas aeruginosa' & sum(rowSums(tbl[, carbapenems] == 'R', na.rm = TRUE) >= 1, rowSums(tbl[, aminoglycosides] == 'R', na.rm = TRUE) >= 1, - rowSums(tbl[, quinolones] == 'R', na.rm = TRUE) >= 1, - tbl[, ceftazidime] == 'R', - tbl[, piperacillin] == 'R') >= 3 + rowSums(tbl[, fluoroquinolones] == 'R', na.rm = TRUE) >= 1, + tbl[, cfta] == 'R', + tbl[, pita] == 'R') >= 3 ), 'MDRO'] <- 4 # rest of Pseudomonas is negative tbl[which( @@ -165,11 +374,11 @@ MDRO <- function(tbl, # Table 3 tbl[which( tbl$fullname %like% 'Streptococcus pneumoniae' - & tbl[, penicillin] == 'R' + & tbl[, peni] == 'R' ), 'MDRO'] <- 4 tbl[which( tbl$fullname %like% 'Streptococcus pneumoniae' - & tbl[, vancomycin] == 'R' + & tbl[, vanc] == 'R' ), 'MDRO'] <- 4 # rest of Streptococcus pneumoniae is negative tbl[which( @@ -179,7 +388,7 @@ MDRO <- function(tbl, tbl[which( tbl$fullname %like% 'Enterococcus faecium' - & rowSums(tbl[, c(penicillin, vancomycin)] == 'R', na.rm = TRUE) >= 1 + & rowSums(tbl[, c(peni, vanc)] == 'R', na.rm = TRUE) >= 1 ), 'MDRO'] <- 4 # rest of Enterococcus faecium is negative tbl[which( @@ -197,11 +406,17 @@ MDRO <- function(tbl, #' @rdname MDRO #' @export BRMO <- function(tbl, country = "nl", ...) { - MDRO(tbl = tbl, country = country, ...) + MDRO(tbl = tbl, country = "nl", ...) } #' @rdname MDRO #' @export MRGN <- function(tbl, country = "de", ...) { - MDRO(tbl = tbl, country = country, ...) + MDRO(tbl = tbl, country = "de", ...) +} + +#' @rdname MDRO +#' @export +EUCAST_exceptional_phenotypes <- function(tbl, country = "EUCAST", ...) { + MDRO(tbl = tbl, country = "EUCAST", ...) } diff --git a/R/misc.R b/R/misc.R index eace1da5..18a36908 100644 --- a/R/misc.R +++ b/R/misc.R @@ -73,6 +73,7 @@ check_available_columns <- function(tbl, col.list, info = TRUE) { if (info == TRUE) { warning('These columns do not exist and will be ignored: ', col.list.bak[!(col.list %in% colnames(tbl))] %>% toString(), + '.\nTHIS MAY STRONGLY INFLUENCE THE OUTCOME.', immediate. = TRUE, call. = FALSE) } diff --git a/README.md b/README.md index 81745b40..0914f92e 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,14 @@ This R package was created for academic research by PhD students of the Faculty This R package contains functions to make microbiological, epidemiological data analysis easier. It allows the use of some new classes to work with MIC values and antimicrobial interpretations (i.e. values S, I and R). With `AMR` you can also: -* Conduct AMR analysis with the `rsi()` function, that can also be used with the `dplyr` package (e.g. in conjunction with `summarise`) to calculate the resistance percentages of different antibiotic columns of a table. -* Predict antimicrobial resistance for the nextcoming years with the `rsi_predict()` function -* Apply [EUCAST rules to isolates](http://www.eucast.org/expert_rules_and_intrinsic_resistance/) with the `EUCAST_rules()` function -* Identify first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute) with the `first_isolate()` function -* Translate antibiotic codes from the lab (like `"AMOX"`) or the [WHO](https://www.whocc.no/atc_ddd_index/?code=J01CA04&showdescription=no) (like `"J01CA04"`) to trivial names (like `"amoxicillin"`) with the `abname()` function +* Create frequency tables with the `freq` function +* Conduct AMR analysis with the `rsi` function, that can also be used with the `dplyr` package (e.g. in conjunction with `summarise`) to calculate the resistance percentages of different antibiotic columns of a table +* Predict antimicrobial resistance for the nextcoming years with the `rsi_predict` function +* Apply [EUCAST rules to isolates](http://www.eucast.org/expert_rules_and_intrinsic_resistance/) with the `EUCAST_rules` function +* Identify first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute) with the `first_isolate` function +* Translate antibiotic codes from the lab (like `"AMOX"`) or the [WHO](https://www.whocc.no/atc_ddd_index/?code=J01CA04&showdescription=no) (like `"J01CA04"`) to trivial names (like `"amoxicillin"`) with the `abname` function -With the `MDRO` function (abbreviation of mutli-drug resistant organisms), you can check your isolates for exceptional resistance with country-specific guidelines. Currently guidelines for Germany and the Netherlands are supported. Please suggest addition of your own country here: [https://github.com/msberends/AMR/issues](https://github.com/msberends/AMR/issues/new?title=New%20guideline%20for%20MDRO&body=%3C--%20Please%20add%20your%20country%20code,%20guideline%20name,%20version%20and%20source%20below%20and%20remove%20this%20line--%3E). +With the `MDRO` function (abbreviation of Multi Drug Resistant Organisms), you can check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently guidelines for Germany and the Netherlands are supported. Please suggest addition of your own country here: [https://github.com/msberends/AMR/issues/new](https://github.com/msberends/AMR/issues/new?title=New%20guideline%20for%20MDRO&body=%3C--%20Please%20add%20your%20country%20code,%20guideline%20name,%20version%20and%20source%20below%20and%20remove%20this%20line--%3E). This package contains an example data set `septic_patients`, consisting of 2000 isolates from anonymised septic patients between 2001 and 2017. @@ -96,7 +97,7 @@ after ``` ### Frequency tables -Base R lacks a simple function to create frequency tables. We created such a function that works with almost all data types: `freq()` (or `frequency_tbl()`). +Base R lacks a simple function to create frequency tables. We created such a function that works with almost all data types: `freq` (or `frequency_tbl`). ```r ## Factors sort on item by default: diff --git a/data/antibiotics.rda b/data/antibiotics.rda index 3884040e431d1e67e59c52004810808cb43b80e9..6d5d5d8b320f74ee02af000eee22ebee196eeaf1 100644 GIT binary patch literal 12694 zcmYj%S5y;Bv~?OGgcf3u&_fT1NEZ<>gn(2HRRqz{1f)urWpebO*$%d@ADVxG4;e~HmFyPC+uu14*BtlUzI8g*pn2H3&06IGd)sWg4A)V;( z{sF2yGgr1w*+yofoUw)h@dsa_BP;RaB;QNNXX5$AlYb1)US7Zf01)Ft`D~M711uN= z4Ko01h5g(6|KJp(8&FdGqEsI6Q7a1oUhE-w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#C8rJFphW477@AT=qs9^gvB{T)a@F{8gtuGBw{g4M^z#2m15BO z_(r@)>gyx1mOWDVv1qCgnLJ#z%mleC(4tM?IN5iD0p*k0G~=amN)5*cZdxUEO?Dxu z>G691CoCBvGVM{Bp%O5X6<`9k*yB0#oth`$Dx{c5$uv?GWSbFI6js3L03Jwg3^ay7 z(3nD@cXoTwG zgy}pm9Cz2drdnyY8*s-53il)&NRDL^Za~_OlSeufs8f)(v{Hm<7Q%zQwSY`(2W1l{ zbGgleaB^~2XMqG8jA=KR2ow!(m-y^D$1pO zp*`iOD^d0ze-X-5iy)c_@&oXcAVYT0hw7oI3-OEi!5xEh8R$KdtFUL_r79CYQTCa^pq$Dd9YCT zg4w(r{uNkk5DGGSdS8VdoQDK>I;3F<0t6yP5_0I3k$cNtTuvL(c5u~gxNw*@tMnoE zn*6llPEV9dn^i6FeMxCPljVWA)9N}ndOU!EZLL8%@oN|qz1d`tA_x*whC5;5oHxJYqB%Y{_Q|I{A?Uhvm$VcgP8ckO<55Q9I zr{-WdLCx{_-yj3mpw5p0qfTq($7KVxfJH~=0<>RWiDaW!?Ory=P@HddJ=3HLYsyn&JWYy^iN!(CBct zYkC{14p6pXkV8H`^c*vkVB~lKj D#2Y!U diff --git a/man/MDRO.Rd b/man/MDRO.Rd index 9b89c55d..27012851 100644 --- a/man/MDRO.Rd +++ b/man/MDRO.Rd @@ -4,36 +4,58 @@ \alias{MDRO} \alias{BRMO} \alias{MRGN} +\alias{EUCAST_exceptional_phenotypes} \title{Determine multidrug-resistant organisms (MDRO)} \usage{ -MDRO(tbl, country, col_bactid = "bactid", info = TRUE, - aminoglycosides = c("gent", "tobr", "kana"), quinolones = c("cipr", - "norf"), carbapenems = c("imip", "mero", "erta"), ceftazidime = "cfta", - piperacillin = "pita", trimethoprim_sulfa = "trsu", penicillin = "peni", - vancomycin = "vanc") +MDRO(tbl, country = NULL, col_bactid = "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", 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") BRMO(tbl, country = "nl", ...) MRGN(tbl, country = "de", ...) + +EUCAST_exceptional_phenotypes(tbl, country = "EUCAST", ...) } \arguments{ \item{tbl}{table with antibiotic columns, like e.g. \code{amox} and \code{amcl}} -\item{country}{country to determine guidelines. Should be a code from the \href{https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements}{list of ISO 3166-1 alpha-2 country codes}. Case-insensitive. Currently supported are \code{de} (Germany) and \code{nl} (the Netherlands).} +\item{country}{country code to determine guidelines. EUCAST rules will be used when left empty, see Details. Should be or a code from the \href{https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements}{list of ISO 3166-1 alpha-2 country codes}. Case-insensitive. Currently supported are \code{de} (Germany) and \code{nl} (the Netherlands).} \item{col_bactid}{column name of the bacteria ID in \code{tbl} - values of this column should be present in \code{microorganisms$bactid}, see \code{\link{microorganisms}}} \item{info}{print progress} -\item{aminoglycosides, quinolones, carbapenems}{character vector with column names of antibiotics} +\item{amcl, amik, amox, ampi, azit, aztr, cefa, cfra, cfep, cfot, cfox, cfta, cftr, cfur, chlo, cipr, clar, clin, clox, coli, czol, dapt, doxy, erta, eryt, fosf, fusi, gent, imip, kana, levo, linc, line, mero, metr, mino, moxi, nali, neom, neti, nitr, novo, norf, oflo, peni, pita, poly, qida, rifa, roxi, siso, teic, tetr, tica, tige, tobr, trim, trsu, vanc}{column names of antibiotics. column names of antibiotics} -\item{ceftazidime, piperacillin, trimethoprim_sulfa, penicillin, vancomycin}{column names of antibiotics} - -\item{...}{parameters that are passed on to \code{MDR}} +\item{...}{parameters that are passed on to methods} } \value{ -Ordered factor with values \code{Positive}, \code{Unconfirmed}, \code{Negative}. +Ordered factor with levels \code{Unknown < Negative < Unconfirmed < Positive}. } \description{ Determine which isolates are multidrug-resistant organisms (MDRO) according to country-specific guidelines. } +\details{ +When \code{country} will be left blank, guidelines will be taken from EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" (\url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf}). +} +\examples{ +library(dplyr) + +septic_patients \%>\% + mutate(EUCAST = MDRO(.), + BRMO = MDRO(., "nl")) +} diff --git a/man/antibiotics.Rd b/man/antibiotics.Rd index ce1eaf20..73d25ef7 100644 --- a/man/antibiotics.Rd +++ b/man/antibiotics.Rd @@ -9,9 +9,11 @@ \item{\code{atc}}{ATC code, like \code{J01CR02}} \item{\code{molis}}{MOLIS code, like \code{amcl}} \item{\code{umcg}}{UMCG code, like \code{AMCL}} + \item{\code{abbr}}{Abbreviation as used by many countries, to be used for \code{\link{guess_atc}}} \item{\code{official}}{Official name by the WHO, like \code{"Amoxicillin and enzyme inhibitor"}} \item{\code{official_nl}}{Official name in the Netherlands, like \code{"Amoxicilline met enzymremmer"}} \item{\code{trivial_nl}}{Trivial name in Dutch, like \code{"Amoxicilline/clavulaanzuur"}} + \item{\code{trade_name}}{Trade name as used by many countries, to be used for \code{\link{guess_atc}}} \item{\code{oral_ddd}}{Defined Daily Dose (DDD), oral treatment} \item{\code{oral_units}}{Units of \code{ddd_units}} \item{\code{iv_ddd}}{Defined Daily Dose (DDD), parenteral treatment} diff --git a/man/as.mic.Rd b/man/as.mic.Rd index 4dc1a8cd..f72ff003 100644 --- a/man/as.mic.Rd +++ b/man/as.mic.Rd @@ -15,7 +15,7 @@ is.mic(x) \item{na.rm}{a logical indicating whether missing values should be removed} } \value{ -New class \code{mic} +Ordered factor with new class \code{mic} and new attributes \code{package} and \code{package.version} } \description{ This transforms a vector to a new class\code{mic}, which is an ordered factor with valid MIC values as levels. Invalid MIC values will be translated as \code{NA} with a warning. diff --git a/man/as.rsi.Rd b/man/as.rsi.Rd index 952ecef4..f7eec124 100644 --- a/man/as.rsi.Rd +++ b/man/as.rsi.Rd @@ -13,7 +13,7 @@ is.rsi(x) \item{x}{vector} } \value{ -New class \code{rsi} +Ordered factor with new class \code{rsi} and new attributes \code{package} and \code{package.version} } \description{ This transforms a vector to a new class \code{rsi}, which is an ordered factor with levels \code{S < I < R}. Invalid antimicrobial interpretations will be translated as \code{NA} with a warning. diff --git a/man/guess_atc.Rd b/man/guess_atc.Rd new file mode 100644 index 00000000..ccfe9906 --- /dev/null +++ b/man/guess_atc.Rd @@ -0,0 +1,35 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/atc.R +\name{guess_atc} +\alias{guess_atc} +\title{Find ATC code based on antibiotic property} +\usage{ +guess_atc(x) +} +\arguments{ +\item{x}{character vector to determine \code{ATC} code} +} +\value{ +Character (vector). +} +\description{ +Use this function to determine the ATC code of one or more antibiotics. The dataset \code{\link{antibiotics}} will be searched for abbreviations, official names and trade names. +} +\details{ +In the ATC classification system, the active substances are classified in a hierarchy with five different levels. The system has fourteen main anatomical/pharmacological groups or 1st levels. Each ATC main group is divided into 2nd levels which could be either pharmacological or therapeutic groups. The 3rd and 4th levels are chemical, pharmacological or therapeutic subgroups and the 5th level is the chemical substance. The 2nd, 3rd and 4th levels are often used to identify pharmacological subgroups when that is considered more appropriate than therapeutic or chemical subgroups. + Source: \url{https://www.whocc.no/atc/structure_and_principles/} +} +\examples{ +# These examples all return "J01FA01", the ATC code of Erythromycin: +guess_atc("J01FA01") +guess_atc("Erythromycin") +guess_atc("eryt") +guess_atc("ERYT") +guess_atc("ERY") +guess_atc("Erythrocin") # Trade name +guess_atc("Eryzole") # Trade name +guess_atc("Pediamycin") # Trade name +} +\seealso{ +\code{\link{antibiotics}} for the dataframe that is being used to determine ATC's. +} diff --git a/tests/testthat/test-mdro.R b/tests/testthat/test-mdro.R index 5b6fce1a..a8fc1a00 100644 --- a/tests/testthat/test-mdro.R +++ b/tests/testthat/test-mdro.R @@ -3,13 +3,17 @@ context("mdro.R") test_that("MDRO works", { library(dplyr) - outcome <- MDRO(septic_patients, "nl", info = FALSE) + outcome <- MDRO(septic_patients, "EUCAST", info = FALSE) + # check class + expect_equal(outcome %>% class(), c('ordered', 'factor')) + + outcome <- MDRO(septic_patients, "nl", info = FALSE) # check class expect_equal(outcome %>% class(), c('ordered', 'factor')) # septic_patients should have these finding using Dutch guidelines - expect_equal(outcome %>% freq(toConsole = FALSE) %>% pull(Count), c(1152, 824, 3, 21)) + expect_equal(outcome %>% freq(toConsole = FALSE) %>% pull(Count), c(3, 21)) expect_equal(BRMO(septic_patients, info = FALSE), MDRO(septic_patients, "nl", info = FALSE))