mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 22:22:03 +02:00
EUCAST update, as.mo bugfix for empty vlaues
This commit is contained in:
2
R/data.R
2
R/data.R
@ -127,7 +127,7 @@
|
||||
#' Data set with taxonomic data from ITIS
|
||||
#'
|
||||
#' A data set containing the complete microbial taxonomy of the kingdoms Bacteria, Fungi and Protozoa. MO codes can be looked up using \code{\link{as.mo}}.
|
||||
#' @inheritSection itis ITIS
|
||||
#' @inheritSection ITIS ITIS
|
||||
#' @format A \code{\link{data.frame}} with 18,833 observations and 15 variables:
|
||||
#' \describe{
|
||||
#' \item{\code{mo}}{ID of microorganism}
|
||||
|
128
R/eucast_rules.R
128
R/eucast_rules.R
@ -34,68 +34,68 @@
|
||||
#'
|
||||
#' Abbrevations of the column containing antibiotics in the form: \strong{abbreviation}: generic name (\emph{ATC code})
|
||||
#'
|
||||
#' \strong{amcl}: amoxicillin+clavulanic acid (\emph{J01CR02}),
|
||||
#' \strong{amik}: amikacin (\emph{J01GB06}),
|
||||
#' \strong{amox}: amoxicillin (\emph{J01CA04}),
|
||||
#' \strong{ampi}: ampicillin (\emph{J01CA01}),
|
||||
#' \strong{azit}: azithromycin (\emph{J01FA10}),
|
||||
#' \strong{azlo}: azlocillin (\emph{J01CA09}),
|
||||
#' \strong{aztr}: aztreonam (\emph{J01DF01}),
|
||||
#' \strong{cefa}: cefaloridine (\emph{J01DB02}),
|
||||
#' \strong{cfep}: cefepime (\emph{J01DE01}),
|
||||
#' \strong{cfot}: cefotaxime (\emph{J01DD01}),
|
||||
#' \strong{cfox}: cefoxitin (\emph{J01DC01}),
|
||||
#' \strong{cfra}: cefradine (\emph{J01DB09}),
|
||||
#' \strong{cfta}: ceftazidime (\emph{J01DD02}),
|
||||
#' \strong{cftr}: ceftriaxone (\emph{J01DD04}),
|
||||
#' \strong{cfur}: cefuroxime (\emph{J01DC02}),
|
||||
#' \strong{chlo}: chloramphenicol (\emph{J01BA01}),
|
||||
#' \strong{cipr}: ciprofloxacin (\emph{J01MA02}),
|
||||
#' \strong{clar}: clarithromycin (\emph{J01FA09}),
|
||||
#' \strong{clin}: clindamycin (\emph{J01FF01}),
|
||||
#' \strong{clox}: flucloxacillin (\emph{J01CF05}),
|
||||
#' \strong{coli}: colistin (\emph{J01XB01}),
|
||||
#' \strong{czol}: cefazolin (\emph{J01DB04}),
|
||||
#' \strong{dapt}: daptomycin (\emph{J01XX09}),
|
||||
#' \strong{doxy}: doxycycline (\emph{J01AA02}),
|
||||
#' \strong{erta}: ertapenem (\emph{J01DH03}),
|
||||
#' \strong{eryt}: erythromycin (\emph{J01FA01}),
|
||||
#' \strong{fosf}: fosfomycin (\emph{J01XX01}),
|
||||
#' \strong{fusi}: fusidic acid (\emph{J01XC01}),
|
||||
#' \strong{gent}: gentamicin (\emph{J01GB03}),
|
||||
#' \strong{imip}: imipenem (\emph{J01DH51}),
|
||||
#' \strong{kana}: kanamycin (\emph{J01GB04}),
|
||||
#' \strong{levo}: levofloxacin (\emph{J01MA12}),
|
||||
#' \strong{linc}: lincomycin (\emph{J01FF02}),
|
||||
#' \strong{line}: linezolid (\emph{J01XX08}),
|
||||
#' \strong{mero}: meropenem (\emph{J01DH02}),
|
||||
#' \strong{mezl}: mezlocillin (\emph{J01CA10}),
|
||||
#' \strong{mino}: minocycline (\emph{J01AA08}),
|
||||
#' \strong{moxi}: moxifloxacin (\emph{J01MA14}),
|
||||
#' \strong{nali}: nalidixic acid (\emph{J01MB02}),
|
||||
#' \strong{neom}: neomycin (\emph{J01GB05}),
|
||||
#' \strong{neti}: netilmicin (\emph{J01GB07}),
|
||||
#' \strong{nitr}: nitrofurantoin (\emph{J01XE01}),
|
||||
#' \strong{norf}: norfloxacin (\emph{J01MA06}),
|
||||
#' \strong{novo}: novobiocin (an ATCvet code: \emph{QJ01XX95}),
|
||||
#' \strong{oflo}: ofloxacin (\emph{J01MA01}),
|
||||
#' \strong{peni}: penicillin (\emph{J01RA01}),
|
||||
#' \strong{pipe}: piperacillin (\emph{J01CA12}),
|
||||
#' \strong{pita}: piperacillin+tazobactam (\emph{J01CR05}),
|
||||
#' \strong{poly}: polymyxin B (\emph{J01XB02}),
|
||||
#' \strong{pris}: pristinamycin (\emph{J01FG01}),
|
||||
#' \strong{qida}: quinupristin/dalfopristin (\emph{J01FG02}),
|
||||
#' \strong{rifa}: rifampicin (\emph{J04AB02}),
|
||||
#' \strong{roxi}: roxithromycin (\emph{J01FA06}),
|
||||
#' \strong{siso}: sisomicin (\emph{J01GB08}),
|
||||
#' \strong{teic}: teicoplanin (\emph{J01XA02}),
|
||||
#' \strong{tetr}: tetracycline (\emph{J01AA07}),
|
||||
#' \strong{tica}: ticarcillin (\emph{J01CA13}),
|
||||
#' \strong{tige}: tigecycline (\emph{J01AA12}),
|
||||
#' \strong{tobr}: tobramycin (\emph{J01GB01}),
|
||||
#' \strong{trim}: trimethoprim (\emph{J01EA01}),
|
||||
#' \strong{trsu}: sulfamethoxazole and trimethoprim (\emph{J01EE01}),
|
||||
#' \strong{vanc}: vancomycin (\emph{J01XA01}).
|
||||
#' \strong{amcl}: amoxicillin+clavulanic acid (\href{https://www.whocc.no/atc_ddd_index/?code=J01CR02}{J01CR02}),
|
||||
#' \strong{amik}: amikacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB06}{J01GB06}),
|
||||
#' \strong{amox}: amoxicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA04}{J01CA04}),
|
||||
#' \strong{ampi}: ampicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA01}{J01CA01}),
|
||||
#' \strong{azit}: azithromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA10}{J01FA10}),
|
||||
#' \strong{azlo}: azlocillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA09}{J01CA09}),
|
||||
#' \strong{aztr}: aztreonam (\href{https://www.whocc.no/atc_ddd_index/?code=J01DF01}{J01DF01}),
|
||||
#' \strong{cefa}: cefaloridine (\href{https://www.whocc.no/atc_ddd_index/?code=J01DB02}{J01DB02}),
|
||||
#' \strong{cfep}: cefepime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DE01}{J01DE01}),
|
||||
#' \strong{cfot}: cefotaxime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DD01}{J01DD01}),
|
||||
#' \strong{cfox}: cefoxitin (\href{https://www.whocc.no/atc_ddd_index/?code=J01DC01}{J01DC01}),
|
||||
#' \strong{cfra}: cefradine (\href{https://www.whocc.no/atc_ddd_index/?code=J01DB09}{J01DB09}),
|
||||
#' \strong{cfta}: ceftazidime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DD02}{J01DD02}),
|
||||
#' \strong{cftr}: ceftriaxone (\href{https://www.whocc.no/atc_ddd_index/?code=J01DD04}{J01DD04}),
|
||||
#' \strong{cfur}: cefuroxime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DC02}{J01DC02}),
|
||||
#' \strong{chlo}: chloramphenicol (\href{https://www.whocc.no/atc_ddd_index/?code=J01BA01}{J01BA01}),
|
||||
#' \strong{cipr}: ciprofloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA02}{J01MA02}),
|
||||
#' \strong{clar}: clarithromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA09}{J01FA09}),
|
||||
#' \strong{clin}: clindamycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FF01}{J01FF01}),
|
||||
#' \strong{clox}: flucloxacillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CF05}{J01CF05}),
|
||||
#' \strong{coli}: colistin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XB01}{J01XB01}),
|
||||
#' \strong{czol}: cefazolin (\href{https://www.whocc.no/atc_ddd_index/?code=J01DB04}{J01DB04}),
|
||||
#' \strong{dapt}: daptomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XX09}{J01XX09}),
|
||||
#' \strong{doxy}: doxycycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA02}{J01AA02}),
|
||||
#' \strong{erta}: ertapenem (\href{https://www.whocc.no/atc_ddd_index/?code=J01DH03}{J01DH03}),
|
||||
#' \strong{eryt}: erythromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA01}{J01FA01}),
|
||||
#' \strong{fosf}: fosfomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XX01}{J01XX01}),
|
||||
#' \strong{fusi}: fusidic acid (\href{https://www.whocc.no/atc_ddd_index/?code=J01XC01}{J01XC01}),
|
||||
#' \strong{gent}: gentamicin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB03}{J01GB03}),
|
||||
#' \strong{imip}: imipenem (\href{https://www.whocc.no/atc_ddd_index/?code=J01DH51}{J01DH51}),
|
||||
#' \strong{kana}: kanamycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB04}{J01GB04}),
|
||||
#' \strong{levo}: levofloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA12}{J01MA12}),
|
||||
#' \strong{linc}: lincomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FF02}{J01FF02}),
|
||||
#' \strong{line}: linezolid (\href{https://www.whocc.no/atc_ddd_index/?code=J01XX08}{J01XX08}),
|
||||
#' \strong{mero}: meropenem (\href{https://www.whocc.no/atc_ddd_index/?code=J01DH02}{J01DH02}),
|
||||
#' \strong{mezl}: mezlocillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA10}{J01CA10}),
|
||||
#' \strong{mino}: minocycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA08}{J01AA08}),
|
||||
#' \strong{moxi}: moxifloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA14}{J01MA14}),
|
||||
#' \strong{nali}: nalidixic acid (\href{https://www.whocc.no/atc_ddd_index/?code=J01MB02}{J01MB02}),
|
||||
#' \strong{neom}: neomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB05}{J01GB05}),
|
||||
#' \strong{neti}: netilmicin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB07}{J01GB07}),
|
||||
#' \strong{nitr}: nitrofurantoin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XE01}{J01XE01}),
|
||||
#' \strong{norf}: norfloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA06}{J01MA06}),
|
||||
#' \strong{novo}: novobiocin (an ATCvet code: \href{https://www.whocc.no/atc_ddd_index/?code=QJ01XX95}{QJ01XX95}),
|
||||
#' \strong{oflo}: ofloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA01}{J01MA01}),
|
||||
#' \strong{peni}: (benzyl)penicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CE01}{J01CE01}),
|
||||
#' \strong{pipe}: piperacillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA12}{J01CA12}),
|
||||
#' \strong{pita}: piperacillin+tazobactam (\href{https://www.whocc.no/atc_ddd_index/?code=J01CR05}{J01CR05}),
|
||||
#' \strong{poly}: polymyxin B (\href{https://www.whocc.no/atc_ddd_index/?code=J01XB02}{J01XB02}),
|
||||
#' \strong{pris}: pristinamycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FG01}{J01FG01}),
|
||||
#' \strong{qida}: quinupristin/dalfopristin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FG02}{J01FG02}),
|
||||
#' \strong{rifa}: rifampicin (\href{https://www.whocc.no/atc_ddd_index/?code=J04AB02}{J04AB02}),
|
||||
#' \strong{roxi}: roxithromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA06}{J01FA06}),
|
||||
#' \strong{siso}: sisomicin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB08}{J01GB08}),
|
||||
#' \strong{teic}: teicoplanin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XA02}{J01XA02}),
|
||||
#' \strong{tetr}: tetracycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA07}{J01AA07}),
|
||||
#' \strong{tica}: ticarcillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA13}{J01CA13}),
|
||||
#' \strong{tige}: tigecycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA12}{J01AA12}),
|
||||
#' \strong{tobr}: tobramycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB01}{J01GB01}),
|
||||
#' \strong{trim}: trimethoprim (\href{https://www.whocc.no/atc_ddd_index/?code=J01EA01}{J01EA01}),
|
||||
#' \strong{trsu}: sulfamethoxazole and trimethoprim (\href{https://www.whocc.no/atc_ddd_index/?code=J01EE01}{J01EE01}),
|
||||
#' \strong{vanc}: vancomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XA01}{J01XA01}).
|
||||
#' @keywords interpretive eucast reading resistance
|
||||
#' @rdname eucast_rules
|
||||
#' @export
|
||||
@ -114,8 +114,8 @@
|
||||
#' \url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf}
|
||||
#' }
|
||||
#' \item{
|
||||
#' EUCAST Breakpoint tables for interpretation of MICs and zone diameters. Version 8.1, 2018. \cr
|
||||
#' \url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_8.1_Breakpoint_Tables.xlsx}
|
||||
#' EUCAST Breakpoint tables for interpretation of MICs and zone diameters. Version 9.0, 2019. \cr
|
||||
#' \url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_9.0_Breakpoint_Tables.xlsx}
|
||||
#' }
|
||||
#' }
|
||||
#' @inheritSection AMR Read more on our website!
|
||||
|
6
R/itis.R
6
R/itis.R
@ -30,12 +30,12 @@
|
||||
#'
|
||||
#' ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists [3].
|
||||
#' @inheritSection AMR Read more on our website!
|
||||
#' @name itis
|
||||
#' @rdname itis
|
||||
#' @name ITIS
|
||||
#' @rdname ITIS
|
||||
#' @examples
|
||||
#' # Get a note when a species was renamed
|
||||
#' mo_shortname("Chlamydia psittaci")
|
||||
#' # Note: 'Chlamydia psittaci' (Page, 1968) was renamed
|
||||
#' # Note: 'Chlamydia psittaci' (Page, 1968) was renamed
|
||||
#' # 'Chlamydophila psittaci' (Everett et al., 1999)
|
||||
#' # [1] "C. psittaci"
|
||||
#'
|
||||
|
28
R/mo.R
28
R/mo.R
@ -76,7 +76,7 @@
|
||||
#' \item{\code{"D. spartina"}. This is the abbreviation of an old taxonomic name: \emph{Didymosphaeria spartinae} (the last "e" was missing from the input). This fungus was renamed to \emph{Leptosphaeria obiones}, so a warning will be thrown that this result (\code{F_LPTSP_OBI}) needs review.}
|
||||
#' }
|
||||
#'
|
||||
#' @inheritSection itis ITIS
|
||||
#' @inheritSection ITIS ITIS
|
||||
# (source as a section, so it can be inherited by other man pages)
|
||||
#' @section Source:
|
||||
#' [1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870–926. \url{https://dx.doi.org/10.1128/CMR.00109-13}
|
||||
@ -211,8 +211,16 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE,
|
||||
reference_df[] <- lapply(reference_df, as.character)
|
||||
)
|
||||
}
|
||||
|
||||
if (all(x %in% microorganismsDT[["mo"]])) {
|
||||
if (all(identical(trimws(x_input), "") | is.na(x_input))) {
|
||||
# all empty
|
||||
if (property == "mo") {
|
||||
return(structure(rep(NA_character_, length(x_input)), class = "mo"))
|
||||
} else if (property == "tsn") {
|
||||
return(rep(NA_integer_, length(x_input)))
|
||||
} else {
|
||||
return(rep(NA_character_, length(x_input)))
|
||||
}
|
||||
} else if (all(x %in% microorganismsDT[["mo"]])) {
|
||||
# existing mo codes when not looking for property "mo", like mo_genus("B_ESCHR_COL")
|
||||
x <- microorganismsDT[data.table(mo = x), on = "mo", ..property][[1]]
|
||||
} else if (!is.null(reference_df)
|
||||
@ -665,6 +673,16 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE,
|
||||
}
|
||||
}
|
||||
|
||||
# (4) not yet implemented taxonomic changes in ITIS
|
||||
found <- suppressMessages(suppressWarnings(exec_as.mo(temp_changes(b.x_trimmed), clear_options = FALSE, allow_uncertain = FALSE)))
|
||||
if (!is.na(found)) {
|
||||
found <- microorganismsDT[mo == found, ..property][[1]]
|
||||
warning(red(paste0('UNCERTAIN - "',
|
||||
a.x_backup, '" -> ', italic(microorganismsDT[mo == found[1L], fullname][[1]]), " (", found[1L], ")")),
|
||||
call. = FALSE, immediate. = FALSE)
|
||||
return(found[1L])
|
||||
}
|
||||
|
||||
# didn't found in uncertain results too
|
||||
return(NA_character_)
|
||||
}
|
||||
@ -780,6 +798,10 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE,
|
||||
x
|
||||
}
|
||||
|
||||
temp_changes <- function(x) {
|
||||
x[x %like% 'Cutibacterium'] <- gsub('Cutibacterium', 'Propionibacterium', x[x %like% 'Cutibacterium'])
|
||||
}
|
||||
|
||||
#' @importFrom crayon blue italic
|
||||
renamed_note <- function(name_old, name_new, ref_old = "", ref_new = "", mo = "") {
|
||||
if (!is.na(ref_old)) {
|
||||
|
@ -33,7 +33,7 @@
|
||||
#' \item{\code{mo_ref("Chlamydophila psittaci")} will return \code{"Everett et al., 1999"} (without a warning)}
|
||||
#' }
|
||||
#' @inheritSection get_locale Supported languages
|
||||
#' @inheritSection itis ITIS
|
||||
#' @inheritSection ITIS ITIS
|
||||
#' @inheritSection as.mo Source
|
||||
#' @rdname mo_property
|
||||
#' @name mo_property
|
||||
@ -480,6 +480,12 @@ mo_validate <- function(x, property, ...) {
|
||||
| Lancefield %in% c(TRUE, "all")) {
|
||||
exec_as.mo(x, property = property, ...)
|
||||
} else {
|
||||
x
|
||||
if (property == "mo") {
|
||||
return(structure(x, class = "mo"))
|
||||
} else if (property == "tsn") {
|
||||
return(as.integer(x))
|
||||
} else {
|
||||
return(x)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user