Compare commits
18 Commits
31ceba5441
...
v1.6.0
Author | SHA1 | Date | |
---|---|---|---|
551f99dc8f | |||
4e0a9533ad | |||
8d6ceb6a15 | |||
a7c9b4c295 | |||
461793dc34 | |||
a12975bc6e | |||
68163e3089 | |||
2f0fc3cab7 | |||
450bbe5fb7 | |||
1bbf409fe5 | |||
850c123de7 | |||
91dd755cac | |||
0d29bde693 | |||
0e0e3c4ffa | |||
ddf88345f1 | |||
41f94cde97 | |||
1737d56ae4 | |||
a673407904 |
@ -22,7 +22,6 @@
|
||||
^data-raw$
|
||||
^\.lintr$
|
||||
^tests/testthat/_snaps$
|
||||
^vignettes/AMR.Rmd$
|
||||
^vignettes/benchmarks.Rmd$
|
||||
^vignettes/EUCAST.Rmd$
|
||||
^vignettes/PCA.Rmd$
|
||||
|
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 1.5.0.9024
|
||||
Date: 2021-02-22
|
||||
Version: 1.6.0
|
||||
Date: 2021-03-14
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Authors@R: c(
|
||||
person(role = c("aut", "cre"),
|
||||
@ -38,8 +38,8 @@ Authors@R: c(
|
||||
Description: Functions to simplify the analysis and prediction of Antimicrobial
|
||||
Resistance (AMR) and to work with microbial and antimicrobial properties by
|
||||
using evidence-based methods, like those defined by Leclercq et al. (2013)
|
||||
<doi:10.1111/j.1469-0691.2011.03703.x> and the Clinical and Laboratory
|
||||
Standards Institute (2014) <isbn: 1-56238-899-1>.
|
||||
<doi:10.1111/j.1469-0691.2011.03703.x> and containing reference data such as
|
||||
LPSN <doi:10.1099/ijsem.0.004332>.
|
||||
Depends:
|
||||
R (>= 3.0.0)
|
||||
Suggests:
|
||||
|
82
NAMESPACE
@ -1,51 +1,95 @@
|
||||
# Generated by roxygen2: do not edit by hand
|
||||
|
||||
S3method("!",mic)
|
||||
S3method("!=",mic)
|
||||
S3method("%%",mic)
|
||||
S3method("%/%",mic)
|
||||
S3method("&",mic)
|
||||
S3method("*",mic)
|
||||
S3method("+",mic)
|
||||
S3method("-",mic)
|
||||
S3method("/",mic)
|
||||
S3method("<",mic)
|
||||
S3method("<=",mic)
|
||||
S3method("==",mic)
|
||||
S3method(">",mic)
|
||||
S3method(">=",mic)
|
||||
S3method("[",ab)
|
||||
S3method("[",disk)
|
||||
S3method("[",isolate_identifier)
|
||||
S3method("[",mic)
|
||||
S3method("[",mo)
|
||||
S3method("[<-",ab)
|
||||
S3method("[<-",disk)
|
||||
S3method("[<-",isolate_identifier)
|
||||
S3method("[<-",mic)
|
||||
S3method("[<-",mo)
|
||||
S3method("[<-",rsi)
|
||||
S3method("[[",ab)
|
||||
S3method("[[",disk)
|
||||
S3method("[[",isolate_identifier)
|
||||
S3method("[[",mic)
|
||||
S3method("[[",mo)
|
||||
S3method("[[<-",ab)
|
||||
S3method("[[<-",disk)
|
||||
S3method("[[<-",isolate_identifier)
|
||||
S3method("[[<-",mic)
|
||||
S3method("[[<-",mo)
|
||||
S3method("[[<-",rsi)
|
||||
S3method(all.equal,isolate_identifier)
|
||||
S3method("^",mic)
|
||||
S3method("|",mic)
|
||||
S3method(abs,mic)
|
||||
S3method(acos,mic)
|
||||
S3method(acosh,mic)
|
||||
S3method(all,mic)
|
||||
S3method(any,mic)
|
||||
S3method(as.data.frame,ab)
|
||||
S3method(as.data.frame,mo)
|
||||
S3method(as.double,mic)
|
||||
S3method(as.integer,mic)
|
||||
S3method(as.matrix,mic)
|
||||
S3method(as.numeric,mic)
|
||||
S3method(as.rsi,data.frame)
|
||||
S3method(as.rsi,default)
|
||||
S3method(as.rsi,disk)
|
||||
S3method(as.rsi,mic)
|
||||
S3method(asin,mic)
|
||||
S3method(asinh,mic)
|
||||
S3method(atan,mic)
|
||||
S3method(atanh,mic)
|
||||
S3method(barplot,disk)
|
||||
S3method(barplot,mic)
|
||||
S3method(barplot,rsi)
|
||||
S3method(c,ab)
|
||||
S3method(c,disk)
|
||||
S3method(c,isolate_identifier)
|
||||
S3method(c,mic)
|
||||
S3method(c,mo)
|
||||
S3method(c,rsi)
|
||||
S3method(ceiling,mic)
|
||||
S3method(cos,mic)
|
||||
S3method(cosh,mic)
|
||||
S3method(cospi,mic)
|
||||
S3method(cummax,mic)
|
||||
S3method(cummin,mic)
|
||||
S3method(cumprod,mic)
|
||||
S3method(cumsum,mic)
|
||||
S3method(digamma,mic)
|
||||
S3method(droplevels,mic)
|
||||
S3method(droplevels,rsi)
|
||||
S3method(exp,mic)
|
||||
S3method(expm1,mic)
|
||||
S3method(floor,mic)
|
||||
S3method(format,bug_drug_combinations)
|
||||
S3method(gamma,mic)
|
||||
S3method(hist,mic)
|
||||
S3method(kurtosis,data.frame)
|
||||
S3method(kurtosis,default)
|
||||
S3method(kurtosis,matrix)
|
||||
S3method(lgamma,mic)
|
||||
S3method(log,mic)
|
||||
S3method(log10,mic)
|
||||
S3method(log1p,mic)
|
||||
S3method(log2,mic)
|
||||
S3method(max,mic)
|
||||
S3method(mean,mic)
|
||||
S3method(median,mic)
|
||||
S3method(min,mic)
|
||||
S3method(plot,disk)
|
||||
S3method(plot,mic)
|
||||
S3method(plot,resistance_predict)
|
||||
@ -55,24 +99,39 @@ S3method(print,bug_drug_combinations)
|
||||
S3method(print,catalogue_of_life_version)
|
||||
S3method(print,custom_mdro_guideline)
|
||||
S3method(print,disk)
|
||||
S3method(print,isolate_identifier)
|
||||
S3method(print,mic)
|
||||
S3method(print,mo)
|
||||
S3method(print,mo_renamed)
|
||||
S3method(print,mo_uncertainties)
|
||||
S3method(print,pca)
|
||||
S3method(print,rsi)
|
||||
S3method(prod,mic)
|
||||
S3method(quantile,mic)
|
||||
S3method(range,mic)
|
||||
S3method(rep,mo)
|
||||
S3method(round,mic)
|
||||
S3method(sign,mic)
|
||||
S3method(signif,mic)
|
||||
S3method(sin,mic)
|
||||
S3method(sinh,mic)
|
||||
S3method(sinpi,mic)
|
||||
S3method(skewness,data.frame)
|
||||
S3method(skewness,default)
|
||||
S3method(skewness,matrix)
|
||||
S3method(sort,mic)
|
||||
S3method(sqrt,mic)
|
||||
S3method(sum,mic)
|
||||
S3method(summary,mic)
|
||||
S3method(summary,mo)
|
||||
S3method(summary,pca)
|
||||
S3method(summary,rsi)
|
||||
S3method(tan,mic)
|
||||
S3method(tanh,mic)
|
||||
S3method(tanpi,mic)
|
||||
S3method(trigamma,mic)
|
||||
S3method(trunc,mic)
|
||||
S3method(unique,ab)
|
||||
S3method(unique,disk)
|
||||
S3method(unique,isolate_identifier)
|
||||
S3method(unique,mic)
|
||||
S3method(unique,mo)
|
||||
S3method(unique,rsi)
|
||||
@ -168,7 +227,6 @@ export(is.mo)
|
||||
export(is.rsi)
|
||||
export(is.rsi.eligible)
|
||||
export(is_new_episode)
|
||||
export(isolate_identifier)
|
||||
export(key_antibiotics)
|
||||
export(key_antibiotics_equal)
|
||||
export(kurtosis)
|
||||
@ -242,15 +300,19 @@ export(theme_rsi)
|
||||
importFrom(graphics,arrows)
|
||||
importFrom(graphics,axis)
|
||||
importFrom(graphics,barplot)
|
||||
importFrom(graphics,par)
|
||||
importFrom(graphics,hist)
|
||||
importFrom(graphics,legend)
|
||||
importFrom(graphics,mtext)
|
||||
importFrom(graphics,plot)
|
||||
importFrom(graphics,points)
|
||||
importFrom(graphics,text)
|
||||
importFrom(stats,complete.cases)
|
||||
importFrom(stats,glm)
|
||||
importFrom(stats,lm)
|
||||
importFrom(stats,median)
|
||||
importFrom(stats,pchisq)
|
||||
importFrom(stats,prcomp)
|
||||
importFrom(stats,predict)
|
||||
importFrom(stats,qchisq)
|
||||
importFrom(stats,quantile)
|
||||
importFrom(stats,var)
|
||||
|
41
NEWS.md
@ -1,5 +1,5 @@
|
||||
# AMR 1.5.0.9024
|
||||
## <small>Last updated: 22 February 2021</small>
|
||||
# AMR 1.6.0
|
||||
|
||||
|
||||
### New
|
||||
* Support for EUCAST Clinical Breakpoints v11.0 (2021), effective in the `eucast_rules()` function and in `as.rsi()` to interpret MIC and disk diffusion values. This is now the default guideline in this package.
|
||||
@ -22,7 +22,7 @@
|
||||
#> Filtering on oxazolidinones: value in column `LNZ` (linezolid) is either "R", "S" or "I"
|
||||
```
|
||||
* Support for custom MDRO guidelines, using the new `custom_mdro_guideline()` function, please see `mdro()` for additional info
|
||||
* Function `isolate_identifier()`, which will paste a microorganism code with all antimicrobial results of a data set into one string for each row. This is useful to compare isolates, e.g. between institutions or regions, when there is no genotyping available.
|
||||
* `ggplot()` generics for classes `<mic>` and `<disk>`
|
||||
* Function `mo_is_yeast()`, which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:
|
||||
```r
|
||||
mo_kingdom(c("Aspergillus", "Candida"))
|
||||
@ -42,24 +42,51 @@
|
||||
mo_type(c("Aspergillus", "Candida"), language = "es") # also supported: de, nl, fr, it, pt
|
||||
#> [1] "Hongos" "Levaduras"
|
||||
```
|
||||
* Added Pretomanid (PMD, J04AK08) to the `antibiotics` data set
|
||||
* MIC values (see `as.mic()`) can now be used in any mathematical processing, such as usage inside functions `min()`, `max()`, `range()`, and with binary operators (`+`, `-`, etc.). This allows for easy distribution analysis and fast filtering on MIC values:
|
||||
```r
|
||||
x <- random_mic(10)
|
||||
x
|
||||
#> Class <mic>
|
||||
#> [1] 128 0.5 2 0.125 64 0.25 >=256 8 16 4
|
||||
x[x > 4]
|
||||
#> Class <mic>
|
||||
#> [1] 128 64 >=256 8 16
|
||||
range(x)
|
||||
#> [1] 0.125 256.000
|
||||
range(log2(x))
|
||||
#> [1] -3 8
|
||||
```
|
||||
|
||||
### Changed
|
||||
* Updated the bacterial taxonomy to 3 March 2021 (using [LSPN](https://lpsn.dsmz.de))
|
||||
* Added 3,372 new species and 1,523 existing species became synomyms
|
||||
* The URL of a bacterial species (`mo_url()`) will now lead to https://lpsn.dsmz.de
|
||||
* Big update for plotting classes `rsi`, `<mic>`, and `<disk>`:
|
||||
* Plotting of MIC and disk diffusion values now support interpretation colouring if you supply the microorganism and antimicrobial agent
|
||||
* All colours were updated to colour-blind friendly versions for values R, S and I for all plot methods (also applies to tibble printing)
|
||||
* Interpretation of MIC and disk diffusion values to R/SI will now be translated if the system language is German, Dutch or Spanish (see `translate`)
|
||||
* Plotting is now possible with base R using `plot()` and with ggplot2 using `ggplot()` on any vector of MIC and disk diffusion values
|
||||
* Updated SNOMED codes to US Edition of SNOMED CT from 1 September 2020 and added the source to the help page of the `microorganisms` data set
|
||||
* `is.rsi()` and `is.rsi.eligible()` now return a vector of `TRUE`/`FALSE` when the input is a data set, by iterating over all columns
|
||||
* Using functions without setting a data set (e.g., `mo_is_gram_negative()`, `mo_is_gram_positive()`, `mo_is_intrinsic_resistant()`, `first_isolate()`, `mdro()`) now work with `dplyr`s `group_by()` again
|
||||
* `first_isolate()` can be used with `group_by()` (also when using a dot `.` as input for the data) and now returns the names of the groups
|
||||
* Updated the data set `microorganisms.codes` (which contains popular LIS and WHONET codes for microorganisms) for some species of *Mycobacterium* that previously incorrectly returned *M. africanum*
|
||||
* Added Pretomanid (PMD, J04AK08) to the `antibiotics` data set
|
||||
* WHONET code `"PNV"` will now correctly be interpreted as `PHN`, the antibiotic code for phenoxymethylpenicillin ('peni V')
|
||||
* Fix for verbose output of `mdro(..., verbose = TRUE)` for German guideline (3MGRN and 4MGRN) and Dutch guideline (BRMO, only *P. aeruginosa*)
|
||||
* `is.rsi.eligible()` now detects if the column name resembles an antibiotic name or code and now returns `TRUE` immediately if the input contains any of the values "R", "S" or "I". This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.
|
||||
* Functions `get_episode()` and `is_new_episode()` now support less than a day as value for argument `episode_days` (e.g., to include one patient/test per hour)
|
||||
* Argument `ampc_cephalosporin_resistance` in `eucast_rules()` now also applies to value "I" (not only "S")
|
||||
* Updated colours of values R, S and I in tibble printing
|
||||
* Functions `print()` and `summary()` on a Principal Components Analysis object (`pca()`) now print additional group info if the original data was grouped using `dplyr::group_by()`
|
||||
* Improved speed and reliability of `guess_ab_col()`. As this also internally improves the reliability of `first_isolate()` and `mdro()`, this might have a slight impact on the results of those functions.
|
||||
* Fix for `mo_name()` when used in other languages than English
|
||||
* The `like()` function (and its fast alias `%like%`) now always use Perl compatibility, improving speed for many functions in this package (e.g., `as.mo()` is now up to 4 times faster)
|
||||
* *Staphylococcus cornubiensis* is now correctly categorised as coagulase-positive
|
||||
* `random_disk()` and `random_mic()` now have an expanded range in their randomisation
|
||||
* Support for GISA (glycopeptide-intermediate *S. aureus*), so e.g. `mo_genus("GISA")` will return `"Staphylococcus"`
|
||||
* Added translations of German and Spanish for more than 200 antimicrobial drugs
|
||||
* Speed improvement for `as.ab()` when the input is an official name or ATC code
|
||||
* Added argument `include_untested_rsi` to the `first_isolate()` functions (defaults to `TRUE` to keep existing behaviour), to be able to exclude rows where all R/SI values (class `<rsi>`, see `as.rsi()`) are empty
|
||||
|
||||
### Other
|
||||
* Big documentation updates
|
||||
@ -380,7 +407,7 @@ This software is now out of beta and considered stable. Nonetheless, this packag
|
||||
* Speed improvements, especially for the *G. species* format (G for genus), like *E. coli* and *K pneumoniae*
|
||||
* Support for more common codes used in laboratory information systems
|
||||
* Input values for `as.disk()` limited to a maximum of 50 millimeters
|
||||
* Added a lifecycle state to every function, following [the lifecycle circle of the `tidyverse`](https://www.tidyverse.org/lifecycle)
|
||||
* Added a lifecycle state to every function, following the lifecycle circle of the `tidyverse`
|
||||
* For in `as.ab()`: support for drugs starting with "co-" like co-amoxiclav, co-trimoxazole, co-trimazine and co-trimazole (thanks to Peter Dutey)
|
||||
* Changes to the `antibiotics` data set (thanks to Peter Dutey):
|
||||
* Added more synonyms to colistin, imipenem and piperacillin/tazobactam
|
||||
@ -666,7 +693,7 @@ This software is now out of beta and considered stable. Nonetheless, this packag
|
||||
* Based on the Compound ID, almost 5,000 official brand names have been added from many different countries
|
||||
* All references to antibiotics in our package now use EARS-Net codes, like `AMX` for amoxicillin
|
||||
* Functions `atc_certe`, `ab_umcg` and `atc_trivial_nl` have been removed
|
||||
* All `atc_*` functions are superceded by `ab_*` functions
|
||||
* All `atc_*` functions are superseded by `ab_*` functions
|
||||
* All output will be translated by using an included translation file which [can be viewed here](https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv)
|
||||
* Improvements to plotting AMR results with `ggplot_rsi()`:
|
||||
* New argument `colours` to set the bar colours
|
||||
|
@ -507,12 +507,12 @@ format_class <- function(class, plural) {
|
||||
if ("isolate_identifier" %in% class) {
|
||||
class <- "created with isolate_identifier()"
|
||||
}
|
||||
if (any(c("mo", "ab", "rsi", "disk", "mic") %in% class)) {
|
||||
if (any(c("mo", "ab", "rsi") %in% class)) {
|
||||
class <- paste0("of class <", class[1L], ">")
|
||||
}
|
||||
class[class == class.bak] <- paste0("of class <", class[class == class.bak], ">")
|
||||
# output
|
||||
vector_or(class, quotes = FALSE)
|
||||
vector_or(class, quotes = FALSE, sort = FALSE)
|
||||
}
|
||||
|
||||
# a check for every single argument in all functions
|
||||
@ -879,13 +879,16 @@ font_green_bg <- function(..., collapse = " ") {
|
||||
try_colour(..., before = "\033[42m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_rsi_R_bg <- function(..., collapse = " ") {
|
||||
try_colour(..., before = "\033[48;5;210m", after = "\033[49m", collapse = collapse)
|
||||
#ED553B
|
||||
try_colour(..., before = "\033[48;5;203m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_rsi_S_bg <- function(..., collapse = " ") {
|
||||
try_colour(..., before = "\033[48;5;113m", after = "\033[49m", collapse = collapse)
|
||||
#3CAEA3
|
||||
try_colour(..., before = "\033[48;5;79m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_rsi_I_bg <- function(..., collapse = " ") {
|
||||
try_colour(..., before = "\033[48;5;185m", after = "\033[49m", collapse = collapse)
|
||||
#F6D55C
|
||||
try_colour(..., before = "\033[48;5;222m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_red_bg <- function(..., collapse = " ") {
|
||||
try_colour(..., before = "\033[41m", after = "\033[49m", collapse = collapse)
|
||||
@ -958,15 +961,8 @@ formatted_filesize <- function(...) {
|
||||
}
|
||||
|
||||
create_pillar_column <- function(x, ...) {
|
||||
new_pillar_shaft_simple <- import_fn("new_pillar_shaft_simple", "pillar", error_on_fail = FALSE)
|
||||
if (!is.null(new_pillar_shaft_simple)) {
|
||||
new_pillar_shaft_simple(x, ...)
|
||||
} else {
|
||||
# does not exist in package 'pillar' anymore
|
||||
structure(list(x),
|
||||
class = "pillar_shaft_simple",
|
||||
...)
|
||||
}
|
||||
new_pillar_shaft_simple <- import_fn("new_pillar_shaft_simple", "pillar")
|
||||
new_pillar_shaft_simple(x, ...)
|
||||
}
|
||||
|
||||
# copied from vctrs::s3_register by their permission:
|
||||
|
36
R/ab.R
@ -105,14 +105,28 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
|
||||
already_regex <- isTRUE(list(...)$already_regex)
|
||||
fast_mode <- isTRUE(list(...)$fast_mode)
|
||||
|
||||
if (all(toupper(x) %in% antibiotics$ab)) {
|
||||
# valid AB code, but not yet right class
|
||||
return(set_clean_class(toupper(x),
|
||||
new_class = c("ab", "character")))
|
||||
}
|
||||
|
||||
x_bak <- x
|
||||
x <- toupper(x)
|
||||
x_nonNA <- x[!is.na(x)]
|
||||
|
||||
if (all(x_nonNA %in% antibiotics$ab, na.rm = TRUE)) {
|
||||
# all valid AB codes, but not yet right class
|
||||
return(set_clean_class(x,
|
||||
new_class = c("ab", "character")))
|
||||
}
|
||||
if (all(x_nonNA %in% toupper(antibiotics$name), na.rm = TRUE)) {
|
||||
# all valid AB names
|
||||
out <- antibiotics$ab[match(x, toupper(antibiotics$name))]
|
||||
out[is.na(x)] <- NA_character_
|
||||
return(out)
|
||||
}
|
||||
if (all(x_nonNA %in% antibiotics$atc, na.rm = TRUE)) {
|
||||
# all valid ATC codes
|
||||
out <- antibiotics$ab[match(x, antibiotics$atc)]
|
||||
out[is.na(x)] <- NA_character_
|
||||
return(out)
|
||||
}
|
||||
|
||||
# remove diacritics
|
||||
x <- iconv(x, from = "UTF-8", to = "ASCII//TRANSLIT")
|
||||
x <- gsub('"', "", x, fixed = TRUE)
|
||||
@ -310,10 +324,12 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
|
||||
x_translated <- paste(lapply(strsplit(x[i], "[^A-Z0-9]"),
|
||||
function(y) {
|
||||
for (i in seq_len(length(y))) {
|
||||
y[i] <- ifelse(tolower(y[i]) %in% tolower(translations_file$replacement),
|
||||
translations_file[which(tolower(translations_file$replacement) == tolower(y[i]) &
|
||||
!isFALSE(translations_file$fixed)), "pattern"],
|
||||
y[i])
|
||||
for (lang in LANGUAGES_SUPPORTED[LANGUAGES_SUPPORTED != "en"]) {
|
||||
y[i] <- ifelse(tolower(y[i]) %in% tolower(translations_file[, lang, drop = TRUE]),
|
||||
translations_file[which(tolower(translations_file[, lang, drop = TRUE]) == tolower(y[i]) &
|
||||
!isFALSE(translations_file$fixed)), "pattern"],
|
||||
y[i])
|
||||
}
|
||||
}
|
||||
generalise_antibiotic_name(y)
|
||||
})[[1]],
|
||||
|
@ -27,7 +27,7 @@
|
||||
#'
|
||||
#' These functions help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. \strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param only_rsi_columns a logical to indicate whether only columns of class [`<rsi>`]([rsi]) must be selected (defaults to `FALSE`)
|
||||
#' @param only_rsi_columns a logical to indicate whether only columns of class `<rsi>` must be selected (defaults to `FALSE`), see [as.rsi()]
|
||||
#' @inheritParams filter_ab_class
|
||||
#' @details \strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
||||
#'
|
||||
|
@ -26,7 +26,7 @@
|
||||
#' Retrieve Antimicrobial Drug Names and Doses from Clinical Text
|
||||
#'
|
||||
#' Use this function on e.g. clinical texts from health care records. It returns a [list] with all antimicrobial drugs, doses and forms of administration found in the texts.
|
||||
#' @inheritSection lifecycle Maturing Lifecycle
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param text text to analyse
|
||||
#' @param type type of property to search for, either `"drug"`, `"dose"` or `"administration"`, see *Examples*
|
||||
#' @param collapse character to pass on to `paste(, collapse = ...)` to only return one character per element of `text`, see *Examples*
|
||||
|
15
R/amr.R
@ -29,7 +29,7 @@
|
||||
#' @details
|
||||
#' `AMR` is a free, open-source and independent \R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. Our aim is to provide a standard for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.
|
||||
#'
|
||||
#' After installing this package, \R knows ~70,000 distinct microbial species and all ~550 antibiotic, antimycotic and antiviral drugs by name and code (including ATC, EARS-NET, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
|
||||
#' After installing this package, \R knows `r format_included_data_number(microorganisms)` distinct microbial species and all `r format_included_data_number(rbind(antibiotics[, "atc", drop = FALSE], antivirals[, "atc", drop = FALSE]))` antibiotic, antimycotic and antiviral drugs by name and code (including ATC, EARS-NET, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
|
||||
#'
|
||||
#' This package is fully independent of any other \R package and works on Windows, macOS and Linux with all versions of \R since R-3.0.0 (April 2013). It was designed to work in any setting, including those with very limited resources. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the University of Groningen, in collaboration with non-profit organisations Certe Medical Diagnostics and Advice and University Medical Center Groningen. This \R package is actively maintained and free software; you can freely use and distribute it for both personal and commercial (but not patent) purposes under the terms of the GNU General Public License version 2.0 (GPL-2), as published by the Free Software Foundation.
|
||||
#'
|
||||
@ -73,16 +73,3 @@
|
||||
#' @name AMR
|
||||
#' @rdname AMR
|
||||
NULL
|
||||
|
||||
#' Plotting for Classes `rsi`, `mic` and `disk`
|
||||
#'
|
||||
#' Functions to print classes of the `AMR` package.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @param ... Arguments passed on to functions
|
||||
#' @inheritParams base::plot
|
||||
#' @inheritParams graphics::barplot
|
||||
#' @name plot
|
||||
#' @rdname plot
|
||||
#' @keywords internal
|
||||
NULL
|
||||
|
@ -44,9 +44,9 @@ format_included_data_number <- function(data) {
|
||||
#' This package contains the complete taxonomic tree of almost all microorganisms from the authoritative and comprehensive Catalogue of Life.
|
||||
#' @section Catalogue of Life:
|
||||
#' \if{html}{\figure{logo_col.png}{options: height=40px style=margin-bottom:5px} \cr}
|
||||
#' This package contains the complete taxonomic tree of almost all microorganisms (~70,000 species) from the authoritative and comprehensive Catalogue of Life (CoL, <http://www.catalogueoflife.org>). The CoL is the most comprehensive and authoritative global index of species currently available. Nonetheless, we supplemented the CoL data with data from the List of Prokaryotic names with Standing in Nomenclature (LPSN, [lpsn.dsmz.de](https://lpsn.dsmz.de)). This supplementation is needed until the [CoL+ project](https://github.com/CatalogueOfLife/general) is finished, which we await.
|
||||
#' This package contains the complete taxonomic tree of almost all microorganisms (`r format_included_data_number(microorganisms)` species) from the authoritative and comprehensive Catalogue of Life (CoL, <http://www.catalogueoflife.org>). The CoL is the most comprehensive and authoritative global index of species currently available. Nonetheless, we supplemented the CoL data with data from the List of Prokaryotic names with Standing in Nomenclature (LPSN, [lpsn.dsmz.de](https://lpsn.dsmz.de)). This supplementation is needed until the [CoL+ project](https://github.com/CatalogueOfLife/general) is finished, which we await.
|
||||
#'
|
||||
#' [Click here][catalogue_of_life] for more information about the included taxa. Check which versions of the CoL and LSPN were included in this package with [catalogue_of_life_version()].
|
||||
#' [Click here][catalogue_of_life] for more information about the included taxa. Check which versions of the CoL and LPSN were included in this package with [catalogue_of_life_version()].
|
||||
#' @section Included Taxa:
|
||||
#' Included are:
|
||||
#' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom %in% c("Archeae", "Bacteria", "Chromista", "Protozoa")), ])` (sub)species from the kingdoms of Archaea, Bacteria, Chromista and Protozoa
|
||||
@ -99,7 +99,7 @@ NULL
|
||||
#'
|
||||
#' This function returns information about the included data from the Catalogue of Life.
|
||||
#' @seealso [microorganisms]
|
||||
#' @details For DSMZ, see [microorganisms].
|
||||
#' @details For LPSN, see [microorganisms].
|
||||
#' @return a [list], which prints in pretty format
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
@ -108,16 +108,16 @@ catalogue_of_life_version <- function() {
|
||||
|
||||
check_dataset_integrity()
|
||||
|
||||
# see the `catalogue_of_life` list in R/data.R
|
||||
lst <- list(catalogue_of_life =
|
||||
list(version = gsub("{year}", catalogue_of_life$year, catalogue_of_life$version, fixed = TRUE),
|
||||
url = gsub("{year}", catalogue_of_life$year, catalogue_of_life$url_CoL, fixed = TRUE),
|
||||
# see the `CATALOGUE_OF_LIFE` list in R/globals.R
|
||||
lst <- list(CoL =
|
||||
list(version = gsub("{year}", CATALOGUE_OF_LIFE$year, CATALOGUE_OF_LIFE$version, fixed = TRUE),
|
||||
url = gsub("{year}", CATALOGUE_OF_LIFE$year, CATALOGUE_OF_LIFE$url_CoL, fixed = TRUE),
|
||||
n = nrow(pm_filter(microorganisms, source == "CoL"))),
|
||||
deutsche_sammlung_von_mikroorganismen_und_zellkulturen =
|
||||
list(version = "Prokaryotic Nomenclature Up-to-Date from DSMZ",
|
||||
url = catalogue_of_life$url_DSMZ,
|
||||
yearmonth = catalogue_of_life$yearmonth_DSMZ,
|
||||
n = nrow(pm_filter(microorganisms, source == "DSMZ"))),
|
||||
LPSN =
|
||||
list(version = "List of Prokaryotic names with Standing in Nomenclature",
|
||||
url = CATALOGUE_OF_LIFE$url_LPSN,
|
||||
yearmonth = CATALOGUE_OF_LIFE$yearmonth_LPSN,
|
||||
n = nrow(pm_filter(microorganisms, source == "LPSN"))),
|
||||
total_included =
|
||||
list(
|
||||
n_total_species = nrow(microorganisms),
|
||||
@ -131,16 +131,15 @@ catalogue_of_life_version <- function() {
|
||||
#' @export
|
||||
#' @noRd
|
||||
print.catalogue_of_life_version <- function(x, ...) {
|
||||
lst <- x
|
||||
cat(paste0(font_bold("Included in this AMR package are:\n\n"),
|
||||
font_underline(lst$catalogue_of_life$version), "\n",
|
||||
" Available at: ", lst$catalogue_of_life$url, "\n",
|
||||
" Number of included species: ", format(lst$catalogue_of_life$n, big.mark = ","), "\n",
|
||||
font_underline(paste0(lst$deutsche_sammlung_von_mikroorganismen_und_zellkulturen$version, " (",
|
||||
lst$deutsche_sammlung_von_mikroorganismen_und_zellkulturen$yearmonth, ")")), "\n",
|
||||
" Available at: ", lst$deutsche_sammlung_von_mikroorganismen_und_zellkulturen$url, "\n",
|
||||
" Number of included species: ", format(lst$deutsche_sammlung_von_mikroorganismen_und_zellkulturen$n, big.mark = ","), "\n\n",
|
||||
"=> Total number of species included: ", format(lst$total_included$n_total_species, big.mark = ","), "\n",
|
||||
"=> Total number of synonyms included: ", format(lst$total_included$n_total_synonyms, big.mark = ","), "\n\n",
|
||||
cat(paste0(font_bold("Included in this AMR package (v", utils::packageDescription("AMR")$Version, ") are:\n\n", collapse = ""),
|
||||
font_underline(x$CoL$version), "\n",
|
||||
" Available at: ", font_blue(x$CoL$url), "\n",
|
||||
" Number of included microbial species: ", format(x$CoL$n, big.mark = ","), "\n",
|
||||
font_underline(paste0(x$LPSN$version, " (",
|
||||
x$LPSN$yearmonth, ")")), "\n",
|
||||
" Available at: ", font_blue(x$LPSN$url), "\n",
|
||||
" Number of included bacterial species: ", format(x$LPSN$n, big.mark = ","), "\n\n",
|
||||
"=> Total number of species included: ", format(x$total_included$n_total_species, big.mark = ","), "\n",
|
||||
"=> Total number of synonyms included: ", format(x$total_included$n_total_synonyms, big.mark = ","), "\n\n",
|
||||
"See for more info ?microorganisms and ?catalogue_of_life.\n"))
|
||||
}
|
||||
|
46
R/data.R
@ -83,7 +83,7 @@
|
||||
|
||||
#' Data Set with `r format(nrow(microorganisms), big.mark = ",")` Microorganisms
|
||||
#'
|
||||
#' A data set containing the microbial taxonomy of six kingdoms from the Catalogue of Life. MO codes can be looked up using [as.mo()].
|
||||
#' A data set containing the microbial taxonomy, last updated in `r CATALOGUE_OF_LIFE$yearmonth_LPSN`, of six kingdoms from the Catalogue of Life (CoL) and the List of Prokaryotic names with Standing in Nomenclature (LPSN). MO codes can be looked up using [as.mo()].
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' @format A [data.frame] with `r format(nrow(microorganisms), big.mark = ",")` observations and `r ncol(microorganisms)` variables:
|
||||
#' - `mo`\cr ID of microorganism as used by this package
|
||||
@ -92,15 +92,15 @@
|
||||
#' - `rank`\cr Text of the taxonomic rank of the microorganism, like `"species"` or `"genus"`
|
||||
#' - `ref`\cr Author(s) and year of concerning scientific publication
|
||||
#' - `species_id`\cr ID of the species as used by the Catalogue of Life
|
||||
#' - `source`\cr Either "CoL", "DSMZ" (see *Source*) or "manually added"
|
||||
#' - `source`\cr Either `r vector_or(microorganisms$source)` (see *Source*)
|
||||
#' - `prevalence`\cr Prevalence of the microorganism, see [as.mo()]
|
||||
#' - `snomed`\cr SNOMED code of the microorganism. Use [mo_snomed()] to retrieve it quickly, see [mo_property()].
|
||||
#' - `snomed`\cr Systematized Nomenclature of Medicine (SNOMED) code of the microorganism, according to the `r SNOMED_VERSION$current_source` (see *Source*). Use [mo_snomed()] to retrieve it quickly, see [mo_property()].
|
||||
#' @details
|
||||
#' Please note that entries are only based on the Catalogue of Life and the LPSN (see below). Since these sources incorporate entries based on (recent) publications in the International Journal of Systematic and Evolutionary Microbiology (IJSEM), it can happen that the year of publication is sometimes later than one might expect.
|
||||
#'
|
||||
#' For example, *Staphylococcus pettenkoferi* was newly named in Diagnostic Microbiology and Infectious Disease in 2002 (PMID 12106949), but it was not before 2007 that a publication in IJSEM followed (PMID 17625191). Consequently, the AMR package returns 2007 for `mo_year("S. pettenkoferi")`.
|
||||
#' For example, *Staphylococcus pettenkoferi* was described for the first time in Diagnostic Microbiology and Infectious Disease in 2002 (\doi{10.1016/s0732-8893(02)00399-1}), but it was not before 2007 that a publication in IJSEM followed (\doi{10.1099/ijs.0.64381-0}). Consequently, the AMR package returns 2007 for `mo_year("S. pettenkoferi")`.
|
||||
#'
|
||||
#' ## Manually additions
|
||||
#' ## Manual additions
|
||||
#' For convenience, some entries were added manually:
|
||||
#'
|
||||
#' - 11 entries of *Streptococcus* (beta-haemolytic: groups A, B, C, D, F, G, H, K and unspecified; other: viridans, milleri)
|
||||
@ -110,7 +110,6 @@
|
||||
#' - 1 entry of *Blastocystis* (*Blastocystis hominis*), although it officially does not exist (Noel *et al.* 2005, PMID 15634993)
|
||||
#' - 5 other 'undefined' entries (unknown, unknown Gram negatives, unknown Gram positives, unknown yeast and unknown fungus)
|
||||
#' - 6 families under the Enterobacterales order, according to Adeolu *et al.* (2016, PMID 27620848), that are not (yet) in the Catalogue of Life
|
||||
#' - `r format(nrow(subset(microorganisms, source == "DSMZ")), big.mark = ",")` species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) since the DSMZ contain the latest taxonomic information based on recent publications
|
||||
#'
|
||||
#' ## Direct download
|
||||
#' This data set is available as 'flat file' for use even without \R - you can find the file here:
|
||||
@ -120,29 +119,30 @@
|
||||
#' The file in \R format (with preserved data structure) can be found here:
|
||||
#'
|
||||
#' * <https://github.com/msberends/AMR/raw/master/data/microorganisms.rda>
|
||||
#' @section About the Records from DSMZ (see *Source*):
|
||||
#' Names of prokaryotes are defined as being validly published by the International Code of Nomenclature of Bacteria. Validly published are all names which are included in the Approved Lists of Bacterial Names and the names subsequently published in the International Journal of Systematic Bacteriology (IJSB) and, from January 2000, in the International Journal of Systematic and Evolutionary Microbiology (IJSEM) as original articles or in the validation lists.
|
||||
#' *(from <https://www.dsmz.de/services/online-tools/prokaryotic-nomenclature-up-to-date>)*
|
||||
#' @section About the Records from LPSN (see *Source*):
|
||||
#' The List of Prokaryotic names with Standing in Nomenclature (LPSN) provides comprehensive information on the nomenclature of prokaryotes. LPSN is a free to use service founded by Jean P. Euzeby in 1997 and later on maintained by Aidan C. Parte.
|
||||
#'
|
||||
#' In February 2020, the DSMZ records were merged with the List of Prokaryotic names with Standing in Nomenclature (LPSN).
|
||||
#' @source Catalogue of Life: Annual Checklist (public online taxonomic database), <http://www.catalogueoflife.org> (check included annual version with [catalogue_of_life_version()]).
|
||||
#' As of February 2020, the regularly augmented LPSN database at DSMZ is the basis of the new LPSN service. The new database was implemented for the Type-Strain Genome Server and augmented in 2018 to store all kinds of nomenclatural information. Data from the previous version of LPSN and from the Prokaryotic Nomenclature Up-to-date (PNU) service were imported into the new system. PNU had been established in 1993 as a service of the Leibniz Institute DSMZ, and was curated by Norbert Weiss, Manfred Kracht and Dorothea Gleim.
|
||||
#' @source
|
||||
#' `r gsub("{year}", CATALOGUE_OF_LIFE$year, CATALOGUE_OF_LIFE$version, fixed = TRUE)` as currently implemented in this `AMR` package:
|
||||
#'
|
||||
#' Parte, A.C. (2018). LPSN — List of Prokaryotic names with Standing in Nomenclature (bacterio.net), 20 years on. International Journal of Systematic and Evolutionary Microbiology, 68, 1825-1829; \doi{10.1099/ijsem.0.002786}
|
||||
#'
|
||||
#' Leibniz Institute DSMZ-German Collection of Microorganisms and Cell Cultures, Germany, Prokaryotic Nomenclature Up-to-Date, <https://www.dsmz.de/services/online-tools/prokaryotic-nomenclature-up-to-date> and <https://lpsn.dsmz.de> (check included version with [catalogue_of_life_version()]).
|
||||
#' * Annual Checklist (public online taxonomic database), <http://www.catalogueoflife.org>
|
||||
#'
|
||||
#' List of Prokaryotic names with Standing in Nomenclature (`r CATALOGUE_OF_LIFE$yearmonth_LPSN`) as currently implemented in this `AMR` package:
|
||||
#'
|
||||
#' * Parte, A.C., Sarda Carbasse, J., Meier-Kolthoff, J.P., Reimer, L.C. and Goker, M. (2020). List of Prokaryotic names with Standing in Nomenclature (LPSN) moves to the DSMZ. International Journal of Systematic and Evolutionary Microbiology, 70, 5607-5612; \doi{10.1099/ijsem.0.004332}
|
||||
#' * Parte, A.C. (2018). LPSN — List of Prokaryotic names with Standing in Nomenclature (bacterio.net), 20 years on. International Journal of Systematic and Evolutionary Microbiology, 68, 1825-1829; \doi{10.1099/ijsem.0.002786}
|
||||
#' * Parte, A.C. (2014). LPSN — List of Prokaryotic names with Standing in Nomenclature. Nucleic Acids Research, 42, Issue D1, D613–D616; \doi{10.1093/nar/gkt1111}
|
||||
#' * Euzeby, J.P. (1997). List of Bacterial Names with Standing in Nomenclature: a Folder Available on the Internet. International Journal of Systematic Bacteriology, 47, 590-592; \doi{10.1099/00207713-47-2-590}
|
||||
#'
|
||||
#' `r SNOMED_VERSION$current_source` as currently implemented in this `AMR` package:
|
||||
#'
|
||||
#' * Retrieved from the `r SNOMED_VERSION$title`, OID `r SNOMED_VERSION$current_oid`, version `r SNOMED_VERSION$current_version`; url: <`r SNOMED_VERSION$url`>
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @seealso [as.mo()], [mo_property()], [microorganisms.codes], [intrinsic_resistant]
|
||||
"microorganisms"
|
||||
|
||||
catalogue_of_life <- list(
|
||||
year = 2019,
|
||||
version = "Catalogue of Life: {year} Annual Checklist",
|
||||
url_CoL = "http://www.catalogueoflife.org/col/",
|
||||
url_DSMZ = "https://lpsn.dsmz.de",
|
||||
yearmonth_DSMZ = "May 2020"
|
||||
)
|
||||
|
||||
#' Data Set with Previously Accepted Taxonomic Names
|
||||
#'
|
||||
#' A data set containing old (previously valid or accepted) taxonomic names according to the Catalogue of Life. This data set is used internally by [as.mo()].
|
||||
@ -242,7 +242,7 @@ catalogue_of_life <- list(
|
||||
#' Data set to interpret MIC and disk diffusion to R/SI values. Included guidelines are CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`) and EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`). Use [as.rsi()] to transform MICs or disks measurements to R/SI values.
|
||||
#' @format A [data.frame] with `r format(nrow(rsi_translation), big.mark = ",")` observations and `r ncol(rsi_translation)` variables:
|
||||
#' - `guideline`\cr Name of the guideline
|
||||
#' - `method`\cr Either "MIC" or "DISK"
|
||||
#' - `method`\cr Either `r vector_or(rsi_translation$method)`
|
||||
#' - `site`\cr Body site, e.g. "Oral" or "Respiratory"
|
||||
#' - `mo`\cr Microbial ID, see [as.mo()]
|
||||
#' - `ab`\cr Antibiotic ID, see [as.ab()]
|
||||
|
24
R/disk.R
@ -145,30 +145,6 @@ print.disk <- function(x, ...) {
|
||||
print(as.integer(x), quote = FALSE)
|
||||
}
|
||||
|
||||
#' @method plot disk
|
||||
#' @export
|
||||
#' @importFrom graphics barplot axis
|
||||
#' @rdname plot
|
||||
plot.disk <- function(x,
|
||||
main = paste("Disk zones values of", deparse(substitute(x))),
|
||||
ylab = "Frequency",
|
||||
xlab = "Disk diffusion (mm)",
|
||||
axes = FALSE,
|
||||
...) {
|
||||
meet_criteria(main, allow_class = "character", has_length = 1)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(axes, allow_class = "logical", has_length = 1)
|
||||
|
||||
barplot(table(x),
|
||||
ylab = ylab,
|
||||
xlab = xlab,
|
||||
axes = axes,
|
||||
main = main,
|
||||
...)
|
||||
axis(2, seq(0, max(table(x))))
|
||||
}
|
||||
|
||||
#' @method [ disk
|
||||
#' @export
|
||||
#' @noRd
|
||||
|
@ -23,25 +23,6 @@
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# add new version numbers here, and add the rules themselves to "data-raw/eucast_rules.tsv" and rsi_translation
|
||||
# (sourcing "data-raw/_internals.R" will process the TSV file)
|
||||
EUCAST_VERSION_BREAKPOINTS <- list("11.0" = list(version_txt = "v11.0",
|
||||
year = 2021,
|
||||
title = "'EUCAST Clinical Breakpoint Tables'",
|
||||
url = "https://www.eucast.org/clinical_breakpoints/"),
|
||||
"10.0" = list(version_txt = "v10.0",
|
||||
year = 2020,
|
||||
title = "'EUCAST Clinical Breakpoint Tables'",
|
||||
url = "https://www.eucast.org/ast_of_bacteria/previous_versions_of_documents/"))
|
||||
EUCAST_VERSION_EXPERT_RULES <- list("3.1" = list(version_txt = "v3.1",
|
||||
year = 2016,
|
||||
title = "'EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes'",
|
||||
url = "https://www.eucast.org/expert_rules_and_intrinsic_resistance/"),
|
||||
"3.2" = list(version_txt = "v3.2",
|
||||
year = 2020,
|
||||
title = "'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes'",
|
||||
url = "https://www.eucast.org/expert_rules_and_intrinsic_resistance/"))
|
||||
|
||||
format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
# for documentation - adds title, version number, year and url in markdown language
|
||||
lst <- c(EUCAST_VERSION_BREAKPOINTS, EUCAST_VERSION_EXPERT_RULES)
|
||||
@ -74,11 +55,11 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
#' @param verbose a [logical] to turn Verbose mode on and off (default is off). In Verbose mode, the function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way. Using Verbose mode takes a lot more time.
|
||||
#' @param version_breakpoints the version number to use for the EUCAST Clinical Breakpoints guideline. Can be either `r vector_or(names(EUCAST_VERSION_BREAKPOINTS), reverse = TRUE)`.
|
||||
#' @param version_expertrules the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either `r vector_or(names(EUCAST_VERSION_EXPERT_RULES), reverse = TRUE)`.
|
||||
#' @param ampc_cephalosporin_resistance a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to `NA`. Currently only works when `version_expertrules` is `3.2`; '*EUCAST Expert Rules v3.2 on Enterobacterales*' states that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of `NA` for this argument will remove results for these agents, while e.g. a value of `"R"` will make the results for these agents resistant. Use `NULL` to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. \cr For *EUCAST Expert Rules* v3.2, this rule applies to: `r vector_and(gsub("[^a-zA-Z ]+", "", unlist(strsplit(eucast_rules_file[which(eucast_rules_file$reference.version == 3.2 & eucast_rules_file$reference.rule %like% "ampc"), "this_value"][1], "|", fixed = TRUE))), quotes = "*")`.
|
||||
#' @param ampc_cephalosporin_resistance a character value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants, defaults to `NA`. Currently only works when `version_expertrules` is `3.2`; '*EUCAST Expert Rules v3.2 on Enterobacterales*' states that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these three agents. A value of `NA` (the default) for this argument will remove results for these three agents, while e.g. a value of `"R"` will make the results for these agents resistant. Use `NULL` or `FALSE` to not alter results for these three agents of AmpC de-repressed cephalosporin-resistant mutants. Using `TRUE` is equal to using `"R"`. \cr For *EUCAST Expert Rules* v3.2, this rule applies to: `r vector_and(gsub("[^a-zA-Z ]+", "", unlist(strsplit(eucast_rules_file[which(eucast_rules_file$reference.version == 3.2 & eucast_rules_file$reference.rule %like% "ampc"), "this_value"][1], "|", fixed = TRUE))), quotes = "*")`.
|
||||
#' @param ... column name of an antibiotic, see section *Antibiotics* below
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()]
|
||||
#' @param administration route of administration, either `r vector_or(dosage$administration)`
|
||||
#' @param only_rsi_columns a logical to indicate whether only antibiotic columns must be detected that were [transformed to class `<rsi>`]([rsi]) on beforehand (defaults to `FALSE`)
|
||||
#' @param only_rsi_columns a logical to indicate whether only antibiotic columns must be detected that were transformed to class `<rsi>` (see [as.rsi()]) on beforehand (defaults to `FALSE`)
|
||||
#' @inheritParams first_isolate
|
||||
#' @details
|
||||
#' **Note:** This function does not translate MIC values to RSI values. Use [as.rsi()] for that. \cr
|
||||
@ -101,7 +82,7 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
#'
|
||||
#' The following antibiotics are used for the functions [eucast_rules()] and [mdro()]. These are shown below in the format 'name (`antimicrobial ID`, [ATC code](https://www.whocc.no/atc/structure_and_principles/))', sorted alphabetically:
|
||||
#'
|
||||
#' `r create_ab_documentation(c("AMC", "AMK", "AMP", "AMX", "ATM", "AVO", "AZL", "AZM", "BAM", "BPR", "CAC", "CAT", "CAZ", "CCP", "CCV", "CCX", "CDC", "CDR", "CDZ", "CEC", "CED", "CEI", "CEM", "CEP", "CFM", "CFM1", "CFP", "CFR", "CFS", "CFZ", "CHE", "CHL", "CID", "CIP", "CLI", "CLR", "CMX", "CMZ", "CND", "COL", "CPD", "CPI", "CPL", "CPM", "CPO", "CPR", "CPT", "CPX", "CRB", "CRD", "CRN", "CRO", "CSL", "CTB", "CTC", "CTF", "CTL", "CTS", "CTT", "CTX", "CTZ", "CXM", "CYC", "CZA", "CZD", "CZO", "CZP", "CZX", "DAL", "DAP", "DIR", "DIT", "DIX", "DIZ", "DKB", "DOR", "DOX", "ENX", "EPC", "ERY", "ETP", "FEP", "FLC", "FLE", "FLR1", "FOS", "FOV", "FOX", "FOX1", "FUS", "GAT", "GEM", "GEN", "GRX", "HAP", "HET", "IPM", "ISE", "JOS", "KAN", "LEX", "LIN", "LNZ", "LOM", "LOR", "LTM", "LVX", "MAN", "MCM", "MEC", "MEM", "MEV", "MEZ", "MFX", "MID", "MNO", "MTM", "NAL", "NEO", "NET", "NIT", "NOR", "NOV", "NVA", "OFX", "OLE", "ORI", "OXA", "PAZ", "PEF", "PEN", "PHN", "PIP", "PLB", "PME", "PRI", "PRL", "PRU", "PVM", "QDA", "RAM", "RFL", "RID", "RIF", "ROK", "RST", "RXT", "SAM", "SBC", "SDI", "SDM", "SIS", "SLF", "SLF1", "SLF10", "SLF11", "SLF12", "SLF13", "SLF2", "SLF3", "SLF4", "SLF5", "SLF6", "SLF7", "SLF8", "SLF9", "SLT1", "SLT2", "SLT3", "SLT4", "SLT5", "SMX", "SPI", "SPX", "STR", "STR1", "SUD", "SUT", "SXT", "SZO", "TAL", "TCC", "TCM", "TCY", "TEC", "TEM", "TGC", "THA", "TIC", "TIO", "TLT", "TLV", "TMP", "TMX", "TOB", "TRL", "TVA", "TZD", "TZP", "VAN"))`
|
||||
#' `r create_ab_documentation(c("AMC", "AMK", "AMP", "AMX", "APL", "APX", "ATM", "AVB", "AVO", "AZD", "AZL", "AZM", "BAM", "BPR", "CAC", "CAT", "CAZ", "CCP", "CCV", "CCX", "CDC", "CDR", "CDZ", "CEC", "CED", "CEI", "CEM", "CEP", "CFM", "CFM1", "CFP", "CFR", "CFS", "CFZ", "CHE", "CHL", "CIC", "CID", "CIP", "CLI", "CLM", "CLO", "CLR", "CMX", "CMZ", "CND", "COL", "CPD", "CPI", "CPL", "CPM", "CPO", "CPR", "CPT", "CPX", "CRB", "CRD", "CRN", "CRO", "CSL", "CTB", "CTC", "CTF", "CTL", "CTS", "CTT", "CTX", "CTZ", "CXM", "CYC", "CZA", "CZD", "CZO", "CZP", "CZX", "DAL", "DAP", "DIC", "DIR", "DIT", "DIX", "DIZ", "DKB", "DOR", "DOX", "ENX", "EPC", "ERY", "ETP", "FEP", "FLC", "FLE", "FLR1", "FOS", "FOV", "FOX", "FOX1", "FUS", "GAT", "GEM", "GEN", "GRX", "HAP", "HET", "IPM", "ISE", "JOS", "KAN", "LEN", "LEX", "LIN", "LNZ", "LOM", "LOR", "LTM", "LVX", "MAN", "MCM", "MEC", "MEM", "MET", "MEV", "MEZ", "MFX", "MID", "MNO", "MTM", "NAC", "NAF", "NAL", "NEO", "NET", "NIT", "NOR", "NOV", "NVA", "OFX", "OLE", "ORI", "OXA", "PAZ", "PEF", "PEN", "PHE", "PHN", "PIP", "PLB", "PME", "PNM", "PRC", "PRI", "PRL", "PRP", "PRU", "PVM", "QDA", "RAM", "RFL", "RID", "RIF", "ROK", "RST", "RXT", "SAM", "SBC", "SDI", "SDM", "SIS", "SLF", "SLF1", "SLF10", "SLF11", "SLF12", "SLF13", "SLF2", "SLF3", "SLF4", "SLF5", "SLF6", "SLF7", "SLF8", "SLF9", "SLT1", "SLT2", "SLT3", "SLT4", "SLT5", "SLT6", "SMX", "SPI", "SPX", "SRX", "STR", "STR1", "SUD", "SUL", "SUT", "SXT", "SZO", "TAL", "TAZ", "TCC", "TCM", "TCY", "TEC", "TEM", "TGC", "THA", "TIC", "TIO", "TLT", "TLV", "TMP", "TMX", "TOB", "TRL", "TVA", "TZD", "TZP", "VAN"))`
|
||||
#' @aliases EUCAST
|
||||
#' @rdname eucast_rules
|
||||
#' @export
|
||||
@ -176,7 +157,7 @@ eucast_rules <- function(x,
|
||||
meet_criteria(verbose, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(version_breakpoints, allow_class = c("numeric", "integer"), has_length = 1, is_in = as.double(names(EUCAST_VERSION_BREAKPOINTS)))
|
||||
meet_criteria(version_expertrules, allow_class = c("numeric", "integer"), has_length = 1, is_in = as.double(names(EUCAST_VERSION_EXPERT_RULES)))
|
||||
meet_criteria(ampc_cephalosporin_resistance, has_length = 1, allow_NA = TRUE, allow_NULL = TRUE, is_in = c("R", "S", "I"))
|
||||
meet_criteria(ampc_cephalosporin_resistance, allow_class = c("logical", "character", "rsi"), has_length = 1, allow_NA = TRUE, allow_NULL = TRUE)
|
||||
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||
|
||||
x_deparsed <- deparse(substitute(x))
|
||||
@ -287,8 +268,12 @@ eucast_rules <- function(x,
|
||||
AMK <- cols_ab["AMK"]
|
||||
AMP <- cols_ab["AMP"]
|
||||
AMX <- cols_ab["AMX"]
|
||||
APL <- cols_ab["APL"]
|
||||
APX <- cols_ab["APX"]
|
||||
ATM <- cols_ab["ATM"]
|
||||
AVB <- cols_ab["AVB"]
|
||||
AVO <- cols_ab["AVO"]
|
||||
AZD <- cols_ab["AZD"]
|
||||
AZL <- cols_ab["AZL"]
|
||||
AZM <- cols_ab["AZM"]
|
||||
BAM <- cols_ab["BAM"]
|
||||
@ -315,9 +300,12 @@ eucast_rules <- function(x,
|
||||
CFZ <- cols_ab["CFZ"]
|
||||
CHE <- cols_ab["CHE"]
|
||||
CHL <- cols_ab["CHL"]
|
||||
CIC <- cols_ab["CIC"]
|
||||
CID <- cols_ab["CID"]
|
||||
CIP <- cols_ab["CIP"]
|
||||
CLI <- cols_ab["CLI"]
|
||||
CLM <- cols_ab["CLM"]
|
||||
CLO <- cols_ab["CLO"]
|
||||
CLR <- cols_ab["CLR"]
|
||||
CMX <- cols_ab["CMX"]
|
||||
CMZ <- cols_ab["CMZ"]
|
||||
@ -353,6 +341,7 @@ eucast_rules <- function(x,
|
||||
CZX <- cols_ab["CZX"]
|
||||
DAL <- cols_ab["DAL"]
|
||||
DAP <- cols_ab["DAP"]
|
||||
DIC <- cols_ab["DIC"]
|
||||
DIR <- cols_ab["DIR"]
|
||||
DIT <- cols_ab["DIT"]
|
||||
DIX <- cols_ab["DIX"]
|
||||
@ -383,6 +372,7 @@ eucast_rules <- function(x,
|
||||
ISE <- cols_ab["ISE"]
|
||||
JOS <- cols_ab["JOS"]
|
||||
KAN <- cols_ab["KAN"]
|
||||
LEN <- cols_ab["LEN"]
|
||||
LEX <- cols_ab["LEX"]
|
||||
LIN <- cols_ab["LIN"]
|
||||
LNZ <- cols_ab["LNZ"]
|
||||
@ -394,12 +384,15 @@ eucast_rules <- function(x,
|
||||
MCM <- cols_ab["MCM"]
|
||||
MEC <- cols_ab["MEC"]
|
||||
MEM <- cols_ab["MEM"]
|
||||
MET <- cols_ab["MET"]
|
||||
MEV <- cols_ab["MEV"]
|
||||
MEZ <- cols_ab["MEZ"]
|
||||
MFX <- cols_ab["MFX"]
|
||||
MID <- cols_ab["MID"]
|
||||
MNO <- cols_ab["MNO"]
|
||||
MTM <- cols_ab["MTM"]
|
||||
NAC <- cols_ab["NAC"]
|
||||
NAF <- cols_ab["NAF"]
|
||||
NAL <- cols_ab["NAL"]
|
||||
NEO <- cols_ab["NEO"]
|
||||
NET <- cols_ab["NET"]
|
||||
@ -414,12 +407,16 @@ eucast_rules <- function(x,
|
||||
PAZ <- cols_ab["PAZ"]
|
||||
PEF <- cols_ab["PEF"]
|
||||
PEN <- cols_ab["PEN"]
|
||||
PHE <- cols_ab["PHE"]
|
||||
PHN <- cols_ab["PHN"]
|
||||
PIP <- cols_ab["PIP"]
|
||||
PLB <- cols_ab["PLB"]
|
||||
PME <- cols_ab["PME"]
|
||||
PNM <- cols_ab["PNM"]
|
||||
PRC <- cols_ab["PRC"]
|
||||
PRI <- cols_ab["PRI"]
|
||||
PRL <- cols_ab["PRL"]
|
||||
PRP <- cols_ab["PRP"]
|
||||
PRU <- cols_ab["PRU"]
|
||||
PVM <- cols_ab["PVM"]
|
||||
QDA <- cols_ab["QDA"]
|
||||
@ -454,16 +451,20 @@ eucast_rules <- function(x,
|
||||
SLT3 <- cols_ab["SLT3"]
|
||||
SLT4 <- cols_ab["SLT4"]
|
||||
SLT5 <- cols_ab["SLT5"]
|
||||
SLT6 <- cols_ab["SLT6"]
|
||||
SMX <- cols_ab["SMX"]
|
||||
SPI <- cols_ab["SPI"]
|
||||
SPX <- cols_ab["SPX"]
|
||||
SRX <- cols_ab["SRX"]
|
||||
STR <- cols_ab["STR"]
|
||||
STR1 <- cols_ab["STR1"]
|
||||
SUD <- cols_ab["SUD"]
|
||||
SUL <- cols_ab["SUL"]
|
||||
SUT <- cols_ab["SUT"]
|
||||
SXT <- cols_ab["SXT"]
|
||||
SZO <- cols_ab["SZO"]
|
||||
TAL <- cols_ab["TAL"]
|
||||
TAZ <- cols_ab["TAZ"]
|
||||
TCC <- cols_ab["TCC"]
|
||||
TCM <- cols_ab["TCM"]
|
||||
TCY <- cols_ab["TCY"]
|
||||
@ -765,10 +766,14 @@ eucast_rules <- function(x,
|
||||
(reference.rule_group %like% "expert" & reference.version == version_expertrules))
|
||||
}
|
||||
# filter out AmpC de-repressed cephalosporin-resistant mutants ----
|
||||
if (is.null(ampc_cephalosporin_resistance)) {
|
||||
# cefotaxime, ceftriaxone, ceftazidime
|
||||
if (is.null(ampc_cephalosporin_resistance) || isFALSE(ampc_cephalosporin_resistance)) {
|
||||
eucast_rules_df <- subset(eucast_rules_df,
|
||||
!reference.rule %like% "ampc")
|
||||
} else {
|
||||
if (isTRUE(ampc_cephalosporin_resistance)) {
|
||||
ampc_cephalosporin_resistance <- "R"
|
||||
}
|
||||
eucast_rules_df[which(eucast_rules_df$reference.rule %like% "ampc"), "to_value"] <- as.character(ampc_cephalosporin_resistance)
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#' @param ab_class an antimicrobial class, like `"carbapenems"`. The columns `group`, `atc_group1` and `atc_group2` of the [antibiotics] data set will be searched (case-insensitive) for this value.
|
||||
#' @param result an antibiotic result: S, I or R (or a combination of more of them)
|
||||
#' @param scope the scope to check which variables to check, can be `"any"` (default) or `"all"`
|
||||
#' @param only_rsi_columns a logical to indicate whether only columns must be included that were [transformed to class `<rsi>`]([rsi]) on beforehand (defaults to `FALSE`)
|
||||
#' @param only_rsi_columns a logical to indicate whether only columns must be included that were transformed to class `<rsi>` (see [as.rsi()]) on beforehand (defaults to `FALSE`)
|
||||
#' @param ... arguments passed on to [filter_ab_class()]
|
||||
#' @details All columns of `x` will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.). This means that a filter function like e.g. [filter_aminoglycosides()] will include column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.
|
||||
#' @rdname filter_ab_class
|
||||
|
@ -37,13 +37,14 @@
|
||||
#' @param col_keyantibiotics column name of the key antibiotics to determine first (weighted) isolates, see [key_antibiotics()]. Defaults to the first column that starts with 'key' followed by 'ab' or 'antibiotics' (case insensitive). Use `col_keyantibiotics = FALSE` to prevent this.
|
||||
#' @param episode_days episode in days after which a genus/species combination will be determined as 'first isolate' again. The default of 365 days is based on the guideline by CLSI, see *Source*.
|
||||
#' @param testcodes_exclude character vector with test codes that should be excluded (case-insensitive)
|
||||
#' @param icu_exclude logical whether ICU isolates should be excluded (rows with value `TRUE` in the column set with `col_icu`)
|
||||
#' @param icu_exclude logical to indicate whether ICU isolates should be excluded (rows with value `TRUE` in the column set with `col_icu`)
|
||||
#' @param specimen_group value in the column set with `col_specimen` to filter on
|
||||
#' @param type type to determine weighed isolates; can be `"keyantibiotics"` or `"points"`, see *Details*
|
||||
#' @param ignore_I logical to determine whether antibiotic interpretations with `"I"` will be ignored when `type = "keyantibiotics"`, see *Details*
|
||||
#' @param ignore_I logical to indicate whether antibiotic interpretations with `"I"` will be ignored when `type = "keyantibiotics"`, see *Details*
|
||||
#' @param points_threshold points until the comparison of key antibiotics will lead to inclusion of an isolate when `type = "points"`, see *Details*
|
||||
#' @param info print progress
|
||||
#' @param include_unknown logical to determine whether 'unknown' microorganisms should be included too, i.e. microbial code `"UNKNOWN"`, which defaults to `FALSE`. For WHONET users, this means that all records with organism code `"con"` (*contamination*) will be excluded at default. Isolates with a microbial ID of `NA` will always be excluded as first isolate.
|
||||
#' @param include_unknown logical to indicate whether 'unknown' microorganisms should be included too, i.e. microbial code `"UNKNOWN"`, which defaults to `FALSE`. For WHONET users, this means that all records with organism code `"con"` (*contamination*) will be excluded at default. Isolates with a microbial ID of `NA` will always be excluded as first isolate.
|
||||
#' @param include_untested_rsi logical to indicate whether also rows without antibiotic results are still eligible for becoming a first isolate. Use `include_untested_rsi = FALSE` to always return `FALSE` for such rows. This checks the data set for columns of class `<rsi>` and consequently requires transforming columns with antibiotic results using [as.rsi()] first.
|
||||
#' @param ... arguments passed on to [first_isolate()] when using [filter_first_isolate()], or arguments passed on to [key_antibiotics()] when using [filter_first_weighted_isolate()]
|
||||
#' @details
|
||||
#' These functions are context-aware. This means that then the `x` argument can be left blank, see *Examples*.
|
||||
@ -159,6 +160,7 @@ first_isolate <- function(x = NULL,
|
||||
points_threshold = 2,
|
||||
info = interactive(),
|
||||
include_unknown = FALSE,
|
||||
include_untested_rsi = TRUE,
|
||||
...) {
|
||||
if (is_null_or_grouped_tbl(x)) {
|
||||
# when `x` is left blank, auto determine it (get_current_data() also contains dplyr::cur_data_all())
|
||||
@ -188,6 +190,7 @@ first_isolate <- function(x = NULL,
|
||||
meet_criteria(points_threshold, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(info, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(include_unknown, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(include_untested_rsi, allow_class = "logical", has_length = 1)
|
||||
|
||||
# remove data.table, grouping from tibbles, etc.
|
||||
x <- as.data.frame(x, stringsAsFactors = FALSE)
|
||||
@ -472,6 +475,14 @@ first_isolate <- function(x = NULL,
|
||||
}
|
||||
x[which(is.na(x$newvar_mo)), "newvar_first_isolate"] <- FALSE
|
||||
|
||||
# handle isolates without antibiogram
|
||||
if (include_untested_rsi == FALSE && any(is.rsi(x))) {
|
||||
rsi_all_NA <- which(unname(vapply(FUN.VALUE = logical(1),
|
||||
as.data.frame(t(x[, is.rsi(x), drop = FALSE])),
|
||||
function(rsi_values) all(is.na(rsi_values)))))
|
||||
x[rsi_all_NA, "newvar_first_isolate"] <- FALSE
|
||||
}
|
||||
|
||||
# arrange back according to original sorting again
|
||||
x <- x[order(x$newvar_row_index), ]
|
||||
rownames(x) <- NULL
|
||||
|
@ -26,7 +26,7 @@
|
||||
#' PCA Biplot with `ggplot2`
|
||||
#'
|
||||
#' Produces a `ggplot2` variant of a so-called [biplot](https://en.wikipedia.org/wiki/Biplot) for PCA (principal component analysis), but is more flexible and more appealing than the base \R [biplot()] function.
|
||||
#' @inheritSection lifecycle Maturing Lifecycle
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x an object returned by [pca()], [prcomp()] or [princomp()]
|
||||
#' @inheritParams stats::biplot.prcomp
|
||||
#' @param labels an optional vector of labels for the observations. If set, the labels will be placed below their respective points. When using the [pca()] function as input for `x`, this will be determined automatically based on the attribute `non_numeric_cols`, see [pca()].
|
||||
@ -57,7 +57,7 @@
|
||||
#' 4. Added total amount of explained variance as a caption in the plot
|
||||
#' 5. Cleaned all syntax based on the `lintr` package, fixed grammatical errors and added integrity checks
|
||||
#' 6. Updated documentation
|
||||
#' @details The colours for labels and points can be changed by adding another scale layer for colour, like `scale_colour_viridis_d()` or `scale_colour_brewer()`.
|
||||
#' @details The colours for labels and points can be changed by adding another scale layer for colour, such as `scale_colour_viridis_d()` and `scale_colour_brewer()`.
|
||||
#' @rdname ggplot_pca
|
||||
#' @export
|
||||
#' @examples
|
||||
|
126
R/ggplot_rsi.R
@ -26,7 +26,7 @@
|
||||
#' AMR Plots with `ggplot2`
|
||||
#'
|
||||
#' Use these functions to create bar plots for AMR data analysis. All functions rely on [ggplot2][ggplot2::ggplot()] functions.
|
||||
#' @inheritSection lifecycle Maturing Lifecycle
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param data a [data.frame] with column(s) of class [`rsi`] (see [as.rsi()])
|
||||
#' @param position position adjustment of bars, either `"fill"`, `"stack"` or `"dodge"`
|
||||
#' @param x variable to show on x axis, either `"antibiotic"` (default) or `"interpretation"` or a grouping variable
|
||||
@ -36,7 +36,8 @@
|
||||
#' @param facet variable to split plots by, either `"interpretation"` (default) or `"antibiotic"` or a grouping variable
|
||||
#' @inheritParams proportion
|
||||
#' @param nrow (when using `facet`) number of rows
|
||||
#' @param colours a named vector with colours for the bars. The names must be one or more of: S, SI, I, IR, R or be `FALSE` to use default [ggplot2][ggplot2::ggplot()] colours.
|
||||
#' @param colours a named vactor with colour to be used for filling. The default colours are colour-blind friendly.
|
||||
#' @param aesthetics aesthetics to apply the colours to, defaults to "fill" but can also be (a combination of) "alpha", "colour", "fill", "linetype", "shape" or "size"
|
||||
#' @param datalabels show datalabels using [labels_rsi_count()]
|
||||
#' @param datalabels.size size of the datalabels
|
||||
#' @param datalabels.colour colour of the datalabels
|
||||
@ -45,7 +46,7 @@
|
||||
#' @param caption text to show as caption of the plot
|
||||
#' @param x.title text to show as x axis description
|
||||
#' @param y.title text to show as y axis description
|
||||
#' @param ... other arguments passed on to [geom_rsi()]
|
||||
#' @param ... other arguments passed on to [geom_rsi()] or, in case of [scale_rsi_colours()], named values to set colours. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red. See *Examples*.
|
||||
#' @details At default, the names of antibiotics will be shown on the plots using [ab_name()]. This can be set with the `translate_ab` argument. See [count_df()].
|
||||
#'
|
||||
#' ## The Functions
|
||||
@ -55,7 +56,7 @@
|
||||
#'
|
||||
#' [scale_y_percent()] transforms the y axis to a 0 to 100% range using [ggplot2::scale_y_continuous()].
|
||||
#'
|
||||
#' [scale_rsi_colours()] sets colours to the bars: pastel blue for S, pastel turquoise for I and pastel red for R, using [ggplot2::scale_fill_manual()].
|
||||
#' [scale_rsi_colours()] sets colours to the bars (green for S, yellow for I, and red for R). with multilingual support. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red.
|
||||
#'
|
||||
#' [theme_rsi()] is a [ggplot2 theme][[ggplot2::theme()] with minimal distraction.
|
||||
#'
|
||||
@ -99,11 +100,20 @@
|
||||
#' size = 1,
|
||||
#' linetype = 2,
|
||||
#' alpha = 0.25)
|
||||
#'
|
||||
#'
|
||||
#' # you can alter the colours with colour names:
|
||||
#' example_isolates %>%
|
||||
#' select(AMX) %>%
|
||||
#' ggplot_rsi(colours = c(SI = "yellow"))
|
||||
#'
|
||||
#'
|
||||
#' # but you can also use the built-in colour-blind friendly colours for
|
||||
#' # your plots, where "S" is green, "I" is yellow and "R" is red:
|
||||
#' data.frame(x = c("Value1", "Value2", "Value3"),
|
||||
#' y = c(1, 2, 3),
|
||||
#' z = c("Value4", "Value5", "Value6")) %>%
|
||||
#' ggplot() +
|
||||
#' geom_col(aes(x = x, y = y, fill = z)) +
|
||||
#' scale_rsi_colours(Value4 = "S", Value5 = "I", Value6 = "R")
|
||||
#' }
|
||||
#'
|
||||
#' \donttest{
|
||||
@ -118,11 +128,6 @@
|
||||
#' CIP) %>%
|
||||
#' ggplot_rsi(x = "age_group")
|
||||
#'
|
||||
#' # for colourblind mode, use divergent colours from the viridis package:
|
||||
#' example_isolates %>%
|
||||
#' select(AMX, NIT, FOS, TMP, CIP) %>%
|
||||
#' ggplot_rsi() +
|
||||
#' scale_fill_viridis_d()
|
||||
#' # a shorter version which also adjusts data label colours:
|
||||
#' example_isolates %>%
|
||||
#' select(AMX, NIT, FOS, TMP, CIP) %>%
|
||||
@ -154,11 +159,11 @@ ggplot_rsi <- function(data,
|
||||
minimum = 30,
|
||||
language = get_locale(),
|
||||
nrow = NULL,
|
||||
colours = c(S = "#61a8ff",
|
||||
SI = "#61a8ff",
|
||||
I = "#61f7ff",
|
||||
IR = "#ff6961",
|
||||
R = "#ff6961"),
|
||||
colours = c(S = "#3CAEA3",
|
||||
SI = "#3CAEA3",
|
||||
I = "#F6D55C",
|
||||
IR = "#ED553B",
|
||||
R = "#ED553B"),
|
||||
datalabels = TRUE,
|
||||
datalabels.size = 2.5,
|
||||
datalabels.colour = "grey15",
|
||||
@ -223,11 +228,6 @@ ggplot_rsi <- function(data,
|
||||
theme_rsi()
|
||||
|
||||
if (fill == "interpretation") {
|
||||
# set RSI colours
|
||||
if (isFALSE(colours) & missing(datalabels.colour)) {
|
||||
# set datalabel colour to middle grey
|
||||
datalabels.colour <- "grey50"
|
||||
}
|
||||
p <- p + scale_rsi_colours(colours = colours)
|
||||
}
|
||||
|
||||
@ -308,17 +308,19 @@ geom_rsi <- function(position = NULL,
|
||||
x <- "interpretation"
|
||||
}
|
||||
|
||||
ggplot2::layer(geom = "bar", stat = "identity", position = position,
|
||||
mapping = ggplot2::aes_string(x = x, y = y, fill = fill),
|
||||
params = list(...), data = function(x) {
|
||||
rsi_df(data = x,
|
||||
translate_ab = translate_ab,
|
||||
language = language,
|
||||
minimum = minimum,
|
||||
combine_SI = combine_SI,
|
||||
combine_IR = combine_IR)
|
||||
})
|
||||
|
||||
ggplot2::geom_col(
|
||||
data = function(x) {
|
||||
rsi_df(data = x,
|
||||
translate_ab = translate_ab,
|
||||
language = language,
|
||||
minimum = minimum,
|
||||
combine_SI = combine_SI,
|
||||
combine_IR = combine_IR)
|
||||
},
|
||||
mapping = ggplot2::aes_string(x = x, y = y, fill = fill),
|
||||
position = position,
|
||||
...
|
||||
)
|
||||
}
|
||||
|
||||
#' @rdname ggplot_rsi
|
||||
@ -364,26 +366,52 @@ scale_y_percent <- function(breaks = seq(0, 1, 0.1), limits = NULL) {
|
||||
|
||||
#' @rdname ggplot_rsi
|
||||
#' @export
|
||||
scale_rsi_colours <- function(colours = c(S = "#61a8ff",
|
||||
SI = "#61a8ff",
|
||||
I = "#61f7ff",
|
||||
IR = "#ff6961",
|
||||
R = "#ff6961")) {
|
||||
scale_rsi_colours <- function(...,
|
||||
aesthetics = "fill") {
|
||||
stop_ifnot_installed("ggplot2")
|
||||
meet_criteria(colours, allow_class = c("character", "logical"))
|
||||
meet_criteria(aesthetics, allow_class = "character", is_in = c("alpha", "colour", "color", "fill", "linetype", "shape", "size"))
|
||||
|
||||
# previous colour: palette = "RdYlGn"
|
||||
# previous colours: values = c("#b22222", "#ae9c20", "#7cfc00")
|
||||
|
||||
if (!identical(colours, FALSE)) {
|
||||
original_cols <- c(S = "#61a8ff",
|
||||
SI = "#61a8ff",
|
||||
I = "#61f7ff",
|
||||
IR = "#ff6961",
|
||||
R = "#ff6961")
|
||||
colours <- replace(original_cols, names(colours), colours)
|
||||
ggplot2::scale_fill_manual(values = colours)
|
||||
# behaviour until AMR pkg v1.5.0 and also when coming from ggplot_rsi()
|
||||
if ("colours" %in% names(list(...))) {
|
||||
original_cols <- c(S = "#3CAEA3",
|
||||
SI = "#3CAEA3",
|
||||
I = "#F6D55C",
|
||||
IR = "#ED553B",
|
||||
R = "#ED553B")
|
||||
colours <- replace(original_cols, names(list(...)$colours), list(...)$colours)
|
||||
return(ggplot2::scale_fill_manual(values = colours))
|
||||
}
|
||||
if (identical(unlist(list(...)), FALSE)) {
|
||||
return(invisible())
|
||||
}
|
||||
|
||||
names_susceptible <- c("S", "SI", "IS", "S+I", "I+S", "susceptible", "Susceptible",
|
||||
unique(translations_file[which(translations_file$pattern == "Susceptible"),
|
||||
"replacement", drop = TRUE]))
|
||||
names_incr_exposure <- c("I", "intermediate", "increased exposure", "incr. exposure", "Increased exposure", "Incr. exposure",
|
||||
unique(translations_file[which(translations_file$pattern == "Intermediate"),
|
||||
"replacement", drop = TRUE]),
|
||||
unique(translations_file[which(translations_file$pattern == "Incr. exposure"),
|
||||
"replacement", drop = TRUE]))
|
||||
names_resistant <- c("R", "IR", "RI", "R+I", "I+R", "resistant", "Resistant",
|
||||
unique(translations_file[which(translations_file$pattern == "Resistant"),
|
||||
"replacement", drop = TRUE]))
|
||||
|
||||
susceptible <- rep("#3CAEA3", length(names_susceptible))
|
||||
names(susceptible) <- names_susceptible
|
||||
incr_exposure <- rep("#F6D55C", length(names_incr_exposure))
|
||||
names(incr_exposure) <- names_incr_exposure
|
||||
resistant <- rep("#ED553B", length(names_resistant))
|
||||
names(resistant) <- names_resistant
|
||||
|
||||
original_cols = c(susceptible, incr_exposure, resistant)
|
||||
dots <- c(...)
|
||||
# replace S, I, R as colours: scale_rsi_colours(mydatavalue = "S")
|
||||
dots[dots == "S"] <- "#3CAEA3"
|
||||
dots[dots == "I"] <- "#F6D55C"
|
||||
dots[dots == "R"] <- "#ED553B"
|
||||
cols <- replace(original_cols, names(dots), dots)
|
||||
ggplot2::scale_discrete_manual(aesthetics = aesthetics, values = cols)
|
||||
}
|
||||
|
||||
#' @rdname ggplot_rsi
|
||||
|
42
R/globals.R
@ -23,6 +23,40 @@
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# add new version numbers here, and add the rules themselves to "data-raw/eucast_rules.tsv" and rsi_translation
|
||||
# (sourcing "data-raw/_internals.R" will process the TSV file)
|
||||
EUCAST_VERSION_BREAKPOINTS <- list("11.0" = list(version_txt = "v11.0",
|
||||
year = 2021,
|
||||
title = "'EUCAST Clinical Breakpoint Tables'",
|
||||
url = "https://www.eucast.org/clinical_breakpoints/"),
|
||||
"10.0" = list(version_txt = "v10.0",
|
||||
year = 2020,
|
||||
title = "'EUCAST Clinical Breakpoint Tables'",
|
||||
url = "https://www.eucast.org/ast_of_bacteria/previous_versions_of_documents/"))
|
||||
EUCAST_VERSION_EXPERT_RULES <- list("3.1" = list(version_txt = "v3.1",
|
||||
year = 2016,
|
||||
title = "'EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes'",
|
||||
url = "https://www.eucast.org/expert_rules_and_intrinsic_resistance/"),
|
||||
"3.2" = list(version_txt = "v3.2",
|
||||
year = 2020,
|
||||
title = "'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes'",
|
||||
url = "https://www.eucast.org/expert_rules_and_intrinsic_resistance/"))
|
||||
|
||||
SNOMED_VERSION <- list(title = "Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS)",
|
||||
current_source = "US Edition of SNOMED CT from 1 September 2020",
|
||||
current_version = 12,
|
||||
current_oid = "2.16.840.1.114222.4.11.1009",
|
||||
value_set_name = "Microorganism",
|
||||
url = "https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.1009")
|
||||
|
||||
CATALOGUE_OF_LIFE <- list(
|
||||
year = 2019,
|
||||
version = "Catalogue of Life: {year} Annual Checklist",
|
||||
url_CoL = "http://www.catalogueoflife.org/col/",
|
||||
url_LPSN = "https://lpsn.dsmz.de",
|
||||
yearmonth_LPSN = "March 2021"
|
||||
)
|
||||
|
||||
globalVariables(c(".rowid",
|
||||
"ab",
|
||||
"ab_txt",
|
||||
@ -33,7 +67,10 @@ globalVariables(c(".rowid",
|
||||
"atc_group1",
|
||||
"atc_group2",
|
||||
"code",
|
||||
"cols",
|
||||
"count",
|
||||
"data",
|
||||
"disk",
|
||||
"dosage",
|
||||
"dose",
|
||||
"dose_times",
|
||||
@ -52,6 +89,8 @@ globalVariables(c(".rowid",
|
||||
"language",
|
||||
"lookup",
|
||||
"method",
|
||||
"mic",
|
||||
"mic ",
|
||||
"microorganism",
|
||||
"microorganisms",
|
||||
"microorganisms.codes",
|
||||
@ -67,8 +106,9 @@ globalVariables(c(".rowid",
|
||||
"reference.rule",
|
||||
"reference.rule_group",
|
||||
"reference.version",
|
||||
"rsi_translation",
|
||||
"rowid",
|
||||
"rsi",
|
||||
"rsi_translation",
|
||||
"rule_group",
|
||||
"rule_name",
|
||||
"se_max",
|
||||
|
@ -30,7 +30,7 @@
|
||||
#' @param x a [data.frame]
|
||||
#' @param search_string a text to search `x` for, will be checked with [as.ab()] if this value is not a column in `x`
|
||||
#' @param verbose a logical to indicate whether additional info should be printed
|
||||
#' @param only_rsi_columns a logical to indicate whether only antibiotic columns must be detected that were [transformed to class `<rsi>`]([rsi]) on beforehand (defaults to `FALSE`)
|
||||
#' @param only_rsi_columns a logical to indicate whether only antibiotic columns must be detected that were transformed to class `<rsi>` (see [as.rsi()]) on beforehand (defaults to `FALSE`)
|
||||
#' @details You can look for an antibiotic (trade) name or abbreviation and it will search `x` and the [antibiotics] data set for any column containing a name or code of that antibiotic. **Longer columns names take precedence over shorter column names.**
|
||||
#' @return A column name of `x`, or `NULL` when no result is found.
|
||||
#' @export
|
||||
|
@ -1,203 +0,0 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2021 Berends MS, Luz CF et al. #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
# #
|
||||
# This R package is free software; you can freely use and distribute #
|
||||
# it for both personal and commercial purposes under the terms of the #
|
||||
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
||||
# the Free Software Foundation. #
|
||||
# We created this package for both routine data analysis and academic #
|
||||
# research and it was publicly released in the hope that it will be #
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Create Identifier of an Isolate
|
||||
#'
|
||||
#' This function will paste the microorganism code with all antimicrobial results into one string for each row in a data set. This is useful to compare isolates, e.g. between institutions or regions, when there is no genotyping available.
|
||||
#' @inheritSection lifecycle Experimental Lifecycle
|
||||
#' @inheritParams eucast_rules
|
||||
#' @param cols_ab a character vector of column names of `x`, or (a combination with) an [antibiotic selector function]([ab_class()]), such as [carbapenems()] and [aminoglycosides()]
|
||||
#' @rdname isolate_identifier
|
||||
#' @export
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # automatic selection of microorganism and antibiotics (i.e., all <rsi> columns, see ?as.rsi)
|
||||
#' x <- isolate_identifier(example_isolates)
|
||||
#'
|
||||
#' # ignore microorganism codes, only use antimicrobial results
|
||||
#' x <- isolate_identifier(example_isolates, col_mo = FALSE, cols_ab = c("AMX", "TZP", "GEN", "TOB"))
|
||||
#'
|
||||
#' # select antibiotics from certain antibiotic classes
|
||||
#' x <- isolate_identifier(example_isolates, cols_ab = c(carbapenems(), aminoglycosides()))
|
||||
isolate_identifier <- function(x, col_mo = NULL, cols_ab = NULL) {
|
||||
if (is.null(col_mo)) {
|
||||
col_mo <- search_type_in_df(x, "mo")
|
||||
if (is.null(col_mo)) {
|
||||
# no column found, then ignore the argument
|
||||
col_mo <- FALSE
|
||||
}
|
||||
}
|
||||
|
||||
if (isFALSE(col_mo)) {
|
||||
# is FALSE then ignore mo column
|
||||
x$col_mo <- ""
|
||||
col_mo <- "col_mo"
|
||||
} else if (!is.null(col_mo)) {
|
||||
x[, col_mo] <- paste0(as.mo(x[, col_mo, drop = TRUE]), "|")
|
||||
}
|
||||
|
||||
cols_ab <- deparse(substitute(cols_ab)) # support ab class selectors: isolate_identifier(x, cols_ab = carbapenems())
|
||||
if (identical(cols_ab, "NULL")) {
|
||||
cols_ab <- colnames(x)[vapply(FUN.VALUE = logical(1), x, is.rsi)]
|
||||
} else {
|
||||
cols_ab <- tryCatch(colnames(x[, eval(parse(text = cols_ab), envir = parent.frame())]),
|
||||
# tryCatch adds 4 calls, so total is -5
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
# cope with empty values
|
||||
if (length(cols_ab) == 0 && all(x[, col_mo, drop = TRUE] == "", na.rm = TRUE)) {
|
||||
warning_("in isolate_identifier(): no column with microorganisms and no columns with antimicrobial agents found", call = FALSE)
|
||||
} else if (length(cols_ab) == 0) {
|
||||
warning_("in isolate_identifier(): no columns with antimicrobial agents found", call = FALSE)
|
||||
}
|
||||
|
||||
out <- x[, c(col_mo, cols_ab), drop = FALSE]
|
||||
out <- do.call(paste, c(out, sep = ""))
|
||||
out <- gsub("NA", ".", out, fixed = TRUE)
|
||||
out <- set_clean_class(out, new_class = c("isolate_identifier", "character"))
|
||||
attr(out, "ab") <- cols_ab
|
||||
out
|
||||
}
|
||||
|
||||
#' @method all.equal isolate_identifier
|
||||
#' @inheritParams base::all.equal
|
||||
#' @param ignore_empty_results a logical to indicate whether empty results must be ignored, so that only values R, S and I will be compared
|
||||
#' @rdname isolate_identifier
|
||||
#' @export
|
||||
all.equal.isolate_identifier <- function(target, current, ignore_empty_results = TRUE, ...) {
|
||||
meet_criteria(target, allow_class = "isolate_identifier")
|
||||
meet_criteria(current, allow_class = "isolate_identifier")
|
||||
meet_criteria(ignore_empty_results, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (isTRUE(all.equal.character(target, current))) {
|
||||
return(TRUE)
|
||||
}
|
||||
# vectorise over both target and current
|
||||
if (length(target) > 1 && length(current) == 1) {
|
||||
current <- rep(current, length(target))
|
||||
} else if (length(current) > 1 && length(target) == 1) {
|
||||
target <- rep(target, length(current))
|
||||
}
|
||||
stop_if(length(target) != length(current),
|
||||
"length of `target` and `current` must be the same, or one must be 1")
|
||||
|
||||
get_vector <- function(x) {
|
||||
if (grepl("|", x, fixed = TRUE)) {
|
||||
mo <- gsub("(.*)\\|.*", "\\1", x)
|
||||
} else {
|
||||
mo <- NULL
|
||||
}
|
||||
if (grepl("|", x, fixed = TRUE)) {
|
||||
ab <- gsub(".*\\|(.*)", "\\1", x)
|
||||
} else {
|
||||
ab <- x
|
||||
}
|
||||
ab <- strsplit(ab, "")[[1L]]
|
||||
if (is.null(mo)) {
|
||||
out <- as.character(ab)
|
||||
names(out) <- attributes(x)$ab
|
||||
} else {
|
||||
out <- as.character(c(mo, ab))
|
||||
names(out) <- c("mo", attributes(x)$ab)
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
# run it
|
||||
for (i in seq_len(length(target))) {
|
||||
if (i == 1) {
|
||||
df <- data.frame(object = paste0(c("target[", "current["), i, "]"))
|
||||
}
|
||||
trgt <- get_vector(target[i])
|
||||
crnt <- get_vector(current[i])
|
||||
if (ignore_empty_results == TRUE) {
|
||||
diff <- names(trgt[trgt != crnt & trgt != "." & crnt != "."])
|
||||
} else {
|
||||
diff <- names(trgt[trgt != crnt])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
stop("THIS FUNCTION IS WORK IN PROGRESS AND NOT AVAILABLE IN THIS BETA VERSION")
|
||||
|
||||
}
|
||||
|
||||
#' @method print isolate_identifier
|
||||
#' @export
|
||||
#' @noRd
|
||||
print.isolate_identifier <- function(x, ...) {
|
||||
print(as.character(x), ...)
|
||||
}
|
||||
|
||||
#' @method [ isolate_identifier
|
||||
#' @export
|
||||
#' @noRd
|
||||
"[.isolate_identifier" <- function(x, ...) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(x)
|
||||
y
|
||||
}
|
||||
#' @method [[ isolate_identifier
|
||||
#' @export
|
||||
#' @noRd
|
||||
"[[.isolate_identifier" <- function(x, ...) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(x)
|
||||
y
|
||||
}
|
||||
#' @method [<- isolate_identifier
|
||||
#' @export
|
||||
#' @noRd
|
||||
"[<-.isolate_identifier" <- function(i, j, ..., value) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(i)
|
||||
y
|
||||
}
|
||||
#' @method [[<- isolate_identifier
|
||||
#' @export
|
||||
#' @noRd
|
||||
"[[<-.isolate_identifier" <- function(i, j, ..., value) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(i)
|
||||
y
|
||||
}
|
||||
#' @method c isolate_identifier
|
||||
#' @export
|
||||
#' @noRd
|
||||
c.isolate_identifier <- function(x, ...) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(x)
|
||||
y
|
||||
}
|
||||
|
||||
#' @method unique isolate_identifier
|
||||
#' @export
|
||||
#' @noRd
|
||||
unique.isolate_identifier <- function(x, incomparables = FALSE, ...) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(x)
|
||||
y
|
||||
}
|
@ -27,10 +27,10 @@
|
||||
# NOTE TO SELF: could also have done this with the 'lifecycle' package, but why add a package dependency for such an easy job??
|
||||
###############
|
||||
|
||||
#' Lifecycles of Functions in the `amr` Package
|
||||
#' Lifecycles of Functions in the `AMR` Package
|
||||
#' @name lifecycle
|
||||
#' @rdname lifecycle
|
||||
#' @description Functions in this `AMR` package are categorised using [the lifecycle circle of the Tidyverse as found on www.tidyverse.org/lifecycle](https://www.Tidyverse.org/lifecycle).
|
||||
#' @description Functions in this `AMR` package are categorised using [the lifecycle circle of the Tidyverse as found on www.tidyverse.org/lifecycle](https://lifecycle.r-lib.org/articles/stages.html).
|
||||
#'
|
||||
#' \if{html}{\figure{lifecycle_tidyverse.svg}{options: height=200px style=margin-bottom:5px} \cr}
|
||||
#' This page contains a section for every lifecycle (with text borrowed from the aforementioned Tidyverse website), so they can be used in the manual pages of the functions.
|
||||
|
82
R/like.R
@ -25,7 +25,7 @@
|
||||
|
||||
#' Pattern Matching with Keyboard Shortcut
|
||||
#'
|
||||
#' Convenient wrapper around [grep()] to match a pattern: `x %like% pattern`. It always returns a [`logical`] vector and is always case-insensitive (use `x %like_case% pattern` for case-sensitive matching). Also, `pattern` can be as long as `x` to compare items of each index in both vectors, or they both can have the same length to iterate over all cases.
|
||||
#' Convenient wrapper around [grepl()] to match a pattern: `x %like% pattern`. It always returns a [`logical`] vector and is always case-insensitive (use `x %like_case% pattern` for case-sensitive matching). Also, `pattern` can be as long as `x` to compare items of each index in both vectors, or they both can have the same length to iterate over all cases.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x a character vector where matches are sought, or an object which can be coerced by [as.character()] to a character vector.
|
||||
#' @param pattern a character string containing a regular expression (or [character] string for `fixed = TRUE`) to be matched in the given character vector. Coerced by [as.character()] to a character string if possible. If a [character] vector of length 2 or more is supplied, the first element is used with a warning.
|
||||
@ -43,7 +43,7 @@
|
||||
#'
|
||||
#' Using RStudio? The text `%like%` can also be directly inserted in your code from the Addins menu and can have its own Keyboard Shortcut like `Ctrl+Shift+L` or `Cmd+Shift+L` (see `Tools` > `Modify Keyboard Shortcuts...`).
|
||||
#' @source Idea from the [`like` function from the `data.table` package](https://github.com/Rdatatable/data.table/blob/master/R/like.R)
|
||||
#' @seealso [grep()]
|
||||
#' @seealso [grepl()]
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # simple test
|
||||
@ -53,13 +53,17 @@
|
||||
#' #> TRUE
|
||||
#' b %like% a
|
||||
#' #> FALSE
|
||||
#'
|
||||
#' # also supports multiple patterns, length must be equal to x
|
||||
#'
|
||||
#' # also supports multiple patterns
|
||||
#' a <- c("Test case", "Something different", "Yet another thing")
|
||||
#' b <- c( "case", "diff", "yet")
|
||||
#' a %like% b
|
||||
#' #> TRUE TRUE TRUE
|
||||
#'
|
||||
#' a[1] %like% b
|
||||
#' #> TRUE FALSE FALSE
|
||||
#' a %like% b[1]
|
||||
#' #> TRUE FALSE FALSE
|
||||
#'
|
||||
#' # get isolates whose name start with 'Ent' or 'ent'
|
||||
#' \donttest{
|
||||
#' if (require("dplyr")) {
|
||||
@ -71,7 +75,11 @@ like <- function(x, pattern, ignore.case = TRUE) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(pattern, allow_NA = FALSE)
|
||||
meet_criteria(ignore.case, allow_class = "logical", has_length = 1)
|
||||
|
||||
|
||||
if (all(is.na(x))) {
|
||||
return(rep(FALSE, length(x)))
|
||||
}
|
||||
|
||||
# set to fixed if no regex found
|
||||
fixed <- !any(is_possibly_regex(pattern))
|
||||
if (ignore.case == TRUE) {
|
||||
@ -79,53 +87,25 @@ like <- function(x, pattern, ignore.case = TRUE) {
|
||||
x <- tolower(x)
|
||||
pattern <- tolower(pattern)
|
||||
}
|
||||
|
||||
if (length(pattern) > 1 & length(x) == 1) {
|
||||
x <- rep(x, length(pattern))
|
||||
}
|
||||
|
||||
if (all(is.na(x))) {
|
||||
return(rep(FALSE, length(x)))
|
||||
}
|
||||
|
||||
if (length(pattern) > 1) {
|
||||
res <- vector(length = length(pattern))
|
||||
if (length(x) != length(pattern)) {
|
||||
if (length(x) == 1) {
|
||||
x <- rep(x, length(pattern))
|
||||
}
|
||||
# return TRUE for every 'x' that matches any 'pattern', FALSE otherwise
|
||||
for (i in seq_len(length(res))) {
|
||||
if (is.factor(x[i])) {
|
||||
res[i] <- as.integer(x[i]) %in% grep(pattern[i], levels(x[i]), ignore.case = FALSE, fixed = fixed)
|
||||
} else {
|
||||
res[i] <- grepl(pattern[i], x[i], ignore.case = FALSE, fixed = fixed, perl = !fixed)
|
||||
}
|
||||
}
|
||||
res <- vapply(FUN.VALUE = logical(1), pattern, function(pttrn) grepl(pttrn, x, ignore.case = FALSE, fixed = fixed))
|
||||
res2 <- as.logical(rowSums(res))
|
||||
# get only first item of every hit in pattern
|
||||
res2[duplicated(res)] <- FALSE
|
||||
res2[rowSums(res) == 0] <- NA
|
||||
return(res2)
|
||||
} else {
|
||||
# x and pattern are of same length, so items with each other
|
||||
for (i in seq_len(length(res))) {
|
||||
if (is.factor(x[i])) {
|
||||
res[i] <- as.integer(x[i]) %in% grep(pattern[i], levels(x[i]), ignore.case = FALSE, fixed = fixed, perl = !fixed)
|
||||
} else {
|
||||
res[i] <- grepl(pattern[i], x[i], ignore.case = FALSE, fixed = fixed, perl = !fixed)
|
||||
}
|
||||
}
|
||||
return(res)
|
||||
}
|
||||
}
|
||||
|
||||
# the regular way how grepl works; just one pattern against one or more x
|
||||
|
||||
if (is.factor(x)) {
|
||||
as.integer(x) %in% grep(pattern, levels(x), ignore.case = FALSE, fixed = fixed, perl = !fixed)
|
||||
} else {
|
||||
x <- as.character(x)
|
||||
}
|
||||
|
||||
if (length(pattern) == 1) {
|
||||
grepl(pattern, x, ignore.case = FALSE, fixed = fixed, perl = !fixed)
|
||||
} else {
|
||||
if (length(x) == 1) {
|
||||
x <- rep(x, length(pattern))
|
||||
} else if (length(pattern) != length(x)) {
|
||||
stop_("arguments `x` and `pattern` must be of same length, or either one must be 1")
|
||||
}
|
||||
unlist(
|
||||
Map(f = grepl,
|
||||
pattern,
|
||||
x,
|
||||
MoreArgs = list(ignore.case = FALSE, fixed = fixed, perl = !fixed)),
|
||||
use.names = FALSE)
|
||||
}
|
||||
}
|
||||
|
||||
|
591
R/mic.R
@ -25,13 +25,51 @@
|
||||
|
||||
#' Transform Input to Minimum Inhibitory Concentrations (MIC)
|
||||
#'
|
||||
#' This transforms a vector to a new class [`mic`], which is an ordered [factor] with valid minimum inhibitory concentrations (MIC) as levels. Invalid MIC values will be translated as `NA` with a warning.
|
||||
#' This ransforms vectors to a new class [`mic`], which treats the input as decimal numbers, while maintaining operators (such as ">=") and only allowing valid MIC values known to the field of (medical) microbiology.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @rdname as.mic
|
||||
#' @param x vector
|
||||
#' @param x character or numeric vector
|
||||
#' @param na.rm a logical indicating whether missing values should be removed
|
||||
#' @details To interpret MIC values as RSI values, use [as.rsi()] on MIC values. It supports guidelines from EUCAST and CLSI.
|
||||
#' @return Ordered [factor] with additional class [`mic`]
|
||||
#'
|
||||
#' This class for MIC values is a quite a special data type: formally it is an ordered factor with valid MIC values as factor levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers:
|
||||
#'
|
||||
#' ```
|
||||
#' x <- random_mic(10)
|
||||
#' x
|
||||
#' #> Class <mic>
|
||||
#' #> [1] 16 1 8 8 64 >=128 0.0625 32 32 16
|
||||
#'
|
||||
#' is.factor(x)
|
||||
#' #> [1] TRUE
|
||||
#'
|
||||
#' x[1] * 2
|
||||
#' #> [1] 32
|
||||
#'
|
||||
#' median(x)
|
||||
#' #> [1] 26
|
||||
#' ```
|
||||
#'
|
||||
#' This makes it possible to maintain operators that often come with MIC values, such ">=" and "<=", even when filtering using numeric values in data analysis, e.g.:
|
||||
#'
|
||||
#' ```
|
||||
#' x[x > 4]
|
||||
#' #> Class <mic>
|
||||
#' #> [1] 16 8 8 64 >=128 32 32 16
|
||||
#'
|
||||
#' df <- data.frame(x, hospital = "A")
|
||||
#' subset(df, x > 4) # or with dplyr: df %>% filter(x > 4)
|
||||
#' #> x hospital
|
||||
#' #> 1 16 A
|
||||
#' #> 5 64 A
|
||||
#' #> 6 >=128 A
|
||||
#' #> 8 32 A
|
||||
#' #> 9 32 A
|
||||
#' #> 10 16 A
|
||||
#' ```
|
||||
#'
|
||||
#' The following [generic functions][groupGeneric()] are implemented for the MIC class: `!`, `!=`, `%%`, `%/%`, `&`, `*`, `+`, `-`, `/`, `<`, `<=`, `==`, `>`, `>=`, `^`, `|`, [abs()], [acos()], [acosh()], [all()], [any()], [asin()], [asinh()], [atan()], [atanh()], [ceiling()], [cos()], [cosh()], [cospi()], [cummax()], [cummin()], [cumprod()], [cumsum()], [digamma()], [exp()], [expm1()], [floor()], [gamma()], [lgamma()], [log()], [log1p()], [log2()], [log10()], [max()], [mean()], [min()], [prod()], [range()], [round()], [sign()], [signif()], [sin()], [sinh()], [sinpi()], [sqrt()], [sum()], [tan()], [tanh()], [tanpi()], [trigamma()] and [trunc()]. Some functions of the `stats` package are also implemented: [median()], [quantile()], [mad()], [IQR()], [fivenum()]. Also, [boxplot.stats()] is supported. Since [sd()] and [var()] are non-generic functions, these could not be extended. Use [mad()] as an alternative, or use e.g. `sd(as.numeric(x))` where `x` is your vector of MIC values.
|
||||
#' @return Ordered [factor] with additional class [`mic`], that in mathematical operations acts as decimal numbers. Bare in mind that the outcome of any mathematical operation on MICs will return a numeric value.
|
||||
#' @aliases mic
|
||||
#' @export
|
||||
#' @seealso [as.rsi()]
|
||||
@ -42,6 +80,11 @@
|
||||
#'
|
||||
#' # this can also coerce combined MIC/RSI values:
|
||||
#' as.mic("<=0.002; S") # will return <=0.002
|
||||
#'
|
||||
#' # mathematical processing treats MICs as numeric values
|
||||
#' fivenum(mic_data)
|
||||
#' quantile(mic_data)
|
||||
#' all(mic_data < 512)
|
||||
#'
|
||||
#' # interpret MIC values
|
||||
#' as.rsi(x = as.mic(2),
|
||||
@ -53,16 +96,17 @@
|
||||
#' ab = "AMX",
|
||||
#' guideline = "EUCAST")
|
||||
#'
|
||||
#' # plot MIC values, see ?plot
|
||||
#' plot(mic_data)
|
||||
#' barplot(mic_data)
|
||||
#' plot(mic_data, mo = "E. coli", ab = "cipro")
|
||||
as.mic <- function(x, na.rm = FALSE) {
|
||||
meet_criteria(x, allow_class = c("mic", "character", "numeric", "integer"), allow_NA = TRUE)
|
||||
meet_criteria(x, allow_class = c("mic", "character", "numeric", "integer", "factor"), allow_NA = TRUE)
|
||||
meet_criteria(na.rm, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (is.mic(x)) {
|
||||
x
|
||||
} else {
|
||||
x <- unlist(x)
|
||||
x <- as.character(unlist(x))
|
||||
if (na.rm == TRUE) {
|
||||
x <- x[!is.na(x)]
|
||||
}
|
||||
@ -74,29 +118,29 @@ as.mic <- function(x, na.rm = FALSE) {
|
||||
x <- gsub("\u2264", "<=", x, fixed = TRUE)
|
||||
x <- gsub("\u2265", ">=", x, fixed = TRUE)
|
||||
# remove space between operator and number ("<= 0.002" -> "<=0.002")
|
||||
x <- gsub("(<|=|>) +", "\\1", x)
|
||||
x <- gsub("(<|=|>) +", "\\1", x, perl = TRUE)
|
||||
# transform => to >= and =< to <=
|
||||
x <- gsub("=<", "<=", x, fixed = TRUE)
|
||||
x <- gsub("=>", ">=", x, fixed = TRUE)
|
||||
# dots without a leading zero must start with 0
|
||||
x <- gsub("([^0-9]|^)[.]", "\\10.", x)
|
||||
x <- gsub("([^0-9]|^)[.]", "\\10.", x, perl = TRUE)
|
||||
# values like "<=0.2560.512" should be 0.512
|
||||
x <- gsub(".*[.].*[.]", "0.", x)
|
||||
x <- gsub(".*[.].*[.]", "0.", x, perl = TRUE)
|
||||
# remove ending .0
|
||||
x <- gsub("[.]+0$", "", x)
|
||||
x <- gsub("[.]+0$", "", x, perl = TRUE)
|
||||
# remove all after last digit
|
||||
x <- gsub("[^0-9]+$", "", x)
|
||||
x <- gsub("[^0-9]+$", "", x, perl = TRUE)
|
||||
# keep only one zero before dot
|
||||
x <- gsub("0+[.]", "0.", x)
|
||||
x <- gsub("0+[.]", "0.", x, perl = TRUE)
|
||||
# starting 00 is probably 0.0 if there's no dot yet
|
||||
x[!x %like% "[.]"] <- gsub("^00", "0.0", x[!x %like% "[.]"])
|
||||
# remove last zeroes
|
||||
x <- gsub("([.].?)0+$", "\\1", x)
|
||||
x <- gsub("(.*[.])0+$", "\\10", x)
|
||||
x <- gsub("([.].?)0+$", "\\1", x, perl = TRUE)
|
||||
x <- gsub("(.*[.])0+$", "\\10", x, perl = TRUE)
|
||||
# remove ending .0 again
|
||||
x[x %like% "[.]"] <- gsub("0+$", "", x[x %like% "[.]"])
|
||||
# never end with dot
|
||||
x <- gsub("[.]$", "", x)
|
||||
x <- gsub("[.]$", "", x, perl = TRUE)
|
||||
# force to be character
|
||||
x <- as.character(x)
|
||||
# trim it
|
||||
@ -155,29 +199,31 @@ is.mic <- function(x) {
|
||||
#' @export
|
||||
#' @noRd
|
||||
as.double.mic <- function(x, ...) {
|
||||
as.double(gsub("[<=>]+", "", as.character(x)))
|
||||
as.double(gsub("[<=>]+", "", as.character(x), perl = TRUE))
|
||||
}
|
||||
|
||||
#' @method as.integer mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
as.integer.mic <- function(x, ...) {
|
||||
as.integer(gsub("[<=>]+", "", as.character(x)))
|
||||
as.integer(gsub("[<=>]+", "", as.character(x), perl = TRUE))
|
||||
}
|
||||
|
||||
#' @method as.numeric mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
as.numeric.mic <- function(x, ...) {
|
||||
as.numeric(gsub("[<=>]+", "", as.character(x)))
|
||||
as.numeric(gsub("[<=>]+", "", as.character(x), perl = TRUE))
|
||||
}
|
||||
|
||||
#' @method droplevels mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
droplevels.mic <- function(x, exclude = if (any(is.na(levels(x)))) NULL else NA, ...) {
|
||||
droplevels.mic <- function(x, exclude = if (any(is.na(levels(x)))) NULL else NA, as.mic = TRUE, ...) {
|
||||
x <- droplevels.factor(x, exclude = exclude, ...)
|
||||
class(x) <- c("mic", "ordered", "factor")
|
||||
if (as.mic == TRUE) {
|
||||
class(x) <- c("mic", "ordered", "factor")
|
||||
}
|
||||
x
|
||||
}
|
||||
|
||||
@ -189,6 +235,7 @@ pillar_shaft.mic <- function(x, ...) {
|
||||
out <- pasted
|
||||
out[is.na(x)] <- font_na(NA)
|
||||
out <- gsub("(<|=|>)", font_silver("\\1"), out)
|
||||
out <- gsub("([.]?0+)$", font_white("\\1"), out)
|
||||
create_pillar_column(out, align = "right", width = max(nchar(pasted)))
|
||||
}
|
||||
|
||||
@ -203,70 +250,24 @@ type_sum.mic <- function(x, ...) {
|
||||
print.mic <- function(x, ...) {
|
||||
cat("Class <mic>\n")
|
||||
print(as.character(x), quote = FALSE)
|
||||
att <- attributes(x)
|
||||
if ("na.action" %in% names(att)) {
|
||||
cat(font_silver(paste0("(NA ", class(att$na.action), ": ", paste0(att$na.action, collapse = ", "), ")\n")))
|
||||
}
|
||||
}
|
||||
|
||||
#' @method summary mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
summary.mic <- function(object, ...) {
|
||||
x <- object
|
||||
n_total <- length(x)
|
||||
x <- x[!is.na(x)]
|
||||
n <- length(x)
|
||||
value <- c("Class" = "mic",
|
||||
"<NA>" = n_total - n,
|
||||
"Min." = as.character(sort(x)[1]),
|
||||
"Max." = as.character(sort(x)[n]))
|
||||
class(value) <- c("summaryDefault", "table")
|
||||
value
|
||||
summary(as.double(object), ...)
|
||||
}
|
||||
|
||||
#' @method plot mic
|
||||
#' @method as.matrix mic
|
||||
#' @export
|
||||
#' @importFrom graphics barplot axis
|
||||
#' @rdname plot
|
||||
plot.mic <- function(x,
|
||||
main = paste("MIC values of", deparse(substitute(x))),
|
||||
ylab = "Frequency",
|
||||
xlab = "MIC value",
|
||||
axes = FALSE,
|
||||
...) {
|
||||
meet_criteria(main, allow_class = "character", has_length = 1)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(axes, allow_class = "logical", has_length = 1)
|
||||
|
||||
barplot(table(as.double(x)),
|
||||
ylab = ylab,
|
||||
xlab = xlab,
|
||||
axes = axes,
|
||||
main = main,
|
||||
...)
|
||||
axis(2, seq(0, max(table(as.double(x)))))
|
||||
}
|
||||
|
||||
#' @method barplot mic
|
||||
#' @export
|
||||
#' @importFrom graphics barplot axis
|
||||
#' @rdname plot
|
||||
barplot.mic <- function(height,
|
||||
main = paste("MIC values of", deparse(substitute(height))),
|
||||
ylab = "Frequency",
|
||||
xlab = "MIC value",
|
||||
axes = FALSE,
|
||||
...) {
|
||||
meet_criteria(main, allow_class = "character", has_length = 1)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(axes, allow_class = "logical", has_length = 1)
|
||||
|
||||
barplot(table(as.double(height)),
|
||||
ylab = ylab,
|
||||
xlab = xlab,
|
||||
axes = axes,
|
||||
main = main,
|
||||
...)
|
||||
axis(2, seq(0, max(table(as.double(height)))))
|
||||
#' @noRd
|
||||
as.matrix.mic <- function(x, ...) {
|
||||
as.matrix(as.double(x), ...)
|
||||
}
|
||||
|
||||
#' @method [ mic
|
||||
@ -321,14 +322,446 @@ unique.mic <- function(x, incomparables = FALSE, ...) {
|
||||
y
|
||||
}
|
||||
|
||||
#' @method sort mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
sort.mic <- function(x, decreasing = FALSE, ...) {
|
||||
if (decreasing == TRUE) {
|
||||
ord <- order(-as.double(x))
|
||||
} else {
|
||||
ord <- order(as.double(x))
|
||||
}
|
||||
x[ord]
|
||||
}
|
||||
|
||||
#' @method hist mic
|
||||
#' @importFrom graphics hist
|
||||
#' @export
|
||||
#' @noRd
|
||||
hist.mic <- function(x, ...) {
|
||||
warning_("Use `plot()` or `ggplot()` for optimal plotting of MIC values", call = FALSE)
|
||||
hist(log2(x))
|
||||
}
|
||||
|
||||
# will be exported using s3_register() in R/zzz.R
|
||||
get_skimmers.mic <- function(column) {
|
||||
skimr::sfl(
|
||||
skim_type = "mic",
|
||||
min = ~as.character(sort(stats::na.omit(.))[1]),
|
||||
max = ~as.character(sort(stats::na.omit(.))[length(stats::na.omit(.))]),
|
||||
median = ~as.character(stats::na.omit(.)[as.double(stats::na.omit(.)) == median(as.double(stats::na.omit(.)))])[1],
|
||||
min = ~min(., na.rm = TRUE),
|
||||
max = ~max(., na.rm = TRUE),
|
||||
median = ~stats::median(., na.rm = TRUE),
|
||||
n_unique = ~pm_n_distinct(., na.rm = TRUE),
|
||||
hist_log2 = ~skimr::inline_hist(log2(as.double(stats::na.omit(.))))
|
||||
hist_log2 = ~skimr::inline_hist(log2(stats::na.omit(.)))
|
||||
)
|
||||
}
|
||||
|
||||
# Miscellaneous mathematical functions ------------------------------------
|
||||
|
||||
#' @method mean mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
mean.mic <- function(x, trim = 0, na.rm = FALSE, ...) {
|
||||
mean(as.double(x), trim = trim, na.rm = na.rm, ...)
|
||||
}
|
||||
|
||||
#' @method median mic
|
||||
#' @importFrom stats median
|
||||
#' @export
|
||||
#' @noRd
|
||||
median.mic <- function(x, na.rm = FALSE, ...) {
|
||||
median(as.double(x), na.rm = na.rm, ...)
|
||||
}
|
||||
|
||||
#' @method quantile mic
|
||||
#' @importFrom stats quantile
|
||||
#' @export
|
||||
#' @noRd
|
||||
quantile.mic <- function(x, probs = seq(0, 1, 0.25), na.rm = FALSE,
|
||||
names = TRUE, type = 7, ...) {
|
||||
quantile(as.double(x), probs = probs, na.rm = na.rm, names = names, type = type, ...)
|
||||
}
|
||||
|
||||
# Math (see ?groupGeneric) ----------------------------------------------
|
||||
|
||||
#' @method abs mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
abs.mic <- function(x) {
|
||||
abs(as.double(x))
|
||||
}
|
||||
#' @method sign mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
sign.mic <- function(x) {
|
||||
sign(as.double(x))
|
||||
}
|
||||
#' @method sqrt mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
sqrt.mic <- function(x) {
|
||||
sqrt(as.double(x))
|
||||
}
|
||||
#' @method floor mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
floor.mic <- function(x) {
|
||||
floor(as.double(x))
|
||||
}
|
||||
#' @method ceiling mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
ceiling.mic <- function(x) {
|
||||
ceiling(as.double(x))
|
||||
}
|
||||
#' @method trunc mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
trunc.mic <- function(x, ...) {
|
||||
trunc(as.double(x), ...)
|
||||
}
|
||||
#' @method round mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
round.mic <- function(x, digits = 0) {
|
||||
round(as.double(x), digits = digits)
|
||||
}
|
||||
#' @method signif mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
signif.mic <- function(x, digits = 6) {
|
||||
signif(as.double(x), digits = digits)
|
||||
}
|
||||
#' @method exp mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
exp.mic <- function(x) {
|
||||
exp(as.double(x))
|
||||
}
|
||||
#' @method log mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
log.mic <- function(x, base = exp(1)) {
|
||||
log(as.double(x), base = base)
|
||||
}
|
||||
#' @method log10 mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
log10.mic <- function(x) {
|
||||
log10(as.double(x))
|
||||
}
|
||||
#' @method log2 mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
log2.mic <- function(x) {
|
||||
log2(as.double(x))
|
||||
}
|
||||
#' @method expm1 mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
expm1.mic <- function(x) {
|
||||
expm1(as.double(x))
|
||||
}
|
||||
#' @method log1p mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
log1p.mic <- function(x) {
|
||||
log1p(as.double(x))
|
||||
}
|
||||
#' @method cos mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
cos.mic <- function(x) {
|
||||
cos(as.double(x))
|
||||
}
|
||||
#' @method sin mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
sin.mic <- function(x) {
|
||||
sin(as.double(x))
|
||||
}
|
||||
#' @method tan mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
tan.mic <- function(x) {
|
||||
tan(as.double(x))
|
||||
}
|
||||
#' @method cospi mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
cospi.mic <- function(x) {
|
||||
cospi(as.double(x))
|
||||
}
|
||||
#' @method sinpi mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
sinpi.mic <- function(x) {
|
||||
sinpi(as.double(x))
|
||||
}
|
||||
#' @method tanpi mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
tanpi.mic <- function(x) {
|
||||
tanpi(as.double(x))
|
||||
}
|
||||
#' @method acos mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
acos.mic <- function(x) {
|
||||
acos(as.double(x))
|
||||
}
|
||||
#' @method asin mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
asin.mic <- function(x) {
|
||||
asin(as.double(x))
|
||||
}
|
||||
#' @method atan mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
atan.mic <- function(x) {
|
||||
atan(as.double(x))
|
||||
}
|
||||
#' @method cosh mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
cosh.mic <- function(x) {
|
||||
cosh(as.double(x))
|
||||
}
|
||||
#' @method sinh mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
sinh.mic <- function(x) {
|
||||
sinh(as.double(x))
|
||||
}
|
||||
#' @method tanh mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
tanh.mic <- function(x) {
|
||||
tanh(as.double(x))
|
||||
}
|
||||
#' @method acosh mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
acosh.mic <- function(x) {
|
||||
acosh(as.double(x))
|
||||
}
|
||||
#' @method asinh mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
asinh.mic <- function(x) {
|
||||
asinh(as.double(x))
|
||||
}
|
||||
#' @method atanh mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
atanh.mic <- function(x) {
|
||||
atanh(as.double(x))
|
||||
}
|
||||
#' @method lgamma mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
lgamma.mic <- function(x) {
|
||||
lgamma(as.double(x))
|
||||
}
|
||||
#' @method gamma mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
gamma.mic <- function(x) {
|
||||
gamma(as.double(x))
|
||||
}
|
||||
#' @method digamma mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
digamma.mic <- function(x) {
|
||||
digamma(as.double(x))
|
||||
}
|
||||
#' @method trigamma mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
trigamma.mic <- function(x) {
|
||||
trigamma(as.double(x))
|
||||
}
|
||||
#' @method cumsum mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
cumsum.mic <- function(x) {
|
||||
cumsum(as.double(x))
|
||||
}
|
||||
#' @method cumprod mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
cumprod.mic <- function(x) {
|
||||
cumprod(as.double(x))
|
||||
}
|
||||
#' @method cummax mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
cummax.mic <- function(x) {
|
||||
cummax(as.double(x))
|
||||
}
|
||||
#' @method cummin mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
cummin.mic <- function(x) {
|
||||
cummin(as.double(x))
|
||||
}
|
||||
|
||||
# Ops (see ?groupGeneric) -----------------------------------------------
|
||||
|
||||
|
||||
#' @method + mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`+.mic` <- function(e1, e2) {
|
||||
as.double(e1) + as.double(e2)
|
||||
}
|
||||
|
||||
#' @method - mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`-.mic` <- function(e1, e2) {
|
||||
as.double(e1) - as.double(e2)
|
||||
}
|
||||
|
||||
#' @method * mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`*.mic` <- function(e1, e2) {
|
||||
as.double(e1) * as.double(e2)
|
||||
}
|
||||
|
||||
#' @method / mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`/.mic` <- function(e1, e2) {
|
||||
as.double(e1) / as.double(e2)
|
||||
}
|
||||
|
||||
#' @method ^ mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`^.mic` <- function(e1, e2) {
|
||||
as.double(e1) ^ as.double(e2)
|
||||
}
|
||||
|
||||
#' @method %% mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`%%.mic` <- function(e1, e2) {
|
||||
as.double(e1) %% as.double(e2)
|
||||
}
|
||||
|
||||
#' @method %/% mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`%/%.mic` <- function(e1, e2) {
|
||||
as.double(e1) %/% as.double(e2)
|
||||
}
|
||||
|
||||
#' @method & mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`&.mic` <- function(e1, e2) {
|
||||
as.double(e1) & as.double(e2)
|
||||
}
|
||||
|
||||
#' @method | mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`|.mic` <- function(e1, e2) {
|
||||
as.double(e1) | as.double(e2)
|
||||
}
|
||||
|
||||
#' @method ! mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`!.mic` <- function(x) {
|
||||
!as.double(x)
|
||||
}
|
||||
|
||||
#' @method == mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`==.mic` <- function(e1, e2) {
|
||||
as.double(e1) == as.double(e2)
|
||||
}
|
||||
|
||||
#' @method != mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`!=.mic` <- function(e1, e2) {
|
||||
as.double(e1) != as.double(e2)
|
||||
}
|
||||
|
||||
#' @method < mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`<.mic` <- function(e1, e2) {
|
||||
as.double(e1) < as.double(e2)
|
||||
}
|
||||
|
||||
#' @method <= mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`<=.mic` <- function(e1, e2) {
|
||||
as.double(e1) <= as.double(e2)
|
||||
}
|
||||
|
||||
#' @method >= mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`>=.mic` <- function(e1, e2) {
|
||||
as.double(e1) >= as.double(e2)
|
||||
}
|
||||
|
||||
#' @method > mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
`>.mic` <- function(e1, e2) {
|
||||
as.double(e1) > as.double(e2)
|
||||
}
|
||||
|
||||
# Summary (see ?groupGeneric) -------------------------------------------
|
||||
|
||||
#' @method all mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
all.mic <- function(..., na.rm = FALSE) {
|
||||
all(as.double(c(...)), na.rm = na.rm)
|
||||
}
|
||||
#' @method any mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
any.mic <- function(..., na.rm = FALSE) {
|
||||
any(as.double(c(...)), na.rm = na.rm)
|
||||
}
|
||||
#' @method sum mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
sum.mic <- function(..., na.rm = FALSE) {
|
||||
sum(as.double(c(...)), na.rm = na.rm)
|
||||
}
|
||||
#' @method prod mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
prod.mic <- function(..., na.rm = FALSE) {
|
||||
prod(as.double(c(...)), na.rm = na.rm)
|
||||
}
|
||||
#' @method min mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
min.mic <- function(..., na.rm = FALSE) {
|
||||
min(as.double(c(...)), na.rm = na.rm)
|
||||
}
|
||||
#' @method max mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
max.mic <- function(..., na.rm = FALSE) {
|
||||
max(as.double(c(...)), na.rm = na.rm)
|
||||
}
|
||||
#' @method range mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
range.mic <- function(..., na.rm = FALSE) {
|
||||
range(as.double(c(...)), na.rm = na.rm)
|
||||
}
|
||||
|
40
R/mo.R
@ -106,7 +106,9 @@
|
||||
#' 2. Becker K *et al.* **Implications of identifying the recently defined members of the *S. aureus* complex, *S. argenteus* and *S. schweitzeri*: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS).** 2019. Clin Microbiol Infect; \doi{10.1016/j.cmi.2019.02.028}
|
||||
#' 3. Becker K *et al.* **Emergence of coagulase-negative staphylococci** 2020. Expert Rev Anti Infect Ther. 18(4):349-366; \doi{10.1080/14787210.2020.1730813}
|
||||
#' 4. Lancefield RC **A serological differentiation of human and other groups of hemolytic streptococci**. 1933. J Exp Med. 57(4): 571–95; \doi{10.1084/jem.57.4.571}
|
||||
#' 5. Catalogue of Life: Annual Checklist (public online taxonomic database), <http://www.catalogueoflife.org> (check included annual version with [catalogue_of_life_version()]).
|
||||
#' 5. `r gsub("{year}", CATALOGUE_OF_LIFE$year, CATALOGUE_OF_LIFE$version, fixed = TRUE)`, <http://www.catalogueoflife.org>
|
||||
#' 6. List of Prokaryotic names with Standing in Nomenclature (`r CATALOGUE_OF_LIFE$yearmonth_LPSN`), \doi{10.1099/ijsem.0.004332}
|
||||
#' 7. `r SNOMED_VERSION$current_source`, retrieved from the `r SNOMED_VERSION$title`, OID `r SNOMED_VERSION$current_oid`, version `r SNOMED_VERSION$current_version`; url: <`r SNOMED_VERSION$url`>
|
||||
#' @export
|
||||
#' @return A [character] [vector] with additional class [`mo`]
|
||||
#' @seealso [microorganisms] for the [data.frame] that is being used to determine ID's.
|
||||
@ -463,16 +465,22 @@ exec_as.mo <- function(x,
|
||||
# translate 'unknown' names back to English
|
||||
if (any(x %like% "unbekannt|onbekend|desconocid|sconosciut|iconnu|desconhecid", na.rm = TRUE)) {
|
||||
trns <- subset(translations_file, pattern %like% "unknown" | affect_mo_name == TRUE)
|
||||
lapply(seq_len(nrow(trns)),
|
||||
function(i) x <<- gsub(pattern = trns$replacement[i],
|
||||
replacement = trns$pattern[i],
|
||||
x = x,
|
||||
ignore.case = TRUE,
|
||||
perl = TRUE))
|
||||
langs <- LANGUAGES_SUPPORTED[LANGUAGES_SUPPORTED != "en"]
|
||||
for (l in langs) {
|
||||
for (i in seq_len(nrow(trns))) {
|
||||
if (!is.na(trns[i, l, drop = TRUE])) {
|
||||
x <- gsub(pattern = trns[i, l, drop = TRUE],
|
||||
replacement = trns$pattern[i],
|
||||
x = x,
|
||||
ignore.case = TRUE,
|
||||
perl = TRUE)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x_backup <- x
|
||||
|
||||
|
||||
# from here on case-insensitive
|
||||
x <- tolower(x)
|
||||
|
||||
@ -711,8 +719,8 @@ exec_as.mo <- function(x,
|
||||
}
|
||||
|
||||
# translate known trivial abbreviations to genus + species ----
|
||||
if (toupper(x_backup_without_spp[i]) %in% c("MRSA", "MSSA", "VISA", "VRSA", "BORSA")
|
||||
| x_backup_without_spp[i] %like_case% "(^| )(mrsa|mssa|visa|vrsa|borsa|la-?mrsa|ca-?mrsa)( |$)") {
|
||||
if (toupper(x_backup_without_spp[i]) %in% c("MRSA", "MSSA", "VISA", "VRSA", "BORSA", "GISA")
|
||||
| x_backup_without_spp[i] %like_case% "(^| )(mrsa|mssa|visa|vrsa|borsa|gisa|la-?mrsa|ca-?mrsa)( |$)") {
|
||||
x[i] <- lookup(fullname == "Staphylococcus aureus", uncertainty = -1)
|
||||
next
|
||||
}
|
||||
@ -1468,8 +1476,8 @@ exec_as.mo <- function(x,
|
||||
if (length(uncertainties$input) > 1) {
|
||||
plural <- c("s", "them", "were")
|
||||
}
|
||||
msg <- paste0("Translation to ", nr2char(length(uncertainties$input)), " microorganism", plural[1],
|
||||
" was guessed with uncertainty. Use `mo_uncertainties()` to review ", plural[2], ".")
|
||||
msg <- paste0("Translation is uncertain of ", nr2char(length(uncertainties$input)), " microorganism", plural[1],
|
||||
". Use `mo_uncertainties()` to review ", plural[2], ".")
|
||||
message_(msg)
|
||||
}
|
||||
x[already_known] <- x_known
|
||||
@ -1551,6 +1559,9 @@ exec_as.mo <- function(x,
|
||||
if (property == "mo") {
|
||||
x <- set_clean_class(x, new_class = c("mo", "character"))
|
||||
}
|
||||
|
||||
# keep track of time
|
||||
end_time <- Sys.time()
|
||||
|
||||
if (length(mo_renamed()) > 0) {
|
||||
print(mo_renamed())
|
||||
@ -1571,10 +1582,9 @@ exec_as.mo <- function(x,
|
||||
x <- structure(x, uncertainties = uncertainties)
|
||||
} else {
|
||||
# keep track of time - give some hints to improve speed if it takes a long time
|
||||
end_time <- Sys.time()
|
||||
delta_time <- difftime(end_time, start_time, units = "secs")
|
||||
if (delta_time >= 30) {
|
||||
message_("Using `as.mo()` took ", delta_time, " seconds, which is a long time. Some suggestions to improve speed include:")
|
||||
message_("Using `as.mo()` took ", round(delta_time), " seconds, which is a long time. Some suggestions to improve speed include:")
|
||||
message_(word_wrap("- Try to use as many valid taxonomic names as possible for your input.",
|
||||
extra_indent = 2),
|
||||
as_note = FALSE)
|
||||
@ -1922,7 +1932,7 @@ print.mo_renamed <- function(x, ...) {
|
||||
"",
|
||||
paste0(" (", gsub("et al.", font_italic("et al."), x$old_ref[i]), ")")),
|
||||
" was renamed ",
|
||||
ifelse(as.integer(gsub("[^0-9]", "", x$new_ref[i])) < as.integer(gsub("[^0-9]", "", x$old_ref[i])),
|
||||
ifelse(!x$new_ref[i] %in% c("", NA) && as.integer(gsub("[^0-9]", "", x$new_ref[i])) < as.integer(gsub("[^0-9]", "", x$old_ref[i])),
|
||||
font_bold("back to "),
|
||||
""),
|
||||
font_italic(x$new_name[i]),
|
||||
|
@ -44,7 +44,7 @@
|
||||
#' * \ifelse{html}{\out{<i>p<sub>n</sub></i> is the human pathogenic prevalence group of <i>n</i>, as described below;}}{p_n is the human pathogenic prevalence group of \eqn{n}, as described below;}
|
||||
#' * \ifelse{html}{\out{<i>k<sub>n</sub></i> is the taxonomic kingdom of <i>n</i>, set as Bacteria = 1, Fungi = 2, Protozoa = 3, Archaea = 4, others = 5.}}{l_n is the taxonomic kingdom of \eqn{n}, set as Bacteria = 1, Fungi = 2, Protozoa = 3, Archaea = 4, others = 5.}
|
||||
#'
|
||||
#' The grouping into human pathogenic prevalence (\eqn{p}) is based on experience from several microbiological laboratories in the Netherlands in conjunction with international reports on pathogen prevalence. **Group 1** (most prevalent microorganisms) consists of all microorganisms where the taxonomic class is Gammaproteobacteria or where the taxonomic genus is *Enterococcus*, *Staphylococcus* or *Streptococcus*. This group consequently contains all common Gram-negative bacteria, such as *Pseudomonas* and *Legionella* and all species within the order Enterobacterales. **Group 2** consists of all microorganisms where the taxonomic phylum is Proteobacteria, Firmicutes, Actinobacteria or Sarcomastigophora, or where the taxonomic genus is *Absidia*, *Acremonium*, *Actinotignum*, *Alternaria*, *Anaerosalibacter*, *Apophysomyces*, *Arachnia*, *Aspergillus*, *Aureobacterium*, *Aureobasidium*, *Bacteroides*, *Basidiobolus*, *Beauveria*, *Blastocystis*, *Branhamella*, *Calymmatobacterium*, *Candida*, *Capnocytophaga*, *Catabacter*, *Chaetomium*, *Chryseobacterium*, *Chryseomonas*, *Chrysonilia*, *Cladophialophora*, *Cladosporium*, *Conidiobolus*, *Cryptococcus*, *Curvularia*, *Exophiala*, *Exserohilum*, *Flavobacterium*, *Fonsecaea*, *Fusarium*, *Fusobacterium*, *Hendersonula*, *Hypomyces*, *Koserella*, *Lelliottia*, *Leptosphaeria*, *Leptotrichia*, *Malassezia*, *Malbranchea*, *Mortierella*, *Mucor*, *Mycocentrospora*, *Mycoplasma*, *Nectria*, *Ochroconis*, *Oidiodendron*, *Phoma*, *Piedraia*, *Pithomyces*, *Pityrosporum*, *Prevotella*,\\*Pseudallescheria*, *Rhizomucor*, *Rhizopus*, *Rhodotorula*, *Scolecobasidium*, *Scopulariopsis*, *Scytalidium*,*Sporobolomyces*, *Stachybotrys*, *Stomatococcus*, *Treponema*, *Trichoderma*, *Trichophyton*, *Trichosporon*, *Tritirachium* or *Ureaplasma*. **Group 3** consists of all other microorganisms.
|
||||
#' The grouping into human pathogenic prevalence (\eqn{p}) is based on experience from several microbiological laboratories in the Netherlands in conjunction with international reports on pathogen prevalence. **Group 1** (most prevalent microorganisms) consists of all microorganisms where the taxonomic class is Gammaproteobacteria or where the taxonomic genus is *Enterococcus*, *Staphylococcus* or *Streptococcus*. This group consequently contains all common Gram-negative bacteria, such as *Pseudomonas* and *Legionella* and all species within the order Enterobacterales. **Group 2** consists of all microorganisms where the taxonomic phylum is Proteobacteria, Firmicutes, Actinobacteria or Sarcomastigophora, or where the taxonomic genus is *Absidia*, *Acremonium*, *Actinotignum*, *Alternaria*, *Anaerosalibacter*, *Apophysomyces*, *Arachnia*, *Aspergillus*, *Aureobacterium*, *Aureobasidium*, *Bacteroides*, *Basidiobolus*, *Beauveria*, *Blastocystis*, *Branhamella*, *Calymmatobacterium*, *Candida*, *Capnocytophaga*, *Catabacter*, *Chaetomium*, *Chryseobacterium*, *Chryseomonas*, *Chrysonilia*, *Cladophialophora*, *Cladosporium*, *Conidiobolus*, *Cryptococcus*, *Curvularia*, *Exophiala*, *Exserohilum*, *Flavobacterium*, *Fonsecaea*, *Fusarium*, *Fusobacterium*, *Hendersonula*, *Hypomyces*, *Koserella*, *Lelliottia*, *Leptosphaeria*, *Leptotrichia*, *Malassezia*, *Malbranchea*, *Mortierella*, *Mucor*, *Mycocentrospora*, *Mycoplasma*, *Nectria*, *Ochroconis*, *Oidiodendron*, *Phoma*, *Piedraia*, *Pithomyces*, *Pityrosporum*, *Prevotella*, *Pseudallescheria*, *Rhizomucor*, *Rhizopus*, *Rhodotorula*, *Scolecobasidium*, *Scopulariopsis*, *Scytalidium*,*Sporobolomyces*, *Stachybotrys*, *Stomatococcus*, *Treponema*, *Trichoderma*, *Trichophyton*, *Trichosporon*, *Tritirachium* or *Ureaplasma*. **Group 3** consists of all other microorganisms.
|
||||
#'
|
||||
#' All matches are sorted descending on their matching score and for all user input values, the top match will be returned. This will lead to the effect that e.g., `"E. coli"` will return the microbial ID of *Escherichia coli* (\eqn{m = `r round(mo_matching_score("E. coli", "Escherichia coli"), 3)`}, a highly prevalent microorganism found in humans) and not *Entamoeba coli* (\eqn{m = `r round(mo_matching_score("E. coli", "Entamoeba coli"), 3)`}, a less prevalent microorganism in humans), although the latter would alphabetically come first.
|
||||
#' @export
|
||||
|
@ -51,6 +51,8 @@
|
||||
#' All output [will be translated][translate] where possible.
|
||||
#'
|
||||
#' The function [mo_url()] will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.
|
||||
#'
|
||||
#' SNOMED codes - [mo_snomed()] - are from the `r SNOMED_VERSION$current_source`. See the [microorganisms] data set for more info.
|
||||
#' @inheritSection mo_matching_score Matching Score for Microorganisms
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' @inheritSection as.mo Source
|
||||
@ -60,7 +62,7 @@
|
||||
#' - An [integer] in case of [mo_year()]
|
||||
#' - A [list] in case of [mo_taxonomy()] and [mo_info()]
|
||||
#' - A named [character] in case of [mo_url()]
|
||||
#' - A [double] in case of [mo_snomed()]
|
||||
#' - A [numeric] in case of [mo_snomed()]
|
||||
#' - A [character] in all other cases
|
||||
#' @export
|
||||
#' @seealso [microorganisms]
|
||||
@ -161,7 +163,8 @@
|
||||
#'
|
||||
#' # get a list with the complete taxonomy (from kingdom to subspecies)
|
||||
#' mo_taxonomy("E. coli")
|
||||
#' # get a list with the taxonomy, the authors, Gram-stain and URL to the online database
|
||||
#' # get a list with the taxonomy, the authors, Gram-stain,
|
||||
#' # SNOMED codes, and URL to the online database
|
||||
#' mo_info("E. coli")
|
||||
#' }
|
||||
mo_name <- function(x, language = get_locale(), ...) {
|
||||
@ -629,7 +632,8 @@ mo_info <- function(x, language = get_locale(), ...) {
|
||||
list(synonyms = mo_synonyms(y),
|
||||
gramstain = mo_gramstain(y, language = language),
|
||||
url = unname(mo_url(y, open = FALSE)),
|
||||
ref = mo_ref(y))))
|
||||
ref = mo_ref(y),
|
||||
snomed = unlist(mo_snomed(y)))))
|
||||
if (length(info) > 1) {
|
||||
names(info) <- mo_name(x)
|
||||
result <- info
|
||||
@ -659,11 +663,21 @@ mo_url <- function(x, open = FALSE, language = get_locale(), ...) {
|
||||
df <- data.frame(mo, stringsAsFactors = FALSE) %pm>%
|
||||
pm_left_join(pm_select(microorganisms, mo, source, species_id), by = "mo")
|
||||
df$url <- ifelse(df$source == "CoL",
|
||||
paste0(catalogue_of_life$url_CoL, "details/species/id/", df$species_id, "/"),
|
||||
ifelse(df$source == "DSMZ",
|
||||
paste0(catalogue_of_life$url_DSMZ, "/advanced_search?adv[taxon-name]=", gsub(" ", "+", mo_names), "/"),
|
||||
NA_character_))
|
||||
paste0(CATALOGUE_OF_LIFE$url_CoL, "details/species/id/", df$species_id, "/"),
|
||||
NA_character_)
|
||||
u <- df$url
|
||||
u[mo_kingdom(mo) == "Bacteria"] <- paste0(CATALOGUE_OF_LIFE$url_LPSN, "/species/", gsub(" ", "-", tolower(mo_names), fixed = TRUE))
|
||||
u[mo_kingdom(mo) == "Bacteria" & mo_rank(mo) == "genus"] <- gsub("/species/",
|
||||
"/genus/",
|
||||
u[mo_kingdom(mo) == "Bacteria" & mo_rank(mo) == "genus"],
|
||||
fixed = TRUE)
|
||||
u[mo_kingdom(mo) == "Bacteria" &
|
||||
mo_rank(mo) %in% c("subsp.", "infraspecies")] <- gsub("/species/",
|
||||
"/subspecies/",
|
||||
u[mo_kingdom(mo) == "Bacteria" &
|
||||
mo_rank(mo) %in% c("subsp.", "infraspecies")],
|
||||
fixed = TRUE)
|
||||
|
||||
names(u) <- mo_names
|
||||
|
||||
if (open == TRUE) {
|
||||
|
2
R/pca.R
@ -26,7 +26,7 @@
|
||||
#' Principal Component Analysis (for AMR)
|
||||
#'
|
||||
#' Performs a principal component analysis (PCA) based on a data set with automatic determination for afterwards plotting the groups and labels, and automatic filtering on only suitable (i.e. non-empty and numeric) variables.
|
||||
#' @inheritSection lifecycle Maturing Lifecycle
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x a [data.frame] containing numeric columns
|
||||
#' @param ... columns of `x` to be selected for PCA, can be unquoted since it supports quasiquotation.
|
||||
#' @inheritParams stats::prcomp
|
||||
|
660
R/plot.R
Normal file
@ -0,0 +1,660 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2021 Berends MS, Luz CF et al. #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
# #
|
||||
# This R package is free software; you can freely use and distribute #
|
||||
# it for both personal and commercial purposes under the terms of the #
|
||||
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
||||
# the Free Software Foundation. #
|
||||
# We created this package for both routine data analysis and academic #
|
||||
# research and it was publicly released in the hope that it will be #
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Plotting for Classes `rsi`, `mic` and `disk`
|
||||
#'
|
||||
#' Functions to plot classes `rsi`, `mic` and `disk`, with support for base R and `ggplot2`.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @param x,data MIC values created with [as.mic()] or disk diffusion values created with [as.disk()]
|
||||
#' @param mapping aesthetic mappings to use for [`ggplot()`][ggplot2::ggplot()]
|
||||
#' @param main,title title of the plot
|
||||
#' @param xlab,ylab axis title
|
||||
#' @param mo any (vector of) text that can be coerced to a valid microorganism code with [as.mo()]
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antimicrobial code with [as.ab()]
|
||||
#' @param guideline interpretation guideline to use, defaults to the latest included EUCAST guideline, see *Details*
|
||||
#' @param colours_RSI colours to use for filling in the bars, must be a vector of three values (in the order R, S and I). The default colours are colour-blind friendly.
|
||||
#' @param language language to be used to translate 'Susceptible', 'Increased exposure'/'Intermediate' and 'Resistant', defaults to system language (see [get_locale()]) and can be overwritten by setting the option `AMR_locale`, e.g. `options(AMR_locale = "de")`, see [translate]. Use `language = NULL` or `language = ""` to prevent translation.
|
||||
#' @param expand logical to indicate whether the range on the x axis should be expanded between the lowest and highest value. For MIC values, intermediate values will be factors of 2 starting from the highest MIC value. For disk diameters, the whole diameter range will be filled.
|
||||
#' @details
|
||||
#' The interpretation of "I" will be named "Increased exposure" for all EUCAST guidelines since 2019, and will be named "Intermediate" in all other cases.
|
||||
#'
|
||||
#' For interpreting MIC values as well as disk diffusion diameters, supported guidelines to be used as input for the `guideline` argument are: `r vector_and(AMR::rsi_translation$guideline, quotes = TRUE, reverse = TRUE)`.
|
||||
#'
|
||||
#' Simply using `"CLSI"` or `"EUCAST"` as input will automatically select the latest version of that guideline.
|
||||
#' @name plot
|
||||
#' @rdname plot
|
||||
#' @return The `ggplot` functions return a [`ggplot`][ggplot2::ggplot()] model that is extendible with any `ggplot2` function.
|
||||
#' @param ... arguments passed on to [as.rsi()]
|
||||
#' @examples
|
||||
#' some_mic_values <- random_mic(size = 100)
|
||||
#' some_disk_values <- random_disk(size = 100, mo = "Escherichia coli", ab = "cipro")
|
||||
#' some_rsi_values <- random_rsi(50, prob_RSI = c(0.30, 0.55, 0.05))
|
||||
#'
|
||||
#' plot(some_mic_values)
|
||||
#' plot(some_disk_values)
|
||||
#' plot(some_rsi_values)
|
||||
#'
|
||||
#' # when providing the microorganism and antibiotic, colours will show interpretations:
|
||||
#' plot(some_mic_values, mo = "S. aureus", ab = "ampicillin")
|
||||
#' plot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
|
||||
#'
|
||||
#' if (require("ggplot2")) {
|
||||
#' ggplot(some_mic_values)
|
||||
#' ggplot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
|
||||
#' ggplot(some_rsi_values)
|
||||
#' }
|
||||
NULL
|
||||
|
||||
#' @method plot mic
|
||||
#' @importFrom graphics barplot axis mtext legend
|
||||
#' @export
|
||||
#' @rdname plot
|
||||
plot.mic <- function(x,
|
||||
main = paste("MIC values of", deparse(substitute(x))),
|
||||
ylab = "Frequency",
|
||||
xlab = "Minimum Inhibitory Concentration (mg/L)",
|
||||
mo = NULL,
|
||||
ab = NULL,
|
||||
guideline = "EUCAST",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
language = get_locale(),
|
||||
expand = TRUE,
|
||||
...) {
|
||||
meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (length(colours_RSI) == 1) {
|
||||
colours_RSI <- rep(colours_RSI, 3)
|
||||
}
|
||||
main <- gsub(" +", " ", paste0(main, collapse = " "))
|
||||
|
||||
x <- plot_prepare_table(x, expand = expand)
|
||||
|
||||
cols_sub <- plot_colours_subtitle_guideline(x = x,
|
||||
mo = mo,
|
||||
ab = ab,
|
||||
guideline = guideline,
|
||||
colours_RSI = colours_RSI,
|
||||
fn = as.mic,
|
||||
language = language,
|
||||
...)
|
||||
barplot(x,
|
||||
col = cols_sub$cols,
|
||||
main = main,
|
||||
ylim = c(0, max(x) * ifelse(any(colours_RSI %in% cols_sub$cols), 1.1, 1)),
|
||||
ylab = ylab,
|
||||
xlab = xlab,
|
||||
axes = FALSE)
|
||||
axis(2, seq(0, max(x)))
|
||||
if (!is.null(cols_sub$sub)) {
|
||||
mtext(side = 3, line = 0.5, adj = 0.5, cex = 0.75, cols_sub$sub)
|
||||
}
|
||||
|
||||
if (any(colours_RSI %in% cols_sub$cols)) {
|
||||
legend_txt <- character(0)
|
||||
legend_col <- character(0)
|
||||
if (any(cols_sub$cols == colours_RSI[2] & cols_sub$count > 0)) {
|
||||
legend_txt <- "Susceptible"
|
||||
legend_col <- colours_RSI[2]
|
||||
}
|
||||
if (any(cols_sub$cols == colours_RSI[3] & cols_sub$count > 0)) {
|
||||
legend_txt <- c(legend_txt, plot_name_of_I(cols_sub$guideline))
|
||||
legend_col <- c(legend_col, colours_RSI[3])
|
||||
}
|
||||
if (any(cols_sub$cols == colours_RSI[1] & cols_sub$count > 0)) {
|
||||
legend_txt <- c(legend_txt, "Resistant")
|
||||
legend_col <- c(legend_col, colours_RSI[1])
|
||||
}
|
||||
legend("top",
|
||||
x.intersp = 0.5,
|
||||
legend = translate_AMR(legend_txt, language = language),
|
||||
fill = legend_col,
|
||||
horiz = TRUE,
|
||||
cex = 0.75,
|
||||
box.lwd = 0,
|
||||
bg = "#FFFFFF55")
|
||||
}
|
||||
}
|
||||
|
||||
#' @method barplot mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
barplot.mic <- function(height,
|
||||
main = paste("MIC values of", deparse(substitute(height))),
|
||||
ylab = "Frequency",
|
||||
xlab = "Minimum Inhibitory Concentration (mg/L)",
|
||||
mo = NULL,
|
||||
ab = NULL,
|
||||
guideline = "EUCAST",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
language = get_locale(),
|
||||
expand = TRUE,
|
||||
...) {
|
||||
meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
main <- gsub(" +", " ", paste0(main, collapse = " "))
|
||||
|
||||
plot(x = height,
|
||||
main = main,
|
||||
ylab = ylab,
|
||||
xlab = xlab,
|
||||
mo = mo,
|
||||
ab = ab,
|
||||
guideline = guideline,
|
||||
colours_RSI = colours_RSI,
|
||||
...)
|
||||
}
|
||||
|
||||
#' @method ggplot mic
|
||||
#' @rdname plot
|
||||
# will be exported using s3_register() in R/zzz.R
|
||||
ggplot.mic <- function(data,
|
||||
mapping = NULL,
|
||||
title = paste("MIC values of", deparse(substitute(data))),
|
||||
ylab = "Frequency",
|
||||
xlab = "Minimum Inhibitory Concentration (mg/L)",
|
||||
mo = NULL,
|
||||
ab = NULL,
|
||||
guideline = "EUCAST",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
language = get_locale(),
|
||||
expand = TRUE,
|
||||
...) {
|
||||
stop_ifnot_installed("ggplot2")
|
||||
meet_criteria(title, allow_class = "character", allow_NULL = TRUE)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
if ("main" %in% names(list(...))) {
|
||||
title <- list(...)$main
|
||||
}
|
||||
if (!is.null(title)) {
|
||||
title <- gsub(" +", " ", paste0(title, collapse = " "))
|
||||
}
|
||||
|
||||
x <- plot_prepare_table(data, expand = expand)
|
||||
cols_sub <- plot_colours_subtitle_guideline(x = x,
|
||||
mo = mo,
|
||||
ab = ab,
|
||||
guideline = guideline,
|
||||
colours_RSI = colours_RSI,
|
||||
fn = as.mic,
|
||||
language = language,
|
||||
...)
|
||||
df <- as.data.frame(x, stringsAsFactors = TRUE)
|
||||
colnames(df) <- c("mic", "count")
|
||||
df$cols <- cols_sub$cols
|
||||
df$cols[df$cols == colours_RSI[1]] <- "Resistant"
|
||||
df$cols[df$cols == colours_RSI[2]] <- "Susceptible"
|
||||
df$cols[df$cols == colours_RSI[3]] <- plot_name_of_I(cols_sub$guideline)
|
||||
df$cols <- factor(translate_AMR(df$cols, language = language),
|
||||
levels = translate_AMR(c("Susceptible", plot_name_of_I(cols_sub$guideline), "Resistant"),
|
||||
language = language),
|
||||
ordered = TRUE)
|
||||
if (!is.null(mapping)) {
|
||||
p <- ggplot2::ggplot(df, mapping = mapping)
|
||||
} else {
|
||||
p <- ggplot2::ggplot(df)
|
||||
}
|
||||
|
||||
if (any(colours_RSI %in% cols_sub$cols)) {
|
||||
vals <- c("Resistant" = colours_RSI[1],
|
||||
"Susceptible" = colours_RSI[2],
|
||||
"Incr. exposure" = colours_RSI[3],
|
||||
"Intermediate" = colours_RSI[3])
|
||||
names(vals) <- translate_AMR(names(vals), language = language)
|
||||
p <- p +
|
||||
ggplot2::geom_col(ggplot2::aes(x = mic, y = count, fill = cols)) +
|
||||
ggplot2::scale_fill_manual(values = vals,
|
||||
name = NULL)
|
||||
} else {
|
||||
p <- p +
|
||||
ggplot2::geom_col(ggplot2::aes(x = mic, y = count))
|
||||
}
|
||||
|
||||
p +
|
||||
ggplot2::labs(title = title, x = xlab, y = ylab, subtitle = cols_sub$sub)
|
||||
}
|
||||
|
||||
#' @method plot disk
|
||||
#' @export
|
||||
#' @importFrom graphics barplot axis mtext legend
|
||||
#' @rdname plot
|
||||
plot.disk <- function(x,
|
||||
main = paste("Disk zones of", deparse(substitute(x))),
|
||||
ylab = "Frequency",
|
||||
xlab = "Disk diffusion diameter (mm)",
|
||||
mo = NULL,
|
||||
ab = NULL,
|
||||
guideline = "EUCAST",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
language = get_locale(),
|
||||
expand = TRUE,
|
||||
...) {
|
||||
meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (length(colours_RSI) == 1) {
|
||||
colours_RSI <- rep(colours_RSI, 3)
|
||||
}
|
||||
main <- gsub(" +", " ", paste0(main, collapse = " "))
|
||||
|
||||
x <- plot_prepare_table(x, expand = expand)
|
||||
|
||||
cols_sub <- plot_colours_subtitle_guideline(x = x,
|
||||
mo = mo,
|
||||
ab = ab,
|
||||
guideline = guideline,
|
||||
colours_RSI = colours_RSI,
|
||||
fn = as.disk,
|
||||
language = language,
|
||||
...)
|
||||
|
||||
barplot(x,
|
||||
col = cols_sub$cols,
|
||||
main = main,
|
||||
ylim = c(0, max(x) * ifelse(any(colours_RSI %in% cols_sub$cols), 1.1, 1)),
|
||||
ylab = ylab,
|
||||
xlab = xlab,
|
||||
axes = FALSE)
|
||||
axis(2, seq(0, max(x)))
|
||||
if (!is.null(cols_sub$sub)) {
|
||||
mtext(side = 3, line = 0.5, adj = 0.5, cex = 0.75, cols_sub$sub)
|
||||
}
|
||||
|
||||
if (any(colours_RSI %in% cols_sub$cols)) {
|
||||
legend_txt <- character(0)
|
||||
legend_col <- character(0)
|
||||
if (any(cols_sub$cols == colours_RSI[1] & cols_sub$count > 0)) {
|
||||
legend_txt <- "Resistant"
|
||||
legend_col <- colours_RSI[1]
|
||||
}
|
||||
if (any(cols_sub$cols == colours_RSI[3] & cols_sub$count > 0)) {
|
||||
legend_txt <- c(legend_txt, plot_name_of_I(cols_sub$guideline))
|
||||
legend_col <- c(legend_col, colours_RSI[3])
|
||||
}
|
||||
if (any(cols_sub$cols == colours_RSI[2] & cols_sub$count > 0)) {
|
||||
legend_txt <- c(legend_txt, "Susceptible")
|
||||
legend_col <- c(legend_col, colours_RSI[2])
|
||||
}
|
||||
legend("top",
|
||||
x.intersp = 0.5,
|
||||
legend = translate_AMR(legend_txt, language = language),
|
||||
fill = legend_col,
|
||||
horiz = TRUE,
|
||||
cex = 0.75,
|
||||
box.lwd = 0,
|
||||
bg = "#FFFFFF55")
|
||||
}
|
||||
}
|
||||
|
||||
#' @method barplot disk
|
||||
#' @export
|
||||
#' @noRd
|
||||
barplot.disk <- function(height,
|
||||
main = paste("Disk zones of", deparse(substitute(height))),
|
||||
ylab = "Frequency",
|
||||
xlab = "Disk diffusion diameter (mm)",
|
||||
mo = NULL,
|
||||
ab = NULL,
|
||||
guideline = "EUCAST",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
language = get_locale(),
|
||||
expand = TRUE,
|
||||
...) {
|
||||
meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
main <- gsub(" +", " ", paste0(main, collapse = " "))
|
||||
|
||||
plot(x = height,
|
||||
main = main,
|
||||
ylab = ylab,
|
||||
xlab = xlab,
|
||||
mo = mo,
|
||||
ab = ab,
|
||||
guideline = guideline,
|
||||
colours_RSI = colours_RSI,
|
||||
...)
|
||||
}
|
||||
|
||||
#' @method ggplot disk
|
||||
#' @rdname plot
|
||||
# will be exported using s3_register() in R/zzz.R
|
||||
ggplot.disk <- function(data,
|
||||
mapping = NULL,
|
||||
title = paste("Disk zones of", deparse(substitute(data))),
|
||||
ylab = "Frequency",
|
||||
xlab = "Disk diffusion diameter (mm)",
|
||||
mo = NULL,
|
||||
ab = NULL,
|
||||
guideline = "EUCAST",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
language = get_locale(),
|
||||
expand = TRUE,
|
||||
...) {
|
||||
stop_ifnot_installed("ggplot2")
|
||||
meet_criteria(title, allow_class = "character", allow_NULL = TRUE)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
if ("main" %in% names(list(...))) {
|
||||
title <- list(...)$main
|
||||
}
|
||||
if (!is.null(title)) {
|
||||
title <- gsub(" +", " ", paste0(title, collapse = " "))
|
||||
}
|
||||
|
||||
x <- plot_prepare_table(data, expand = expand)
|
||||
cols_sub <- plot_colours_subtitle_guideline(x = x,
|
||||
mo = mo,
|
||||
ab = ab,
|
||||
guideline = guideline,
|
||||
colours_RSI = colours_RSI,
|
||||
fn = as.disk,
|
||||
language = language,
|
||||
...)
|
||||
df <- as.data.frame(x, stringsAsFactors = TRUE)
|
||||
colnames(df) <- c("disk", "count")
|
||||
df$cols <- cols_sub$cols
|
||||
|
||||
df$cols[df$cols == colours_RSI[1]] <- "Resistant"
|
||||
df$cols[df$cols == colours_RSI[2]] <- "Susceptible"
|
||||
df$cols[df$cols == colours_RSI[3]] <- plot_name_of_I(cols_sub$guideline)
|
||||
df$cols <- factor(translate_AMR(df$cols, language = language),
|
||||
levels = translate_AMR(c("Susceptible", plot_name_of_I(cols_sub$guideline), "Resistant"),
|
||||
language = language),
|
||||
ordered = TRUE)
|
||||
if (!is.null(mapping)) {
|
||||
p <- ggplot2::ggplot(df, mapping = mapping)
|
||||
} else {
|
||||
p <- ggplot2::ggplot(df)
|
||||
}
|
||||
|
||||
if (any(colours_RSI %in% cols_sub$cols)) {
|
||||
vals <- c("Resistant" = colours_RSI[1],
|
||||
"Susceptible" = colours_RSI[2],
|
||||
"Incr. exposure" = colours_RSI[3],
|
||||
"Intermediate" = colours_RSI[3])
|
||||
names(vals) <- translate_AMR(names(vals), language = language)
|
||||
p <- p +
|
||||
ggplot2::geom_col(ggplot2::aes(x = disk, y = count, fill = cols)) +
|
||||
ggplot2::scale_fill_manual(values = vals,
|
||||
name = NULL)
|
||||
} else {
|
||||
p <- p +
|
||||
ggplot2::geom_col(ggplot2::aes(x = disk, y = count))
|
||||
}
|
||||
|
||||
p +
|
||||
ggplot2::labs(title = title, x = xlab, y = ylab, subtitle = cols_sub$sub)
|
||||
}
|
||||
|
||||
plot_prepare_table <- function(x, expand) {
|
||||
if (is.mic(x)) {
|
||||
if (expand == TRUE) {
|
||||
# expand range for MIC by adding factors of 2 from lowest to highest so all MICs in between also print
|
||||
extra_range <- max(x) / 2
|
||||
while (min(extra_range) / 2 > min(x)) {
|
||||
extra_range <- c(min(extra_range) / 2, extra_range)
|
||||
}
|
||||
nms <- extra_range
|
||||
extra_range <- rep(0, length(extra_range))
|
||||
names(extra_range) <- nms
|
||||
x <- table(droplevels(x, as.mic = FALSE))
|
||||
extra_range <- extra_range[!names(extra_range) %in% names(x)]
|
||||
x <- as.table(c(x, extra_range))
|
||||
} else {
|
||||
x <- table(droplevels(x, as.mic = FALSE))
|
||||
}
|
||||
x <- x[order(as.double(as.mic(names(x))))]
|
||||
} else if (is.disk(x)) {
|
||||
if (expand == TRUE) {
|
||||
# expand range for disks from lowest to highest so all mm's in between also print
|
||||
extra_range <- rep(0, max(x) - min(x) - 1)
|
||||
names(extra_range) <- seq(min(x) + 1, max(x) - 1)
|
||||
x <- table(x)
|
||||
extra_range <- extra_range[!names(extra_range) %in% names(x)]
|
||||
x <- as.table(c(x, extra_range))
|
||||
} else {
|
||||
x <- table(x)
|
||||
}
|
||||
x <- x[order(as.double(names(x)))]
|
||||
}
|
||||
as.table(x)
|
||||
}
|
||||
|
||||
plot_name_of_I <- function(guideline) {
|
||||
if (!guideline %like% "CLSI" && as.double(gsub("[^0-9]+", "", guideline)) >= 2019) {
|
||||
# interpretation since 2019
|
||||
"Incr. exposure"
|
||||
} else {
|
||||
# interpretation until 2019
|
||||
"Intermediate"
|
||||
}
|
||||
}
|
||||
|
||||
plot_colours_subtitle_guideline <- function(x, mo, ab, guideline, colours_RSI, fn, language, ...) {
|
||||
guideline <- get_guideline(guideline, AMR::rsi_translation)
|
||||
if (!is.null(mo) && !is.null(ab)) {
|
||||
# interpret and give colour based on MIC values
|
||||
mo <- as.mo(mo)
|
||||
ab <- as.ab(ab)
|
||||
rsi <- suppressWarnings(suppressMessages(as.rsi(fn(names(x)), mo = mo, ab = ab, guideline = guideline, ...)))
|
||||
cols <- character(length = length(rsi))
|
||||
cols[is.na(rsi)] <- "#BEBEBE"
|
||||
cols[rsi == "R"] <- colours_RSI[1]
|
||||
cols[rsi == "S"] <- colours_RSI[2]
|
||||
cols[rsi == "I"] <- colours_RSI[3]
|
||||
moname <- mo_name(mo, language = language)
|
||||
abname <- ab_name(ab, language = language)
|
||||
if (all(cols == "#BEBEBE")) {
|
||||
message_("No ", guideline, " interpretations found for ",
|
||||
ab_name(ab, language = NULL, tolower = TRUE), " in ", moname)
|
||||
guideline_txt <- ""
|
||||
} else {
|
||||
guideline_txt <- paste0("(", guideline, ")")
|
||||
}
|
||||
sub <- bquote(.(abname)~"in"~italic(.(moname))~.(guideline_txt))
|
||||
} else {
|
||||
cols <- "#BEBEBE"
|
||||
sub <- NULL
|
||||
}
|
||||
list(cols = cols, count = as.double(x), sub = sub, guideline = guideline)
|
||||
}
|
||||
|
||||
#' @method plot rsi
|
||||
#' @export
|
||||
#' @importFrom graphics plot text axis
|
||||
#' @rdname plot
|
||||
plot.rsi <- function(x,
|
||||
ylab = "Percentage",
|
||||
xlab = "Antimicrobial Interpretation",
|
||||
main = paste("Resistance Overview of", deparse(substitute(x))),
|
||||
...) {
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
|
||||
data <- as.data.frame(table(x), stringsAsFactors = FALSE)
|
||||
colnames(data) <- c("x", "n")
|
||||
data$s <- round((data$n / sum(data$n)) * 100, 1)
|
||||
|
||||
if (!"S" %in% data$x) {
|
||||
data <- rbind(data, data.frame(x = "S", n = 0, s = 0, stringsAsFactors = FALSE),
|
||||
stringsAsFactors = FALSE)
|
||||
}
|
||||
if (!"I" %in% data$x) {
|
||||
data <- rbind(data, data.frame(x = "I", n = 0, s = 0, stringsAsFactors = FALSE),
|
||||
stringsAsFactors = FALSE)
|
||||
}
|
||||
if (!"R" %in% data$x) {
|
||||
data <- rbind(data, data.frame(x = "R", n = 0, s = 0, stringsAsFactors = FALSE),
|
||||
stringsAsFactors = FALSE)
|
||||
}
|
||||
|
||||
data$x <- factor(data$x, levels = c("S", "I", "R"), ordered = TRUE)
|
||||
|
||||
ymax <- pm_if_else(max(data$s) > 95, 105, 100)
|
||||
|
||||
plot(x = data$x,
|
||||
y = data$s,
|
||||
lwd = 2,
|
||||
ylim = c(0, ymax),
|
||||
ylab = ylab,
|
||||
xlab = xlab,
|
||||
main = main,
|
||||
axes = FALSE)
|
||||
# x axis
|
||||
axis(side = 1, at = 1:pm_n_distinct(data$x), labels = levels(data$x), lwd = 0)
|
||||
# y axis, 0-100%
|
||||
axis(side = 2, at = seq(0, 100, 5))
|
||||
|
||||
text(x = data$x,
|
||||
y = data$s + 4,
|
||||
labels = paste0(data$s, "% (n = ", data$n, ")"))
|
||||
}
|
||||
|
||||
|
||||
#' @method barplot rsi
|
||||
#' @importFrom graphics barplot axis
|
||||
#' @export
|
||||
#' @noRd
|
||||
barplot.rsi <- function(height,
|
||||
main = paste("Resistance Overview of", deparse(substitute(height))),
|
||||
xlab = "Antimicrobial Interpretation",
|
||||
ylab = "Frequency",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
language = get_locale(),
|
||||
expand = TRUE,
|
||||
...) {
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (length(colours_RSI) == 1) {
|
||||
colours_RSI <- rep(colours_RSI, 3)
|
||||
}
|
||||
main <- gsub(" +", " ", paste0(main, collapse = " "))
|
||||
|
||||
x <- table(height)
|
||||
x <- x[c(1, 2, 3)]
|
||||
barplot(x,
|
||||
col = colours_RSI,
|
||||
xlab = xlab,
|
||||
main = main,
|
||||
ylab = ylab,
|
||||
axes = FALSE)
|
||||
axis(2, seq(0, max(x)))
|
||||
}
|
||||
|
||||
#' @method ggplot rsi
|
||||
#' @rdname plot
|
||||
# will be exported using s3_register() in R/zzz.R
|
||||
ggplot.rsi <- function(data,
|
||||
mapping = NULL,
|
||||
title = paste("Resistance Overview of", deparse(substitute(data))),
|
||||
xlab = "Antimicrobial Interpretation",
|
||||
ylab = "Frequency",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
...) {
|
||||
stop_ifnot_installed("ggplot2")
|
||||
meet_criteria(title, allow_class = "character", allow_NULL = TRUE)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
|
||||
if ("main" %in% names(list(...))) {
|
||||
title <- list(...)$main
|
||||
}
|
||||
if (!is.null(title)) {
|
||||
title <- gsub(" +", " ", paste0(title, collapse = " "))
|
||||
}
|
||||
|
||||
if (length(colours_RSI) == 1) {
|
||||
colours_RSI <- rep(colours_RSI, 3)
|
||||
}
|
||||
|
||||
df <- as.data.frame(table(data), stringsAsFactors = TRUE)
|
||||
colnames(df) <- c("rsi", "count")
|
||||
if (!is.null(mapping)) {
|
||||
p <- ggplot2::ggplot(df, mapping = mapping)
|
||||
} else {
|
||||
p <- ggplot2::ggplot(df)
|
||||
}
|
||||
|
||||
p +
|
||||
ggplot2::geom_col(ggplot2::aes(x = rsi, y = count, fill = rsi)) +
|
||||
ggplot2::scale_fill_manual(values = c("R" = colours_RSI[1],
|
||||
"S" = colours_RSI[2],
|
||||
"I" = colours_RSI[3])) +
|
||||
ggplot2::labs(title = title, x = xlab, y = ylab) +
|
||||
ggplot2::theme(legend.position = "none")
|
||||
}
|
28
R/random.R
@ -25,8 +25,8 @@
|
||||
|
||||
#' Random MIC Values/Disk Zones/RSI Generation
|
||||
#'
|
||||
#' These functions can be used for generating random MIC values and disk diffusion diameters, for AMR data analysis practice.
|
||||
#' @inheritSection lifecycle Maturing Lifecycle
|
||||
#' These functions can be used for generating random MIC values and disk diffusion diameters, for AMR data analysis practice. By providing a microorganism and antimicrobial agent, the generated results will reflect reality as much as possible.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param size desired size of the returned vector
|
||||
#' @param mo any character that can be coerced to a valid microorganism code with [as.mo()]
|
||||
#' @param ab any character that can be coerced to a valid antimicrobial agent code with [as.ab()]
|
||||
@ -51,9 +51,9 @@
|
||||
#' random_mic(100, "Klebsiella pneumoniae", "meropenem") # range 0.0625-16
|
||||
#' random_mic(100, "Streptococcus pneumoniae", "meropenem") # range 0.0625-4
|
||||
#'
|
||||
#' random_disk(100, "Klebsiella pneumoniae") # range 11-50
|
||||
#' random_disk(100, "Klebsiella pneumoniae", "ampicillin") # range 6-14
|
||||
#' random_disk(100, "Streptococcus pneumoniae", "ampicillin") # range 16-22
|
||||
#' random_disk(100, "Klebsiella pneumoniae") # range 8-50
|
||||
#' random_disk(100, "Klebsiella pneumoniae", "ampicillin") # range 11-17
|
||||
#' random_disk(100, "Streptococcus pneumoniae", "ampicillin") # range 12-27
|
||||
#' }
|
||||
random_mic <- function(size, mo = NULL, ab = NULL, ...) {
|
||||
random_exec("MIC", size = size, mo = mo, ab = ab)
|
||||
@ -111,18 +111,26 @@ random_exec <- function(type, size, mo = NULL, ab = NULL) {
|
||||
if (log(set_range_max, 2) %% 1 == 0) {
|
||||
# return powers of 2
|
||||
valid_range <- unique(as.double(valid_range))
|
||||
# add one higher MIC level to set_range_max
|
||||
set_range_max <- 2 ^ (log(set_range_max, 2) + 1)
|
||||
# add 1-3 higher MIC levels to set_range_max
|
||||
set_range_max <- 2 ^ (log(set_range_max, 2) + sample(c(1:3), 1))
|
||||
set_range <- as.mic(valid_range[log(valid_range, 2) %% 1 == 0 & valid_range <= set_range_max])
|
||||
} else {
|
||||
# no power of 2, return factors of 2 to left and right side
|
||||
valid_mics <- suppressWarnings(as.mic(set_range_max / (2 ^ c(-3:3))))
|
||||
set_range <- valid_mics[!is.na(valid_mics)]
|
||||
}
|
||||
return(as.mic(sample(set_range, size = size, replace = TRUE)))
|
||||
out <- as.mic(sample(set_range, size = size, replace = TRUE))
|
||||
# 50% chance that lowest will get <= and highest will get >=
|
||||
if (stats::runif(1) > 0.5) {
|
||||
out[out == min(out)] <- paste0("<=", out[out == min(out)])
|
||||
}
|
||||
if (stats::runif(1) > 0.5) {
|
||||
out[out == max(out)] <- paste0(">=", out[out == max(out)])
|
||||
}
|
||||
return(out)
|
||||
} else if (type == "DISK") {
|
||||
set_range <- seq(from = as.integer(min(df$breakpoint_R)),
|
||||
to = as.integer(max(df$breakpoint_S)),
|
||||
set_range <- seq(from = as.integer(min(df$breakpoint_R) / 1.25),
|
||||
to = as.integer(max(df$breakpoint_S) * 1.25),
|
||||
by = 1)
|
||||
out <- sample(set_range, size = size, replace = TRUE)
|
||||
out[out < 6] <- sample(c(6:10), length(out[out < 6]), replace = TRUE)
|
||||
|
@ -26,7 +26,7 @@
|
||||
#' Predict antimicrobial resistance
|
||||
#'
|
||||
#' Create a prediction model to predict antimicrobial resistance for the next years on statistical solid ground. Standard errors (SE) will be returned as columns `se_min` and `se_max`. See *Examples* for a real live example.
|
||||
#' @inheritSection lifecycle Maturing Lifecycle
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param col_ab column name of `x` containing antimicrobial interpretations (`"R"`, `"I"` and `"S"`)
|
||||
#' @param col_date column name of the date, will be used to calculate years if this column doesn't consist of years already, defaults to the first column of with a date class
|
||||
#' @param year_min lowest year to use in the prediction model, dafaults to the lowest year in `col_date`
|
||||
|
141
R/rsi.R
@ -252,12 +252,13 @@ is.rsi.eligible <- function(x, threshold = 0.05) {
|
||||
}
|
||||
|
||||
#' @export
|
||||
# extra param: warn (never throw warning)
|
||||
as.rsi.default <- function(x, ...) {
|
||||
if (is.rsi(x)) {
|
||||
return(x)
|
||||
}
|
||||
|
||||
if (inherits(x, "integer") & all(x %in% c(1:3, NA))) {
|
||||
if (inherits(x, c("integer", "numeric", "double")) && all(x %in% c(1:3, NA))) {
|
||||
x[x == 1] <- "S"
|
||||
x[x == 2] <- "I"
|
||||
x[x == 3] <- "R"
|
||||
@ -265,11 +266,11 @@ as.rsi.default <- function(x, ...) {
|
||||
} else if (!all(is.na(x)) && !identical(levels(x), c("S", "I", "R"))) {
|
||||
|
||||
if (!any(x %like% "(R|S|I)", na.rm = TRUE)) {
|
||||
# check if they are actually MICs or disks now that the antibiotic name is valid
|
||||
# check if they are actually MICs or disks
|
||||
if (all_valid_mics(x)) {
|
||||
warning_("The input seems to be MIC values. Transform them with as.mic() before running as.rsi() to interpret them.")
|
||||
warning_("The input seems to be MIC values. Transform them with `as.mic()` before running `as.rsi()` to interpret them.")
|
||||
} else if (all_valid_disks(x)) {
|
||||
warning_("The input seems to be disk diffusion values. Transform them with as.disk() before running as.rsi() to interpret them.")
|
||||
warning_("The input seems to be disk diffusion values. Transform them with `as.disk()` before running `as.rsi()` to interpret them.")
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,7 +339,7 @@ as.rsi.mic <- function(x,
|
||||
|
||||
# for dplyr's across()
|
||||
cur_column_dplyr <- import_fn("cur_column", "dplyr", error_on_fail = FALSE)
|
||||
if (!is.null(cur_column_dplyr)) {
|
||||
if (!is.null(cur_column_dplyr) && tryCatch(is.data.frame(get_current_data("ab", 0)), error = function(e) FALSE)) {
|
||||
# try to get current column, which will only be available when in across()
|
||||
ab <- tryCatch(cur_column_dplyr(),
|
||||
error = function(e) ab)
|
||||
@ -427,7 +428,7 @@ as.rsi.disk <- function(x,
|
||||
|
||||
# for dplyr's across()
|
||||
cur_column_dplyr <- import_fn("cur_column", "dplyr", error_on_fail = FALSE)
|
||||
if (!is.null(cur_column_dplyr)) {
|
||||
if (!is.null(cur_column_dplyr) && tryCatch(is.data.frame(get_current_data("ab", 0)), error = function(e) FALSE)) {
|
||||
# try to get current column, which will only be available when in across()
|
||||
ab <- tryCatch(cur_column_dplyr(),
|
||||
error = function(e) ab)
|
||||
@ -703,7 +704,6 @@ exec_as.rsi <- function(method,
|
||||
conserve_capped_values,
|
||||
add_intrinsic_resistance,
|
||||
reference_data) {
|
||||
|
||||
metadata_mo <- get_mo_failures_uncertainties_renamed()
|
||||
|
||||
x_bak <- data.frame(x_mo = paste0(x, mo), stringsAsFactors = FALSE)
|
||||
@ -720,10 +720,10 @@ exec_as.rsi <- function(method,
|
||||
warned <- FALSE
|
||||
method_param <- toupper(method)
|
||||
|
||||
genera <- mo_genus(mo)
|
||||
mo_genus <- as.mo(genera)
|
||||
mo_family <- as.mo(mo_family(mo))
|
||||
mo_order <- as.mo(mo_order(mo))
|
||||
genera <- mo_genus(mo, language = NULL)
|
||||
mo_genus <- as.mo(genera, language = NULL)
|
||||
mo_family <- as.mo(mo_family(mo, language = NULL))
|
||||
mo_order <- as.mo(mo_order(mo, language = NULL))
|
||||
if (any(genera == "Staphylococcus", na.rm = TRUE)) {
|
||||
mo_becker <- as.mo(mo, Becker = TRUE)
|
||||
} else {
|
||||
@ -807,23 +807,19 @@ exec_as.rsi <- function(method,
|
||||
pm_filter(uti == FALSE) %pm>% # 'uti' is a column in rsi_translation
|
||||
pm_arrange(pm_desc(nchar(mo)))
|
||||
}
|
||||
|
||||
get_record <- get_record[1L, , drop = FALSE]
|
||||
|
||||
if (NROW(get_record) > 0) {
|
||||
if (is.na(x[i])) {
|
||||
if (is.na(x[i]) | (is.na(get_record$breakpoint_S) & is.na(get_record$breakpoint_R))) {
|
||||
new_rsi[i] <- NA_character_
|
||||
} else if (method == "mic") {
|
||||
mic_input <- x[i]
|
||||
mic_S <- as.mic(get_record$breakpoint_S)
|
||||
mic_R <- as.mic(get_record$breakpoint_R)
|
||||
new_rsi[i] <- quick_case_when(isTRUE(conserve_capped_values) & mic_input %like% "^<[0-9]" ~ "S",
|
||||
isTRUE(conserve_capped_values) & mic_input %like% "^>[0-9]" ~ "R",
|
||||
new_rsi[i] <- quick_case_when(isTRUE(conserve_capped_values) & x[i] %like% "^<[0-9]" ~ "S",
|
||||
isTRUE(conserve_capped_values) & x[i] %like% "^>[0-9]" ~ "R",
|
||||
# start interpreting: EUCAST uses <= S and > R, CLSI uses <=S and >= R
|
||||
isTRUE(which(levels(mic_input) == mic_input) <= which(levels(mic_S) == mic_S)) ~ "S",
|
||||
guideline_coerced %like% "EUCAST" &
|
||||
isTRUE(which(levels(mic_input) == mic_input) > which(levels(mic_R) == mic_R)) ~ "R",
|
||||
guideline_coerced %like% "CLSI" &
|
||||
isTRUE(which(levels(mic_input) == mic_input) >= which(levels(mic_R) == mic_R)) ~ "R",
|
||||
x[i] <= get_record$breakpoint_S ~ "S",
|
||||
guideline_coerced %like% "EUCAST" & x[i] > get_record$breakpoint_R ~ "R",
|
||||
guideline_coerced %like% "CLSI" & x[i] >= get_record$breakpoint_R ~ "R",
|
||||
# return "I" when not match the bottom or top
|
||||
!is.na(get_record$breakpoint_S) & !is.na(get_record$breakpoint_R) ~ "I",
|
||||
# and NA otherwise
|
||||
@ -1010,107 +1006,6 @@ summary.rsi <- function(object, ...) {
|
||||
value
|
||||
}
|
||||
|
||||
#' @method plot rsi
|
||||
#' @export
|
||||
#' @importFrom graphics plot text axis
|
||||
#' @rdname plot
|
||||
plot.rsi <- function(x,
|
||||
lwd = 2,
|
||||
ylim = NULL,
|
||||
ylab = "Percentage",
|
||||
xlab = "Antimicrobial Interpretation",
|
||||
main = paste("Resistance Overview of", deparse(substitute(x))),
|
||||
axes = FALSE,
|
||||
...) {
|
||||
meet_criteria(lwd, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(ylim, allow_class = c("numeric", "integer"), allow_NULL = TRUE)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(main, allow_class = "character", has_length = 1)
|
||||
meet_criteria(axes, allow_class = "logical", has_length = 1)
|
||||
|
||||
data <- as.data.frame(table(x), stringsAsFactors = FALSE)
|
||||
colnames(data) <- c("x", "n")
|
||||
data$s <- round((data$n / sum(data$n)) * 100, 1)
|
||||
|
||||
if (!"S" %in% data$x) {
|
||||
data <- rbind(data, data.frame(x = "S", n = 0, s = 0, stringsAsFactors = FALSE),
|
||||
stringsAsFactors = FALSE)
|
||||
}
|
||||
if (!"I" %in% data$x) {
|
||||
data <- rbind(data, data.frame(x = "I", n = 0, s = 0, stringsAsFactors = FALSE),
|
||||
stringsAsFactors = FALSE)
|
||||
}
|
||||
if (!"R" %in% data$x) {
|
||||
data <- rbind(data, data.frame(x = "R", n = 0, s = 0, stringsAsFactors = FALSE),
|
||||
stringsAsFactors = FALSE)
|
||||
}
|
||||
|
||||
# don't use as.rsi() here, it will confuse plot()
|
||||
data$x <- factor(data$x, levels = c("S", "I", "R"), ordered = TRUE)
|
||||
|
||||
ymax <- pm_if_else(max(data$s) > 95, 105, 100)
|
||||
|
||||
plot(x = data$x,
|
||||
y = data$s,
|
||||
lwd = lwd,
|
||||
ylim = c(0, ymax),
|
||||
ylab = ylab,
|
||||
xlab = xlab,
|
||||
main = main,
|
||||
axes = axes,
|
||||
...)
|
||||
# x axis
|
||||
axis(side = 1, at = 1:pm_n_distinct(data$x), labels = levels(data$x), lwd = 0)
|
||||
# y axis, 0-100%
|
||||
axis(side = 2, at = seq(0, 100, 5))
|
||||
|
||||
text(x = data$x,
|
||||
y = data$s + 4,
|
||||
labels = paste0(data$s, "% (n = ", data$n, ")"))
|
||||
}
|
||||
|
||||
|
||||
#' @method barplot rsi
|
||||
#' @export
|
||||
#' @importFrom graphics barplot axis par
|
||||
#' @rdname plot
|
||||
barplot.rsi <- function(height,
|
||||
col = c("chartreuse4", "chartreuse3", "brown3"),
|
||||
xlab = ifelse(beside, "Antimicrobial Interpretation", ""),
|
||||
main = paste("Resistance Overview of", deparse(substitute(height))),
|
||||
ylab = "Frequency",
|
||||
beside = TRUE,
|
||||
axes = beside,
|
||||
...) {
|
||||
meet_criteria(col, allow_class = "character", has_length = 3)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(main, allow_class = "character", has_length = 1)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(beside, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(axes, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (axes == TRUE) {
|
||||
par(mar = c(5, 4, 4, 2) + 0.1)
|
||||
} else {
|
||||
par(mar = c(2, 4, 4, 2) + 0.1)
|
||||
}
|
||||
|
||||
barplot(as.matrix(table(height)),
|
||||
col = col,
|
||||
xlab = xlab,
|
||||
main = main,
|
||||
ylab = ylab,
|
||||
beside = beside,
|
||||
axes = FALSE,
|
||||
...)
|
||||
# y axis, 0-100%
|
||||
axis(side = 2, at = seq(0, max(table(height)) + max(table(height)) * 1.1, by = 25))
|
||||
if (axes == TRUE && beside == TRUE) {
|
||||
axis(side = 1, labels = levels(height), at = c(1, 2, 3) + 0.5, lwd = 0)
|
||||
}
|
||||
}
|
||||
|
||||
#' @method [<- rsi
|
||||
#' @export
|
||||
#' @noRd
|
||||
|
BIN
R/sysdata.rda
@ -142,7 +142,8 @@ translate_AMR <- function(from, language = get_locale(), only_unknown = FALSE, a
|
||||
vector_or(LANGUAGES_SUPPORTED, quotes = TRUE),
|
||||
call = FALSE)
|
||||
|
||||
df_trans <- subset(df_trans, lang == language)
|
||||
# only keep lines where translation is available for this language
|
||||
df_trans <- df_trans[which(!is.na(df_trans[, language, drop = TRUE])), , drop = FALSE]
|
||||
if (only_unknown == TRUE) {
|
||||
df_trans <- subset(df_trans, pattern %like% "unknown")
|
||||
}
|
||||
@ -150,10 +151,10 @@ translate_AMR <- function(from, language = get_locale(), only_unknown = FALSE, a
|
||||
df_trans <- subset(df_trans, affect_mo_name == TRUE)
|
||||
}
|
||||
|
||||
# default: case sensitive if value if 'ignore.case' is missing:
|
||||
df_trans$ignore.case[is.na(df_trans$ignore.case)] <- FALSE
|
||||
# default: not using regular expressions (fixed = TRUE) if 'fixed' is missing:
|
||||
df_trans$fixed[is.na(df_trans$fixed)] <- TRUE
|
||||
# default: case sensitive if value if 'case_sensitive' is missing:
|
||||
df_trans$case_sensitive[is.na(df_trans$case_sensitive)] <- TRUE
|
||||
# default: not using regular expressions if 'regular_expr' is missing:
|
||||
df_trans$regular_expr[is.na(df_trans$regular_expr)] <- FALSE
|
||||
|
||||
# check if text to look for is in one of the patterns
|
||||
any_form_in_patterns <- tryCatch(any(from_unique %like% paste0("(", paste(df_trans$pattern, collapse = "|"), ")")),
|
||||
@ -167,11 +168,11 @@ translate_AMR <- function(from, language = get_locale(), only_unknown = FALSE, a
|
||||
|
||||
lapply(seq_len(nrow(df_trans)),
|
||||
function(i) from_unique_translated <<- gsub(pattern = df_trans$pattern[i],
|
||||
replacement = df_trans$replacement[i],
|
||||
replacement = df_trans[i, language, drop = TRUE],
|
||||
x = from_unique_translated,
|
||||
ignore.case = df_trans$ignore.case[i],
|
||||
fixed = df_trans$fixed[i],
|
||||
perl = !df_trans$fixed[i]))
|
||||
ignore.case = !df_trans$case_sensitive[i],
|
||||
fixed = !df_trans$regular_expr[i],
|
||||
perl = df_trans$regular_expr[i]))
|
||||
|
||||
# force UTF-8 for diacritics
|
||||
from_unique_translated <- enc2utf8(from_unique_translated)
|
||||
|
3
R/zzz.R
@ -50,6 +50,9 @@ pkg_env$mo_failed <- character(0)
|
||||
s3_register("skimr::get_skimmers", "rsi")
|
||||
s3_register("skimr::get_skimmers", "mic")
|
||||
s3_register("skimr::get_skimmers", "disk")
|
||||
s3_register("ggplot2::ggplot", "rsi")
|
||||
s3_register("ggplot2::ggplot", "mic")
|
||||
s3_register("ggplot2::ggplot", "disk")
|
||||
|
||||
# if mo source exists, fire it up (see mo_source())
|
||||
try({
|
||||
|
@ -10,13 +10,13 @@
|
||||
|
||||
<img src="https://msberends.github.io/AMR/works_great_on.png" align="center" height="150px" />
|
||||
|
||||
The latest built **source package** (`AMR_latest.tar.gz`) can be found in folder [/data-raw/](data-raw).
|
||||
The latest built **source package** (`AMR_latest.tar.gz`) can be found in folder [/data-raw/](https://github.com/msberends/AMR/tree/master/data-raw).
|
||||
|
||||
`AMR` is a free, open-source and independent R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. Our aim is to provide a standard for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.
|
||||
`AMR` is a free, open-source and independent R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. Our aim is to provide a standard for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting. It is currently being used in over 150 countries.
|
||||
|
||||
After installing this package, R knows ~70,000 distinct microbial species and all ~550 antibiotic, antimycotic and antiviral drugs by name and code (including ATC, EARS-NET, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
|
||||
After installing this package, R knows ~70,000 distinct microbial species and all ~550 antibiotic, antimycotic, and antiviral drugs by name and code (including ATC, EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
|
||||
|
||||
This package is fully independent of any other R package and works on Windows, macOS and Linux with all versions of R since R-3.0.0 (April 2013). It was designed to work in any setting, including those with very limited resources. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the University of Groningen, in collaboration with non-profit organisations Certe Medical Diagnostics and Advice and University Medical Center Groningen. This R package is actively maintained and free software; you can freely use and distribute it for both personal and commercial (but not patent) purposes under the terms of the GNU General Public License version 2.0 (GPL-2), as published by the Free Software Foundation.
|
||||
This package is fully independent of any other R package and works on Windows, macOS and Linux with all versions of R since R-3.0.0 (April 2013). It was designed to work in any setting, including those with very limited resources. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the University of Groningen, in collaboration with non-profit organisations Certe Medical Diagnostics and Advice Foundation and University Medical Center Groningen. This R package is actively maintained and free software; you can freely use and distribute it for both personal and commercial (but not patent) purposes under the terms of the GNU General Public License version 2.0 (GPL-2), as published by the Free Software Foundation.
|
||||
|
||||
This is the development source of the `AMR` package for R. Not a developer? Then please visit our website [https://msberends.github.io/AMR/](https://msberends.github.io/AMR/) to read more about this package.
|
||||
|
||||
|
@ -143,8 +143,6 @@ reference:
|
||||
- "`as.mic`"
|
||||
- "`as.disk`"
|
||||
- "`eucast_rules`"
|
||||
- "`plot`"
|
||||
- "`isolate_identifier`"
|
||||
|
||||
- title: "Analysing data: antimicrobial resistance"
|
||||
desc: >
|
||||
@ -159,6 +157,7 @@ reference:
|
||||
- "`key_antibiotics`"
|
||||
- "`mdro`"
|
||||
- "`count`"
|
||||
- "`plot`"
|
||||
- "`ggplot_rsi`"
|
||||
- "`bug_drug_combinations`"
|
||||
- "`antibiotic_class_selectors`"
|
||||
|
@ -1 +1 @@
|
||||
* Ever since one of the first CRAN releases, CHECK returns a NOTE for having a data and R directory over 3 MB. This is needed to offer users reference data for the complete taxonomy of microorganisms - one of the most important features of this package.
|
||||
* This package has a tarball size of over 7 MB and an installation size of over 5 MB, which will return a NOTE on R CMD CHECK. The package size is needed to offer users reference data for the complete taxonomy of microorganisms - one of the most important features of this package. This was written and explained in a manuscript that was accepted for publication in the Journal of Statistical Software 4 weeks ago. We will add the paper as a vignette in the next version. Please allow this exception in package size for CRAN. We already compressed all data sets using `compression = "xz"` to make them as small as possible.
|
||||
|
19173
data-raw/SNOMED_PHVS_Microorganism_CDC_V12.txt
Normal file
@ -43,21 +43,23 @@ create_species_cons_cops <- function(type = c("CoNS", "CoPS")) {
|
||||
MO_staph <- MO_staph[which(MO_staph$genus == "Staphylococcus"), , drop = FALSE]
|
||||
if (type == "CoNS") {
|
||||
MO_staph[which(MO_staph$species %in% c("coagulase-negative", "argensis", "arlettae",
|
||||
"auricularis", "caeli", "capitis", "caprae",
|
||||
"carnosus", "chromogenes", "cohnii", "condimenti",
|
||||
"auricularis", "borealis", "caeli", "capitis", "caprae",
|
||||
"carnosus", "casei", "chromogenes", "cohnii", "condimenti",
|
||||
"croceilyticus",
|
||||
"debuckii", "devriesei", "edaphicus", "epidermidis",
|
||||
"equorum", "felis", "fleurettii", "gallinarum",
|
||||
"haemolyticus", "hominis", "jettensis", "kloosii",
|
||||
"lentus", "lugdunensis", "massiliensis", "microti",
|
||||
"muscae", "nepalensis", "pasteuri", "petrasii",
|
||||
"pettenkoferi", "piscifermentans", "pseudoxylosus",
|
||||
"pettenkoferi", "piscifermentans", "pragensis", "pseudoxylosus",
|
||||
"pulvereri", "rostri", "saccharolyticus", "saprophyticus",
|
||||
"sciuri", "simulans", "stepanovicii", "succinus",
|
||||
"ureilyticus",
|
||||
"vitulinus", "vitulus", "warneri", "xylosus")
|
||||
| (MO_staph$species == "schleiferi" & MO_staph$subspecies %in% c("schleiferi", ""))),
|
||||
"mo", drop = TRUE]
|
||||
} else if (type == "CoPS") {
|
||||
MO_staph[which(MO_staph$species %in% c("coagulase-positive",
|
||||
MO_staph[which(MO_staph$species %in% c("coagulase-positive", "coagulans",
|
||||
"agnetis", "argenteus",
|
||||
"cornubiensis",
|
||||
"delphini", "lutrae",
|
||||
@ -175,7 +177,7 @@ microorganisms.translation <- readRDS("data-raw/microorganisms.translation.rds")
|
||||
INTRINSIC_R <- create_intr_resistance()
|
||||
|
||||
# for checking input in `language` argument in e.g. mo_*() and ab_*() functions
|
||||
LANGUAGES_SUPPORTED <- sort(c("en", unique(translations_file$lang)))
|
||||
LANGUAGES_SUPPORTED <- sort(c("en", colnames(translations_file)[nchar(colnames(translations_file)) == 2]))
|
||||
|
||||
# vectors of CoNS and CoPS, improves speed in as.mo()
|
||||
MO_CONS <- create_species_cons_cops("CoNS")
|
||||
@ -217,11 +219,11 @@ changed_md5 <- function(object) {
|
||||
compared
|
||||
}, error = function(e) TRUE)
|
||||
}
|
||||
usethis::ui_done(paste0("Saving raw data to {usethis::ui_value('/data-raw/')}"))
|
||||
|
||||
# give official names to ABs and MOs
|
||||
rsi <- dplyr::mutate(rsi_translation, ab = ab_name(ab), mo = mo_name(mo))
|
||||
if (changed_md5(rsi)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('rsi_translation')} to {usethis::ui_value('/data-raw/')}"))
|
||||
write_md5(rsi)
|
||||
try(saveRDS(rsi, "data-raw/rsi_translation.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(rsi, "data-raw/rsi_translation.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
@ -233,16 +235,18 @@ if (changed_md5(rsi)) {
|
||||
|
||||
mo <- dplyr::mutate_if(microorganisms, ~!is.numeric(.), as.character)
|
||||
if (changed_md5(mo)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('microorganisms')} to {usethis::ui_value('/data-raw/')}"))
|
||||
write_md5(mo)
|
||||
try(saveRDS(mo, "data-raw/microorganisms.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(mo, "data-raw/microorganisms.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
try(haven::write_sas(mo, "data-raw/microorganisms.sas"), silent = TRUE)
|
||||
try(haven::write_sav(mo, "data-raw/microorganisms.sav"), silent = TRUE)
|
||||
try(haven::write_dta(mo, "data-raw/microorganisms.dta"), silent = TRUE)
|
||||
try(haven::write_sas(dplyr::select(mo, -snomed), "data-raw/microorganisms.sas"), silent = TRUE)
|
||||
try(haven::write_sav(dplyr::select(mo, -snomed), "data-raw/microorganisms.sav"), silent = TRUE)
|
||||
try(haven::write_dta(dplyr::select(mo, -snomed), "data-raw/microorganisms.dta"), silent = TRUE)
|
||||
try(openxlsx::write.xlsx(mo, "data-raw/microorganisms.xlsx"), silent = TRUE)
|
||||
}
|
||||
|
||||
if (changed_md5(microorganisms.old)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('microorganisms.old')} to {usethis::ui_value('/data-raw/')}"))
|
||||
write_md5(microorganisms.old)
|
||||
try(saveRDS(microorganisms.old, "data-raw/microorganisms.old.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(microorganisms.old, "data-raw/microorganisms.old.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
@ -254,6 +258,7 @@ if (changed_md5(microorganisms.old)) {
|
||||
|
||||
ab <- dplyr::mutate_if(antibiotics, ~!is.numeric(.), as.character)
|
||||
if (changed_md5(ab)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('antibiotics')} to {usethis::ui_value('/data-raw/')}"))
|
||||
write_md5(ab)
|
||||
try(saveRDS(ab, "data-raw/antibiotics.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(ab, "data-raw/antibiotics.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
@ -265,6 +270,7 @@ if (changed_md5(ab)) {
|
||||
|
||||
av <- dplyr::mutate_if(antivirals, ~!is.numeric(.), as.character)
|
||||
if (changed_md5(av)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('antivirals')} to {usethis::ui_value('/data-raw/')}"))
|
||||
write_md5(av)
|
||||
try(saveRDS(av, "data-raw/antivirals.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(av, "data-raw/antivirals.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
@ -275,6 +281,7 @@ if (changed_md5(av)) {
|
||||
}
|
||||
|
||||
if (changed_md5(intrinsic_resistant)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('intrinsic_resistant')} to {usethis::ui_value('/data-raw/')}"))
|
||||
write_md5(intrinsic_resistant)
|
||||
try(saveRDS(intrinsic_resistant, "data-raw/intrinsic_resistant.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(intrinsic_resistant, "data-raw/intrinsic_resistant.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
@ -285,6 +292,7 @@ if (changed_md5(intrinsic_resistant)) {
|
||||
}
|
||||
|
||||
if (changed_md5(dosage)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('dosage')} to {usethis::ui_value('/data-raw/')}"))
|
||||
write_md5(dosage)
|
||||
try(saveRDS(dosage, "data-raw/dosage.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(dosage, "data-raw/dosage.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
|
@ -1 +1 @@
|
||||
fa68ab044001078f290218a7de6cc5c4
|
||||
77f6cca42687a0e3b1b1045a2d70b226
|
||||
|
@ -108,7 +108,7 @@
|
||||
"CPT" "J01DI02" 56841980 "Ceftaroline" "Cephalosporins (5th gen.)" "c(\"\", \"cfro\")" "c(\"teflaro\", \"zinforo\")" 1.2 "character(0)"
|
||||
"CPA" "Ceftaroline/avibactam" "Cephalosporins (5th gen.)" "" "" ""
|
||||
"CAZ" "J01DD02" 5481173 "Ceftazidime" "Cephalosporins (3rd gen.)" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "c(\"caz\", \"cefta\", \"cfta\", \"cftz\", \"taz\", \"tz\", \"xtz\")" "c(\"ceftazidim\", \"ceftazidima\", \"ceftazidime\", \"ceftazidimum\", \"ceptaz\", \"fortaz\", \"fortum\", \"pentacef\", \"tazicef\", \"tazidime\")" 4 "g" "c(\"21151-6\", \"3449-6\", \"80960-8\")"
|
||||
"CZA" "Ceftazidime/avibactam" "Cephalosporins (3rd gen.)" "c(\"\", \"cfav\")" "" ""
|
||||
"CZA" "J01DD52" 90643431 "Ceftazidime/avibactam" "Cephalosporins (3rd gen.)" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "c(\"\", \"cfav\")" "c(\"avycaz\", \"zavicefta\")" 6 "g" ""
|
||||
"CCV" "J01DD52" 9575352 "Ceftazidime/clavulanic acid" "Cephalosporins (3rd gen.)" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "c(\"czcl\", \"xtzl\")" "" 6 ""
|
||||
"CEM" 6537431 "Cefteram" "Cephalosporins (3rd gen.)" "" "c(\"cefteram\", \"cefterame\", \"cefteramum\", \"ceftetrame\")" "character(0)"
|
||||
"CPL" 5362114 "Cefteram pivoxil" "Cephalosporins (3rd gen.)" "" "c(\"cefteram pivoxil\", \"tomiron\")" "character(0)"
|
||||
|
@ -1 +1 @@
|
||||
b6de75043ef27eabd6fff22f04638225
|
||||
9c58b2d894dbad7593cd44b78d04cd78
|
||||
|
@ -1 +1 @@
|
||||
617b59b8ac3bd1aad7847aafc328f0f3
|
||||
8338ff5f079f4519fa3c44f8c5bace64
|
||||
|
134806
data-raw/microorganisms.txt
@ -1 +1 @@
|
||||
a5b85c5b3d37d6330865dfe09ef9b354
|
||||
82bd6236cf159569f6f5c99f48f92d86
|
||||
|
@ -166,7 +166,7 @@ abx2$abbr <- lapply(as.list(abx2$abbr), function(x) unlist(strsplit(x, "|", fixe
|
||||
# vector with official names, returns vector with CIDs
|
||||
get_CID <- function(ab) {
|
||||
CID <- rep(NA_integer_, length(ab))
|
||||
p <- progress_estimated(n = length(ab), min_time = 0)
|
||||
p <- progress_ticker(n = length(ab), min_time = 0)
|
||||
for (i in 1:length(ab)) {
|
||||
p$tick()$print()
|
||||
|
||||
@ -208,10 +208,10 @@ abx2[is.na(CIDs),] %>% View()
|
||||
# returns list with synonyms (brand names), with CIDs as names
|
||||
get_synonyms <- function(CID, clean = TRUE) {
|
||||
synonyms <- rep(NA_character_, length(CID))
|
||||
p <- progress_estimated(n = length(CID), min_time = 0)
|
||||
#p <- progress_ticker(n = length(CID), min_time = 0)
|
||||
|
||||
for (i in 1:length(CID)) {
|
||||
p$tick()$print()
|
||||
#p$tick()$print()
|
||||
|
||||
synonyms_txt <- ""
|
||||
|
||||
@ -564,6 +564,14 @@ antibiotics[which(antibiotics$ab == "CPT"), "atc"] <- "J01DI02"
|
||||
antibiotics[which(antibiotics$ab == "FAR"), "atc"] <- "J01DI03"
|
||||
# ceftobiprole
|
||||
antibiotics[which(antibiotics$ab == "BPR"), "atc"] <- "J01DI01"
|
||||
# ceftazidime / avibactam
|
||||
antibiotics[which(antibiotics$ab == "CZA"), "atc"] <- "J01DD52"
|
||||
antibiotics[which(antibiotics$ab == "CZA"), "cid"] <- 90643431
|
||||
antibiotics[which(antibiotics$ab == "CZA"), "atc_group1"] <- "Other beta-lactam antibacterials"
|
||||
antibiotics[which(antibiotics$ab == "CZA"), "atc_group2"] <- "Third-generation cephalosporins"
|
||||
antibiotics[which(antibiotics$ab == "CZA"), "iv_ddd"] <- 6
|
||||
antibiotics[which(antibiotics$ab == "CZA"), "iv_units"] <- "g"
|
||||
antibiotics[which(antibiotics$ab == "CZA"), "synonyms"] <- list(c("Avycaz", "Zavicefta"))
|
||||
|
||||
# typo
|
||||
antibiotics[which(antibiotics$ab == "RXT"), "name"] <- "Roxithromycin"
|
||||
|
480
data-raw/reproduction_of_microorganisms_update.R
Normal file
@ -0,0 +1,480 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2021 Berends MS, Luz CF et al. #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
# #
|
||||
# This R package is free software; you can freely use and distribute #
|
||||
# it for both personal and commercial purposes under the terms of the #
|
||||
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
||||
# the Free Software Foundation. #
|
||||
# We created this package for both routine data analysis and academic #
|
||||
# research and it was publicly released in the hope that it will be #
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# Register at List of Prokaryotic names with Standing in Nomenclature (LPSN)
|
||||
# then got to https://lpsn.dsmz.de/downloads and download the latest CSV file.
|
||||
|
||||
library(tidyverse)
|
||||
library(AMR)
|
||||
|
||||
# these should still work after this update
|
||||
test_fullname <- microorganisms$fullname
|
||||
test_mo <- microorganisms$mo
|
||||
|
||||
|
||||
# Helper functions --------------------------------------------------------
|
||||
|
||||
get_author_year <- function(ref) {
|
||||
# Only keep first author, e.g. transform 'Smith, Jones, 2011' to 'Smith et al., 2011'
|
||||
|
||||
authors2 <- iconv(ref, from = "UTF-8", to = "ASCII//TRANSLIT")
|
||||
authors2 <- gsub(" ?\\(Approved Lists [0-9]+\\) ?", " () ", authors2)
|
||||
authors2 <- gsub(" [)(]+ $", "", authors2)
|
||||
# remove leading and trailing brackets
|
||||
authors2 <- trimws(gsub("^[(](.*)[)]$", "\\1", authors2))
|
||||
# only take part after brackets if there's a name
|
||||
authors2 <- ifelse(grepl(".*[)] [a-zA-Z]+.*", authors2),
|
||||
gsub(".*[)] (.*)", "\\1", authors2),
|
||||
authors2)
|
||||
# get year from last 4 digits
|
||||
lastyear = as.integer(gsub(".*([0-9]{4})$", "\\1", authors2))
|
||||
# can never be later than now
|
||||
lastyear = ifelse(lastyear > as.integer(format(Sys.Date(), "%Y")),
|
||||
NA,
|
||||
lastyear)
|
||||
# get authors without last year
|
||||
authors <- gsub("(.*)[0-9]{4}$", "\\1", authors2)
|
||||
# remove nonsense characters from names
|
||||
authors <- gsub("[^a-zA-Z,'& -]", "", authors)
|
||||
# remove trailing and leading spaces
|
||||
authors <- trimws(authors)
|
||||
# only keep first author and replace all others by 'et al'
|
||||
authors <- gsub("(,| and| et| &| ex| emend\\.?) .*", " et al.", authors)
|
||||
# et al. always with ending dot
|
||||
authors <- gsub(" et al\\.?", " et al.", authors)
|
||||
authors <- gsub(" ?,$", "", authors)
|
||||
# don't start with 'sensu' or 'ehrenb'
|
||||
authors <- gsub("^(sensu|Ehrenb.?) ", "", authors, ignore.case = TRUE)
|
||||
# no initials, only surname
|
||||
authors <- gsub("^([A-Z]+ )+", "", authors, ignore.case = FALSE)
|
||||
# combine author and year if year is available
|
||||
ref <- ifelse(!is.na(lastyear),
|
||||
paste0(authors, ", ", lastyear),
|
||||
authors)
|
||||
# fix beginning and ending
|
||||
ref <- gsub(", $", "", ref)
|
||||
ref <- gsub("^, ", "", ref)
|
||||
ref <- gsub("^(emend|et al.,?)", "", ref)
|
||||
ref <- trimws(ref)
|
||||
ref <- gsub("'", "", ref)
|
||||
|
||||
# a lot start with a lowercase character - fix that
|
||||
ref[!grepl("^d[A-Z]", ref)] <- gsub("^([a-z])", "\\U\\1", ref[!grepl("^d[A-Z]", ref)], perl = TRUE)
|
||||
# specific one for the French that are named dOrbigny
|
||||
ref[grepl("^d[A-Z]", ref)] <- gsub("^d", "d'", ref[grepl("^d[A-Z]", ref)])
|
||||
ref <- gsub(" +", " ", ref)
|
||||
ref
|
||||
}
|
||||
|
||||
df_remove_nonASCII <- function(df) {
|
||||
# Remove non-ASCII characters (these are not allowed by CRAN)
|
||||
df %>%
|
||||
mutate_if(is.character, iconv, from = "UTF-8", to = "ASCII//TRANSLIT") %>%
|
||||
# also remove invalid characters
|
||||
mutate_if(is.character, ~gsub("[\"'`]+", "", .)) %>%
|
||||
AMR:::dataset_UTF8_to_ASCII()
|
||||
}
|
||||
|
||||
abbreviate_mo <- function(x, minlength = 5, prefix = "", ...) {
|
||||
# keep a starting Latin ae
|
||||
suppressWarnings(
|
||||
gsub("^ae", "\u00E6\u00E6", x, ignore.case = TRUE) %>%
|
||||
abbreviate(minlength = minlength,
|
||||
use.classes = TRUE,
|
||||
method = "both.sides", ...) %>%
|
||||
paste0(prefix, .) %>%
|
||||
toupper() %>%
|
||||
gsub("(\u00C6|\u00E6)+", "AE", .)
|
||||
)
|
||||
}
|
||||
|
||||
# Read data ---------------------------------------------------------------
|
||||
|
||||
taxonomy <- read_csv("~/Downloads/taxonomy.csv")
|
||||
|
||||
# Create synonyms ---------------------------------------------------------
|
||||
|
||||
new_synonyms <- taxonomy %>%
|
||||
left_join(taxonomy,
|
||||
by = c("record_lnk" = "record_no"),
|
||||
suffix = c("", ".new")) %>%
|
||||
filter(!is.na(record_lnk)) %>%
|
||||
mutate_all(~ifelse(is.na(.), "", .)) %>%
|
||||
transmute(fullname = trimws(paste(genus_name, sp_epithet, subsp_epithet)),
|
||||
fullname_new = trimws(paste(genus_name.new, sp_epithet.new, subsp_epithet.new)),
|
||||
ref = get_author_year(authors),
|
||||
prevalence = 0) %>%
|
||||
distinct(fullname, .keep_all = TRUE) %>%
|
||||
filter(fullname != fullname_new) %>%
|
||||
# this part joins this table to itself to correct for entries that had >1 renames,
|
||||
# such as:
|
||||
# Bacteroides tectum -> Bacteroides tectus
|
||||
# Bacteroides tectus -> Bacteroides pyogenes
|
||||
left_join(., .,
|
||||
by = c("fullname_new" = "fullname"),
|
||||
suffix = c("", ".2")) %>%
|
||||
mutate(fullname_new = ifelse(!is.na(fullname_new.2), fullname_new.2, fullname_new),
|
||||
ref = ifelse(!is.na(ref.2), ref.2, ref)) %>%
|
||||
select(-ends_with(".2"))
|
||||
|
||||
mo_became_synonym <- microorganisms %>%
|
||||
filter(fullname %in% new_synonyms$fullname)
|
||||
|
||||
updated_microorganisms <- taxonomy %>%
|
||||
filter(is.na(record_lnk)) %>%
|
||||
mutate_all(~ifelse(is.na(.), "", .)) %>%
|
||||
transmute(mo = "",
|
||||
fullname = trimws(paste(genus_name, sp_epithet, subsp_epithet)),
|
||||
kingdom = "Bacteria",
|
||||
phylum = "",
|
||||
class = "",
|
||||
order = "",
|
||||
family = "",
|
||||
genus = trimws(genus_name),
|
||||
species = trimws(replace_na(sp_epithet, "")),
|
||||
subspecies = trimws(replace_na(subsp_epithet, "")),
|
||||
rank = case_when(subspecies == "" & species == "" ~ "genus",
|
||||
subspecies == "" ~ "species",
|
||||
TRUE ~ "subsp."),
|
||||
ref = get_author_year(authors),
|
||||
species_id = as.character(record_no),
|
||||
source = "LSPN",
|
||||
prevalence = 0,
|
||||
snomed = NA)
|
||||
|
||||
new_microorganisms <- updated_microorganisms %>%
|
||||
filter(!fullname %in% microorganisms$fullname)
|
||||
|
||||
genera_with_mo_code <- updated_microorganisms %>%
|
||||
filter(genus %in% (microorganisms %>% filter(kingdom == "Bacteria", rank == "genus") %>% pull(genus))) %>%
|
||||
distinct(genus) %>%
|
||||
left_join(microorganisms %>% filter(kingdom == "Bacteria", rank == "genus") %>% select(mo, genus),
|
||||
by = "genus")
|
||||
|
||||
genera_without_mo_code <- updated_microorganisms %>%
|
||||
filter(!genus %in% genera_with_mo_code$genus) %>%
|
||||
pull(genus) %>%
|
||||
unique()
|
||||
|
||||
genera_without_mo_code_abbr <- genera_without_mo_code %>%
|
||||
abbreviate_mo(5, prefix = "B_")
|
||||
genera_without_mo_code_abbr[genera_without_mo_code_abbr %in% microorganisms$mo] <- abbreviate_mo(genera_without_mo_code[genera_without_mo_code_abbr %in% microorganisms$mo], 6, prefix = "B_")
|
||||
genera_without_mo_code_abbr[genera_without_mo_code_abbr %in% microorganisms$mo] <- abbreviate_mo(genera_without_mo_code[genera_without_mo_code_abbr %in% microorganisms$mo], 7, prefix = "B_")
|
||||
# all unique??
|
||||
sum(genera_without_mo_code_abbr %in% microorganisms$mo) == 0
|
||||
|
||||
genus_abb <- tibble(genus = genera_without_mo_code,
|
||||
abbr = genera_without_mo_code_abbr) %>%
|
||||
bind_rows(microorganisms %>%
|
||||
filter(kingdom == "Bacteria", rank == "genus", !genus %in% genera_without_mo_code) %>%
|
||||
transmute(genus, abbr = as.character(mo))) %>%
|
||||
arrange(genus)
|
||||
|
||||
|
||||
# Update taxonomy ---------------------------------------------------------
|
||||
|
||||
# fill in the taxonomy of new genera
|
||||
updated_taxonomy <- tibble(phylum = character(0),
|
||||
class = character(0),
|
||||
order = character(0),
|
||||
family = character(0),
|
||||
genus = character(0))
|
||||
for (page in LETTERS) {
|
||||
message("Downloading page ", page, "... ", appendLF = FALSE)
|
||||
url <- paste0("https://lpsn.dsmz.de/genus?page=", page)
|
||||
|
||||
x <- xml2::read_html(url) %>%
|
||||
rvest::html_node(".main-list") %>%
|
||||
# evety list element with a set <id> attribute
|
||||
rvest::html_nodes("li[id]")
|
||||
for (i in seq_len(length(x))) {
|
||||
txt <- x %>%
|
||||
magrittr::extract2(i) %>%
|
||||
rvest::html_text() %>%
|
||||
gsub("\\[[A-Za-z]+, no [a-z]+\\]", "NA", .) %>%
|
||||
gsub("Candidatus ", "", ., fixed = TRUE) %>%
|
||||
gsub("[ \t\r\n\"]+", "|", .) %>%
|
||||
gsub("\\|ShowHide.*", "", .) %>%
|
||||
gsub("[\\[\\]]", "", ., fixed = TRUE) %>%
|
||||
gsub("^\\|", "", .) %>%
|
||||
strsplit("|", fixed = TRUE) %>%
|
||||
unlist()
|
||||
txt[txt == "NA"] <- ""
|
||||
txt <- gsub("[^A-Za-z]+", "", txt)
|
||||
updated_taxonomy <- updated_taxonomy %>%
|
||||
bind_rows(tibble(phylum = txt[2],
|
||||
class = txt[3],
|
||||
order = txt[4],
|
||||
family = txt[5],
|
||||
genus = txt[6]))
|
||||
}
|
||||
message(length(x), " entries (total ", nrow(updated_taxonomy), ")")
|
||||
}
|
||||
|
||||
# Create new microorganisms -----------------------------------------------
|
||||
|
||||
new_microorganisms <- new_microorganisms %>%
|
||||
left_join(genus_abb, by = "genus") %>%
|
||||
group_by(genus) %>%
|
||||
mutate(species_abb = abbreviate_mo(species, 4)) %>%
|
||||
group_by(genus, species) %>%
|
||||
mutate(subspecies_abb = abbreviate_mo(subspecies, 4)) %>%
|
||||
ungroup() %>%
|
||||
mutate(mo = paste(abbr, species_abb, subspecies_abb, sep = "_"),
|
||||
mo = gsub("_+$", "", mo)) %>%
|
||||
select(-matches("abb"))
|
||||
|
||||
# add taxonomy new microorganisms
|
||||
MOs <- microorganisms %>%
|
||||
mutate(mo = as.character(mo)) %>%
|
||||
bind_rows(new_microorganisms) %>%
|
||||
arrange(fullname)
|
||||
|
||||
# unique MO codes
|
||||
MOs$mo[which(duplicated(MOs$mo))] <- paste0(MOs$mo[which(duplicated(MOs$mo))], 1)
|
||||
# all unique?
|
||||
!any(duplicated(MOs$mo))
|
||||
|
||||
MOs <- MOs %>%
|
||||
# remove entries that are now a synonym
|
||||
filter(!fullname %in% new_synonyms$fullname) %>%
|
||||
# update the taxonomy
|
||||
left_join(updated_taxonomy, by = "genus", suffix = c("", ".new")) %>%
|
||||
mutate(phylum = ifelse(!is.na(phylum.new), phylum.new, phylum),
|
||||
class = ifelse(!is.na(class.new), class.new, class),
|
||||
order = ifelse(!is.na(order.new), order.new, order),
|
||||
family = ifelse(!is.na(family.new), family.new, family)) %>%
|
||||
select(-ends_with(".new")) %>%
|
||||
# update prevalence based on taxonomy (Berends et al., 2021)
|
||||
mutate(prevalence = case_when(
|
||||
class == "Gammaproteobacteria"
|
||||
| genus %in% c("Enterococcus", "Staphylococcus", "Streptococcus")
|
||||
~ 1,
|
||||
kingdom %in% c("Archaea", "Bacteria", "Chromista", "Fungi")
|
||||
& (phylum %in% c("Proteobacteria",
|
||||
"Firmicutes",
|
||||
"Actinobacteria",
|
||||
"Sarcomastigophora")
|
||||
| genus %in% c("Absidia", "Acremonium", "Actinotignum", "Alternaria", "Anaerosalibacter", "Apophysomyces",
|
||||
"Arachnia", "Aspergillus", "Aureobacterium", "Aureobasidium", "Bacteroides", "Basidiobolus",
|
||||
"Beauveria", "Blastocystis", "Branhamella", "Calymmatobacterium", "Candida", "Capnocytophaga",
|
||||
"Catabacter", "Chaetomium", "Chryseobacterium", "Chryseomonas", "Chrysonilia", "Cladophialophora",
|
||||
"Cladosporium", "Conidiobolus", "Cryptococcus", "Curvularia", "Exophiala", "Exserohilum",
|
||||
"Flavobacterium", "Fonsecaea", "Fusarium", "Fusobacterium", "Hendersonula", "Hypomyces",
|
||||
"Koserella", "Lelliottia", "Leptosphaeria", "Leptotrichia", "Malassezia", "Malbranchea",
|
||||
"Mortierella", "Mucor", "Mycocentrospora", "Mycoplasma", "Nectria", "Ochroconis",
|
||||
"Oidiodendron", "Phoma", "Piedraia", "Pithomyces", "Pityrosporum", "Prevotella", "Pseudallescheria",
|
||||
"Rhizomucor", "Rhizopus", "Rhodotorula", "Scolecobasidium", "Scopulariopsis", "Scytalidium",
|
||||
"Sporobolomyces", "Stachybotrys", "Stomatococcus", "Treponema", "Trichoderma", "Trichophyton",
|
||||
"Trichosporon", "Tritirachium", "Ureaplasma")
|
||||
| rank %in% c("kingdom", "phylum", "class", "order", "family"))
|
||||
~ 2,
|
||||
TRUE ~ 3
|
||||
))
|
||||
|
||||
# add all mssing genera, families and orders
|
||||
MOs <- MOs %>%
|
||||
bind_rows(
|
||||
MOs %>%
|
||||
arrange(genus, species) %>%
|
||||
distinct(genus, .keep_all = TRUE) %>%
|
||||
filter(rank == "species", source != "manually added") %>%
|
||||
mutate(mo = gsub("^([A-Z]_[A-Z]+)_.*", "\\1", mo),
|
||||
fullname = genus,
|
||||
species = "",
|
||||
subspecies = "",
|
||||
rank = "genus",
|
||||
species_id = "",
|
||||
snomed = NA,
|
||||
ref = NA_character_),
|
||||
MOs %>%
|
||||
group_by(family) %>%
|
||||
filter(!any(rank == "family") & n() > 1) %>%
|
||||
ungroup() %>%
|
||||
arrange(family) %>%
|
||||
distinct(family, .keep_all = TRUE) %>%
|
||||
filter(!family %in% c("", NA), source != "manually added") %>%
|
||||
mutate(mo = paste0(substr(kingdom, 1, 1), "_[FAM]_",
|
||||
abbreviate(family,
|
||||
minlength = 8,
|
||||
use.classes = TRUE,
|
||||
method = "both.sides",
|
||||
strict = FALSE)),
|
||||
mo = toupper(mo),
|
||||
fullname = family,
|
||||
genus = "",
|
||||
species = "",
|
||||
subspecies = "",
|
||||
rank = "family",
|
||||
species_id = "",
|
||||
snomed = NA,
|
||||
ref = NA_character_),
|
||||
MOs %>%
|
||||
group_by(order) %>%
|
||||
filter(!any(rank == "order") & n() > 1) %>%
|
||||
ungroup() %>%
|
||||
arrange(order) %>%
|
||||
distinct(order, .keep_all = TRUE) %>%
|
||||
filter(!order %in% c("", NA), source != "manually added") %>%
|
||||
mutate(mo = paste0(substr(kingdom, 1, 1), "_[ORD]_",
|
||||
abbreviate(order,
|
||||
minlength = 8,
|
||||
use.classes = TRUE,
|
||||
method = "both.sides",
|
||||
strict = FALSE)),
|
||||
mo = toupper(mo),
|
||||
fullname = order,
|
||||
family = "",
|
||||
genus = "",
|
||||
species = "",
|
||||
subspecies = "",
|
||||
rank = "order",
|
||||
species_id = "",
|
||||
snomed = NA,
|
||||
ref = NA_character_)
|
||||
) %>%
|
||||
arrange(fullname)
|
||||
|
||||
# clean up
|
||||
MOs <- MOs %>%
|
||||
df_remove_nonASCII()
|
||||
|
||||
|
||||
# Merge synonyms ----------------------------------------------------------
|
||||
|
||||
# remove synonyms that are now valid names
|
||||
MOs.old <- microorganisms.old %>%
|
||||
# add new synonyms
|
||||
bind_rows(new_synonyms) %>%
|
||||
filter(!fullname %in% MOs$fullname) %>%
|
||||
arrange(fullname) %>%
|
||||
distinct(fullname, fullname_new, .keep_all = TRUE) %>%
|
||||
# add prevalence to old taxonomic names
|
||||
select(-prevalence) %>%
|
||||
left_join(MOs %>% select(fullname, prevalence), by = c("fullname_new" = "fullname")) %>%
|
||||
# clean up
|
||||
df_remove_nonASCII()
|
||||
|
||||
# Keep old codes for translation ------------------------------------------
|
||||
|
||||
# add removed microbial IDs to the internal translation table so old package versions keep working
|
||||
MOs.translation <- microorganisms %>%
|
||||
filter(!mo %in% MOs$mo) %>%
|
||||
select(mo, fullname) %>%
|
||||
left_join(new_synonyms) %>%
|
||||
left_join(MOs %>% transmute(fullname_new = fullname, mo2 = as.character(mo))) %>%
|
||||
select(mo_old = mo, mo_new = mo2) %>%
|
||||
distinct()
|
||||
MOs.translation <- AMR:::microorganisms.translation %>%
|
||||
left_join(MOs.translation %>% select(mo_new_update = mo_new, mo_new = mo_old)) %>%
|
||||
mutate(mo_new = as.character(ifelse(!is.na(mo_new_update), mo_new_update, mo_new))) %>%
|
||||
select(-mo_new_update) %>%
|
||||
bind_rows(
|
||||
# old IDs used in microorganisms.codes must put in here as well
|
||||
microorganisms.codes %>%
|
||||
filter(!mo %in% MOs$mo) %>%
|
||||
transmute(mo_old = mo, fullname = mo_name(mo)) %>%
|
||||
left_join(MOs.old %>%
|
||||
select(fullname, fullname_new)) %>%
|
||||
left_join(MOs %>%
|
||||
select(mo_new = mo, fullname_new = fullname)) %>%
|
||||
transmute(mo_old = as.character(mo_old), mo_new)) %>%
|
||||
arrange(mo_old) %>%
|
||||
filter(mo_old != mo_new,
|
||||
!mo_old %in% MOs$mo) %>%
|
||||
left_join(., .,
|
||||
by = c("mo_new" = "mo_old"),
|
||||
suffix = c("", ".2")) %>%
|
||||
mutate(mo_new = ifelse(!is.na(mo_new.2), mo_new.2, mo_new)) %>%
|
||||
distinct(mo_old, mo_new) %>%
|
||||
# clean up
|
||||
df_remove_nonASCII()
|
||||
|
||||
message("microorganisms new: ", sum(!MOs$fullname %in% c(microorganisms$fullname, MOs.old$fullname)))
|
||||
message("microorganisms renamed: ", sum(!MOs.old$fullname %in% microorganisms.old$fullname))
|
||||
|
||||
|
||||
# Save --------------------------------------------------------------------
|
||||
|
||||
# class <mo>
|
||||
class(MOs$mo) <- c("mo", "character")
|
||||
class(MOs.translation$mo_new) <- c("mo", "character")
|
||||
|
||||
microorganisms <- MOs
|
||||
microorganisms.old <- MOs.old
|
||||
microorganisms.translation <- MOs.translation
|
||||
|
||||
# on the server, do:
|
||||
usethis::use_data(microorganisms, overwrite = TRUE, version = 2, compress = "xz")
|
||||
usethis::use_data(microorganisms.old, overwrite = TRUE, version = 2)
|
||||
saveRDS(microorganisms.translation, file = "data-raw/microorganisms.translation.rds", version = 2)
|
||||
rm(microorganisms)
|
||||
rm(microorganisms.old)
|
||||
rm(microorganisms.translation)
|
||||
# to save microorganisms.translation internally to the package
|
||||
devtools::load_all(".")
|
||||
source("data-raw/_internals.R")
|
||||
|
||||
# load new data sets
|
||||
devtools::load_all(".")
|
||||
|
||||
# reset previously changed mo codes
|
||||
rsi_translation$mo <- as.mo(rsi_translation$mo, language = NULL)
|
||||
usethis::use_data(rsi_translation, overwrite = TRUE, version = 2)
|
||||
rm(rsi_translation)
|
||||
|
||||
microorganisms.codes$mo <- as.mo(microorganisms.codes$mo, language = NULL)
|
||||
usethis::use_data(microorganisms.codes, overwrite = TRUE, version = 2)
|
||||
rm(microorganisms.codes)
|
||||
|
||||
example_isolates$mo <- as.mo(example_isolates$mo, language = NULL)
|
||||
usethis::use_data(example_isolates, overwrite = TRUE, version = 2)
|
||||
rm(example_isolates)
|
||||
|
||||
intrinsic_resistant$microorganism <- suppressMessages(mo_name(intrinsic_resistant$microorganism))
|
||||
usethis::use_data(intrinsic_resistant, overwrite = TRUE, version = 2)
|
||||
rm(intrinsic_resistant)
|
||||
|
||||
# load new data sets again
|
||||
devtools::load_all(".")
|
||||
source("data-raw/_internals.R")
|
||||
devtools::load_all(".")
|
||||
|
||||
|
||||
# Test updates ------------------------------------------------------------
|
||||
|
||||
# and check: these codes should not be missing (will otherwise throw a unit test error):
|
||||
AMR::microorganisms.codes %>% filter(!mo %in% MOs$mo)
|
||||
AMR::rsi_translation %>% filter(!mo %in% MOs$mo)
|
||||
AMR:::microorganisms.translation %>% filter(!mo_new %in% MOs$mo)
|
||||
AMR::example_isolates %>% filter(!mo %in% MOs$mo)
|
||||
|
||||
# Don't forget to add SNOMED codes! (data-raw/snomed.R)
|
||||
|
||||
# run the unit tests
|
||||
Sys.setenv(NOT_CRAN = "true")
|
||||
testthat::test_file("tests/testthat/test-data.R")
|
||||
testthat::test_file("tests/testthat/test-mo.R")
|
||||
testthat::test_file("tests/testthat/test-mo_property.R")
|
@ -1 +1 @@
|
||||
f816b536ddd71d00e1adcdaba97d0329
|
||||
aa80f169fc2cba97f5eedc1d24ca8c03
|
||||
|
@ -1982,7 +1982,7 @@
|
||||
"EUCAST 2020" "MIC" "Streptococcus pyogenes" "Azithromycin" "Streptococcus A,B,C,G" 0.25 0.5 FALSE
|
||||
"EUCAST 2020" "MIC" "Streptococcus salivarius" "Azithromycin" "Streptococcus A,B,C,G" 0.25 0.5 FALSE
|
||||
"EUCAST 2020" "MIC" "Streptococcus sanguinis" "Azithromycin" "Streptococcus A,B,C,G" 0.25 0.5 FALSE
|
||||
"EUCAST 2020" "MIC" "Mycobacterium africanum" "Bedaquiline" "M.tuberculosis" 0.25 0.25 FALSE
|
||||
"EUCAST 2020" "MIC" "Mycobacterium tuberculosis" "Bedaquiline" "M.tuberculosis" 0.25 0.25 FALSE
|
||||
"EUCAST 2020" "DISK" "Enterobacterales" "Ceftobiprole" "Enterobacterales" "5ug" 23 23 FALSE
|
||||
"EUCAST 2020" "MIC" "Enterobacterales" "Ceftobiprole" "Enterobacterales" 0.25 0.25 FALSE
|
||||
"EUCAST 2020" "DISK" "Staphylococcus aureus" "Ceftobiprole" "Staphylococcus" "5ug" 17 17 FALSE
|
||||
@ -2367,7 +2367,7 @@
|
||||
"EUCAST 2020" "MIC" "Streptococcus pyogenes" "Delafloxacin" "Streptococcus A,B,C,G" 0.03 0.03 FALSE
|
||||
"EUCAST 2020" "MIC" "Streptococcus salivarius" "Delafloxacin" "Streptococcus A,B,C,G" 0.03 0.03 FALSE
|
||||
"EUCAST 2020" "MIC" "Streptococcus sanguinis" "Delafloxacin" "Streptococcus A,B,C,G" 0.03 0.03 FALSE
|
||||
"EUCAST 2020" "MIC" "Mycobacterium africanum" "Delamanid" "M.tuberculosis" 0.06 0.06 FALSE
|
||||
"EUCAST 2020" "MIC" "Mycobacterium tuberculosis" "Delamanid" "M.tuberculosis" 0.06 0.06 FALSE
|
||||
"EUCAST 2020" "MIC" "Burkholderia pseudomallei" "Doxycycline" "B.pseudomallei" 0.001 2 FALSE
|
||||
"EUCAST 2020" "MIC" "Haemophilus influenzae" "Doxycycline" "H.influenzae" 1 2 FALSE
|
||||
"EUCAST 2020" "MIC" "Kingella kingae" "Doxycycline" "K.kingae" 0.5 0.5 FALSE
|
||||
@ -3743,7 +3743,7 @@
|
||||
"EUCAST 2019" "MIC" "Streptococcus pyogenes" "Azithromycin" "Streptococcus A,B,C,G" 0.25 0.5 FALSE
|
||||
"EUCAST 2019" "MIC" "Streptococcus salivarius" "Azithromycin" "Streptococcus A,B,C,G" 0.25 0.5 FALSE
|
||||
"EUCAST 2019" "MIC" "Streptococcus sanguinis" "Azithromycin" "Streptococcus A,B,C,G" 0.25 0.5 FALSE
|
||||
"EUCAST 2019" "MIC" "Mycobacterium africanum" "Bedaquiline" "M.tuberculosis" 0.25 0.25 FALSE
|
||||
"EUCAST 2019" "MIC" "Mycobacterium tuberculosis" "Bedaquiline" "M.tuberculosis" 0.25 0.25 FALSE
|
||||
"EUCAST 2019" "DISK" "Enterobacterales" "Ceftobiprole" "Enterobacterales" "5ug" 23 23 FALSE
|
||||
"EUCAST 2019" "MIC" "Enterobacterales" "Ceftobiprole" "Enterobacterales" 0.25 0.25 FALSE
|
||||
"EUCAST 2019" "DISK" "Staphylococcus aureus" "Ceftobiprole" "Staphylococcus" "5ug" 17 17 FALSE
|
||||
@ -4098,7 +4098,7 @@
|
||||
"EUCAST 2019" "MIC" "Streptococcus pyogenes" "Daptomycin" "Streptococcus A,B,C,G" 1 1 FALSE
|
||||
"EUCAST 2019" "MIC" "Streptococcus salivarius" "Daptomycin" "Streptococcus A,B,C,G" 1 1 FALSE
|
||||
"EUCAST 2019" "MIC" "Streptococcus sanguinis" "Daptomycin" "Streptococcus A,B,C,G" 1 1 FALSE
|
||||
"EUCAST 2019" "MIC" "Mycobacterium africanum" "Delamanid" "M.tuberculosis" 0.06 0.06 FALSE
|
||||
"EUCAST 2019" "MIC" "Mycobacterium tuberculosis" "Delamanid" "M.tuberculosis" 0.06 0.06 FALSE
|
||||
"EUCAST 2019" "MIC" "Haemophilus influenzae" "Doxycycline" "H.influenzae" 1 2 FALSE
|
||||
"EUCAST 2019" "MIC" "Kingella kingae" "Doxycycline" "K.kingae" 0.5 0.5 FALSE
|
||||
"EUCAST 2019" "MIC" "Moraxella catarrhalis" "Doxycycline" "M.catarrhalis" 1 2 FALSE
|
||||
|
@ -26,89 +26,44 @@
|
||||
library(AMR)
|
||||
library(tidyverse)
|
||||
|
||||
# go to https://www.nictiz.nl/standaardisatie/terminologiecentrum/referentielijsten/micro-organismen/ (Ctrl/Cmd + A in table)
|
||||
# read the table from clipboard
|
||||
snomed <- clipr::read_clip_tbl(skip = 2)
|
||||
snomed <- snomed %>%
|
||||
dplyr::filter(gsub("(^genus |^familie |^stam |ss.? |subsp.? |subspecies )", "",
|
||||
Omschrijving.,
|
||||
ignore.case = TRUE) %in% c(microorganisms$fullname,
|
||||
microorganisms.old$fullname)) %>%
|
||||
dplyr::transmute(fullname = mo_name(Omschrijving.),
|
||||
snomed = as.integer(Id)) %>%
|
||||
dplyr::filter(!fullname %like% "unknown")
|
||||
snomed_trans <- snomed %>%
|
||||
group_by(fullname) %>%
|
||||
mutate(snomed_list = list(snomed)) %>%
|
||||
ungroup() %>%
|
||||
select(fullname, snomed = snomed_list) %>%
|
||||
distinct(fullname, .keep_all = TRUE)
|
||||
# we will use Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS)
|
||||
# as a source, which copies directly from the latest US SNOMED CT version
|
||||
# - go to https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.1009
|
||||
# - check that current online version is higher than SNOMED_VERSION$current_version
|
||||
# - if so, click on 'Download Value Set', choose 'TXT'
|
||||
snomed <- read_tsv("data-raw/SNOMED_PHVS_Microorganism_CDC_V12.txt", skip = 3) %>%
|
||||
select(1:2) %>%
|
||||
set_names(c("snomed", "mo"))
|
||||
|
||||
microorganisms <- AMR::microorganisms %>%
|
||||
left_join(snomed_trans)
|
||||
# remove the NULLs, set to NA
|
||||
microorganisms$snomed <- lapply(microorganisms$snomed, function(x) if (length(x) == 0) NA else x)
|
||||
# save all valid genera, species and subspecies
|
||||
vctr <- unique(unlist(strsplit(c(microorganisms$fullname, microorganisms.old$fullname), " ")))
|
||||
vctr <- tolower(vctr[vctr %like% "^[a-z]+$"])
|
||||
|
||||
microorganisms <- dataset_UTF8_to_ASCII(microorganisms)
|
||||
# remove all parts of the name that are no valid values in genera, species or subspecies
|
||||
snomed <- snomed %>%
|
||||
mutate(fullname = vapply(FUN.VALUE = character(1),
|
||||
# split on space and/or comma
|
||||
strsplit(tolower(mo), "[ ,]"),
|
||||
function(x) trimws(paste0(x[x %in% vctr], collapse = " "))),
|
||||
# remove " group"
|
||||
fullname = gsub(" group", "", fullname, fixed = TRUE))
|
||||
|
||||
usethis::use_data(microorganisms, overwrite = TRUE)
|
||||
rm(microorganisms)
|
||||
snomed_keep <- snomed %>%
|
||||
filter(fullname %in% tolower(c(microorganisms$fullname, microorganisms.old$fullname))) %>%
|
||||
group_by(fullname_lower = fullname) %>%
|
||||
summarise(snomed = list(snomed))
|
||||
|
||||
# OLD ---------------------------------------------------------------------
|
||||
# save to microorganisms data set
|
||||
microorganisms <- microorganisms %>%
|
||||
# remove old snomed
|
||||
select(-snomed) %>%
|
||||
# create dummy var for joining
|
||||
mutate(fullname_lower = tolower(fullname)) %>%
|
||||
# join new snomed
|
||||
left_join(snomed_keep) %>%
|
||||
# remove dummy var
|
||||
select(-fullname_lower) %>%
|
||||
AMR:::dataset_UTF8_to_ASCII()
|
||||
usethis::use_data(microorganisms, overwrite = TRUE, compress = "xz")
|
||||
|
||||
# baseUrl <- 'https://browser.ihtsdotools.org/snowstorm/snomed-ct'
|
||||
# edition <- 'MAIN'
|
||||
# version <- '2019-07-31'
|
||||
#
|
||||
# microorganisms.snomed <- data.frame(conceptid = character(0),
|
||||
# mo = character(0),
|
||||
# stringsAsFactors = FALSE)
|
||||
# microorganisms$snomed <- ""
|
||||
#
|
||||
# # for (i in 1:50) {
|
||||
# for (i in 1:1000) {
|
||||
#
|
||||
# if (i %% 10 == 0) {
|
||||
# cat(paste0(i, " - ", cleaner::percentage(i / nrow(microorganisms)), "\n"))
|
||||
# }
|
||||
#
|
||||
# mo_data <- microorganisms %>%
|
||||
# filter(mo == microorganisms$mo[i]) %>%
|
||||
# as.list()
|
||||
#
|
||||
# if (!mo_data$rank %in% c("genus", "species")) {
|
||||
# next
|
||||
# }
|
||||
#
|
||||
# searchTerm <- paste0(
|
||||
# ifelse(mo_data$rank == "genus", "Genus ", ""),
|
||||
# mo_data$fullname,
|
||||
# " (organism)")
|
||||
#
|
||||
# url <- paste0(baseUrl, '/browser/',
|
||||
# edition, '/',
|
||||
# version,
|
||||
# '/descriptions?term=', curl::curl_escape(searchTerm),
|
||||
# '&mode=fullText&activeFilter=true&limit=', 250)
|
||||
# results <- url %>%
|
||||
# httr::GET() %>%
|
||||
# httr::content(type = "text", encoding = "UTF-8") %>%
|
||||
# jsonlite::fromJSON(flatten = TRUE) %>%
|
||||
# .$items
|
||||
# if (NROW(results) == 0) {
|
||||
# next
|
||||
# } else {
|
||||
# message("Adding ", crayon::italic(mo_data$fullname))
|
||||
# }
|
||||
#
|
||||
# tryCatch(
|
||||
# microorganisms$snomed[i] <- results %>% filter(term == searchTerm) %>% pull(concept.conceptId),
|
||||
# error = function(e) invisible()
|
||||
# )
|
||||
#
|
||||
# if (nrow(results) > 1) {
|
||||
# microorganisms.snomed <- microorganisms.snomed %>%
|
||||
# bind_rows(tibble(conceptid = results %>% filter(term != searchTerm) %>% pull(concept.conceptId) %>% unique(),
|
||||
# mo = as.character(mo_data$mo)))
|
||||
# }
|
||||
# }
|
||||
# don't forget to update the version number in SNOMED_VERSION in ./R/globals.R!
|
||||
|
@ -1,412 +1,262 @@
|
||||
lang pattern replacement fixed ignore.case affect_mo_name
|
||||
de Coagulase-negative Staphylococcus Koagulase-negative Staphylococcus FALSE FALSE TRUE
|
||||
de Coagulase-positive Staphylococcus Koagulase-positive Staphylococcus FALSE FALSE TRUE
|
||||
de Beta-haemolytic Streptococcus Beta-hämolytischer Streptococcus FALSE FALSE TRUE
|
||||
de unknown Gram-negatives unbekannte Gramnegativen FALSE FALSE TRUE
|
||||
de unknown Gram-positives unbekannte Grampositiven FALSE FALSE TRUE
|
||||
de unknown fungus unbekannter Pilze FALSE FALSE TRUE
|
||||
de unknown yeast unbekannte Hefe FALSE FALSE TRUE
|
||||
de unknown name unbekannte Name FALSE FALSE TRUE
|
||||
de unknown kingdom unbekanntes Reich FALSE FALSE TRUE
|
||||
de unknown phylum unbekannter Stamm FALSE FALSE TRUE
|
||||
de unknown class unbekannte Klasse FALSE FALSE TRUE
|
||||
de unknown order unbekannte Ordnung FALSE FALSE TRUE
|
||||
de unknown family unbekannte Familie FALSE FALSE TRUE
|
||||
de unknown genus unbekannte Gattung FALSE FALSE TRUE
|
||||
de unknown species unbekannte Art FALSE FALSE TRUE
|
||||
de unknown subspecies unbekannte Unterart FALSE FALSE TRUE
|
||||
de unknown rank unbekannter Rang FALSE FALSE TRUE
|
||||
de CoNS KNS TRUE FALSE TRUE
|
||||
de CoPS KPS TRUE FALSE TRUE
|
||||
de Gram-negative Gramnegativ FALSE FALSE FALSE
|
||||
de Gram-positive Grampositiv FALSE FALSE FALSE
|
||||
de ^Bacteria$ Bakterien FALSE FALSE FALSE
|
||||
de ^Fungi$ Pilze FALSE FALSE FALSE
|
||||
de ^Yeasts$ Hefen FALSE FALSE FALSE
|
||||
de ^Protozoa$ Protozoen FALSE FALSE FALSE
|
||||
de biogroup Biogruppe FALSE FALSE FALSE
|
||||
de biotype Biotyp FALSE FALSE FALSE
|
||||
de vegetative vegetativ FALSE FALSE FALSE
|
||||
de ([([ ]*?)group \\1Gruppe FALSE FALSE FALSE
|
||||
de ([([ ]*?)Group \\1Gruppe FALSE FALSE FALSE
|
||||
de no .*growth keine? .*wachstum FALSE TRUE FALSE
|
||||
de (^| )no|not keine? FALSE TRUE FALSE
|
||||
nl Coagulase-negative Staphylococcus Coagulase-negatieve Staphylococcus FALSE FALSE TRUE
|
||||
nl Coagulase-positive Staphylococcus Coagulase-positieve Staphylococcus FALSE FALSE TRUE
|
||||
nl Beta-haemolytic Streptococcus Beta-hemolytische Streptococcus FALSE FALSE TRUE
|
||||
nl unknown Gram-negatives onbekende Gram-negatieven FALSE FALSE TRUE
|
||||
nl unknown Gram-positives onbekende Gram-positieven FALSE FALSE TRUE
|
||||
nl unknown fungus onbekende schimmel FALSE FALSE TRUE
|
||||
nl unknown yeast onbekende gist FALSE FALSE TRUE
|
||||
nl unknown name onbekende naam FALSE FALSE TRUE
|
||||
nl unknown kingdom onbekend koninkrijk FALSE FALSE TRUE
|
||||
nl unknown phylum onbekend fylum FALSE FALSE TRUE
|
||||
nl unknown class onbekende klasse FALSE FALSE TRUE
|
||||
nl unknown order onbekende orde FALSE FALSE TRUE
|
||||
nl unknown family onbekende familie FALSE FALSE TRUE
|
||||
nl unknown genus onbekend geslacht FALSE FALSE TRUE
|
||||
nl unknown species onbekende soort FALSE FALSE TRUE
|
||||
nl unknown subspecies onbekende ondersoort FALSE FALSE TRUE
|
||||
nl unknown rank onbekende rang FALSE FALSE TRUE
|
||||
nl CoNS CNS TRUE FALSE TRUE
|
||||
nl CoPS CPS TRUE FALSE TRUE
|
||||
nl Gram-negative Gram-negatief FALSE FALSE FALSE
|
||||
nl Gram-positive Gram-positief FALSE FALSE FALSE
|
||||
nl ^Bacteria$ Bacteriën FALSE FALSE FALSE
|
||||
nl ^Fungi$ Schimmels FALSE FALSE FALSE
|
||||
nl ^Yeasts$ Gisten FALSE FALSE FALSE
|
||||
nl ^Protozoa$ Protozoën FALSE FALSE FALSE
|
||||
nl biogroup biogroep FALSE FALSE FALSE
|
||||
nl vegetative vegetatief FALSE FALSE FALSE
|
||||
nl ([([ ]*?)group \\1groep FALSE FALSE FALSE
|
||||
nl ([([ ]*?)Group \\1Groep FALSE FALSE FALSE
|
||||
nl antibiotic antibioticum FALSE FALSE FALSE
|
||||
nl Antibiotic Antibioticum FALSE FALSE FALSE
|
||||
nl Drug Middel FALSE FALSE FALSE
|
||||
nl drug middel FALSE FALSE FALSE
|
||||
nl no .*growth geen .*groei FALSE TRUE FALSE
|
||||
nl no|not geen|niet FALSE TRUE FALSE
|
||||
es Coagulase-negative Staphylococcus Staphylococcus coagulasa negativo FALSE FALSE TRUE
|
||||
es Coagulase-positive Staphylococcus Staphylococcus coagulasa positivo FALSE FALSE TRUE
|
||||
es Beta-haemolytic Streptococcus Streptococcus Beta-hemolítico FALSE FALSE TRUE
|
||||
es unknown Gram-negatives Gram negativos desconocidos FALSE FALSE TRUE
|
||||
es unknown Gram-positives Gram positivos desconocidos FALSE FALSE TRUE
|
||||
es unknown fungus hongo desconocido FALSE FALSE TRUE
|
||||
es unknown yeast levadura desconocida FALSE FALSE TRUE
|
||||
es unknown name nombre desconocido FALSE FALSE TRUE
|
||||
es unknown kingdom reino desconocido FALSE FALSE TRUE
|
||||
es unknown phylum filo desconocido FALSE FALSE TRUE
|
||||
es unknown class clase desconocida FALSE FALSE TRUE
|
||||
es unknown order orden desconocido FALSE FALSE TRUE
|
||||
es unknown family familia desconocida FALSE FALSE TRUE
|
||||
es unknown genus género desconocido FALSE FALSE TRUE
|
||||
es unknown species especie desconocida FALSE FALSE TRUE
|
||||
es unknown subspecies subespecie desconocida FALSE FALSE TRUE
|
||||
es unknown rank rango desconocido FALSE FALSE TRUE
|
||||
es CoNS SCN TRUE FALSE TRUE
|
||||
es CoPS SCP TRUE FALSE TRUE
|
||||
es Gram-negative Gram negativo FALSE FALSE FALSE
|
||||
es Gram-positive Gram positivo FALSE FALSE FALSE
|
||||
es ^Bacteria$ Bacterias FALSE FALSE FALSE
|
||||
es ^Fungi$ Hongos FALSE FALSE FALSE
|
||||
es ^Yeasts$ Levaduras FALSE FALSE FALSE
|
||||
es ^Protozoa$ Protozoarios FALSE FALSE FALSE
|
||||
es biogroup biogrupo FALSE FALSE FALSE
|
||||
es biotype biotipo FALSE FALSE FALSE
|
||||
es vegetative vegetativo FALSE FALSE FALSE
|
||||
es ([([ ]*?)group \\1grupo FALSE FALSE FALSE
|
||||
es ([([ ]*?)Group \\1Grupo FALSE FALSE FALSE
|
||||
es no .*growth no .*crecimientonon FALSE TRUE FALSE
|
||||
es no|not no|sin FALSE TRUE FALSE
|
||||
it Coagulase-negative Staphylococcus Staphylococcus negativo coagulasi FALSE FALSE TRUE
|
||||
it Coagulase-positive Staphylococcus Staphylococcus positivo coagulasi FALSE FALSE TRUE
|
||||
it Beta-haemolytic Streptococcus Streptococcus Beta-emolitico FALSE FALSE TRUE
|
||||
it unknown Gram-negatives Gram negativi sconosciuti FALSE FALSE TRUE
|
||||
it unknown Gram-positives Gram positivi sconosciuti FALSE FALSE TRUE
|
||||
it unknown fungus fungo sconosciuto FALSE FALSE TRUE
|
||||
it unknown yeast lievito sconosciuto FALSE FALSE TRUE
|
||||
it unknown name nome sconosciuto FALSE FALSE TRUE
|
||||
it unknown kingdom regno sconosciuto FALSE FALSE TRUE
|
||||
it unknown phylum phylum sconosciuto FALSE FALSE TRUE
|
||||
it unknown class classe sconosciuta FALSE FALSE TRUE
|
||||
it unknown order ordine sconosciuto FALSE FALSE TRUE
|
||||
it unknown family famiglia sconosciuta FALSE FALSE TRUE
|
||||
it unknown genus genere sconosciuto FALSE FALSE TRUE
|
||||
it unknown species specie sconosciute FALSE FALSE TRUE
|
||||
it unknown subspecies sottospecie sconosciute FALSE FALSE TRUE
|
||||
it unknown rank grado sconosciuto FALSE FALSE TRUE
|
||||
it Gram-negative Gram negativo FALSE FALSE FALSE
|
||||
it Gram-positive Gram positivo FALSE FALSE FALSE
|
||||
it ^Bacteria$ Batteri FALSE FALSE FALSE
|
||||
it ^Fungi$ Funghi FALSE FALSE FALSE
|
||||
it ^Yeasts$ Lieviti FALSE FALSE FALSE
|
||||
it ^Protozoa$ Protozoi FALSE FALSE FALSE
|
||||
it biogroup biogruppo FALSE FALSE FALSE
|
||||
it biotype biotipo FALSE FALSE FALSE
|
||||
it vegetative vegetativo FALSE FALSE FALSE
|
||||
it ([([ ]*?)group \\1gruppo FALSE FALSE FALSE
|
||||
it ([([ ]*?)Group \\1Gruppo FALSE FALSE FALSE
|
||||
it no .*growth sem .*crescimento FALSE TRUE FALSE
|
||||
it no|not sem FALSE TRUE FALSE
|
||||
fr Coagulase-negative Staphylococcus Staphylococcus à coagulase négative FALSE FALSE TRUE
|
||||
fr Coagulase-positive Staphylococcus Staphylococcus à coagulase positif FALSE FALSE TRUE
|
||||
fr Beta-haemolytic Streptococcus Streptococcus Bêta-hémolytique FALSE FALSE TRUE
|
||||
fr unknown Gram-negatives Gram négatifs inconnus FALSE FALSE TRUE
|
||||
fr unknown Gram-positives Gram positifs inconnus FALSE FALSE TRUE
|
||||
fr unknown fungus champignon inconnu FALSE FALSE TRUE
|
||||
fr unknown yeast levure inconnue FALSE FALSE TRUE
|
||||
fr unknown name nom inconnu FALSE FALSE TRUE
|
||||
fr unknown kingdom règme inconnu FALSE FALSE TRUE
|
||||
fr unknown phylum embranchement inconnu FALSE FALSE TRUE
|
||||
fr unknown class classe inconnue FALSE FALSE TRUE
|
||||
fr unknown order ordre inconnu FALSE FALSE TRUE
|
||||
fr unknown family famille inconnue FALSE FALSE TRUE
|
||||
fr unknown genus genre inconnu FALSE FALSE TRUE
|
||||
fr unknown species espèce inconnue FALSE FALSE TRUE
|
||||
fr unknown subspecies sous-espèce inconnue FALSE FALSE TRUE
|
||||
fr unknown rank rang inconnu FALSE FALSE TRUE
|
||||
fr Gram-negative Gram négatif FALSE FALSE FALSE
|
||||
fr Gram-positive Gram positif FALSE FALSE FALSE
|
||||
fr ^Bacteria$ Bactéries FALSE FALSE FALSE
|
||||
fr ^Fungi$ Champignons FALSE FALSE FALSE
|
||||
fr ^Yeasts$ Levures FALSE FALSE FALSE
|
||||
fr ^Protozoa$ Protozoaires FALSE FALSE FALSE
|
||||
fr biogroup biogroupe FALSE FALSE FALSE
|
||||
fr vegetative végétatif FALSE FALSE FALSE
|
||||
fr ([([ ]*?)group \\1groupe FALSE FALSE FALSE
|
||||
fr ([([ ]*?)Group \\1Groupe FALSE FALSE FALSE
|
||||
fr no .*growth pas .*croissance FALSE TRUE FALSE
|
||||
fr no|not non FALSE TRUE FALSE
|
||||
pt Coagulase-negative Staphylococcus Staphylococcus coagulase negativo FALSE FALSE TRUE
|
||||
pt Coagulase-positive Staphylococcus Staphylococcus coagulase positivo FALSE FALSE TRUE
|
||||
pt Beta-haemolytic Streptococcus Streptococcus Beta-hemolítico FALSE FALSE TRUE
|
||||
pt unknown Gram-negatives Gram negativos desconhecidos FALSE FALSE TRUE
|
||||
pt unknown Gram-positives Gram positivos desconhecidos FALSE FALSE TRUE
|
||||
pt unknown fungus fungo desconhecido FALSE FALSE TRUE
|
||||
pt unknown yeast levedura desconhecida FALSE FALSE TRUE
|
||||
pt unknown name nome desconhecido FALSE FALSE TRUE
|
||||
pt unknown kingdom reino desconhecido FALSE FALSE TRUE
|
||||
pt unknown phylum filo desconhecido FALSE FALSE TRUE
|
||||
pt unknown class classe desconhecida FALSE FALSE TRUE
|
||||
pt unknown order ordem desconhecido FALSE FALSE TRUE
|
||||
pt unknown family família desconhecida FALSE FALSE TRUE
|
||||
pt unknown genus gênero desconhecido FALSE FALSE TRUE
|
||||
pt unknown species espécies desconhecida FALSE FALSE TRUE
|
||||
pt unknown subspecies subespécies desconhecida FALSE FALSE TRUE
|
||||
pt unknown rank classificação desconhecido FALSE FALSE TRUE
|
||||
pt Gram-negative Gram negativo FALSE FALSE FALSE
|
||||
pt Gram-positive Gram positivo FALSE FALSE FALSE
|
||||
pt ^Bacteria$ Bactérias FALSE FALSE FALSE
|
||||
pt ^Fungi$ Fungos FALSE FALSE FALSE
|
||||
pt ^Yeasts$ Leveduras FALSE FALSE FALSE
|
||||
pt ^Protozoa$ Protozoários FALSE FALSE FALSE
|
||||
pt biogroup biogrupo FALSE FALSE FALSE
|
||||
pt biotype biótipo FALSE FALSE FALSE
|
||||
pt vegetative vegetativo FALSE FALSE FALSE
|
||||
pt ([([ ]*?)group \\1grupo FALSE FALSE FALSE
|
||||
pt ([([ ]*?)Group \\1Grupo FALSE FALSE FALSE
|
||||
pt no .*growth sem .*crescimento FALSE TRUE FALSE
|
||||
pt no|not sem FALSE TRUE FALSE
|
||||
de clavulanic acid Clavulansäure FALSE TRUE FALSE
|
||||
nl 4-aminosalicylic acid 4-aminosalicylzuur TRUE FALSE FALSE
|
||||
nl Adefovir dipivoxil Adefovir TRUE FALSE FALSE
|
||||
nl Aldesulfone sodium Aldesulfon TRUE FALSE FALSE
|
||||
nl Amikacin Amikacine TRUE FALSE FALSE
|
||||
nl Amoxicillin Amoxicilline TRUE FALSE FALSE
|
||||
nl Amoxicillin/beta-lactamase inhibitor Amoxicilline/enzymremmer TRUE FALSE FALSE
|
||||
nl Amphotericin B Amfotericine B TRUE FALSE FALSE
|
||||
nl Ampicillin Ampicilline TRUE FALSE FALSE
|
||||
nl Ampicillin/beta-lactamase inhibitor Ampicilline/enzymremmer TRUE FALSE FALSE
|
||||
nl Anidulafungin Anidulafungine TRUE FALSE FALSE
|
||||
nl Azidocillin Azidocilline TRUE FALSE FALSE
|
||||
nl Azithromycin Azitromycine TRUE FALSE FALSE
|
||||
nl Azlocillin Azlocilline TRUE FALSE FALSE
|
||||
nl Bacampicillin Bacampicilline TRUE FALSE FALSE
|
||||
nl Bacitracin Bacitracine TRUE FALSE FALSE
|
||||
nl Benzathine benzylpenicillin Benzylpenicillinebenzathine TRUE FALSE FALSE
|
||||
nl Benzathine phenoxymethylpenicillin Fenoxymethylpenicillinebenzathine TRUE FALSE FALSE
|
||||
nl Benzylpenicillin Benzylpenicilline TRUE FALSE FALSE
|
||||
nl Calcium aminosalicylate Aminosalicylzuur TRUE FALSE FALSE
|
||||
nl Capreomycin Capreomycine TRUE FALSE FALSE
|
||||
nl Carbenicillin Carbenicilline TRUE FALSE FALSE
|
||||
nl Carindacillin Carindacilline TRUE FALSE FALSE
|
||||
nl Caspofungin Caspofungine TRUE FALSE FALSE
|
||||
nl Ce(f|ph)acetrile Cefacetril FALSE FALSE FALSE
|
||||
nl Ce(f|ph)alexin Cefalexine FALSE FALSE FALSE
|
||||
nl Ce(f|ph)alotin Cefalotine FALSE FALSE FALSE
|
||||
nl Ce(f|ph)amandole Cefamandol FALSE FALSE FALSE
|
||||
nl Ce(f|ph)apirin Cefapirine FALSE FALSE FALSE
|
||||
nl Ce(f|ph)azedone Cefazedon FALSE FALSE FALSE
|
||||
nl Ce(f|ph)azolin Cefazoline FALSE FALSE FALSE
|
||||
nl Ce(f|ph)alothin Cefalotine FALSE FALSE FALSE
|
||||
nl Ce(f|ph)alexin Cefalexine FALSE FALSE FALSE
|
||||
nl Ce(f|ph)epime Cefepim FALSE FALSE FALSE
|
||||
nl Ce(f|ph)ixime Cefixim FALSE FALSE FALSE
|
||||
nl Ce(f|ph)menoxime Cefmenoxim FALSE FALSE FALSE
|
||||
nl Ce(f|ph)metazole Cefmetazol FALSE FALSE FALSE
|
||||
nl Ce(f|ph)odizime Cefodizim FALSE FALSE FALSE
|
||||
nl Ce(f|ph)onicid Cefonicide FALSE FALSE FALSE
|
||||
nl Ce(f|ph)operazone Cefoperazon FALSE FALSE FALSE
|
||||
nl Ce(f|ph)operazone/beta-lactamase inhibitor Cefoperazon/enzymremmer FALSE FALSE FALSE
|
||||
nl Ce(f|ph)otaxime Cefotaxim FALSE FALSE FALSE
|
||||
nl Ce(f|ph)oxitin Cefoxitine FALSE FALSE FALSE
|
||||
nl Ce(f|ph)pirome Cefpirom FALSE FALSE FALSE
|
||||
nl Ce(f|ph)podoxime Cefpodoxim FALSE FALSE FALSE
|
||||
nl Ce(f|ph)radine Cefradine FALSE FALSE FALSE
|
||||
nl Ce(f|ph)sulodin Cefsulodine FALSE FALSE FALSE
|
||||
nl Ce(f|ph)tazidime Ceftazidim FALSE FALSE FALSE
|
||||
nl Ce(f|ph)tezole Ceftezol FALSE FALSE FALSE
|
||||
nl Ce(f|ph)tizoxime Ceftizoxim FALSE FALSE FALSE
|
||||
nl Ce(f|ph)triaxone Ceftriaxon FALSE FALSE FALSE
|
||||
nl Ce(f|ph)uroxime Cefuroxim FALSE FALSE FALSE
|
||||
nl Ce(f|ph)uroxime/metronidazole Cefuroxim/andere antibacteriele middelen FALSE FALSE FALSE
|
||||
nl Chloramphenicol Chlooramfenicol TRUE FALSE FALSE
|
||||
nl Chlortetracycline Chloortetracycline TRUE FALSE FALSE
|
||||
nl Cinoxacin Cinoxacine TRUE FALSE FALSE
|
||||
nl Ciprofloxacin Ciprofloxacine TRUE FALSE FALSE
|
||||
nl Clarithromycin Claritromycine TRUE FALSE FALSE
|
||||
nl Clavulanic acid Clavulaanzuur TRUE FALSE FALSE
|
||||
nl clavulanic acid clavulaanzuur TRUE FALSE FALSE
|
||||
nl Clindamycin Clindamycine TRUE FALSE FALSE
|
||||
nl Clometocillin Clometocilline TRUE FALSE FALSE
|
||||
nl Clotrimazole Clotrimazol TRUE FALSE FALSE
|
||||
nl Cloxacillin Cloxacilline TRUE FALSE FALSE
|
||||
nl Colistin Colistine TRUE FALSE FALSE
|
||||
nl Dapsone Dapson TRUE FALSE FALSE
|
||||
nl Daptomycin Daptomycine TRUE FALSE FALSE
|
||||
nl Dibekacin Dibekacine TRUE FALSE FALSE
|
||||
nl Dicloxacillin Dicloxacilline TRUE FALSE FALSE
|
||||
nl Dirithromycin Diritromycine TRUE FALSE FALSE
|
||||
nl Econazole Econazol TRUE FALSE FALSE
|
||||
nl Enoxacin Enoxacine TRUE FALSE FALSE
|
||||
nl Epicillin Epicilline TRUE FALSE FALSE
|
||||
nl Erythromycin Erytromycine TRUE FALSE FALSE
|
||||
nl Ethambutol/isoniazid Ethambutol/isoniazide TRUE FALSE FALSE
|
||||
nl Fleroxacin Fleroxacine TRUE FALSE FALSE
|
||||
nl Flucloxacillin Flucloxacilline TRUE FALSE FALSE
|
||||
nl Fluconazole Fluconazol TRUE FALSE FALSE
|
||||
nl Flucytosine Fluorocytosine TRUE FALSE FALSE
|
||||
nl Flurithromycin Fluritromycine TRUE FALSE FALSE
|
||||
nl Fosfomycin Fosfomycine TRUE FALSE FALSE
|
||||
nl Fusidic acid Fusidinezuur TRUE FALSE FALSE
|
||||
nl Gatifloxacin Gatifloxacine TRUE FALSE FALSE
|
||||
nl Gemifloxacin Gemifloxacine TRUE FALSE FALSE
|
||||
nl Gentamicin Gentamicine TRUE FALSE FALSE
|
||||
nl Grepafloxacin Grepafloxacine TRUE FALSE FALSE
|
||||
nl Hachimycin Hachimycine TRUE FALSE FALSE
|
||||
nl Hetacillin Hetacilline TRUE FALSE FALSE
|
||||
nl Imipenem/cilastatin Imipenem/enzymremmer TRUE FALSE FALSE
|
||||
nl Inosine pranobex Inosiplex TRUE FALSE FALSE
|
||||
nl Isepamicin Isepamicine TRUE FALSE FALSE
|
||||
nl Isoconazole Isoconazol TRUE FALSE FALSE
|
||||
nl Isoniazid Isoniazide TRUE FALSE FALSE
|
||||
nl Itraconazole Itraconazol TRUE FALSE FALSE
|
||||
nl Josamycin Josamycine TRUE FALSE FALSE
|
||||
nl Kanamycin Kanamycine TRUE FALSE FALSE
|
||||
nl Ketoconazole Ketoconazol TRUE FALSE FALSE
|
||||
nl Levofloxacin Levofloxacine TRUE FALSE FALSE
|
||||
nl Lincomycin Lincomycine TRUE FALSE FALSE
|
||||
nl Lomefloxacin Lomefloxacine TRUE FALSE FALSE
|
||||
nl Lysozyme Lysozym TRUE FALSE FALSE
|
||||
nl Mandelic acid Amandelzuur TRUE FALSE FALSE
|
||||
nl Metampicillin Metampicilline TRUE FALSE FALSE
|
||||
nl Meticillin Meticilline TRUE FALSE FALSE
|
||||
nl Metisazone Metisazon TRUE FALSE FALSE
|
||||
nl Metronidazole Metronidazol TRUE FALSE FALSE
|
||||
nl Mezlocillin Mezlocilline TRUE FALSE FALSE
|
||||
nl Micafungin Micafungine TRUE FALSE FALSE
|
||||
nl Miconazole Miconazol TRUE FALSE FALSE
|
||||
nl Midecamycin Midecamycine TRUE FALSE FALSE
|
||||
nl Miocamycin Miocamycine TRUE FALSE FALSE
|
||||
nl Moxifloxacin Moxifloxacine TRUE FALSE FALSE
|
||||
nl Mupirocin Mupirocine TRUE FALSE FALSE
|
||||
nl Nalidixic acid Nalidixinezuur TRUE FALSE FALSE
|
||||
nl Neomycin Neomycine TRUE FALSE FALSE
|
||||
nl Netilmicin Netilmicine TRUE FALSE FALSE
|
||||
nl Nitrofurantoin Nitrofurantoine TRUE FALSE FALSE
|
||||
nl Norfloxacin Norfloxacine TRUE FALSE FALSE
|
||||
nl Novobiocin Novobiocine TRUE FALSE FALSE
|
||||
nl Nystatin Nystatine TRUE FALSE FALSE
|
||||
nl Ofloxacin Ofloxacine TRUE FALSE FALSE
|
||||
nl Oleandomycin Oleandomycine TRUE FALSE FALSE
|
||||
nl Ornidazole Ornidazol TRUE FALSE FALSE
|
||||
nl Oxacillin Oxacilline TRUE FALSE FALSE
|
||||
nl Oxolinic acid Oxolinezuur TRUE FALSE FALSE
|
||||
nl Oxytetracycline Oxytetracycline TRUE FALSE FALSE
|
||||
nl Pazufloxacin Pazufloxacine TRUE FALSE FALSE
|
||||
nl Pefloxacin Pefloxacine TRUE FALSE FALSE
|
||||
nl Penamecillin Penamecilline TRUE FALSE FALSE
|
||||
nl Penicillin Penicilline TRUE FALSE FALSE
|
||||
nl Pheneticillin Feneticilline TRUE FALSE FALSE
|
||||
nl Phenoxymethylpenicillin Fenoxymethylpenicilline TRUE FALSE FALSE
|
||||
nl Pipemidic acid Pipemidinezuur TRUE FALSE FALSE
|
||||
nl Piperacillin Piperacilline TRUE FALSE FALSE
|
||||
nl Piperacillin/beta-lactamase inhibitor Piperacilline/enzymremmer TRUE FALSE FALSE
|
||||
nl Piromidic acid Piromidinezuur TRUE FALSE FALSE
|
||||
nl Pivampicillin Pivampicilline TRUE FALSE FALSE
|
||||
nl Polymyxin B Polymyxine B TRUE FALSE FALSE
|
||||
nl Posaconazole Posaconazol TRUE FALSE FALSE
|
||||
nl Pristinamycin Pristinamycine TRUE FALSE FALSE
|
||||
nl Procaine benzylpenicillin Benzylpenicillineprocaine TRUE FALSE FALSE
|
||||
nl Propicillin Propicilline TRUE FALSE FALSE
|
||||
nl Prulifloxacin Prulifloxacine TRUE FALSE FALSE
|
||||
nl Quinupristin/dalfopristin Quinupristine/dalfopristine TRUE FALSE FALSE
|
||||
nl Ribostamycin Ribostamycine TRUE FALSE FALSE
|
||||
nl Rifabutin Rifabutine TRUE FALSE FALSE
|
||||
nl Rifampicin Rifampicine TRUE FALSE FALSE
|
||||
nl Rifampicin/pyrazinamide/ethambutol/isoniazid Rifampicine/pyrazinamide/ethambutol/isoniazide TRUE FALSE FALSE
|
||||
nl Rifampicin/pyrazinamide/isoniazid Rifampicine/pyrazinamide/isoniazide TRUE FALSE FALSE
|
||||
nl Rifampicin/isoniazid Rifampicine/isoniazide TRUE FALSE FALSE
|
||||
nl Rifamycin Rifamycine TRUE FALSE FALSE
|
||||
nl Rifaximin Rifaximine TRUE FALSE FALSE
|
||||
nl Rokitamycin Rokitamycine TRUE FALSE FALSE
|
||||
nl Rosoxacin Rosoxacine TRUE FALSE FALSE
|
||||
nl Roxithromycin Roxitromycine TRUE FALSE FALSE
|
||||
nl Rufloxacin Rufloxacine TRUE FALSE FALSE
|
||||
nl Sisomicin Sisomicine TRUE FALSE FALSE
|
||||
nl Sodium aminosalicylate Aminosalicylzuur TRUE FALSE FALSE
|
||||
nl Sparfloxacin Sparfloxacine TRUE FALSE FALSE
|
||||
nl Spectinomycin Spectinomycine TRUE FALSE FALSE
|
||||
nl Spiramycin Spiramycine TRUE FALSE FALSE
|
||||
nl Spiramycin/metronidazole Spiramycine/metronidazol TRUE FALSE FALSE
|
||||
nl Staphylococcus immunoglobulin Stafylokokkenimmunoglobuline TRUE FALSE FALSE
|
||||
nl Streptoduocin Streptoduocine TRUE FALSE FALSE
|
||||
nl Streptomycin Streptomycine TRUE FALSE FALSE
|
||||
nl Streptomycin/isoniazid Streptomycine/isoniazide TRUE FALSE FALSE
|
||||
nl Sulbenicillin Sulbenicilline TRUE FALSE FALSE
|
||||
nl Sulfadiazine/tetroxoprim Sulfadiazine/tetroxoprim TRUE FALSE FALSE
|
||||
nl Sulfadiazine/trimethoprim Sulfadiazine/trimethoprim TRUE FALSE FALSE
|
||||
nl Sulfadimidine/trimethoprim Sulfadimidine/trimethoprim TRUE FALSE FALSE
|
||||
nl Sulfafurazole Sulfafurazol TRUE FALSE FALSE
|
||||
nl Sulfaisodimidine Sulfisomidine TRUE FALSE FALSE
|
||||
nl Sulfalene Sulfaleen TRUE FALSE FALSE
|
||||
nl Sulfamazone Sulfamazon TRUE FALSE FALSE
|
||||
nl Sulfamerazine/trimethoprim Sulfamerazine/trimethoprim TRUE FALSE FALSE
|
||||
nl Sulfamethizole Sulfamethizol TRUE FALSE FALSE
|
||||
nl Sulfamethoxazole Sulfamethoxazol TRUE FALSE FALSE
|
||||
nl Sulfamethoxazole/trimethoprim Sulfamethoxazol/trimethoprim TRUE FALSE FALSE
|
||||
nl Sulfametoxydiazine Sulfamethoxydiazine TRUE FALSE FALSE
|
||||
nl Sulfametrole/trimethoprim Sulfametrol/trimethoprim TRUE FALSE FALSE
|
||||
nl Sulfamoxole Sulfamoxol TRUE FALSE FALSE
|
||||
nl Sulfamoxole/trimethoprim Sulfamoxol/trimethoprim TRUE FALSE FALSE
|
||||
nl Sulfaperin Sulfaperine TRUE FALSE FALSE
|
||||
nl Sulfaphenazole Sulfafenazol TRUE FALSE FALSE
|
||||
nl Sulfathiazole Sulfathiazol TRUE FALSE FALSE
|
||||
nl Sulfathiourea Sulfathioureum TRUE FALSE FALSE
|
||||
nl Sultamicillin Sultamicilline TRUE FALSE FALSE
|
||||
nl Talampicillin Talampicilline TRUE FALSE FALSE
|
||||
nl Teicoplanin Teicoplanine TRUE FALSE FALSE
|
||||
nl Telithromycin Telitromycine TRUE FALSE FALSE
|
||||
nl Temafloxacin Temafloxacine TRUE FALSE FALSE
|
||||
nl Temocillin Temocilline TRUE FALSE FALSE
|
||||
nl Tenofovir disoproxil Tenofovir TRUE FALSE FALSE
|
||||
nl Terizidone Terizidon TRUE FALSE FALSE
|
||||
nl Thiamphenicol Thiamfenicol TRUE FALSE FALSE
|
||||
nl Thioacetazone/isoniazid Thioacetazon/isoniazide TRUE FALSE FALSE
|
||||
nl Ticarcillin Ticarcilline TRUE FALSE FALSE
|
||||
nl Ticarcillin/beta-lactamase inhibitor Ticarcilline/enzymremmer TRUE FALSE FALSE
|
||||
nl Ticarcillin/clavulanic acid Ticarcilline/clavulaanzuur TRUE FALSE FALSE
|
||||
nl Tinidazole Tinidazol TRUE FALSE FALSE
|
||||
nl Tobramycin Tobramycine TRUE FALSE FALSE
|
||||
nl Trimethoprim/sulfamethoxazole Cotrimoxazol TRUE FALSE FALSE
|
||||
nl Troleandomycin Troleandomycine TRUE FALSE FALSE
|
||||
nl Trovafloxacin Trovafloxacine TRUE FALSE FALSE
|
||||
nl Vancomycin Vancomycine TRUE FALSE FALSE
|
||||
nl Voriconazole Voriconazol TRUE FALSE FALSE
|
||||
nl Aminoglycosides Aminoglycosiden TRUE FALSE FALSE
|
||||
nl Amphenicols Amfenicolen TRUE FALSE FALSE
|
||||
nl Antifungals/antimycotics Antifungica/antimycotica TRUE FALSE FALSE
|
||||
nl Antimycobacterials Antimycobacteriele middelen TRUE FALSE FALSE
|
||||
nl Beta-lactams/penicillins Beta-lactams/penicillines TRUE FALSE FALSE
|
||||
nl Cephalosporins (1st gen.) Cefalosporines (1e gen.) TRUE FALSE FALSE
|
||||
nl Cephalosporins (2nd gen.) Cefalosporines (2e gen.) TRUE FALSE FALSE
|
||||
nl Cephalosporins (3rd gen.) Cefalosporines (3e gen.) TRUE FALSE FALSE
|
||||
nl Cephalosporins (4th gen.) Cefalosporines (4e gen.) TRUE FALSE FALSE
|
||||
nl Cephalosporins (5th gen.) Cefalosporines (5e gen.) TRUE FALSE FALSE
|
||||
nl Cephalosporins (unclassified gen.) Cefalosporines (ongeclassificeerd) TRUE FALSE FALSE
|
||||
nl Cephalosporins Cefalosporines TRUE FALSE FALSE
|
||||
nl Glycopeptides Glycopeptiden TRUE FALSE FALSE
|
||||
nl Macrolides/lincosamides Macroliden/lincosamiden TRUE FALSE FALSE
|
||||
nl Other antibacterials Overige antibiotica TRUE FALSE FALSE
|
||||
nl Polymyxins Polymyxines TRUE FALSE FALSE
|
||||
nl Quinolones Quinolonen TRUE FALSE FALSE
|
||||
pattern regular_expr case_sensitive affect_mo_name de nl es it fr pt
|
||||
Coagulase-negative Staphylococcus TRUE TRUE TRUE Koagulase-negative Staphylococcus Coagulase-negatieve Staphylococcus Staphylococcus coagulasa negativo Staphylococcus negativo coagulasi Staphylococcus à coagulase négative Staphylococcus coagulase negativo
|
||||
Coagulase-positive Staphylococcus TRUE TRUE TRUE Koagulase-positive Staphylococcus Coagulase-positieve Staphylococcus Staphylococcus coagulasa positivo Staphylococcus positivo coagulasi Staphylococcus à coagulase positif Staphylococcus coagulase positivo
|
||||
Beta-haemolytic Streptococcus TRUE TRUE TRUE Beta-hämolytischer Streptococcus Beta-hemolytische Streptococcus Streptococcus Beta-hemolítico Streptococcus Beta-emolitico Streptococcus Bêta-hémolytique Streptococcus Beta-hemolítico
|
||||
unknown Gram-negatives TRUE TRUE TRUE unbekannte Gramnegativen onbekende Gram-negatieven Gram negativos desconocidos Gram negativi sconosciuti Gram négatifs inconnus Gram negativos desconhecidos
|
||||
unknown Gram-positives TRUE TRUE TRUE unbekannte Grampositiven onbekende Gram-positieven Gram positivos desconocidos Gram positivi sconosciuti Gram positifs inconnus Gram positivos desconhecidos
|
||||
unknown fungus TRUE TRUE TRUE unbekannter Pilze onbekende schimmel hongo desconocido fungo sconosciuto champignon inconnu fungo desconhecido
|
||||
unknown yeast TRUE TRUE TRUE unbekannte Hefe onbekende gist levadura desconocida lievito sconosciuto levure inconnue levedura desconhecida
|
||||
unknown name TRUE TRUE TRUE unbekannte Name onbekende naam nombre desconocido nome sconosciuto nom inconnu nome desconhecido
|
||||
unknown kingdom TRUE TRUE TRUE unbekanntes Reich onbekend koninkrijk reino desconocido regno sconosciuto règme inconnu reino desconhecido
|
||||
unknown phylum TRUE TRUE TRUE unbekannter Stamm onbekend fylum filo desconocido phylum sconosciuto embranchement inconnu filo desconhecido
|
||||
unknown class TRUE TRUE TRUE unbekannte Klasse onbekende klasse clase desconocida classe sconosciuta classe inconnue classe desconhecida
|
||||
unknown order TRUE TRUE TRUE unbekannte Ordnung onbekende orde orden desconocido ordine sconosciuto ordre inconnu ordem desconhecido
|
||||
unknown family TRUE TRUE TRUE unbekannte Familie onbekende familie familia desconocida famiglia sconosciuta famille inconnue família desconhecida
|
||||
unknown genus TRUE TRUE TRUE unbekannte Gattung onbekend geslacht género desconocido genere sconosciuto genre inconnu gênero desconhecido
|
||||
unknown species TRUE TRUE TRUE unbekannte Art onbekende soort especie desconocida specie sconosciute espèce inconnue espécies desconhecida
|
||||
unknown subspecies TRUE TRUE TRUE unbekannte Unterart onbekende ondersoort subespecie desconocida sottospecie sconosciute sous-espèce inconnue subespécies desconhecida
|
||||
unknown rank TRUE TRUE TRUE unbekannter Rang onbekende rang rango desconocido grado sconosciuto rang inconnu classificação desconhecido
|
||||
CoNS FALSE TRUE TRUE KNS CNS SCN
|
||||
CoPS FALSE TRUE TRUE KPS CPS SCP
|
||||
Gram-negative TRUE TRUE FALSE Gramnegativ Gram-negatief Gram negativo Gram negativo Gram négatif Gram negativo
|
||||
Gram-positive TRUE TRUE FALSE Grampositiv Gram-positief Gram positivo Gram positivo Gram positif Gram positivo
|
||||
^Bacteria$ TRUE TRUE FALSE Bakterien Bacteriën Bacterias Batteri Bactéries Bactérias
|
||||
^Fungi$ TRUE TRUE FALSE Pilze Schimmels Hongos Funghi Champignons Fungos
|
||||
^Yeasts$ TRUE TRUE FALSE Hefen Gisten Levaduras Lieviti Levures Leveduras
|
||||
^Protozoa$ TRUE TRUE FALSE Protozoen Protozoën Protozoarios Protozoi Protozoaires Protozoários
|
||||
biogroup TRUE TRUE FALSE Biogruppe biogroep biogrupo biogruppo biogroupe biogrupo
|
||||
biotype TRUE TRUE FALSE Biotyp biotipo biotipo biótipo
|
||||
vegetative TRUE TRUE FALSE vegetativ vegetatief vegetativo vegetativo végétatif vegetativo
|
||||
([([ ]*?)group TRUE TRUE FALSE \\1Gruppe \\1groep \\1grupo \\1gruppo \\1groupe \\1grupo
|
||||
([([ ]*?)Group TRUE TRUE FALSE \\1Gruppe \\1Groep \\1Grupo \\1Gruppo \\1Groupe \\1Grupo
|
||||
no .*growth TRUE FALSE FALSE keine? .*wachstum geen .*groei no .*crecimientonon sem .*crescimento pas .*croissance sem .*crescimento
|
||||
no|not TRUE FALSE FALSE keine? geen|niet no|sin sem non sem
|
||||
Susceptible TRUE FALSE FALSE Empfindlich Gevoelig Susceptible
|
||||
Intermediate TRUE FALSE FALSE Mittlere Intermediair Intermedio
|
||||
Incr. exposure TRUE FALSE FALSE Empfindlich, erh Belastung 'Incr. exposure' 'Incr. exposure'
|
||||
Resistant TRUE FALSE FALSE Resistent Resistent Resistente
|
||||
antibiotic TRUE TRUE FALSE Antibiotikum antibioticum antibiótico
|
||||
Antibiotic TRUE TRUE FALSE Antibiotikum Antibioticum Antibiótico
|
||||
Drug TRUE TRUE FALSE Medikament Middel Fármaco
|
||||
drug TRUE TRUE FALSE Medikament middel fármaco
|
||||
4-aminosalicylic acid FALSE TRUE FALSE 4-Aminosalicylsäure 4-aminosalicylzuur Ácido 4-aminosalicílico
|
||||
Adefovir dipivoxil FALSE TRUE FALSE Adefovir Dipivoxil Adefovir Adefovir dipivoxil
|
||||
Aldesulfone sodium FALSE TRUE FALSE Aldesulfon-Natrium Aldesulfon Aldesulfona sódica
|
||||
Amikacin FALSE TRUE FALSE Amikacin Amikacine Amikacina
|
||||
Amoxicillin FALSE TRUE FALSE Amoxicillin Amoxicilline Amoxicilina
|
||||
Amoxicillin/beta-lactamase inhibitor FALSE TRUE FALSE Amoxicillin/Beta-Lactamase-Hemmer Amoxicilline/enzymremmer amoxicilina/inhib. de la beta-lactamasa
|
||||
Amphotericin B FALSE TRUE FALSE Amphotericin B Amfotericine B Anfotericina B
|
||||
Ampicillin FALSE TRUE FALSE Ampicillin Ampicilline Ampicilina
|
||||
Ampicillin/beta-lactamase inhibitor FALSE TRUE FALSE Ampicillin/Beta-Laktamase-Hemmer Ampicilline/enzymremmer Ampicilina/inhib. de la betalactamasa
|
||||
Anidulafungin FALSE TRUE FALSE Anidulafungin Anidulafungine Anidulafungina
|
||||
Azidocillin FALSE TRUE FALSE Azidocillin Azidocilline Azidocilina
|
||||
Azithromycin FALSE TRUE FALSE Azithromycin Azitromycine Azitromicina
|
||||
Azlocillin FALSE TRUE FALSE Azlocillin Azlocilline Azlocilina
|
||||
Bacampicillin FALSE TRUE FALSE Bacampicillin Bacampicilline Bacampicilina
|
||||
Bacitracin FALSE TRUE FALSE Bacitracin Bacitracine Bacitracina
|
||||
Benzathine benzylpenicillin FALSE TRUE FALSE Benzathin-Benzylpenicillin Benzylpenicillinebenzathine Bencilpenicilina benzatínica
|
||||
Benzathine phenoxymethylpenicillin FALSE TRUE FALSE Benzathin-Phenoxymethylpenicillin Fenoxymethylpenicillinebenzathine Fenoximetilpenicilina benzatínica
|
||||
Benzylpenicillin FALSE TRUE FALSE Benzylpenicillin Benzylpenicilline Bencilpenicilina
|
||||
Calcium aminosalicylate FALSE TRUE FALSE Kalzium-Aminosalicylat Aminosalicylzuur Aminosalicilato de calcio
|
||||
Capreomycin FALSE TRUE FALSE Capreomycin Capreomycine Capreomicina
|
||||
Carbenicillin FALSE TRUE FALSE Carbenicillin Carbenicilline Carbenicilina
|
||||
Carindacillin FALSE TRUE FALSE Carindacillin Carindacilline Carindacilina
|
||||
Caspofungin FALSE TRUE FALSE Caspofungin Caspofungine Caspofungina
|
||||
Ce(f|ph)acetrile TRUE TRUE FALSE Cefacetril Cefacetril Cefacetrilo
|
||||
Ce(f|ph)alotin TRUE TRUE FALSE Cefalotin Cefalotine Cefalotina
|
||||
Ce(f|ph)amandole TRUE TRUE FALSE Cefamandol Cefamandol Cefamandole
|
||||
Ce(f|ph)apirin TRUE TRUE FALSE Cefapirin Cefapirine Cefapirina
|
||||
Ce(f|ph)azedone TRUE TRUE FALSE Cefazedon Cefazedon Cefazedona
|
||||
Ce(f|ph)azolin TRUE TRUE FALSE Cefazolin Cefazoline Cefazolina
|
||||
Ce(f|ph)alothin TRUE TRUE FALSE Cefalothin Cefalotine Cefalotina
|
||||
Ce(f|ph)alexin TRUE TRUE FALSE Cefalexin Cefalexine Cefalexina
|
||||
Ce(f|ph)epime TRUE TRUE FALSE Cefepim Cefepim Cefepime
|
||||
Ce(f|ph)ixime TRUE TRUE FALSE Cefixim Cefixim Cefixima
|
||||
Ce(f|ph)menoxime TRUE TRUE FALSE Cefmenoxim Cefmenoxim Cefmenoxima
|
||||
Ce(f|ph)metazole TRUE TRUE FALSE Cefmetazol Cefmetazol Cefmetazol
|
||||
Ce(f|ph)odizime TRUE TRUE FALSE Cefodizim Cefodizim Cefodizima
|
||||
Ce(f|ph)onicid TRUE TRUE FALSE Cefonicid Cefonicide Cefonicid
|
||||
Ce(f|ph)operazone TRUE TRUE FALSE Cefoperazon Cefoperazon Cefoperazona
|
||||
Ce(f|ph)operazone/beta-lactamase inhibitor TRUE TRUE FALSE Cefoperazon/Beta-Lactamase-Hemmer Cefoperazon/enzymremmer Cefoperazona/inhib. de la betalactamasa
|
||||
Ce(f|ph)otaxime TRUE TRUE FALSE Cefotaxim Cefotaxim Cefotaxima
|
||||
Ce(f|ph)oxitin TRUE TRUE FALSE Cefoxitin Cefoxitine Cefoxitina
|
||||
Ce(f|ph)pirome TRUE TRUE FALSE Cefpirom Cefpirom Cefpirome
|
||||
Ce(f|ph)podoxime TRUE TRUE FALSE Cefpodoxim Cefpodoxim Cefpodoxima
|
||||
Ce(f|ph)radine TRUE TRUE FALSE Cefradin Cefradine Cefradina
|
||||
Ce(f|ph)sulodin TRUE TRUE FALSE Cefsulodin Cefsulodine Cefsulodina
|
||||
Ce(f|ph)tazidime TRUE TRUE FALSE Ceftazidim Ceftazidim Ceftazidima
|
||||
Ce(f|ph)tezole TRUE TRUE FALSE Ceftezol Ceftezol Ceftezol
|
||||
Ce(f|ph)tizoxime TRUE TRUE FALSE Ceftizoxim Ceftizoxim Ceftizoxima
|
||||
Ce(f|ph)triaxone TRUE TRUE FALSE Ceftriaxon Ceftriaxon Ceftriaxona
|
||||
Ce(f|ph)uroxime TRUE TRUE FALSE Cefuroxim Cefuroxim Cefuroxima
|
||||
Ce(f|ph)uroxime/metronidazole TRUE TRUE FALSE Cefuroxim/Metronidazol Cefuroxim/andere antibacteriele middelen Cefuroxima/metronidazol
|
||||
Chloramphenicol FALSE TRUE FALSE Chloramphenicol Chlooramfenicol Cloranfenicol
|
||||
Chlortetracycline FALSE TRUE FALSE Chlortetracyclin Chloortetracycline Clortetraciclina
|
||||
Cinoxacin FALSE TRUE FALSE Cinoxacin Cinoxacine Cinoxacina
|
||||
Ciprofloxacin FALSE TRUE FALSE Ciprofloxacin Ciprofloxacine Ciprofloxacina
|
||||
Clarithromycin FALSE TRUE FALSE Clarithromycin Claritromycine Claritromicina
|
||||
Clavulanic acid FALSE TRUE FALSE Clavulansäure Clavulaanzuur Ácido clavulánico
|
||||
clavulanic acid FALSE TRUE FALSE Clavulansäure clavulaanzuur ácido clavulánico
|
||||
Clindamycin FALSE TRUE FALSE Clindamycin Clindamycine Clindamicina
|
||||
Clometocillin FALSE TRUE FALSE Clometocillin Clometocilline Clometocilina
|
||||
Clotrimazole FALSE TRUE FALSE Clotrimazol Clotrimazol Clotrimazol
|
||||
Cloxacillin FALSE TRUE FALSE Cloxacillin Cloxacilline Cloxacilina
|
||||
Colistin FALSE TRUE FALSE Colistin Colistine Colistina
|
||||
Dapsone FALSE TRUE FALSE Dapson Dapson Dapsona
|
||||
Daptomycin FALSE TRUE FALSE Daptomycin Daptomycine Daptomicina
|
||||
Dibekacin FALSE TRUE FALSE Dibekacin Dibekacine Dibekacina
|
||||
Dicloxacillin FALSE TRUE FALSE Dicloxacillin Dicloxacilline Dicloxacilina
|
||||
Dirithromycin FALSE TRUE FALSE Dirithromycin Diritromycine Diritromicina
|
||||
Econazole FALSE TRUE FALSE Econazol Econazol Econazol
|
||||
Enoxacin FALSE TRUE FALSE Enoxacin Enoxacine Enoxacina
|
||||
Epicillin FALSE TRUE FALSE Epicillin Epicilline Epicilina
|
||||
Erythromycin FALSE TRUE FALSE Erythromycin Erytromycine Eritromicina
|
||||
Ethambutol/isoniazid FALSE TRUE FALSE Ethambutol/Isoniazid Ethambutol/isoniazide Etambutol/isoniazida
|
||||
Fleroxacin FALSE TRUE FALSE Fleroxacin Fleroxacine Fleroxacina
|
||||
Flucloxacillin FALSE TRUE FALSE Flucloxacillin Flucloxacilline Flucloxacilina
|
||||
Fluconazole FALSE TRUE FALSE Fluconazol Fluconazol Fluconazol
|
||||
Flucytosine FALSE TRUE FALSE Flucytosin Fluorocytosine Flucitosina
|
||||
Flurithromycin FALSE TRUE FALSE Flurithromycin Fluritromycine Fluritromicina
|
||||
Fosfomycin FALSE TRUE FALSE Fosfomycin Fosfomycine Fosfomicina
|
||||
Fusidic acid FALSE TRUE FALSE Fusidinsäure Fusidinezuur Ácido fusídico
|
||||
Gatifloxacin FALSE TRUE FALSE Gatifloxacin Gatifloxacine Gatifloxacina
|
||||
Gemifloxacin FALSE TRUE FALSE Gemifloxacin Gemifloxacine Gemifloxacina
|
||||
Gentamicin FALSE TRUE FALSE Gentamicin Gentamicine Gentamicina
|
||||
Grepafloxacin FALSE TRUE FALSE Grepafloxacin Grepafloxacine Grepafloxacina
|
||||
Hachimycin FALSE TRUE FALSE Hachimycin Hachimycine Hachimycin
|
||||
Hetacillin FALSE TRUE FALSE Hetacillin Hetacilline Hetacilina
|
||||
Imipenem/cilastatin FALSE TRUE FALSE Imipenem/Cilastatin Imipenem/enzymremmer Imipenem/cilastatina
|
||||
Inosine pranobex FALSE TRUE FALSE Inosin-Pranobex Inosiplex Inosina pranobex
|
||||
Isepamicin FALSE TRUE FALSE Isepamicin Isepamicine Isepamicina
|
||||
Isoconazole FALSE TRUE FALSE Isoconazol Isoconazol Isoconazol
|
||||
Isoniazid FALSE TRUE FALSE Isoniazid Isoniazide Isoniazida
|
||||
Itraconazole FALSE TRUE FALSE Itraconazol Itraconazol Itraconazol
|
||||
Josamycin FALSE TRUE FALSE Josamycin Josamycine Josamicina
|
||||
Kanamycin FALSE TRUE FALSE Kanamycin Kanamycine Kanamicina
|
||||
Ketoconazole FALSE TRUE FALSE Ketoconazol Ketoconazol Ketoconazol
|
||||
Levofloxacin FALSE TRUE FALSE Levofloxacin Levofloxacine Levofloxacina
|
||||
Lincomycin FALSE TRUE FALSE Lincomycin Lincomycine Lincomicina
|
||||
Lomefloxacin FALSE TRUE FALSE Lomefloxacin Lomefloxacine Lomefloxacina
|
||||
Lysozyme FALSE TRUE FALSE Lysozym Lysozym Lisozima
|
||||
Mandelic acid FALSE TRUE FALSE Mandelsäure Amandelzuur Ácido mandélico
|
||||
Metampicillin FALSE TRUE FALSE Metampicillin Metampicilline Metampicilina
|
||||
Meticillin FALSE TRUE FALSE Meticillin Meticilline Meticilina
|
||||
Metisazone FALSE TRUE FALSE Metisazon Metisazon Metisazona
|
||||
Metronidazole FALSE TRUE FALSE Metronidazol Metronidazol Metronidazol
|
||||
Mezlocillin FALSE TRUE FALSE Mezlocillin Mezlocilline Mezlocilina
|
||||
Micafungin FALSE TRUE FALSE Micafungin Micafungine Micafungina
|
||||
Miconazole FALSE TRUE FALSE Miconazol Miconazol Miconazol
|
||||
Midecamycin FALSE TRUE FALSE Midecamycin Midecamycine Midecamicina
|
||||
Miocamycin FALSE TRUE FALSE Miocamycin Miocamycine Miocamycin
|
||||
Moxifloxacin FALSE TRUE FALSE Moxifloxacin Moxifloxacine Moxifloxacina
|
||||
Mupirocin FALSE TRUE FALSE Mupirocin Mupirocine Mupirocina
|
||||
Nalidixic acid FALSE TRUE FALSE Nalidixinsäure Nalidixinezuur Ácido nalidíxico
|
||||
Neomycin FALSE TRUE FALSE Neomycin Neomycine Neomicina
|
||||
Netilmicin FALSE TRUE FALSE Netilmicin Netilmicine Netilmicina
|
||||
Nitrofurantoin FALSE TRUE FALSE Nitrofurantoin Nitrofurantoine Nitrofurantoína
|
||||
Norfloxacin FALSE TRUE FALSE Norfloxacin Norfloxacine Norfloxacina
|
||||
Novobiocin FALSE TRUE FALSE Novobiocin Novobiocine Novobiocina
|
||||
Nystatin FALSE TRUE FALSE Nystatin Nystatine Nistatina
|
||||
Ofloxacin FALSE TRUE FALSE Ofloxacin Ofloxacine Ofloxacina
|
||||
Oleandomycin FALSE TRUE FALSE Oleandomycin Oleandomycine Oleandomicina
|
||||
Ornidazole FALSE TRUE FALSE Ornidazol Ornidazol Ornidazol
|
||||
Oxacillin FALSE TRUE FALSE Oxacillin Oxacilline Oxacilina
|
||||
Oxolinic acid FALSE TRUE FALSE Oxolinsäure Oxolinezuur Ácido oxolínico
|
||||
Oxytetracycline FALSE TRUE FALSE Oxytetracyclin Oxytetracycline Oxitetraciclina
|
||||
Pazufloxacin FALSE TRUE FALSE Pazufloxacin Pazufloxacine Pazufloxacina
|
||||
Pefloxacin FALSE TRUE FALSE Pefloxacin Pefloxacine Pefloxacina
|
||||
Penamecillin FALSE TRUE FALSE Penamecillin Penamecilline Penamecilina
|
||||
Penicillin FALSE TRUE FALSE Penicillin Penicilline Penicilina
|
||||
Pheneticillin FALSE TRUE FALSE Pheneticillin Feneticilline Feneticilina
|
||||
Phenoxymethylpenicillin FALSE TRUE FALSE Phenoxymethylpenicillin Fenoxymethylpenicilline Fenoximetilpenicilina
|
||||
Pipemidic acid FALSE TRUE FALSE Pipemidinsäure Pipemidinezuur Ácido pipemídico
|
||||
Piperacillin FALSE TRUE FALSE Piperacillin Piperacilline Piperacilina
|
||||
Piperacillin/beta-lactamase inhibitor FALSE TRUE FALSE Piperacillin/Beta-Lactamase-Hemmer Piperacilline/enzymremmer Piperacilina/inhib. de la betalactamasa
|
||||
Piromidic acid FALSE TRUE FALSE Piromidinsäure Piromidinezuur Ácido piromídico
|
||||
Pivampicillin FALSE TRUE FALSE Pivampicillin Pivampicilline Pivampicilina
|
||||
Polymyxin B FALSE TRUE FALSE Polymyxin B Polymyxine B Polimixina B
|
||||
Posaconazole FALSE TRUE FALSE Posaconazol Posaconazol Posaconazol
|
||||
Pristinamycin FALSE TRUE FALSE Pristinamycin Pristinamycine Pristinamicina
|
||||
Procaine benzylpenicillin FALSE TRUE FALSE Procain-Benzylpenicillin Benzylpenicillineprocaine Bencilpenicilina procaína
|
||||
Propicillin FALSE TRUE FALSE Propicillin Propicilline Propicilina
|
||||
Prulifloxacin FALSE TRUE FALSE Prulifloxacin Prulifloxacine Prulifloxacina
|
||||
Quinupristin/dalfopristin FALSE TRUE FALSE Quinupristin/Dalfopristin Quinupristine/dalfopristine Quinupristina/dalfopristina
|
||||
Ribostamycin FALSE TRUE FALSE Ribostamycin Ribostamycine Ribostamicina
|
||||
Rifabutin FALSE TRUE FALSE Rifabutin Rifabutine Rifabutina
|
||||
Rifampicin FALSE TRUE FALSE Rifampicin Rifampicine Rifampicina
|
||||
Rifampicin/pyrazinamide/ethambutol/isoniazid FALSE TRUE FALSE Rifampicin/Pyrazinamid/Ethambutol/Isoniazid Rifampicine/pyrazinamide/ethambutol/isoniazide Rifampicina/pirazinamida/etambutol/isoniazida
|
||||
Rifampicin/pyrazinamide/isoniazid FALSE TRUE FALSE Rifampicin/Pyrazinamid/Isoniazid Rifampicine/pyrazinamide/isoniazide Rifampicina/pirazinamida/isoniazida
|
||||
Rifampicin/isoniazid FALSE TRUE FALSE Rifampicin/Isoniazid Rifampicine/isoniazide Rifampicina/isoniazida
|
||||
Rifamycin FALSE TRUE FALSE Rifamycin Rifamycine Rifamicina
|
||||
Rifaximin FALSE TRUE FALSE Rifaximin Rifaximine Rifaximina
|
||||
Rokitamycin FALSE TRUE FALSE Rokitamycin Rokitamycine Rokitamicina
|
||||
Rosoxacin FALSE TRUE FALSE Rosoxacin Rosoxacine Rosoxacina
|
||||
Roxithromycin FALSE TRUE FALSE Roxithromycin Roxitromycine Roxitromicina
|
||||
Rufloxacin FALSE TRUE FALSE Rufloxacin Rufloxacine Rufloxacina
|
||||
Sisomicin FALSE TRUE FALSE Sisomicin Sisomicine Sisomicina
|
||||
Sodium aminosalicylate FALSE TRUE FALSE Natrium-Aminosalicylat Aminosalicylzuur Aminosalicilato de sodio
|
||||
Sparfloxacin FALSE TRUE FALSE Sparfloxacin Sparfloxacine Esparfloxacina
|
||||
Spectinomycin FALSE TRUE FALSE Spectinomycin Spectinomycine Espectinomicina
|
||||
Spiramycin FALSE TRUE FALSE Spiramycin Spiramycine Espiramicina
|
||||
Spiramycin/metronidazole FALSE TRUE FALSE Spiramycin/Metronidazol Spiramycine/metronidazol Espiramicina/metronidazol
|
||||
Staphylococcus immunoglobulin FALSE TRUE FALSE Staphylococcus-Immunoglobulin Stafylokokkenimmunoglobuline Inmunoglobulina estafilocócica
|
||||
Streptoduocin FALSE TRUE FALSE Streptoduocin Streptoduocine Estreptoduocina
|
||||
Streptomycin FALSE TRUE FALSE Streptomycin Streptomycine Estreptomicina
|
||||
Streptomycin/isoniazid FALSE TRUE FALSE Streptomycin/Isoniazid Streptomycine/isoniazide Estreptomicina/isoniazida
|
||||
Sulbenicillin FALSE TRUE FALSE Sulbenicillin Sulbenicilline Sulbenicilina
|
||||
Sulfadiazine/tetroxoprim FALSE TRUE FALSE Sulfadiazin/Tetroxoprim Sulfadiazine/tetroxoprim Sulfadiazina/tetroxoprima
|
||||
Sulfadiazine/trimethoprim FALSE TRUE FALSE Sulfadiazin/Trimethoprim Sulfadiazine/trimethoprim Sulfadiazina/trimetoprima
|
||||
Sulfadimidine/trimethoprim FALSE TRUE FALSE Sulfadimidin/Trimethoprim Sulfadimidine/trimethoprim Sulfadimidina/trimetoprima
|
||||
Sulfafurazole FALSE TRUE FALSE Sulfafurazol Sulfafurazol Sulfafurazol
|
||||
Sulfaisodimidine FALSE TRUE FALSE Sulfaisodimidin Sulfisomidine Sulfaisodimidina
|
||||
Sulfalene FALSE TRUE FALSE Sulfalene Sulfaleen Sulfaleno
|
||||
Sulfamazone FALSE TRUE FALSE Sulfamazon Sulfamazon Sulfamazona
|
||||
Sulfamerazine/trimethoprim FALSE TRUE FALSE Sulfamerazin/Trimethoprim Sulfamerazine/trimethoprim Sulfamerazina/trimetoprima
|
||||
Sulfamethizole FALSE TRUE FALSE Sulfamethizol Sulfamethizol Sulfametozol
|
||||
Sulfamethoxazole FALSE TRUE FALSE Sulfamethoxazol Sulfamethoxazol Sulfametoxazol
|
||||
Sulfamethoxazole/trimethoprim FALSE TRUE FALSE Sulfamethoxazol/Trimethoprim Sulfamethoxazol/trimethoprim Sulfametoxazol/trimetoprima
|
||||
Sulfametoxydiazine FALSE TRUE FALSE Sulfametoxydiazin Sulfamethoxydiazine Sulfametoxidiazina
|
||||
Sulfametrole/trimethoprim FALSE TRUE FALSE Sulfametrole/Trimethoprim Sulfametrol/trimethoprim Sulfametrole/trimethoprim
|
||||
Sulfamoxole FALSE TRUE FALSE Sulfamoxol Sulfamoxol Sulfamoxole
|
||||
Sulfamoxole/trimethoprim FALSE TRUE FALSE Sulfamoxol/Trimethoprim Sulfamoxol/trimethoprim Sulfamoxol/trimetoprima
|
||||
Sulfaperin FALSE TRUE FALSE Sulfaperin Sulfaperine Sulfaproxeno
|
||||
Sulfaphenazole FALSE TRUE FALSE Sulfaphenazol Sulfafenazol Sulfafenazol
|
||||
Sulfathiazole FALSE TRUE FALSE Sulfathiazol Sulfathiazol Sulfatiazol
|
||||
Sulfathiourea FALSE TRUE FALSE Sulfathioharnstoff Sulfathioureum Sulfathiourea
|
||||
Sultamicillin FALSE TRUE FALSE Sultamicillin Sultamicilline Sultamicilina
|
||||
Talampicillin FALSE TRUE FALSE Talampicillin Talampicilline Talampicilina
|
||||
Teicoplanin FALSE TRUE FALSE Teicoplanin Teicoplanine Teicoplanina
|
||||
Telithromycin FALSE TRUE FALSE Telithromycin Telitromycine Telitromicina
|
||||
Temafloxacin FALSE TRUE FALSE Temafloxacin Temafloxacine Temafloxacina
|
||||
Temocillin FALSE TRUE FALSE Temocillin Temocilline Temocilina
|
||||
Tenofovir disoproxil FALSE TRUE FALSE Tenofovir Disoproxil Tenofovir Tenofovir disoproxil
|
||||
Terizidone FALSE TRUE FALSE Terizidon Terizidon Terizidona
|
||||
Thiamphenicol FALSE TRUE FALSE Thiamphenicol Thiamfenicol Tiamfenicol
|
||||
Thioacetazone/isoniazid FALSE TRUE FALSE Thioacetazon/Isoniazid Thioacetazon/isoniazide Tioacetazona/isoniazida
|
||||
Ticarcillin FALSE TRUE FALSE Ticarcillin Ticarcilline Ticarcilina
|
||||
Ticarcillin/beta-lactamase inhibitor FALSE TRUE FALSE Ticarcillin/Beta-Lactamase-Hemmer Ticarcilline/enzymremmer Ticarcilina/inhib. de la betalactamasa
|
||||
Ticarcillin/clavulanic acid FALSE TRUE FALSE Ticarcillin/Clavulansäure Ticarcilline/clavulaanzuur Ticarcilina/ácido clavulánico
|
||||
Tinidazole FALSE TRUE FALSE Tinidazol Tinidazol Tinidazol
|
||||
Tobramycin FALSE TRUE FALSE Tobramycin Tobramycine Tobramicina
|
||||
Trimethoprim/sulfamethoxazole FALSE TRUE FALSE Trimethoprim/Sulfamethoxazol Cotrimoxazol Trimetoprima/sulfametoxazol
|
||||
Troleandomycin FALSE TRUE FALSE Troleandomycin Troleandomycine Troleandomicina
|
||||
Trovafloxacin FALSE TRUE FALSE Trovafloxacin Trovafloxacine Trovafloxacina
|
||||
Vancomycin FALSE TRUE FALSE Vancomycin Vancomycine Vancomicina
|
||||
Voriconazole FALSE TRUE FALSE Voriconazol Voriconazol Voriconazol
|
||||
Aminoglycosides FALSE TRUE FALSE Aminoglykoside Aminoglycosiden Aminoglucósidos
|
||||
Amphenicols FALSE TRUE FALSE Amphenicole Amfenicolen Anfenicoles
|
||||
Antifungals/antimycotics FALSE TRUE FALSE Antimykotika/Antimykotika Antifungica/antimycotica Antifúngicos/antimicóticos
|
||||
Antimycobacterials FALSE TRUE FALSE Antimykobakterielle Mittel Antimycobacteriele middelen Antimicrobianos
|
||||
Beta-lactams/penicillins FALSE TRUE FALSE Beta-Lactame/Penicilline Beta-lactams/penicillines Beta-lactámicos/penicilinas
|
||||
Cephalosporins (1st gen.) FALSE TRUE FALSE Cephalosporine (1. Gen.) Cefalosporines (1e gen.) Cefalosporinas (1er gen.)
|
||||
Cephalosporins (2nd gen.) FALSE TRUE FALSE Cephalosporine (2. Gen.) Cefalosporines (2e gen.) Cefalosporinas (2do gen.)
|
||||
Cephalosporins (3rd gen.) FALSE TRUE FALSE Cephalosporine (3. Gen.) Cefalosporines (3e gen.) Cefalosporinas (3er gen.)
|
||||
Cephalosporins (4th gen.) FALSE TRUE FALSE Cephalosporine (4. Gen.) Cefalosporines (4e gen.) Cefalosporinas (4º gen.)
|
||||
Cephalosporins (5th gen.) FALSE TRUE FALSE Cephalosporine (5. Gen.) Cefalosporines (5e gen.) Cefalosporinas (5º gen.)
|
||||
Cephalosporins (unclassified gen.) FALSE TRUE FALSE Cephalosporine (unklassifiziert) Cefalosporines (ongeclassificeerd) Cefalosporinas (no clasificado)
|
||||
Cephalosporins FALSE TRUE FALSE Cephalosporine Cefalosporines Cefalosporinas
|
||||
Glycopeptides FALSE TRUE FALSE Glykopeptide Glycopeptiden Glicopéptidos
|
||||
Macrolides/lincosamides FALSE TRUE FALSE Makrolide/Linkosamide Macroliden/lincosamiden Macrólidos/lincosamidas
|
||||
Other antibacterials FALSE TRUE FALSE Andere Antibiotika Overige antibiotica Otros antibacterianos
|
||||
Polymyxins FALSE TRUE FALSE Polymyxine Polymyxines Polimixinas
|
||||
Quinolones FALSE TRUE FALSE Quinolone Quinolonen Quinolonas
|
||||
|
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9024</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9024</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
BIN
docs/articles/AMR_files/figure-html/disk_plots-1.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
docs/articles/AMR_files/figure-html/disk_plots_mo_ab-1.png
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
docs/articles/AMR_files/figure-html/mic_plots-1.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
docs/articles/AMR_files/figure-html/mic_plots-2.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
docs/articles/AMR_files/figure-html/mic_plots_mo_ab-1.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
docs/articles/AMR_files/figure-html/mic_plots_mo_ab-2.png
Normal file
After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
@ -39,7 +39,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9024</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -226,19 +226,19 @@
|
||||
times <span class="op">=</span> <span class="fl">25</span><span class="op">)</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">S.aureus</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">2</span><span class="op">)</span>
|
||||
<span class="co"># Unit: milliseconds</span>
|
||||
<span class="co"># expr min lq mean median uq max neval</span>
|
||||
<span class="co"># as.mo("sau") 9.3 10 11.0 10 11.0 13.0 25</span>
|
||||
<span class="co"># as.mo("stau") 52.0 55 73.0 58 92.0 100.0 25</span>
|
||||
<span class="co"># as.mo("STAU") 50.0 54 73.0 58 96.0 110.0 25</span>
|
||||
<span class="co"># as.mo("staaur") 9.7 10 14.0 11 12.0 57.0 25</span>
|
||||
<span class="co"># as.mo("STAAUR") 8.9 10 14.0 10 11.0 52.0 25</span>
|
||||
<span class="co"># as.mo("S. aureus") 26.0 28 41.0 29 67.0 76.0 25</span>
|
||||
<span class="co"># as.mo("S aureus") 27.0 28 41.0 30 65.0 76.0 25</span>
|
||||
<span class="co"># as.mo("Staphylococcus aureus") 2.6 3 3.2 3 3.3 4.6 25</span>
|
||||
<span class="co"># as.mo("Staphylococcus aureus (MRSA)") 240.0 260 270.0 260 270.0 380.0 25</span>
|
||||
<span class="co"># as.mo("Sthafilokkockus aaureuz") 160.0 190 200.0 200 200.0 300.0 25</span>
|
||||
<span class="co"># as.mo("MRSA") 9.3 10 15.0 10 12.0 49.0 25</span>
|
||||
<span class="co"># as.mo("VISA") 18.0 19 31.0 21 54.0 67.0 25</span></code></pre></div>
|
||||
<span class="co"># expr min lq mean median uq max neval</span>
|
||||
<span class="co"># as.mo("sau") 9.9 11.0 13.0 11.0 12.0 43 25</span>
|
||||
<span class="co"># as.mo("stau") 52.0 55.0 68.0 58.0 86.0 95 25</span>
|
||||
<span class="co"># as.mo("STAU") 53.0 56.0 73.0 62.0 93.0 100 25</span>
|
||||
<span class="co"># as.mo("staaur") 10.0 11.0 17.0 11.0 12.0 48 25</span>
|
||||
<span class="co"># as.mo("STAAUR") 10.0 11.0 14.0 11.0 13.0 48 25</span>
|
||||
<span class="co"># as.mo("S. aureus") 27.0 28.0 41.0 33.0 60.0 73 25</span>
|
||||
<span class="co"># as.mo("S aureus") 27.0 28.0 49.0 34.0 64.0 160 25</span>
|
||||
<span class="co"># as.mo("Staphylococcus aureus") 2.9 3.2 4.8 3.4 3.7 36 25</span>
|
||||
<span class="co"># as.mo("Staphylococcus aureus (MRSA)") 250.0 260.0 270.0 270.0 280.0 320 25</span>
|
||||
<span class="co"># as.mo("Sthafilokkockus aaureuz") 170.0 200.0 210.0 210.0 210.0 310 25</span>
|
||||
<span class="co"># as.mo("MRSA") 10.0 11.0 16.0 12.0 12.0 50 25</span>
|
||||
<span class="co"># as.mo("VISA") 19.0 20.0 27.0 21.0 23.0 60 25</span></code></pre></div>
|
||||
<p><img src="benchmarks_files/figure-html/unnamed-chunk-4-1.png" width="750"></p>
|
||||
<p>In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 200 milliseconds, this is only 5 input values per second. It is clear that accepted taxonomic names are extremely fast, but some variations are up to 200 times slower to determine.</p>
|
||||
<p>To improve performance, we implemented two important algorithms to save unnecessary calculations: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p>
|
||||
@ -260,8 +260,8 @@
|
||||
<span class="co"># what do these values look like? They are of class <mo>:</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
|
||||
<span class="co"># Class <mo></span>
|
||||
<span class="co"># [1] B_STPHY_AURS B_STRPT_GRPC B_STPHY_CONS B_STPHY_EPDR B_STRPT_PNMN</span>
|
||||
<span class="co"># [6] B_PROTS_VLGR</span>
|
||||
<span class="co"># [1] B_STRPT_PYGN B_STPHY_HMNS B_STPHY_CONS B_STRPT_SLVR B_ENTRBC_CLOC</span>
|
||||
<span class="co"># [6] B_STPHY_CONS</span>
|
||||
|
||||
<span class="co"># as the example_isolates data set has 2,000 rows, we should have 2 million items</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/length.html">length</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
|
||||
@ -277,8 +277,8 @@
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
||||
<span class="co"># Unit: milliseconds</span>
|
||||
<span class="co"># expr min lq mean median uq max neval</span>
|
||||
<span class="co"># mo_name(x) 157 187 222 206 224 372 10</span></code></pre></div>
|
||||
<p>So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.206 seconds. That is 2.471 milliseconds per unique item on average. You only lose time on your unique input values.</p>
|
||||
<span class="co"># mo_name(x) 161 194 224 204 229 368 10</span></code></pre></div>
|
||||
<p>So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.204 seconds. That is 102 nanoseconds on average. You only lose time on your unique input values.</p>
|
||||
</div>
|
||||
<div id="precalculated-results" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
@ -292,9 +292,9 @@
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
||||
<span class="co"># Unit: milliseconds</span>
|
||||
<span class="co"># expr min lq mean median uq max neval</span>
|
||||
<span class="co"># A 6.97 7.10 7.55 7.21 8.18 8.32 10</span>
|
||||
<span class="co"># B 23.70 24.20 36.30 26.30 29.00 89.70 10</span>
|
||||
<span class="co"># C 1.53 1.65 1.80 1.76 2.00 2.19 10</span></code></pre></div>
|
||||
<span class="co"># A 7.45 7.84 12.70 8.62 9.16 51.10 10</span>
|
||||
<span class="co"># B 23.80 24.50 30.60 26.30 28.80 70.20 10</span>
|
||||
<span class="co"># C 1.66 1.74 1.85 1.79 1.92 2.24 10</span></code></pre></div>
|
||||
<p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0018 seconds - it doesn’t even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="va">run_it</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span><span class="op">(</span>A <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_species</a></span><span class="op">(</span><span class="st">"aureus"</span><span class="op">)</span>,
|
||||
@ -309,14 +309,14 @@
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
||||
<span class="co"># Unit: milliseconds</span>
|
||||
<span class="co"># expr min lq mean median uq max neval</span>
|
||||
<span class="co"># A 1.44 1.72 1.69 1.74 1.75 1.78 10</span>
|
||||
<span class="co"># B 1.47 1.55 1.67 1.73 1.74 1.89 10</span>
|
||||
<span class="co"># C 1.52 1.59 1.73 1.74 1.89 1.91 10</span>
|
||||
<span class="co"># D 1.46 1.51 1.64 1.64 1.75 1.89 10</span>
|
||||
<span class="co"># E 1.42 1.47 1.60 1.52 1.71 1.97 10</span>
|
||||
<span class="co"># F 1.44 1.71 1.69 1.72 1.75 1.88 10</span>
|
||||
<span class="co"># G 1.42 1.50 1.68 1.61 1.73 2.36 10</span>
|
||||
<span class="co"># H 1.52 1.54 1.66 1.71 1.73 1.87 10</span></code></pre></div>
|
||||
<span class="co"># A 1.59 1.60 1.91 1.97 2.15 2.28 10</span>
|
||||
<span class="co"># B 1.58 1.61 1.87 1.86 1.96 2.39 10</span>
|
||||
<span class="co"># C 1.55 1.57 1.64 1.63 1.69 1.79 10</span>
|
||||
<span class="co"># D 1.57 1.60 1.83 1.72 1.92 2.73 10</span>
|
||||
<span class="co"># E 1.50 1.74 1.86 1.86 2.03 2.24 10</span>
|
||||
<span class="co"># F 1.49 1.55 1.75 1.67 1.90 2.24 10</span>
|
||||
<span class="co"># G 1.54 1.59 1.69 1.65 1.77 1.95 10</span>
|
||||
<span class="co"># H 1.57 1.58 1.75 1.72 1.78 2.21 10</span></code></pre></div>
|
||||
<p>Of course, when running <code><a href="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> anyway, there is no point in calculating the result. And because this package contains all phyla of all known bacteria, it can just return the initial value immediately.</p>
|
||||
</div>
|
||||
<div id="results-in-other-languages" class="section level3">
|
||||
@ -344,13 +344,13 @@
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">4</span><span class="op">)</span>
|
||||
<span class="co"># Unit: milliseconds</span>
|
||||
<span class="co"># expr min lq mean median uq max neval</span>
|
||||
<span class="co"># en 17.12 17.40 22.65 17.54 18.39 78.39 100</span>
|
||||
<span class="co"># de 19.93 20.26 22.60 20.48 20.97 81.27 100</span>
|
||||
<span class="co"># nl 24.87 25.24 30.93 25.50 26.90 87.17 100</span>
|
||||
<span class="co"># es 20.00 20.26 24.39 20.58 21.13 82.01 100</span>
|
||||
<span class="co"># it 19.92 20.26 26.54 20.66 21.38 79.15 100</span>
|
||||
<span class="co"># fr 19.62 19.90 24.74 20.10 21.04 77.20 100</span>
|
||||
<span class="co"># pt 19.74 20.02 26.76 20.41 22.68 82.61 100</span></code></pre></div>
|
||||
<span class="co"># en 17.33 18.21 21.97 19.06 20.40 68.32 100</span>
|
||||
<span class="co"># de 20.44 21.37 30.49 22.33 24.97 78.42 100</span>
|
||||
<span class="co"># nl 25.13 26.10 31.91 27.11 28.50 86.00 100</span>
|
||||
<span class="co"># es 20.28 21.16 26.37 22.03 23.67 74.74 100</span>
|
||||
<span class="co"># it 20.06 21.00 26.05 21.95 23.42 94.16 100</span>
|
||||
<span class="co"># fr 19.90 20.63 24.40 21.85 22.82 69.07 100</span>
|
||||
<span class="co"># pt 20.22 21.03 25.63 21.89 23.24 76.63 100</span></code></pre></div>
|
||||
<p>Currently supported non-English languages are German, Dutch, Spanish, Italian, French and Portuguese.</p>
|
||||
</div>
|
||||
</div>
|
||||
|