mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 11:51:59 +02:00
eucast update
This commit is contained in:
52
R/eucast.R
52
R/eucast.R
@ -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
|
||||
|
@ -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"
|
||||
}
|
||||
|
1
R/mdro.R
1
R/mdro.R
@ -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
2
R/mo.R
@ -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].
|
||||
#'
|
||||
|
Reference in New Issue
Block a user