mirror of
https://github.com/msberends/AMR.git
synced 2025-07-10 08:22:04 +02:00
(v1.7.1.9073) as.rsi() fix for UTIs
This commit is contained in:
6
R/data.R
6
R/data.R
@ -263,9 +263,9 @@
|
||||
#'
|
||||
#' Data set containing defined intrinsic resistance by EUCAST of all bug-drug combinations.
|
||||
#' @format A [data.frame] with `r format(nrow(intrinsic_resistant), big.mark = ",")` observations and `r ncol(intrinsic_resistant)` variables:
|
||||
#' - `microorganism`\cr Official taxonomic name of the microorganism, according to the LPSN
|
||||
#' - `antibiotic`\cr Official name of the antibiotic drug, according to the WHOCC
|
||||
#' @details The repository of this `AMR` package contains a file comprising this exact data set: <https://github.com/msberends/AMR/blob/main/data-raw/intrinsic_resistant.txt>. This file **allows for machine reading EUCAST guidelines about intrinsic resistance**, which is almost impossible with the Excel and PDF files distributed by EUCAST. The file is updated automatically.
|
||||
#' - `mo`\cr Microorganism ID
|
||||
#' - `ab`\cr Antibiotic ID
|
||||
#' @details The repository of this `AMR` package contains a file comprising this data set with full taxonomic and antibiotic names: <https://github.com/msberends/AMR/blob/main/data-raw/intrinsic_resistant.txt>. This file **allows for machine reading EUCAST guidelines about intrinsic resistance**, which is almost impossible with the Excel and PDF files distributed by EUCAST. The file is updated automatically.
|
||||
#'
|
||||
#' This data set is based on `r format_eucast_version_nr(3.3)`.
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
|
16
R/mo.R
16
R/mo.R
@ -485,6 +485,11 @@ exec_as.mo <- function(x,
|
||||
}
|
||||
}
|
||||
|
||||
# remove spp and species
|
||||
x <- gsub(" +(spp.?|ssp.?|sp.? |ss ?.?|subsp.?|subspecies|biovar |serovar |species)", " ", x, ignore.case = TRUE, perl = TRUE)
|
||||
x <- gsub("( spp?.?| ss |subsp.?|subspecies|biovar|serovar|species)", "", x, ignore.case = TRUE, perl = TRUE)
|
||||
x <- strip_whitespace(x, dyslexia_mode)
|
||||
|
||||
x_backup <- x
|
||||
|
||||
# from here on case-insensitive
|
||||
@ -493,11 +498,6 @@ exec_as.mo <- function(x,
|
||||
x_backup[x %like_case% "^(fungus|fungi)$"] <- "(unknown fungus)" # will otherwise become the kingdom
|
||||
x_backup[x_backup_untouched == "Fungi"] <- "Fungi" # is literally the kingdom
|
||||
|
||||
# remove spp and species
|
||||
x_backup <- gsub(" +(spp.?|ssp.?|sp.? |ss ?.?|subsp.?|subspecies|biovar |serovar |species)", " ", x_backup, perl = TRUE)
|
||||
x_backup <- gsub("( spp?.?| ss |subsp.?|subspecies|biovar|serovar|species)", "", x_backup, perl = TRUE)
|
||||
x_backup <- strip_whitespace(x_backup, dyslexia_mode)
|
||||
|
||||
# Fill in fullnames and MO codes directly
|
||||
known_names <- tolower(x_backup) %in% MO_lookup$fullname_lower
|
||||
x[known_names] <- MO_lookup[match(tolower(x_backup)[known_names], MO_lookup$fullname_lower), property, drop = TRUE]
|
||||
@ -717,7 +717,7 @@ exec_as.mo <- function(x,
|
||||
# fewer than 3 chars and not looked for species, add as failure
|
||||
x[i] <- lookup(mo == "UNKNOWN")
|
||||
if (initial_search == TRUE) {
|
||||
failures <- c(failures, x_backup[i])
|
||||
failures <- c(failures, x_backup_untouched[i])
|
||||
}
|
||||
next
|
||||
}
|
||||
@ -900,7 +900,7 @@ exec_as.mo <- function(x,
|
||||
# (at this point the latest reference_df has also been checked)
|
||||
x[i] <- lookup(mo == "UNKNOWN")
|
||||
if (initial_search == TRUE) {
|
||||
failures <- c(failures, x_backup[i])
|
||||
failures <- c(failures, x_backup_untouched[i])
|
||||
}
|
||||
next
|
||||
}
|
||||
@ -1425,7 +1425,7 @@ exec_as.mo <- function(x,
|
||||
# no results found: make them UNKNOWN ----
|
||||
x[i] <- lookup(mo == "UNKNOWN", uncertainty = -1)
|
||||
if (initial_search == TRUE) {
|
||||
failures <- c(failures, x_backup[i])
|
||||
failures <- c(failures, x_backup_untouched[i])
|
||||
}
|
||||
}
|
||||
|
||||
|
3
R/zzz.R
3
R/zzz.R
@ -165,6 +165,5 @@ create_MO.old_lookup <- function() {
|
||||
|
||||
create_intr_resistance <- function() {
|
||||
# for mo_is_intrinsic_resistant() - saves a lot of time when executed on this vector
|
||||
paste(AMR::microorganisms[match(AMR::intrinsic_resistant$microorganism, AMR::microorganisms$fullname), "mo", drop = TRUE],
|
||||
AMR::antibiotics[match(AMR::intrinsic_resistant$antibiotic, AMR::antibiotics$name), "ab", drop = TRUE])
|
||||
paste(AMR::intrinsic_resistant$mo, AMR::intrinsic_resistant$ab)
|
||||
}
|
||||
|
Reference in New Issue
Block a user