1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-15 20:53:18 +02:00

27 Commits

Author SHA1 Message Date
ab97268f4c (v1.8.1.9014) add Toxoplasma 2022-08-12 23:27:15 +02:00
7f981e7778 (v1.8.1.9013) add Toxoplasma 2022-06-10 13:15:23 +02:00
b84d647cac (v1.8.1.9012) update prevalence of some genera 2022-06-03 13:28:55 +02:00
1b84564d36 (v1.8.1.9011) update prevalence of some genera 2022-06-03 12:43:25 +02:00
70a07bad39 (v1.8.1.9010) random when pkg not loaded 2022-05-16 12:52:50 +02:00
2c5bc73ed6 (v1.8.1.9009) random when pkg not loaded 2022-05-16 09:29:46 +02:00
58ed15e7ac (v1.8.1.9008) website update 2022-05-11 10:26:58 +02:00
6de5375256 (v1.8.1.9007) website update 2022-05-11 10:10:31 +02:00
859224e9d0 (v1.8.1.9006) added EUCAST 2022 and CLSI 2022 2022-05-10 21:34:30 +02:00
680e8e7a41 (v1.8.1.9005) as.rsi() fix for EUCAST 2022-05-10 17:01:37 +02:00
d4e22069bc (v1.8.1.9004) fix for table() on MICs 2022-05-09 21:33:27 +02:00
1c891cc90c (v1.8.1.9003) set_mo_source() fix 2022-05-09 20:36:44 +02:00
152db9d1b5 (v1.8.1.9002) fix for table() on MICs 2022-05-09 17:08:40 +02:00
4754848e96 (v1.8.1.9001) update unit tests, fixes #53 2022-04-08 11:02:45 +02:00
641b88c814 website update 2022-03-27 09:37:55 +02:00
ccb09706e4 v1.8.1 2022-03-24 23:05:04 +01:00
7b0f1596bd (v1.8.0.9010) as.mo improvement 2022-03-15 17:35:02 +01:00
0fb9a1b194 prerelease 1.8.1 2022-03-14 16:43:15 +01:00
45e9546538 prerelease 1.8.1
Merge branch 'development' of https://github.com/msberends/AMR into development

# Conflicts:
#	docs/articles/AMR.html
#	docs/articles/AMR_files/figure-html/disk_plots-1.png
#	docs/articles/AMR_files/figure-html/disk_plots_mo_ab-1.png
#	docs/articles/AMR_files/figure-html/mic_plots-1.png
#	docs/articles/AMR_files/figure-html/mic_plots-2.png
#	docs/articles/AMR_files/figure-html/mic_plots_mo_ab-1.png
#	docs/articles/AMR_files/figure-html/mic_plots_mo_ab-2.png
#	docs/articles/AMR_files/figure-html/plot 1-1.png
#	docs/articles/AMR_files/figure-html/plot 3-1.png
#	docs/articles/AMR_files/figure-html/plot 4-1.png
#	docs/articles/AMR_files/figure-html/plot 5-1.png
#	docs/articles/EUCAST.html
#	docs/articles/MDR.html
#	docs/articles/PCA.html
#	docs/articles/PCA_files/figure-html/unnamed-chunk-6-1.png
#	docs/articles/PCA_files/figure-html/unnamed-chunk-7-1.png
#	docs/articles/SPSS.html
#	docs/articles/WHONET.html
#	docs/articles/WHONET_files/figure-html/unnamed-chunk-7-1.png
#	docs/articles/benchmarks.html
#	docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png
#	docs/articles/datasets.html
#	docs/articles/resistance_predict.html
#	docs/articles/resistance_predict_files/figure-html/unnamed-chunk-4-1.png
#	docs/articles/resistance_predict_files/figure-html/unnamed-chunk-5-1.png
#	docs/articles/resistance_predict_files/figure-html/unnamed-chunk-5-2.png
#	docs/articles/resistance_predict_files/figure-html/unnamed-chunk-6-1.png
#	docs/articles/resistance_predict_files/figure-html/unnamed-chunk-7-1.png
#	docs/articles/welcome_to_AMR.html
#	docs/news/index.html
#	docs/pkgdown.yml
#	docs/reference/AMR-deprecated.html
#	docs/reference/AMR.html
#	docs/reference/WHOCC.html
#	docs/reference/WHONET.html
#	docs/reference/antibiotics.html
#	docs/reference/catalogue_of_life.html
#	docs/reference/catalogue_of_life_version.html
#	docs/reference/dosage.html
#	docs/reference/example_isolates.html
#	docs/reference/example_isolates_unclean.html
#	docs/reference/g.test.html
#	docs/reference/intrinsic_resistant.html
#	docs/reference/microorganisms.codes.html
#	docs/reference/microorganisms.html
#	docs/reference/microorganisms.old.html
#	docs/reference/rsi_translation.html
2022-03-14 16:37:37 +01:00
1b0983e382 (v1.8.1) prerelease 1.8.1 2022-03-14 16:36:10 +01:00
8c9feea087 website update 2022-03-12 19:53:29 +01:00
08d387b5ce (v1.8.0.9005) as.rsi() fix 2022-03-10 19:33:25 +01:00
ad82bb4ce0 (v1.8.0.9004) MIC printing in tibbles 2022-03-03 21:11:02 +01:00
dedbe92322 (v1.8.0.9003) deps update 2022-03-02 23:16:37 +01:00
3b2b2be5f8 (v1.8.0.9002) as.rsi() cleanup, more informative warnings 2022-03-02 15:38:55 +01:00
18e8525d10 (v1.8.0.9001) as.mo improvement, fixes #52 2022-02-26 21:58:23 +01:00
be792cc9eb (v1.8.0.9000) unit tests for R 3.3 2022-02-01 17:08:10 +01:00
249 changed files with 27704 additions and 26418 deletions

View File

@ -33,3 +33,4 @@
^vignettes/SPSS.Rmd$
^vignettes/WHONET.Rmd$
^logo.svg$
^CRAN-SUBMISSION$

View File

@ -57,8 +57,8 @@ jobs:
- {os: macOS-latest, r: '3.6', allowfail: false}
- {os: macOS-latest, r: '3.5', allowfail: false}
- {os: macOS-latest, r: '3.4', allowfail: false}
- {os: macOS-latest, r: '3.3', allowfail: false}
- {os: macOS-latest, r: '3.2', allowfail: false}
# - {os: macOS-latest, r: '3.3', allowfail: false}
# - {os: macOS-latest, r: '3.2', allowfail: false}
# - {os: macOS-latest, r: '3.1', allowfail: true}
# - {os: macOS-latest, r: '3.0', allowfail: true}
- {os: ubuntu-20.04, r: 'devel', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
@ -77,7 +77,7 @@ jobs:
- {os: windows-latest, r: '3.6', allowfail: false}
- {os: windows-latest, r: '3.5', allowfail: false}
- {os: windows-latest, r: '3.4', allowfail: false}
- {os: windows-latest, r: '3.3', allowfail: false}
# - {os: windows-latest, r: '3.3', allowfail: false}
# - {os: windows-latest, r: '3.2', allowfail: true}
# - {os: windows-latest, r: '3.1', allowfail: true}
# - {os: windows-latest, r: '3.0', allowfail: true}

3
CRAN-SUBMISSION Normal file
View File

@ -0,0 +1,3 @@
Version: 1.8.1
Date: 2022-03-16 18:22:51 UTC
SHA: 7b0f1596bd65fbb72681a7e3a6a7e4e469a891e8

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 1.8.0
Date: 2022-01-03
Version: 1.8.1.9014
Date: 2022-08-12
Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by
@ -9,7 +9,7 @@ Description: Functions to simplify and standardise antimicrobial resistance (AMR
Authors@R: c(
person(given = c("Matthijs", "S."),
family = "Berends",
email = "m.s.berends@umcg.nl",
email = "m.berends@certe.nl",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-7620-1800")),
person(given = c("Christian", "F."),
@ -71,7 +71,8 @@ Depends: R (>= 3.0.0)
Enhances:
cleaner,
skimr,
ggplot2
ggplot2,
tidyselect
Suggests:
curl,
dplyr,
@ -89,5 +90,5 @@ BugReports: https://github.com/msberends/AMR/issues
License: GPL-2 | file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.2
RoxygenNote: 7.2.1
Roxygen: list(markdown = TRUE)

View File

@ -50,7 +50,6 @@ S3method(any,mic)
S3method(as.data.frame,ab)
S3method(as.data.frame,mo)
S3method(as.double,mic)
S3method(as.integer,mic)
S3method(as.list,custom_eucast_rules)
S3method(as.list,custom_mdro_guideline)
S3method(as.matrix,mic)

43
NEWS.md
View File

@ -1,8 +1,41 @@
# `AMR` 1.8.1.9014
## <small>Last updated: 12 August 2022</small>
### New
* EUCAST 2022 and CLSI 2022 guidelines have been added for `as.rsi()`. EUCAST 2022 is now the new default guideline for all MIC and disks diffusion interpretations.
### Changed
* Fix for `as.rsi()` on certain EUCAST breakpoints for MIC values
* Removed `as.integer()` for MIC values, since MIC are not integer values and running `table()` on MIC values consequently failed for not being able to retrieve the level position (as that's how normally `as.integer()` on `factor`s work)
* `droplevels()` on MIC will now return a common `factor` at default and will lose the `<mic>` class. Use `droplevels(..., as.mic = TRUE)` to keep the `<mic>` class.
* Small fix for using `ab_from_text()`
* Fixes for reading in text files using `set_mo_source()`, which now also allows the source file to contain valid taxonomic names instead of only valid microorganism ID of this package
* Using any `random_*()` function (such as `random_mic()`) is now possible by directly calling the package without loading it first: `AMR::random_mic(10)`
* Added *Toxoplasma gondii* (`P_TXPL_GOND`) to the `microorganisms` data set, together with its genus, family, and order
* Changed value in column `prevalence` of the `microorganisms` data set from 3 to 2 for these genera: *Acholeplasma*, *Alistipes*, *Alloprevotella*, *Bergeyella*, *Borrelia*, *Brachyspira*, *Butyricimonas*, *Cetobacterium*, *Chlamydia*, *Chlamydophila*, *Deinococcus*, *Dysgonomonas*, *Elizabethkingia*, *Empedobacter*, *Haloarcula*, *Halobacterium*, *Halococcus*, *Myroides*, *Odoribacter*, *Ornithobacterium*, *Parabacteroides*, *Pedobacter*, *Phocaeicola*, *Porphyromonas*, *Riemerella*, *Sphingobacterium*, *Streptobacillus*, *Tenacibaculum*, *Terrimonas*, *Victivallis*, *Wautersiella*, *Weeksella*
# `AMR` 1.8.1
### Changed
* Fix for using `as.rsi()` on values containing capped values (such as `>=`), sometimes leading to `NA`
* Support for antibiotic interpretations of the MIPS laboratory system: `"U"` for S ('susceptible urine'), `"D"` for I ('susceptible dose-dependent')
* Improved algorithm of `as.mo()`, especially for ignoring non-taxonomic text, such as:
```r
mo_name("methicillin-resistant S. aureus (MRSA)")
#> [1] "Staphylococcus aureus"
```
* More informative warning messages
* Added 192 as valid MIC
* Updated MIC printing in tibbles
* Increased speed for loading the package
### Other
* Fix for unit testing on R 3.3
* Fix for size of some image elements, as requested by CRAN
# `AMR` 1.8.0
All functions in this package are now all considered to be stable. Updates to the AMR interpretation rules (such as by EUCAST and CLSI), the microbial taxonomy, and the antibiotic dosages will all be updated every 6 to 12 months from now on.
### Breaking changes
* Removed `p_symbol()` and all `filter_*()` functions (except for `filter_first_isolate()`), which were all deprecated in a previous package version
* Removed the `key_antibiotics()` and `key_antibiotics_equal()` functions, which were deprecated and superseded by `key_antimicrobials()` and `antimicrobials_equal()`
@ -256,7 +289,7 @@ All functions in this package are now all considered to be stable. Updates to th
filter(is_new_episode(date, episode_days = 60))
```
* Functions `mo_is_gram_negative()` and `mo_is_gram_positive()` as wrappers around `mo_gramstain()`. They always return `TRUE` or `FALSE` (except when the input is `NA` or the MO code is `UNKNOWN`), thus always return `FALSE` for species outside the taxonomic kingdom of Bacteria.
* Function `mo_is_intrinsic_resistant()` to test for intrinsic resistance, based on [EUCAST Intrinsic Resistance and Unusual Phenotypes v3.2](https://www.eucast.org/expert_rules_and_intrinsic_resistance/) from 2020.
* Function `mo_is_intrinsic_resistant()` to test for intrinsic resistance, based on EUCAST Intrinsic Resistance and Unusual Phenotypes v3.2 from 2020.
* Functions `random_mic()`, `random_disk()` and `random_rsi()` for random value generation. The functions `random_mic()` and `random_disk()` take microorganism names and antibiotic names as input to make generation more realistic.
### Changed
@ -1352,7 +1385,7 @@ We've got a new website: [https://msberends.gitlab.io/AMR](https://msberends.git
* Function `guess_atc` to **determine the ATC** of an antibiotic based on name, trade name, or known abbreviations
* Function `freq` to create **frequency tables**, with additional info in a header
* Function `MDRO` to **determine Multi Drug Resistant Organisms (MDRO)** with support for country-specific guidelines.
* [Exceptional resistances defined by EUCAST](https://www.eucast.org/expert_rules_and_intrinsic_resistance/) are also supported instead of countries alone
* Exceptional resistances defined by EUCAST are also supported instead of countries alone
* Functions `BRMO` and `MRGN` are wrappers for Dutch and German guidelines, respectively
* New algorithm to determine weighted isolates, can now be `"points"` or `"keyantibiotics"`, see `?first_isolate`
* New print format for `tibble`s and `data.table`s

View File

@ -36,15 +36,15 @@ EUCAST_VERSION_BREAKPOINTS <- list("11.0" = list(version_txt = "v11.0",
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/"),
url = "https://www.eucast.org/expert_rules_and_expected_phenotypes/"),
"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/"),
url = "https://www.eucast.org/expert_rules_and_expected_phenotypes/"),
"3.3" = list(version_txt = "v3.3",
year = 2021,
title = "'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes'",
url = "https://www.eucast.org/expert_rules_and_intrinsic_resistance/"))
url = "https://www.eucast.org/expert_rules_and_expected_phenotypes/"))
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",

View File

@ -206,7 +206,7 @@ check_dataset_integrity <- function() {
" overwritten by your global environment and prevent", plural[2],
" the AMR package from working correctly: ",
vector_and(overwritten, quotes = "'"),
".\nPlease rename your object", plural[3], ".", call = FALSE)
".\nPlease rename your object", plural[3], ".")
}
}
# check if other packages did not overwrite our data sets
@ -492,7 +492,7 @@ message_ <- function(...,
warning_ <- function(...,
add_fn = list(),
immediate = FALSE,
call = TRUE) {
call = FALSE) {
warning(word_wrap(...,
add_fn = add_fn,
as_note = FALSE),
@ -559,7 +559,7 @@ stop_ifnot <- function(expr, ..., call = TRUE) {
return_after_integrity_check <- function(value, type, check_vector) {
if (!all(value[!is.na(value)] %in% check_vector)) {
warning_(paste0("invalid ", type, ", NA generated"), call = FALSE)
warning_(paste0("invalid ", type, ", NA generated"))
value[!value %in% check_vector] <- NA
}
value
@ -638,7 +638,7 @@ vector_or <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, initial_ca
if (isTRUE(initial_captital)) {
v[1] <- gsub("^([a-z])", "\\U\\1", v[1], perl = TRUE)
}
if (length(v) == 1) {
if (length(v) <= 1) {
return(paste0(quotes, v, quotes))
}
if (identical(v, c("I", "R", "S"))) {

10
R/ab.R
View File

@ -455,15 +455,13 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_unknown_ATCs <- x_unknown[x_unknown %like% "[A-Z][0-9][0-9][A-Z][A-Z][0-9][0-9]"]
x_unknown <- x_unknown[!x_unknown %in% x_unknown_ATCs]
if (length(x_unknown_ATCs) > 0 & fast_mode == FALSE) {
warning_("These ATC codes are not (yet) in the antibiotics data set: ",
vector_and(x_unknown_ATCs), ".",
call = FALSE)
warning_("in `as.ab()`: these ATC codes are not (yet) in the antibiotics data set: ",
vector_and(x_unknown_ATCs), ".")
}
if (length(x_unknown) > 0 & fast_mode == FALSE) {
warning_("These values could not be coerced to a valid antimicrobial ID: ",
vector_and(x_unknown), ".",
call = FALSE)
warning_("in `as.ab()`: these values could not be coerced to a valid antimicrobial ID: ",
vector_and(x_unknown), ".")
}
x_result <- x_new[match(x_bak_clean, x)]

View File

@ -240,8 +240,8 @@ ab_ddd <- function(x, administration = "oral", ...) {
units <- list(...)$units
if (!is.null(units) && isTRUE(units)) {
if (message_not_thrown_before("ab_ddd", entire_session = TRUE)) {
warning_("Using `ab_ddd(..., units = TRUE)` is deprecated, use `ab_ddd_units()` to retrieve units instead. ",
"This warning will be shown once per session.", call = FALSE)
warning_("in `ab_ddd()`: using `ab_ddd(..., units = TRUE)` is deprecated, use `ab_ddd_units()` to retrieve units instead.",
"This warning will be shown once per session.")
}
ddd_prop <- paste0(ddd_prop, "_units")
} else {
@ -250,9 +250,9 @@ ab_ddd <- function(x, administration = "oral", ...) {
out <- ab_validate(x = x, property = ddd_prop)
if (any(ab_name(x, language = NULL) %like% "/" & is.na(out))) {
warning_("DDDs of some combined products are available for different dose combinations and not (yet) part of the AMR package. ",
warning_("in `ab_ddd()`: DDDs of some combined products are available for different dose combinations and not (yet) part of the AMR package.",
"Please refer to the WHOCC website:\n",
"www.whocc.no/ddd/list_of_ddds_combined_products/", call = FALSE)
"www.whocc.no/ddd/list_of_ddds_combined_products/")
}
out
}
@ -265,9 +265,9 @@ ab_ddd_units <- function(x, administration = "oral", ...) {
x <- as.ab(x, ...)
if (any(ab_name(x, language = NULL) %like% "/")) {
warning_("DDDs of combined products are available for different dose combinations and not (yet) part of the AMR package. ",
warning_("in `ab_ddd_units()`: DDDs of combined products are available for different dose combinations and not (yet) part of the AMR package.",
"Please refer to the WHOCC website:\n",
"www.whocc.no/ddd/list_of_ddds_combined_products/", call = FALSE)
"www.whocc.no/ddd/list_of_ddds_combined_products/")
}
ddd_prop <- paste0(administration, "_units")
@ -311,12 +311,12 @@ ab_url <- function(x, open = FALSE, ...) {
NAs <- ab_name(ab, tolower = TRUE, language = NULL)[!is.na(ab) & is.na(atcs)]
if (length(NAs) > 0) {
warning_("No ATC code available for ", vector_and(NAs, quotes = FALSE), ".")
warning_("in `ab_url()`: no ATC code available for ", vector_and(NAs, quotes = FALSE), ".")
}
if (open == TRUE) {
if (length(u) > 1 & !is.na(u[1L])) {
warning_("Only the first URL will be opened, as `browseURL()` only suports one string.")
warning_("in `ab_url()`: only the first URL will be opened, as `browseURL()` only suports one string.")
}
if (!is.na(u[1L])) {
utils::browseURL(u[1L])
@ -385,7 +385,8 @@ set_ab_names <- function(data, ..., property = "name", language = get_AMR_locale
},
USE.NAMES = FALSE)
if (any(x %in% c("", NA))) {
warning_("No ", property, " found for column(s): ", vector_and(vars[x %in% c("", NA)], sort = FALSE), call = FALSE)
warning_("in `set_ab_names()`: no ", property, " found for column(s): ",
vector_and(vars[x %in% c("", NA)], sort = FALSE))
x[x %in% c("", NA)] <- vars[x %in% c("", NA)]
}

View File

@ -481,14 +481,13 @@ ab_select_exec <- function(function_name,
untreatable <- antibiotics[which(antibiotics$name %like% "-high|EDTA|polysorbate|macromethod|screening|/nacubactam"), "ab", drop = TRUE]
if (any(untreatable %in% names(ab_in_data))) {
if (message_not_thrown_before(function_name, "ab_class", "untreatable", entire_session = TRUE)) {
warning_("Some agents in `", function_name, "()` were ignored since they cannot be used for treating patients: ",
warning_("in `", function_name, "()`: some agents were ignored since they cannot be used for treating patients: ",
vector_and(ab_name(names(ab_in_data)[names(ab_in_data) %in% untreatable],
language = NULL,
tolower = TRUE),
quotes = FALSE,
sort = TRUE), ". They can be included using `", function_name, "(only_treatable = FALSE)`. ",
"This warning will be shown once per session.",
call = FALSE)
"This warning will be shown once per session.")
}
ab_in_data <- ab_in_data[!names(ab_in_data) %in% untreatable]
}

View File

@ -95,10 +95,10 @@ age <- function(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...) {
if (any(ages < 0, na.rm = TRUE)) {
ages[!is.na(ages) & ages < 0] <- NA
warning_("NAs introduced for ages below 0.", call = TRUE)
warning_("in `age()`: NAs introduced for ages below 0.")
}
if (any(ages > 120, na.rm = TRUE)) {
warning_("Some ages are above 120.", call = TRUE)
warning_("in `age()`: some ages are above 120.")
}
if (isTRUE(na.rm)) {
@ -171,7 +171,7 @@ age_groups <- function(x, split_at = c(12, 25, 55, 75), na.rm = FALSE) {
if (any(x < 0, na.rm = TRUE)) {
x[x < 0] <- NA
warning_("NAs introduced for ages below 0.", call = TRUE)
warning_("in `age_groups()`: NAs introduced for ages below 0.")
}
if (is.character(split_at)) {
split_at <- split_at[1L]

View File

@ -51,7 +51,7 @@
#'
#' - `"g"` = gram
#' - `"mg"` = milligram
#' - `"mcg"`` = microgram
#' - `"mcg"` = microgram
#' - `"U"` = unit
#' - `"TU"` = thousand units
#' - `"MU"` = million units
@ -175,7 +175,7 @@ atc_online_property <- function(atc_code,
colnames(out) <- gsub("^atc.*", "atc", tolower(colnames(out)))
if (length(out) == 0) {
warning_("ATC not found: ", atc_code[i], ". Please check ", atc_url, ".", call = FALSE)
warning_("in `atc_online_property()`: ATC not found: ", atc_code[i], ". Please check ", atc_url, ".")
returnvalue[i] <- NA
next
}

View File

@ -184,7 +184,7 @@ format.bug_drug_combinations <- function(x,
if (inherits(x, "grouped")) {
# bug_drug_combinations() has been run on groups, so de-group here
warning_("formatting the output of `bug_drug_combinations()` does not support grouped variables, they are ignored", call = FALSE)
warning_("in `format()`: formatting the output of `bug_drug_combinations()` does not support grouped variables, they were ignored")
idx <- split(seq_len(nrow(x)), paste0(x$mo, "%%", x$ab))
x <- data.frame(mo = gsub("(.*)%%(.*)", "\\1", names(idx)),
ab = gsub("(.*)%%(.*)", "\\2", names(idx)),

View File

@ -43,7 +43,7 @@ format_included_data_number <- function(data) {
#'
#' This package contains the complete taxonomic tree (last updated: `r CATALOGUE_OF_LIFE$yearmonth_LPSN`) of almost all microorganisms from the authoritative and comprehensive Catalogue of Life (CoL), supplemented with data from the List of Prokaryotic names with Standing in Nomenclature (LPSN).
#' @section Catalogue of Life:
#' \if{html}{\figure{logo_col.png}{options: height=40px style=margin-bottom:5px} \cr}
#' \if{html}{\figure{logo_col.png}{options: height="40" style=margin-bottom:"5"} \cr}
#' 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 LPSN were included in this package with [catalogue_of_life_version()].

View File

@ -27,7 +27,7 @@
#'
#' Define custom EUCAST rules for your organisation or specific analysis and use the output of this function in [eucast_rules()].
#' @inheritSection lifecycle Stable Lifecycle
#' @param ... rules in formula notation, see *Examples*
#' @param ... rules in [formula][`~`()] notation, see *Examples*
#' @details
#' Some organisations have their own adoption of EUCAST rules. This function can be used to define custom EUCAST rules to be used in the [eucast_rules()] function.
#'
@ -75,7 +75,7 @@
#'
#' ### Using taxonomic properties in rules
#'
#' There is one exception in variables used for the rules: all column names of the [microorganisms] data set can also be used, but do not have to exist in the data set. These column names are: `r vector_and(colnames(microorganisms), quote = "``", sort = FALSE)`. Thus, this next example will work as well, despite the fact that the `df` data set does not contain a column `genus`:
#' There is one exception in variables used for the rules: all column names of the [microorganisms] data set can also be used, but do not have to exist in the data set. These column names are: `r vector_and(colnames(microorganisms), quote = "\u0096", sort = FALSE)`. Thus, this next example will work as well, despite the fact that the `df` data set does not contain a column `genus`:
#'
#' ```
#' y <- custom_eucast_rules(TZP == "S" & genus == "Klebsiella" ~ aminopenicillins == "S",
@ -91,7 +91,7 @@
#'
#' It is possible to define antibiotic groups instead of single antibiotics for the rule consequence, the part *after* the tilde. In above examples, the antibiotic group `aminopenicillins` is used to include ampicillin and amoxicillin. The following groups are allowed (case-insensitive). Within parentheses are the agents that will be matched when running the rule.
#'
#' `r paste0(" * ", sapply(DEFINED_AB_GROUPS, function(x) paste0("``", tolower(gsub("^AB_", "", x)), "``\\cr(", vector_and(ab_name(eval(parse(text = x), envir = asNamespace("AMR")), language = NULL, tolower = TRUE), quotes = FALSE), ")"), USE.NAMES = FALSE), "\n", collapse = "")`
#' `r paste0(" * ", sapply(DEFINED_AB_GROUPS, function(x) paste0("\u0096", tolower(gsub("^AB_", "", x)), "\u0096\\cr(", vector_and(ab_name(eval(parse(text = x), envir = asNamespace("AMR")), language = NULL, tolower = TRUE), quotes = FALSE), ")"), USE.NAMES = FALSE), "\n", collapse = "")`
#' @returns A [list] containing the custom rules
#' @inheritSection AMR Read more on Our Website!
#' @export

View File

@ -104,6 +104,7 @@
#' - 11 entries of *Streptococcus* (beta-haemolytic: groups A, B, C, D, F, G, H, K and unspecified; other: viridans, milleri)
#' - 2 entries of *Staphylococcus* (coagulase-negative (CoNS) and coagulase-positive (CoPS))
#' - 3 entries of *Trichomonas* (*T. vaginalis*, and its family and genus)
#' - 4 entries of *Toxoplasma* (*T. gondii*, and its order, family and genus)
#' - 1 entry of *Candida* (*C. krusei*), that is not (yet) in the Catalogue of Life
#' - 1 entry of *Blastocystis* (*B. hominis*), although it officially does not exist (Noel *et al.* 2005, PMID 15634993)
#' - 1 entry of *Moraxella* (*M. catarrhalis*), which was formally named *Branhamella catarrhalis* (Catlin, 1970) though this change was never accepted within the field of clinical microbiology
@ -111,13 +112,10 @@
#' - 6 families under the Enterobacterales order, according to Adeolu *et al.* (2016, PMID 27620848), that are not (yet) in the Catalogue of Life
#'
#' ## Direct download
#' This data set is available as 'flat file' for use even without \R - you can find the file here:
#' This data set is available as 'flat file' for use even without \R - you can find the file here: <https://github.com/msberends/AMR/raw/main/data-raw/microorganisms.txt>.
#'
#' * <https://github.com/msberends/AMR/raw/main/data-raw/microorganisms.txt>
#' The file in \R format (with preserved data structure) can be found here: <https://github.com/msberends/AMR/raw/main/data/microorganisms.rda>.
#'
#' The file in \R format (with preserved data structure) can be found here:
#'
#' * <https://github.com/msberends/AMR/raw/main/data/microorganisms.rda>
#' @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.
#'
@ -251,7 +249,14 @@
#' - `breakpoint_S`\cr Lowest MIC value or highest number of millimetres that leads to "S"
#' - `breakpoint_R`\cr Highest MIC value or lowest number of millimetres that leads to "R"
#' - `uti`\cr A [logical] value (`TRUE`/`FALSE`) to indicate whether the rule applies to a urinary tract infection (UTI)
#' @details The repository of this `AMR` package contains a file comprising this exact data set: <https://github.com/msberends/AMR/blob/main/data-raw/rsi_translation.txt>. This file **allows for machine reading EUCAST and CLSI guidelines**, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. The file is updated automatically and the `mo` and `ab` columns have been transformed to contain the full official names instead of codes.
#' @details
#' Overview of the data set:
#'
#' ```{r}
#' head(rsi_translation)
#' ```
#'
#' The repository of this `AMR` package contains a file comprising this exact data set: <https://github.com/msberends/AMR/blob/main/data-raw/rsi_translation.txt>. This file **allows for machine reading EUCAST and CLSI guidelines**, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. The file is updated automatically and the `mo` and `ab` columns have been transformed to contain the full official names instead of codes.
#' @inheritSection AMR Reference Data Publicly Available
#' @inheritSection AMR Read more on Our Website!
#' @seealso [intrinsic_resistant]

View File

@ -100,10 +100,10 @@ as.disk <- function(x, na.rm = FALSE) {
unique() %pm>%
sort() %pm>%
vector_and(quotes = TRUE)
warning_(na_after - na_before, " results truncated (",
warning_("in `as.disk()`: ", na_after - na_before, " results truncated (",
round(((na_after - na_before) / length(x)) * 100),
"%) that were invalid disk zones: ",
list_missing, call = FALSE)
list_missing)
}
}
set_clean_class(as.integer(x),

View File

@ -181,8 +181,7 @@ eucast_rules <- function(x,
meet_criteria(custom_rules, allow_class = "custom_eucast_rules", allow_NULL = TRUE)
if ("custom" %in% rules & is.null(custom_rules)) {
warning_("No custom rules were set with the `custom_rules` argument",
call = FALSE,
warning_("in `eucast_rules()`: no custom rules were set with the `custom_rules` argument",
immediate = TRUE)
rules <- rules[rules != "custom"]
if (length(rules) == 0) {
@ -915,13 +914,12 @@ eucast_rules <- function(x,
# take order from original data set
warn_lacking_rsi_class <- warn_lacking_rsi_class[order(colnames(x.bak))]
warn_lacking_rsi_class <- warn_lacking_rsi_class[!is.na(warn_lacking_rsi_class)]
warning_("Not all columns with antimicrobial results are of class <rsi>. Transform them on beforehand, with e.g.:\n",
warning_("in `eucast_rules()`: not all columns with antimicrobial results are of class <rsi>. Transform them on beforehand, with e.g.:\n",
" - ", x_deparsed, " %>% as.rsi(", ifelse(length(warn_lacking_rsi_class) == 1,
warn_lacking_rsi_class,
paste0(warn_lacking_rsi_class[1], ":", warn_lacking_rsi_class[length(warn_lacking_rsi_class)])), ")\n",
" - ", x_deparsed, " %>% mutate_if(is.rsi.eligible, as.rsi)\n",
" - ", x_deparsed, " %>% mutate(across(where(is.rsi.eligible), as.rsi))",
call = FALSE)
" - ", x_deparsed, " %>% mutate(across(where(is.rsi.eligible), as.rsi))")
}
# Return data set ---------------------------------------------------------
@ -986,14 +984,14 @@ edit_rsi <- function(x,
TRUE
})
suppressWarnings(new_edits[rows, cols] <<- to)
warning_("Value \"", to, "\" added to the factor levels of column", ifelse(length(cols) == 1, "", "s"),
warning_("in `eucast_rules()`: value \"", to, "\" added to the factor levels of column",
ifelse(length(cols) == 1, "", "s"),
" ", vector_and(cols, quotes = "`", sort = FALSE),
" because this value was not an existing factor level.",
call = FALSE)
" because this value was not an existing factor level.")
txt_warning()
warned <- FALSE
} else {
warning_(w$message, call = FALSE)
warning_("in `eucast_rules()`: ", w$message)
txt_warning()
}
},

View File

@ -267,7 +267,6 @@ get_column_abx <- function(x,
", as it is already set for ",
names(already_set_as), " (", ab_name(names(already_set_as), tolower = TRUE, language = NULL), ")"),
add_fn = font_red,
call = FALSE,
immediate = verbose)
}
}
@ -338,6 +337,5 @@ generate_warning_abs_missing <- function(missing, any = FALSE) {
}
warning_(paste0("Introducing NAs since", any_txt[1], " these antimicrobials ", any_txt[2], " required: ",
vector_and(missing, quotes = FALSE)),
immediate = TRUE,
call = FALSE)
immediate = TRUE)
}

View File

@ -170,7 +170,7 @@ join_microorganisms <- function(type, x, by, suffix, ...) {
}
if (type %like% "full|left|right|inner" && NROW(joined) > NROW(x)) {
warning_("The newly joined data set contains ", nrow(joined) - nrow(x), " rows more than the number of rows of `x`.", call = FALSE)
warning_("in `", type, "_join()`: the newly joined data set contains ", nrow(joined) - nrow(x), " rows more than the number of rows of `x`.")
}
joined

View File

@ -150,7 +150,7 @@ key_antimicrobials <- function(x = NULL,
col_mo <- search_type_in_df(x = x, type = "mo", info = FALSE)
}
if (is.null(col_mo)) {
warning_("No column found for `col_mo`, ignoring antibiotics set in `gram_negative` and `gram_positive`, and antimycotics set in `antifungal`", call = FALSE)
warning_("in `key_antimicrobials()`: no column found for `col_mo`, ignoring antibiotics set in `gram_negative` and `gram_positive`, and antimycotics set in `antifungal`")
gramstain <- NA_character_
kingdom <- NA_character_
} else {
@ -172,11 +172,11 @@ key_antimicrobials <- function(x = NULL,
if (values_new_length < values_old_length &
any(filter, na.rm = TRUE) &
message_not_thrown_before("key_antimicrobials", name)) {
warning_(ifelse(values_new_length == 0,
warning_("in `key_antimicrobials()`: ",
ifelse(values_new_length == 0,
"No columns available ",
paste0("Only using ", values_new_length, " out of ", values_old_length, " defined columns ")),
"as key antimicrobials for ", name, "s. See ?key_antimicrobials.",
call = FALSE)
"as key antimicrobials for ", name, "s. See ?key_antimicrobials.")
}
generate_antimcrobials_string(x[which(filter), c(universal, values), drop = FALSE])
@ -217,7 +217,7 @@ key_antimicrobials <- function(x = NULL,
cols = cols)
if (length(unique(key_ab)) == 1) {
warning_("No distinct key antibiotics determined.", call = FALSE)
warning_("in `key_antimicrobials()`: no distinct key antibiotics determined.")
}
key_ab

View File

@ -32,23 +32,23 @@
#' @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://lifecycle.r-lib.org/articles/stages.html).
#'
#' \if{html}{\figure{lifecycle_tidyverse.svg}{options: height=200px style=margin-bottom:5px} \cr}
#' \if{html}{\figure{lifecycle_tidyverse.svg}{options: height="200" style=margin-bottom:"5"} \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.
#' @section Experimental Lifecycle:
#' \if{html}{\figure{lifecycle_experimental.svg}{options: style=margin-bottom:5px} \cr}
#' \if{html}{\figure{lifecycle_experimental.svg}{options: style=margin-bottom:"5"} \cr}
#' The [lifecycle][AMR::lifecycle] of this function is **experimental**. An experimental function is in early stages of development. The unlying code might be changing frequently. Experimental functions might be removed without deprecation, so you are generally best off waiting until a function is more mature before you use it in production code. Experimental functions are only available in development versions of this `AMR` package and will thus not be included in releases that are submitted to CRAN, since such functions have not yet matured enough.
#' @section Maturing Lifecycle:
#' \if{html}{\figure{lifecycle_maturing.svg}{options: style=margin-bottom:5px} \cr}
#' \if{html}{\figure{lifecycle_maturing.svg}{options: style=margin-bottom:"5"} \cr}
#' The [lifecycle][AMR::lifecycle] of this function is **maturing**. The unlying code of a maturing function has been roughed out, but finer details might still change. Since this function needs wider usage and more extensive testing, you are very welcome [to suggest changes at our repository](https://github.com/msberends/AMR/issues) or [write us an email (see section 'Contact Us')][AMR::AMR].
#' @section Stable Lifecycle:
#' \if{html}{\figure{lifecycle_stable.svg}{options: style=margin-bottom:5px} \cr}
#' \if{html}{\figure{lifecycle_stable.svg}{options: style=margin-bottom:"5"} \cr}
#' The [lifecycle][AMR::lifecycle] of this function is **stable**. In a stable function, major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; removing arguments or changing the meaning of existing arguments will be avoided.
#'
#' If the unlying code needs breaking changes, they will occur gradually. For example, an argument will be deprecated and first continue to work, but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.
#' If the unlying code needs breaking changes, they will occur gradually. For example, an argument will be deprecated and first continue to work, but will emit a message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.
#' @section Retired Lifecycle:
#' \if{html}{\figure{lifecycle_retired.svg}{options: style=margin-bottom:5px} \cr}
#' \if{html}{\figure{lifecycle_retired.svg}{options: style=margin-bottom:"5"} \cr}
#' The [lifecycle][AMR::lifecycle] of this function is **retired**. A retired function is no longer under active development, and (if appropiate) a better alternative is available. No new arguments will be added, and only the most critical bugs will be fixed. In a future version, this function will be removed.
#' @section Questioning Lifecycle:
#' \if{html}{\figure{lifecycle_questioning.svg}{options: style=margin-bottom:5px} \cr}
#' \if{html}{\figure{lifecycle_questioning.svg}{options: style=margin-bottom:"5"} \cr}
#' The [lifecycle][AMR::lifecycle] of this function is **questioning**. This function might be no longer be optimal approach, or is it questionable whether this function should be in this `AMR` package at all.
NULL

View File

@ -65,7 +65,7 @@
#'
#' * `guideline = "TB"`
#'
#' The international guideline for multi-drug resistant tuberculosis - World Health Organization "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis" ([link](https://www.who.int/tb/publications/pmdt_companionhandbook/en/))
#' The international guideline for multi-drug resistant tuberculosis - World Health Organization "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis" ([link](https://www.who.int/publications/i/item/9789241548809))
#'
#' * `guideline = "MRGN"`
#'
@ -240,7 +240,7 @@ mdro <- function(x = NULL,
}
if (!is.null(list(...)$country)) {
warning_("Using `country` is deprecated, use `guideline` instead. See ?mdro.", call = FALSE)
warning_("in `mdro()`: using `country` is deprecated, use `guideline` instead. See ?mdro")
guideline <- list(...)$country
}
@ -343,7 +343,7 @@ mdro <- function(x = NULL,
guideline$name <- "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis"
guideline$author <- "WHO (World Health Organization)"
guideline$version <- "WHO/HTM/TB/2014.11, 2014"
guideline$source_url <- "https://www.who.int/tb/publications/pmdt_companionhandbook/en/"
guideline$source_url <- "https://www.who.int/publications/i/item/9789241548809"
guideline$type <- "MDR-TB's"
# support per country:
@ -1550,8 +1550,8 @@ mdro <- function(x = NULL,
if (guideline$code == "cmi2012") {
if (any(x$MDRO == -1, na.rm = TRUE)) {
if (message_not_thrown_before("mdro", "availability")) {
warning_("NA introduced for isolates where the available percentage of antimicrobial classes was below ",
percentage(pct_required_classes), " (set with `pct_required_classes`)", call = FALSE)
warning_("in `mdro()`: NA introduced for isolates where the available percentage of antimicrobial classes was below ",
percentage(pct_required_classes), " (set with `pct_required_classes`)")
}
# set these -1s to NA
x[which(x$MDRO == -1), "MDRO"] <- NA_integer_
@ -1709,7 +1709,7 @@ run_custom_mdro_guideline <- function(df, guideline, info) {
return("error")
})
if (identical(qry, "error")) {
warning_("in custom_mdro_guideline(): rule ", i,
warning_("in `custom_mdro_guideline()`: rule ", i,
" (`", as.character(guideline[[i]]$query), "`) was ignored because of this error message: ",
pkg_env$err_msg,
call = FALSE,

46
R/mic.R
View File

@ -37,8 +37,8 @@ valid_mic_levels <- c(c(t(vapply(FUN.VALUE = character(9), ops,
function(x) paste0(x, sort(c(1:9, 1.5)))))),
c(t(vapply(FUN.VALUE = character(45), ops,
function(x) paste0(x, c(10:98)[9:98 %% 2 == TRUE])))),
c(t(vapply(FUN.VALUE = character(16), ops,
function(x) paste0(x, sort(c(2 ^ c(7:11), 80 * c(2:12))))))))
c(t(vapply(FUN.VALUE = character(17), ops,
function(x) paste0(x, sort(c(2 ^ c(7:11), 192, 80 * c(2:12))))))))
#' Transform Input to Minimum Inhibitory Concentrations (MIC)
#'
@ -47,7 +47,8 @@ valid_mic_levels <- c(c(t(vapply(FUN.VALUE = character(9), ops,
#' @rdname as.mic
#' @param x a [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.
#' @param ... arguments passed on to methods
#' @details To interpret MIC values as RSI values, use [as.rsi()] on MIC values. It supports guidelines from 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)))`) and 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)))`).
#'
#' 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:
#'
@ -86,6 +87,10 @@ valid_mic_levels <- c(c(t(vapply(FUN.VALUE = character(9), ops,
#' ```
#'
#' 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.
#'
#' Using [as.double()] or [as.numeric()] on MIC values will remove the operators and return a numeric vector. Do **not** use [as.integer()] on MIC values as by the \R convention on [factor]s, it will return the index of the factor levels (which is often useless for regular users).
#'
#' Use [droplevels()] to drop unused levels. At default, it will return a plain factor. Use `droplevels(..., as.mic = TRUE)` to maintain the `<mic>` class.
#' @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
@ -175,7 +180,7 @@ as.mic <- function(x, na.rm = FALSE) {
unique() %pm>%
sort() %pm>%
vector_and(quotes = TRUE)
warning_(na_after - na_before, " results truncated (",
warning_("in `as.mic()`: ", na_after - na_before, " results truncated (",
round(((na_after - na_before) / length(x)) * 100),
"%) that were invalid MICs: ",
list_missing, call = FALSE)
@ -196,7 +201,8 @@ all_valid_mics <- function(x) {
}
#' @rdname as.mic
#' @details `NA_mic_` is a missing value of the new `<mic>` class.
#' @details `NA_mic_` is a missing value of the new `<mic>` class, analogous to e.g. base \R's [`NA_character_`][base::NA].
#' @format NULL
#' @export
NA_mic_ <- set_clean_class(factor(NA, levels = valid_mic_levels, ordered = TRUE),
new_class = c("mic", "ordered", "factor"))
@ -214,13 +220,6 @@ as.double.mic <- function(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), perl = TRUE))
}
#' @method as.numeric mic
#' @export
#' @noRd
@ -228,11 +227,12 @@ as.numeric.mic <- function(x, ...) {
as.numeric(gsub("[<=>]+", "", as.character(x), perl = TRUE))
}
#' @rdname as.mic
#' @method droplevels mic
#' @param as.mic a [logical] to indicate whether the `<mic>` class should be kept, defaults to `FALSE`
#' @export
#' @noRd
droplevels.mic <- function(x, exclude = if (any(is.na(levels(x)))) NULL else NA, as.mic = TRUE, ...) {
x <- droplevels.factor(x, exclude = exclude, ...)
droplevels.mic <- function(x, as.mic = FALSE, ...) {
x <- droplevels.factor(x, ...)
if (as.mic == TRUE) {
class(x) <- c("mic", "ordered", "factor")
}
@ -243,12 +243,12 @@ droplevels.mic <- function(x, exclude = if (any(is.na(levels(x)))) NULL else NA,
pillar_shaft.mic <- function(x, ...) {
crude_numbers <- as.double(x)
operators <- gsub("[^<=>]+", "", as.character(x))
pasted <- trimws(paste0(operators, trimws(format(crude_numbers))))
out <- pasted
operators[!is.na(operators) & operators != ""] <- font_silver(operators[!is.na(operators) & operators != ""], collapse = NULL)
out <- trimws(paste0(operators, trimws(format(crude_numbers))))
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)))
# maketrailing zeroes almost invisible
out[out %like% "[.]"] <- gsub("([.]?0+)$", font_white("\\1"), out[out %like% "[.]"], perl = TRUE)
create_pillar_column(out, align = "right", width = max(nchar(font_stripstyle(out))))
}
# will be exported using s3_register() in R/zzz.R
@ -260,7 +260,9 @@ type_sum.mic <- function(x, ...) {
#' @export
#' @noRd
print.mic <- function(x, ...) {
cat("Class <mic>\n")
cat("Class <mic>",
ifelse(length(levels(x)) < length(valid_mic_levels), font_red(" with dropped levels"), ""),
"\n", sep = "")
print(as.character(x), quote = FALSE)
att <- attributes(x)
if ("na.action" %in% names(att)) {
@ -358,7 +360,7 @@ sort.mic <- function(x, decreasing = FALSE, ...) {
#' @export
#' @noRd
hist.mic <- function(x, ...) {
warning_("Use `plot()` or ggplot2's `autoplot()` for optimal plotting of MIC values", call = FALSE)
warning_("in `hist()`: use `plot()` or ggplot2's `autoplot()` for optimal plotting of MIC values")
hist(log2(x))
}

418
R/mo.R
View File

@ -31,9 +31,9 @@
#' @param Becker a [logical] to indicate whether staphylococci should be categorised into coagulase-negative staphylococci ("CoNS") and coagulase-positive staphylococci ("CoPS") instead of their own species, according to Karsten Becker *et al.* (1,2,3).
#'
#' This excludes *Staphylococcus aureus* at default, use `Becker = "all"` to also categorise *S. aureus* as "CoPS".
#' @param Lancefield a [logical] to indicate whether beta-haemolytic *Streptococci* should be categorised into Lancefield groups instead of their own species, according to Rebecca C. Lancefield (4). These *Streptococci* will be categorised in their first group, e.g. *Streptococcus dysgalactiae* will be group C, although officially it was also categorised into groups G and L.
#' @param Lancefield a [logical] to indicate whether a beta-haemolytic *Streptococcus* should be categorised into Lancefield groups instead of their own species, according to Rebecca C. Lancefield (4). These streptococci will be categorised in their first group, e.g. *Streptococcus dysgalactiae* will be group C, although officially it was also categorised into groups G and L.
#'
#' This excludes *Enterococci* at default (who are in group D), use `Lancefield = "all"` to also categorise all *Enterococci* as group D.
#' This excludes enterococci at default (who are in group D), use `Lancefield = "all"` to also categorise all enterococci as group D.
#' @param allow_uncertain a number between `0` (or `"none"`) and `3` (or `"all"`), or `TRUE` (= `2`) or `FALSE` (= `0`) to indicate whether the input should be checked for less probable results, see *Details*
#' @param reference_df a [data.frame] to be used for extra reference when translating `x` to a valid [`mo`]. See [set_mo_source()] and [get_mo_source()] to automate the usage of your own codes (e.g. used in your analysis or organisation).
#' @param ignore_pattern a regular expression (case-insensitive) of which all matches in `x` must return `NA`. This can be convenient to exclude known non-relevant input and can also be set with the option `AMR_ignore_pattern`, e.g. `options(AMR_ignore_pattern = "(not reported|contaminated flora)")`.
@ -1003,6 +1003,35 @@ exec_as.mo <- function(x,
}
}
# try splitting of characters in the middle and then find ID based on old names ----
# only when text length is 6 or lower
# like esco = E. coli, klpn = K. pneumoniae, stau = S. aureus, staaur = S. aureus
if (nchar(g.x_backup_without_spp) <= 6) {
x_length <- nchar(g.x_backup_without_spp)
x_split <- paste0("^",
g.x_backup_without_spp %pm>% substr(1, x_length / 2),
".* ",
g.x_backup_without_spp %pm>% substr((x_length / 2) + 1, x_length))
found <- lookup(fullname_lower %like_case% x_split,
haystack = MO.old_lookup,
column = NULL)
if (!all(is.na(found))) {
# it's an old name, so return it
if (property == "ref") {
x[i] <- found["ref"]
} else {
x[i] <- lookup(fullname == found["fullname_new"], haystack = MO_lookup)
}
pkg_env$mo_renamed_last_run <- found["fullname"]
was_renamed(name_old = found["fullname"],
name_new = lookup(fullname == found["fullname_new"], "fullname", haystack = MO_lookup),
ref_old = found["ref"],
ref_new = lookup(fullname == found["fullname_new"], "ref", haystack = MO_lookup),
mo = lookup(fullname == found["fullname_new"], "mo", haystack = MO_lookup))
return(x[i])
}
}
# try fullname without start and without nchar limit of >= 6 ----
# like "K. pneu rhino" >> "Klebsiella pneumoniae (rhinoscleromatis)" = KLEPNERH
found <- lookup(fullname_lower %like_case% e.x_withspaces_start_only,
@ -1188,9 +1217,38 @@ exec_as.mo <- function(x,
return(found)
}
# (6) try to strip off half an element from end and check the remains ----
# (6) remove non-taxonomic prefix and suffix ----
if (isTRUE(debug)) {
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (6) try to strip off half an element from end and check the remains\n"))
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (6) remove non-taxonomic prefix and suffix\n"))
}
x_without_nontax <- gsub("(^[a-zA-Z]+[./-]+[a-zA-Z]+[^a-zA-Z]* )([a-zA-Z.]+ [a-zA-Z]+.*)",
"\\2", a.x_backup, perl = TRUE)
x_without_nontax <- gsub("( *[(].*[)] *)[^a-zA-Z]*$", "", x_without_nontax, perl = TRUE)
if (isTRUE(debug)) {
message("Running '", x_without_nontax, "'")
}
# first try without dyslexia mode
found <- suppressMessages(suppressWarnings(exec_as.mo(x_without_nontax, initial_search = FALSE, dyslexia_mode = FALSE, allow_uncertain = FALSE, debug = debug, reference_data_to_use = uncertain.reference_data_to_use, actual_uncertainty = 2, actual_input = x_without_nontax)))
if (empty_result(found)) {
# then with dyslexia mode
found <- suppressMessages(suppressWarnings(exec_as.mo(x_without_nontax, initial_search = FALSE, dyslexia_mode = TRUE, allow_uncertain = FALSE, debug = debug, reference_data_to_use = uncertain.reference_data_to_use, actual_uncertainty = 2, actual_input = x_without_nontax)))
}
if (!empty_result(found) & nchar(g.x_backup_without_spp) >= 6) {
# we ran with actual_input = x_without_nontax, so now correct for a.x_backup:
uncertain_df <- attr(found, which = "uncertainties", exact = TRUE)
uncertain_df$input <- a.x_backup
found_result <- found
uncertainties <<- rbind(uncertainties,
uncertain_df,
stringsAsFactors = FALSE)
found <- lookup(mo == found)
return(found)
}
# (7) try to strip off half an element from end and check the remains ----
if (isTRUE(debug)) {
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (7) try to strip off half an element from end and check the remains\n"))
}
x_strip <- a.x_backup %pm>% strsplit("[ .]") %pm>% unlist()
if (length(x_strip) > 1) {
@ -1220,9 +1278,9 @@ exec_as.mo <- function(x,
}
}
}
# (7) try to strip off one element from end and check the remains ----
# (8) try to strip off one element from end and check the remains ----
if (isTRUE(debug)) {
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (7) try to strip off one element from end and check the remains\n"))
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (8) try to strip off one element from end and check the remains\n"))
}
if (length(x_strip) > 1) {
for (i in seq_len(length(x_strip) - 1)) {
@ -1249,9 +1307,9 @@ exec_as.mo <- function(x,
}
}
}
# (8) check for unknown yeasts/fungi ----
# (9) check for unknown yeasts/fungi ----
if (isTRUE(debug)) {
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (8) check for unknown yeasts/fungi\n"))
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (9) check for unknown yeasts/fungi\n"))
}
if (b.x_trimmed %like_case% "yeast") {
found <- "F_YEAST"
@ -1275,9 +1333,9 @@ exec_as.mo <- function(x,
stringsAsFactors = FALSE)
return(found)
}
# (9) try to strip off one element from start and check the remains (only allow >= 2-part name outcome) ----
# (10) try to strip off one element from start and check the remains (only allow >= 2-part name outcome) ----
if (isTRUE(debug)) {
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (9) try to strip off one element from start and check the remains (only allow >= 2-part name outcome)\n"))
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (10) try to strip off one element from start and check the remains (only allow >= 2-part name outcome)\n"))
}
x_strip <- a.x_backup %pm>% strsplit("[ .]") %pm>% unlist()
if (length(x_strip) > 1 & nchar(g.x_backup_without_spp) >= 6) {
@ -1311,9 +1369,9 @@ exec_as.mo <- function(x,
if (uncertainty_level >= 3) {
now_checks_for_uncertainty_level <- 3
# (10) try to strip off one element from start and check the remains (any text size) ----
# (11) try to strip off one element from start and check the remains (any text size) ----
if (isTRUE(debug)) {
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (10) try to strip off one element from start and check the remains (any text size)\n"))
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (11) try to strip off one element from start and check the remains (any text size)\n"))
}
x_strip <- a.x_backup %pm>% strsplit("[ .]") %pm>% unlist()
if (length(x_strip) > 1 & nchar(g.x_backup_without_spp) >= 6) {
@ -1338,10 +1396,10 @@ exec_as.mo <- function(x,
}
}
}
# (11) try to strip off one element from end and check the remains (any text size) ----
# (12) try to strip off one element from end and check the remains (any text size) ----
# (this is in fact 7 but without nchar limit of >=6)
if (isTRUE(debug)) {
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (11) try to strip off one element from end and check the remains (any text size)\n"))
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (12) try to strip off one element from end and check the remains (any text size)\n"))
}
if (length(x_strip) > 1) {
for (i in seq_len(length(x_strip) - 1)) {
@ -1366,9 +1424,9 @@ exec_as.mo <- function(x,
}
}
# (12) part of a name (very unlikely match) ----
# (13) part of a name (very unlikely match) ----
if (isTRUE(debug)) {
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (12) part of a name (very unlikely match)\n"))
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (13) part of a name (very unlikely match)\n"))
}
if (isTRUE(debug)) {
message("Running '", f.x_withspaces_end_only, "'")
@ -1460,9 +1518,8 @@ exec_as.mo <- function(x,
"You can also use your own reference data with set_mo_source() or directly, e.g.:\n",
' as.mo("mycode", reference_df = data.frame(own = "mycode", mo = "', MO_lookup$mo[match("Escherichia coli", MO_lookup$fullname)], '"))\n',
' mo_name("mycode", reference_df = data.frame(own = "mycode", mo = "', MO_lookup$mo[match("Escherichia coli", MO_lookup$fullname)], '"))\n')
warning_(paste0("\n", msg),
warning_(paste0("\nin `as.mo()`: ", msg),
add_fn = font_red,
call = FALSE,
immediate = TRUE) # thus will always be shown, even if >= warnings
}
# handling uncertainties ----
@ -1502,12 +1559,11 @@ exec_as.mo <- function(x,
# comment below code if all staphylococcal species are categorised as CoNS/CoPS
if (any(x %in% MO_lookup[which(MO_lookup$species %in% post_Becker), property])) {
if (message_not_thrown_before("as.mo", "becker")) {
warning_("Becker ", font_italic("et al."), " (2014, 2019, 2020) does not contain these species named after their publication: ",
warning_("in `as.mo()`: Becker ", font_italic("et al."), " (2014, 2019, 2020) does not contain these species named after their publication: ",
font_italic(paste("S.",
sort(mo_species(unique(x[x %in% MO_lookup[which(MO_lookup$species %in% post_Becker), property]]))),
collapse = ", ")),
". Categorisation to CoNS/CoPS was taken from the original scientific publication(s).",
call = FALSE,
immediate = TRUE)
}
}
@ -1680,8 +1736,7 @@ pillar_shaft.mo <- function(x, ...) {
col <- "The data"
}
warning_(col, " contains old MO codes (from a previous AMR package version). ",
"Please update your MO codes with `as.mo()`.",
call = FALSE)
"Please update your MO codes with `as.mo()`.")
}
# make it always fit exactly
@ -1755,8 +1810,7 @@ print.mo <- function(x, print.shortnames = FALSE, ...) {
names(x) <- x_names
if (!all(x[!is.na(x)] %in% MO_lookup$mo)) {
warning_("Some MO codes are from a previous AMR package version. ",
"Please update these MO codes with `as.mo()`.",
call = FALSE)
"Please update the MO codes with `as.mo()`.")
}
print.default(x, quote = FALSE)
}
@ -1785,8 +1839,7 @@ summary.mo <- function(object, ...) {
as.data.frame.mo <- function(x, ...) {
if (!all(x[!is.na(x)] %in% MO_lookup$mo)) {
warning_("The data contains old MO codes (from a previous AMR package version). ",
"Please update your MO codes with `as.mo()`.",
call = FALSE)
"Please update your MO codes with `as.mo()`.")
}
nm <- deparse1(substitute(x))
if (!"nm" %in% names(list(...))) {
@ -1882,7 +1935,7 @@ print.mo_uncertainties <- function(x, ...) {
if (NROW(x) == 0) {
return(NULL)
}
cat(word_wrap("Matching scores", ifelse(has_colour(), " (in blue)", ""), " are based on human pathogenic prevalence and the resemblance between the input and the full taxonomic name. See `?mo_matching_score`.\n\n", add_fn = font_blue))
cat(word_wrap("Matching scores", ifelse(has_colour(), " (in blue)", ""), " are based on pathogenicity in humans and the resemblance between the input and the full taxonomic name. See `?mo_matching_score`.\n\n", add_fn = font_blue))
txt <- ""
for (i in seq_len(nrow(x))) {
@ -2090,24 +2143,22 @@ replace_old_mo_codes <- function(x, property) {
n_unique <- ""
}
if (property != "mo") {
warning_(paste0("The input contained ", n_matched,
" old MO code", ifelse(n_matched == 1, "", "s"),
" (", n_unique, "from a previous AMR package version). ",
"Please update your MO codes with `as.mo()` to increase speed."),
call = FALSE)
warning_("in `mo_", property, "()`: the input contained ", n_matched,
" old MO code", ifelse(n_matched == 1, "", "s"),
" (", n_unique, "from a previous AMR package version). ",
"Please update your MO codes with `as.mo()` to increase speed.")
} else {
warning_(paste0("The input contained ", n_matched,
" old MO code", ifelse(n_matched == 1, "", "s"),
" (", n_unique, "from a previous AMR package version). ",
n_solved, " old MO code", ifelse(n_solved == 1, "", "s"),
ifelse(n_solved == 1, " was", " were"),
ifelse(all_direct_matches, " updated ", font_bold(" guessed ")),
"to ", ifelse(n_solved == 1, "a ", ""),
"currently used MO code", ifelse(n_solved == 1, "", "s"),
ifelse(n_unsolved > 0,
paste0(" and ", n_unsolved, " old MO code", ifelse(n_unsolved == 1, "", "s"), " could not be updated."),
".")),
call = FALSE)
warning_("in `as.mo()`: the input contained ", n_matched,
" old MO code", ifelse(n_matched == 1, "", "s"),
" (", n_unique, "from a previous AMR package version). ",
n_solved, " old MO code", ifelse(n_solved == 1, "", "s"),
ifelse(n_solved == 1, " was", " were"),
ifelse(all_direct_matches, " updated ", font_bold(" guessed ")),
"to ", ifelse(n_solved == 1, "a ", ""),
"currently used MO code", ifelse(n_solved == 1, "", "s"),
ifelse(n_unsolved > 0,
paste0(" and ", n_unsolved, " old MO code", ifelse(n_unsolved == 1, "", "s"), " could not be updated."),
"."))
}
}
x
@ -2157,3 +2208,282 @@ strip_words <- function(text, n, side = "right") {
})
vapply(FUN.VALUE = character(1), out, paste, collapse = " ")
}
as.mo2 <- function(x,
Becker = FALSE,
Lancefield = FALSE,
allow_uncertain = TRUE,
reference_df = get_mo_source(),
info = interactive(),
property = "mo",
initial_search = TRUE,
dyslexia_mode = FALSE,
debug = FALSE,
ignore_pattern = getOption("AMR_ignore_pattern"),
reference_data_to_use = MO_lookup,
actual_uncertainty = 1,
actual_input = NULL,
language = get_AMR_locale()) {
meet_criteria(x, allow_class = c("mo", "data.frame", "list", "character", "numeric", "integer", "factor"), allow_NA = TRUE)
meet_criteria(Becker, allow_class = c("logical", "character"), has_length = 1)
meet_criteria(Lancefield, allow_class = c("logical", "character"), has_length = 1)
meet_criteria(allow_uncertain, allow_class = c("logical", "numeric", "integer"), has_length = 1)
meet_criteria(reference_df, allow_class = "data.frame", allow_NULL = TRUE)
meet_criteria(property, allow_class = "character", has_length = 1, is_in = colnames(microorganisms))
meet_criteria(initial_search, allow_class = "logical", has_length = 1)
meet_criteria(dyslexia_mode, allow_class = "logical", has_length = 1)
meet_criteria(debug, allow_class = "logical", has_length = 1)
meet_criteria(ignore_pattern, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(reference_data_to_use, allow_class = "data.frame")
meet_criteria(actual_uncertainty, allow_class = "numeric", has_length = 1)
meet_criteria(actual_input, allow_class = "character", allow_NULL = TRUE)
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
check_dataset_integrity()
if (isTRUE(debug) && initial_search == TRUE) {
time_start_tracking()
}
lookup <- function(needle,
column = property,
haystack = reference_data_to_use,
n = 1,
debug_mode = debug,
initial = initial_search,
uncertainty = actual_uncertainty,
input_actual = actual_input) {
if (!is.null(input_actual)) {
input <- input_actual
} else {
input <- tryCatch(x_backup[i], error = function(e) "")
}
# `column` can be NULL for all columns, or a selection
# returns a [character] (vector) - if `column` > length 1 then with columns as names
if (isTRUE(debug_mode)) {
cat(font_silver("Looking up: ", substitute(needle), collapse = ""),
"\n ", time_track())
}
if (length(column) == 1) {
res_df <- haystack[which(eval(substitute(needle), envir = haystack, enclos = parent.frame())), , drop = FALSE]
if (NROW(res_df) > 1 & uncertainty != -1) {
# sort the findings on matching score
scores <- mo_matching_score(x = input,
n = res_df[, "fullname", drop = TRUE])
res_df <- res_df[order(scores, decreasing = TRUE), , drop = FALSE]
}
res <- as.character(res_df[, column, drop = TRUE])
if (length(res) == 0) {
if (isTRUE(debug_mode)) {
cat(font_red(" (no match)\n"))
}
NA_character_
} else {
if (isTRUE(debug_mode)) {
cat(font_green(paste0(" MATCH (", NROW(res_df), " results)\n")))
}
if ((length(res) > n | uncertainty > 1) & uncertainty != -1) {
# save the other possible results as well, but not for forced certain results (then uncertainty == -1)
uncertainties <<- rbind(uncertainties,
format_uncertainty_as_df(uncertainty_level = uncertainty,
input = input,
result_mo = res_df[1, "mo", drop = TRUE],
candidates = as.character(res_df[, "fullname", drop = TRUE])),
stringsAsFactors = FALSE)
}
res[seq_len(min(n, length(res)))]
}
} else {
if (is.null(column)) {
column <- names(haystack)
}
res <- haystack[which(eval(substitute(needle), envir = haystack, enclos = parent.frame())), , drop = FALSE]
res <- res[seq_len(min(n, nrow(res))), column, drop = TRUE]
if (NROW(res) == 0) {
if (isTRUE(debug_mode)) {
cat(font_red(" (no rows)\n"))
}
res <- rep(NA_character_, length(column))
} else {
if (isTRUE(debug_mode)) {
cat(font_green(paste0(" MATCH (", NROW(res), " rows)\n")))
}
}
res <- as.character(res)
names(res) <- column
res
}
}
# start off with replaced language-specific non-ASCII characters with ASCII characters
x <- parse_and_convert(x)
# replace mo codes used in older package versions
x <- replace_old_mo_codes(x, property)
# ignore cases that match the ignore pattern
x <- replace_ignore_pattern(x, ignore_pattern)
# WHONET: xxx = no growth
x[tolower(as.character(paste0(x, ""))) %in% c("", "xxx", "na", "nan")] <- NA_character_
# Laboratory systems: remove (translated) entries like "no growth", etc.
x[trimws2(x) %like% translate_AMR("no .*growth", language = language)] <- NA_character_
x[trimws2(x) %like% paste0("^(", translate_AMR("no|not", language = language), ") [a-z]+")] <- "UNKNOWN"
if (initial_search == TRUE) {
# keep track of time - give some hints to improve speed if it takes a long time
start_time <- Sys.time()
pkg_env$mo_failures <- NULL
pkg_env$mo_uncertainties <- NULL
pkg_env$mo_renamed <- NULL
}
pkg_env$mo_renamed_last_run <- NULL
failures <- character(0)
uncertainty_level <- translate_allow_uncertain(allow_uncertain)
uncertainties <- data.frame(uncertainty = integer(0),
input = character(0),
fullname = character(0),
renamed_to = character(0),
mo = character(0),
candidates = character(0),
stringsAsFactors = FALSE)
x_input <- x
# already strip leading and trailing spaces
x <- trimws(x)
# only check the uniques, which is way faster
x <- unique(x)
# remove empty values (to later fill them in again with NAs)
# ("xxx" is WHONET code for 'no growth')
x <- x[!is.na(x)
& !is.null(x)
& !identical(x, "")
& !identical(x, "xxx")]
# defined df to check for
if (!is.null(reference_df)) {
check_validity_mo_source(reference_df)
reference_df <- repair_reference_df(reference_df)
}
# all empty
if (all(identical(trimws(x_input), "") | is.na(x_input) | length(x) == 0)) {
if (property == "mo") {
return(set_clean_class(rep(NA_character_, length(x_input)),
new_class = c("mo", "character")))
} else {
return(rep(NA_character_, length(x_input)))
}
} else if (all(x %in% reference_df[, 1][[1]])) {
# all in reference df
colnames(reference_df)[1] <- "x"
suppressWarnings(
x <- MO_lookup[match(reference_df[match(x, reference_df$x), "mo", drop = TRUE], MO_lookup$mo), property, drop = TRUE]
)
} else if (all(x %in% reference_data_to_use$mo)) {
x <- MO_lookup[match(x, MO_lookup$mo), property, drop = TRUE]
} else if (all(tolower(x) %in% reference_data_to_use$fullname_lower)) {
# we need special treatment for very prevalent full names, they are likely!
# e.g. as.mo("Staphylococcus aureus")
x <- MO_lookup[match(tolower(x), MO_lookup$fullname_lower), property, drop = TRUE]
} else if (all(x %in% reference_data_to_use$fullname)) {
# we need special treatment for very prevalent full names, they are likely!
# e.g. as.mo("Staphylococcus aureus")
x <- MO_lookup[match(x, MO_lookup$fullname), property, drop = TRUE]
} else if (all(toupper(x) %in% microorganisms.codes$code)) {
# commonly used MO codes
x <- MO_lookup[match(microorganisms.codes[match(toupper(x),
microorganisms.codes$code),
"mo",
drop = TRUE],
MO_lookup$mo),
property,
drop = TRUE]
} else if (!all(x %in% microorganisms[, property])) {
strip_whitespace <- function(x, dyslexia_mode) {
# all whitespaces (tab, new lines, etc.) should be one space
# and spaces before and after should be left blank
trimmed <- trimws2(x)
# also, make sure the trailing and leading characters are a-z or 0-9
# in case of non-regex
if (dyslexia_mode == FALSE) {
trimmed <- gsub("^[^a-zA-Z0-9)(]+", "", trimmed, perl = TRUE)
trimmed <- gsub("[^a-zA-Z0-9)(]+$", "", trimmed, perl = TRUE)
}
trimmed
}
x_backup_untouched <- x
x <- strip_whitespace(x, dyslexia_mode)
# translate 'unknown' names back to English
if (any(tolower(x) %like_case% "unbekannt|onbekend|desconocid|sconosciut|iconnu|desconhecid", na.rm = TRUE)) {
trns <- subset(TRANSLATIONS, pattern %like% "unknown")
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)
}
}
}
}
# remove spp and species
x <- gsub("(^| )[ .]*(spp|ssp|ss|sp|subsp|subspecies|biovar|biotype|serovar|species)[ .]*( |$)", "", x, ignore.case = TRUE, perl = TRUE)
x <- strip_whitespace(x, dyslexia_mode)
x_backup <- x
# from here on case-insensitive
x <- tolower(x)
x_backup[x %like_case% "^(fungus|fungi)$"] <- "(unknown fungus)" # will otherwise become the kingdom
x_backup[x_backup_untouched == "Fungi"] <- "Fungi" # is literally the kingdom
# Fill in fullnames and MO codes directly
known_names <- tolower(x_backup) %in% MO_lookup$fullname_lower
x[known_names] <- MO_lookup[match(tolower(x_backup)[known_names], MO_lookup$fullname_lower), property, drop = TRUE]
known_codes_mo <- toupper(x_backup) %in% MO_lookup$mo
x[known_codes_mo] <- MO_lookup[match(toupper(x_backup)[known_codes_mo], MO_lookup$mo), property, drop = TRUE]
known_codes_lis <- toupper(x_backup) %in% microorganisms.codes$code
x[known_codes_lis] <- MO_lookup[match(microorganisms.codes[match(toupper(x_backup)[known_codes_lis],
microorganisms.codes$code), "mo", drop = TRUE],
MO_lookup$mo), property, drop = TRUE]
already_known <- known_names | known_codes_mo | known_codes_lis
# now only continue where the right taxonomic output is not already known
if (any(!already_known)) {
x_unknown <- x[!already_known]
x_unknown <- gsub(" ?[(].*[)] ?", "", x_unknown, perl = TRUE)
x_unknown <- gsub("[^a-z ]", " ", x_unknown, perl = TRUE)
x_unknown <- gsub(" +", " ", x_unknown, perl = TRUE)
print(x_unknown)
x_search <- gsub("([a-z])[a-z]*( ([a-z])[a-z]*)?( ([a-z])[a-z]*)?", "^\\1.* \\3.* \\5.*", x_unknown, perl = TRUE)
x_search <- gsub("( [.][*])+$", "", x_search, perl = TRUE)
print(x_search)
for (i in seq_len(length(x_unknown))) {
# search first, second and third part
mos_to_search <- MO_lookup[which(MO_lookup$fullname_lower %like_case% x_search[i]), "fullname", drop = TRUE]
score <- mo_matching_score(x_unknown[i], mos_to_search)
out <- mos_to_search[order(score, decreasing = TRUE)][1:25] # keep first 25
print(score[order(score, decreasing = TRUE)][1])
x[!already_known][i] <- MO_lookup$mo[match(out[1], MO_lookup$fullname)]
}
}
}
x
}

View File

@ -27,13 +27,13 @@
#'
#' This algorithm is used by [as.mo()] and all the [`mo_*`][mo_property()] functions to determine the most probable match of taxonomic records based on user input.
#' @inheritSection lifecycle Stable Lifecycle
#' @author Dr. Matthijs Berends
#' @author Dr Matthijs Berends
#' @param x Any user input value(s)
#' @param n A full taxonomic name, that exists in [`microorganisms$fullname`][microorganisms]
#' @section Matching Score for Microorganisms:
#' With ambiguous user input in [as.mo()] and all the [`mo_*`][mo_property()] functions, the returned results are chosen based on their matching score using [mo_matching_score()]. This matching score \eqn{m}, is calculated as:
#'
#' \ifelse{latex}{\deqn{m_{(x, n)} = \frac{l_{n} - 0.5 \cdot \min \begin{cases}l_{n} \\ \textrm{lev}(x, n)\end{cases}}{l_{n} \cdot p_{n} \cdot k_{n}}}}{\ifelse{html}{\figure{mo_matching_score.png}{options: width="300px" alt="mo matching score"}}{m(x, n) = ( l_n * min(l_n, lev(x, n) ) ) / ( l_n * p_n * k_n )}}
#' \ifelse{latex}{\deqn{m_{(x, n)} = \frac{l_{n} - 0.5 \cdot \min \begin{cases}l_{n} \\ \textrm{lev}(x, n)\end{cases}}{l_{n} \cdot p_{n} \cdot k_{n}}}}{\ifelse{html}{\figure{mo_matching_score.png}{options: width="300" alt="mo matching score"}}{m(x, n) = ( l_n * min(l_n, lev(x, n) ) ) / ( l_n * p_n * k_n )}}
#'
#' where:
#'
@ -49,6 +49,8 @@
#' All characters in \eqn{x} and \eqn{n} are ignored that are other than A-Z, a-z, 0-9, spaces and parentheses.
#'
#' 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.
#'
#' Since `AMR` version 1.8.1, common microorganism abbreviations are ignored in determining the matching score. These abbreviations are currently: `r vector_and(pkg_env$mo_field_abbreviations, quotes = FALSE)`.
#' @export
#' @inheritSection AMR Reference Data Publicly Available
#' @inheritSection AMR Read more on Our Website!
@ -65,6 +67,13 @@ mo_matching_score <- function(x, n) {
x <- parse_and_convert(x)
# no dots and other non-whitespace characters
x <- gsub("[^a-zA-Z0-9 \\(\\)]+", "", x)
# remove abbreviations known to the field
x <- gsub(paste0("(^|[^a-z0-9]+)(",
paste0(pkg_env$mo_field_abbreviations, collapse = "|"),
")([^a-z0-9]+|$)"),
"", x, perl = TRUE, ignore.case = TRUE)
# only keep one space
x <- gsub(" +", " ", x)
@ -82,7 +91,7 @@ mo_matching_score <- function(x, n) {
l_n.lev <- double(length = length(x))
for (i in seq_len(length(x))) {
# determine Levenshtein distance, but maximise to nchar of n
lev[i] <- utils::adist(x[i], n[i], ignore.case = FALSE, fixed = TRUE)
lev[i] <- utils::adist(x[i], n[i], ignore.case = FALSE, fixed = TRUE, costs = c(ins = 1, del = 1, sub = 1))
# minimum of (l_n, Levenshtein distance)
l_n.lev[i] <- min(l_n[i], as.double(lev[i]))
}

View File

@ -684,7 +684,7 @@ mo_url <- function(x, open = FALSE, language = get_AMR_locale(), ...) {
if (isTRUE(open)) {
if (length(u) > 1) {
warning_("Only the first URL will be opened, as `browseURL()` only suports one string.")
warning_("in `mo_url()`: only the first URL will be opened, as `browseURL()` only suports one string.")
}
utils::browseURL(u[1L])
}

View File

@ -29,16 +29,16 @@
#'
#' This is **the fastest way** to have your organisation (or analysis) specific codes picked up and translated by this package, since you don't have to bother about it again after setting it up once.
#' @inheritSection lifecycle Stable Lifecycle
#' @param path location of your reference file, see *Details*. Can be `""`, `NULL` or `FALSE` to delete the reference file.
#' @param path location of your reference file, this can be any text file (comma-, tab- or pipe-separated) or an Excel file (see *Details*). Can also be `""`, `NULL` or `FALSE` to delete the reference file.
#' @param destination destination of the compressed data file, default to the user's home directory.
#' @rdname mo_source
#' @name mo_source
#' @aliases set_mo_source get_mo_source
#' @details The reference file can be a text file separated with commas (CSV) or tabs or pipes, an Excel file (either 'xls' or 'xlsx' format) or an \R object file (extension '.rds'). To use an Excel file, you will need to have the `readxl` package installed.
#'
#' [set_mo_source()] will check the file for validity: it must be a [data.frame], must have a column named `"mo"` which contains values from [`microorganisms$mo`][microorganisms] and must have a reference column with your own defined values. If all tests pass, [set_mo_source()] will read the file into \R and will ask to export it to `"~/mo_source.rds"`. The CRAN policy disallows packages to write to the file system, although '*exceptions may be allowed in interactive sessions if the package obtains confirmation from the user*'. For this reason, this function only works in interactive sessions so that the user can **specifically confirm and allow** that this file will be created. The destination of this file can be set with the `destination` argument and defaults to the user's home directory. It can also be set as an \R option, using `options(AMR_mo_source = "my/location/file.rds")`.
#' [set_mo_source()] will check the file for validity: it must be a [data.frame], must have a column named `"mo"` which contains values from [`microorganisms$mo`][microorganisms] or [`microorganisms$fullname`][microorganisms] and must have a reference column with your own defined values. If all tests pass, [set_mo_source()] will read the file into \R and will ask to export it to `"~/mo_source.rds"`. The CRAN policy disallows packages to write to the file system, although '*exceptions may be allowed in interactive sessions if the package obtains confirmation from the user*'. For this reason, this function only works in interactive sessions so that the user can **specifically confirm and allow** that this file will be created. The destination of this file can be set with the `destination` argument and defaults to the user's home directory. It can also be set as an \R option, using `options(AMR_mo_source = "my/location/file.rds")`.
#'
#' The created compressed data file `"mo_source.rds"` will be used at default for MO determination (function [as.mo()] and consequently all `mo_*` functions like [mo_genus()] and [mo_gramstain()]). The location and timestamp of the original file will be saved as an attribute to the compressed data file.
#' The created compressed data file `"mo_source.rds"` will be used at default for MO determination (function [as.mo()] and consequently all `mo_*` functions like [mo_genus()] and [mo_gramstain()]). The location and timestamp of the original file will be saved as an [attribute][base::attributes()] to the compressed data file.
#'
#' The function [get_mo_source()] will return the data set by reading `"mo_source.rds"` with [readRDS()]. If the original file has changed (by checking the location and timestamp of the original file), it will call [set_mo_source()] to update the data file automatically if used in an interactive session.
#'
@ -46,15 +46,15 @@
#'
#' @section How to Setup:
#'
#' Imagine this data on a sheet of an Excel file (mo codes were looked up in the [microorganisms] data set). The first column contains the organisation specific codes, the second column contains an MO code from this package:
#' Imagine this data on a sheet of an Excel file. The first column contains the organisation specific codes, the second column contains valid taxonomic names:
#'
#' ```
#' | A | B |
#' --|--------------------|--------------|
#' 1 | Organisation XYZ | mo |
#' 2 | lab_mo_ecoli | B_ESCHR_COLI |
#' 3 | lab_mo_kpneumoniae | B_KLBSL_PNMN |
#' 4 | | |
#' | A | B |
#' --|--------------------|-----------------------|
#' 1 | Organisation XYZ | mo |
#' 2 | lab_mo_ecoli | Escherichia coli |
#' 3 | lab_mo_kpneumoniae | Klebsiella pneumoniae |
#' 4 | | |
#' ```
#'
#' We save it as `"home/me/ourcodes.xlsx"`. Now we have to set it as a source:
@ -89,13 +89,13 @@
#' If we edit the Excel file by, let's say, adding row 4 like this:
#'
#' ```
#' | A | B |
#' --|--------------------|--------------|
#' 1 | Organisation XYZ | mo |
#' 2 | lab_mo_ecoli | B_ESCHR_COLI |
#' 3 | lab_mo_kpneumoniae | B_KLBSL_PNMN |
#' 4 | lab_Staph_aureus | B_STPHY_AURS |
#' 5 | | |
#' | A | B |
#' --|--------------------|-----------------------|
#' 1 | Organisation XYZ | mo |
#' 2 | lab_mo_ecoli | Escherichia coli |
#' 3 | lab_mo_kpneumoniae | Klebsiella pneumoniae |
#' 4 | lab_Staph_aureus | Staphylococcus aureus |
#' 5 | | |
#' ```
#'
#' ...any new usage of an MO function in this package will update your data file:
@ -144,6 +144,7 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
stop_ifnot(file.exists(path), "file not found: ", path)
df <- NULL
if (path %like% "[.]rds$") {
df <- readRDS(path)
@ -153,28 +154,34 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
df <- readxl::read_excel(path)
} else if (path %like% "[.]tsv$") {
df <- utils::read.table(header = TRUE, sep = "\t", stringsAsFactors = FALSE)
df <- utils::read.table(file = path, header = TRUE, sep = "\t", stringsAsFactors = FALSE)
} else if (path %like% "[.]csv$") {
df <- utils::read.table(file = path, header = TRUE, sep = ",", stringsAsFactors = FALSE)
} else {
# try comma first
try(
df <- utils::read.table(header = TRUE, sep = ",", stringsAsFactors = FALSE),
df <- utils::read.table(file = path, header = TRUE, sep = ",", stringsAsFactors = FALSE),
silent = TRUE)
if (!check_validity_mo_source(df, stop_on_error = FALSE)) {
# try tab
try(
df <- utils::read.table(header = TRUE, sep = "\t", stringsAsFactors = FALSE),
df <- utils::read.table(file = path, header = TRUE, sep = "\t", stringsAsFactors = FALSE),
silent = TRUE)
}
if (!check_validity_mo_source(df, stop_on_error = FALSE)) {
# try pipe
try(
df <- utils::read.table(header = TRUE, sep = "|", stringsAsFactors = FALSE),
df <- utils::read.table(file = path, header = TRUE, sep = "|", stringsAsFactors = FALSE),
silent = TRUE)
}
}
# check integrity
if (is.null(df)) {
stop_("the path '", path, "' could not be imported as a dataset.")
}
check_validity_mo_source(df)
df <- subset(df, !is.na(mo))
@ -187,7 +194,7 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
}
df <- as.data.frame(df, stringAsFactors = FALSE)
df[, "mo"] <- set_clean_class(df[, "mo", drop = TRUE], c("mo", "character"))
df[, "mo"] <- as.mo(df[, "mo", drop = TRUE])
# success
if (file.exists(mo_source_destination)) {
@ -275,9 +282,9 @@ check_validity_mo_source <- function(x, refer_to_name = "`reference_df`", stop_o
return(FALSE)
}
}
if (!all(x$mo %in% c("", microorganisms$mo), na.rm = TRUE)) {
if (!all(x$mo %in% c("", microorganisms$mo, microorganisms$fullname), na.rm = TRUE)) {
if (stop_on_error == TRUE) {
invalid <- x[which(!x$mo %in% c("", microorganisms$mo)), , drop = FALSE]
invalid <- x[which(!x$mo %in% c("", microorganisms$mo, microorganisms$fullname)), , drop = FALSE]
if (nrow(invalid) > 1) {
plural <- "s"
} else {

View File

@ -98,7 +98,7 @@ pca <- function(x,
x <- as.data.frame(new_list, stringsAsFactors = FALSE)
if (any(vapply(FUN.VALUE = logical(1), x, function(y) !is.numeric(y)))) {
warning_("Be sure to first calculate the resistance (or susceptibility) of variables with antimicrobial test results, since PCA works with [numeric] variables only. See Examples in ?pca.", call = FALSE)
warning_("in `pca()`: be sure to first calculate the resistance (or susceptibility) of variables with antimicrobial test results, since PCA works with numeric variables only. See Examples in ?pca.", call = FALSE)
}
# set column names

View File

@ -79,7 +79,7 @@ plot.mic <- function(x,
mo = NULL,
ab = NULL,
guideline = "EUCAST",
main = paste("MIC values of", deparse(substitute(x))),
main = deparse(substitute(x)),
ylab = "Frequency",
xlab = "Minimum Inhibitory Concentration (mg/L)",
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
@ -166,7 +166,7 @@ barplot.mic <- function(height,
mo = NULL,
ab = NULL,
guideline = "EUCAST",
main = paste("MIC values of", deparse(substitute(height))),
main = deparse(substitute(height)),
ylab = "Frequency",
xlab = "Minimum Inhibitory Concentration (mg/L)",
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
@ -299,7 +299,7 @@ fortify.mic <- function(object, ...) {
#' @importFrom graphics barplot axis mtext legend
#' @rdname plot
plot.disk <- function(x,
main = paste("Disk zones of", deparse(substitute(x))),
main = deparse(substitute(x)),
ylab = "Frequency",
xlab = "Disk diffusion diameter (mm)",
mo = NULL,
@ -386,7 +386,7 @@ plot.disk <- function(x,
#' @export
#' @noRd
barplot.disk <- function(height,
main = paste("Disk zones of", deparse(substitute(height))),
main = deparse(substitute(height)),
ylab = "Frequency",
xlab = "Disk diffusion diameter (mm)",
mo = NULL,
@ -525,7 +525,7 @@ fortify.disk <- function(object, ...) {
plot.rsi <- function(x,
ylab = "Percentage",
xlab = "Antimicrobial Interpretation",
main = paste("Resistance Overview of", deparse(substitute(x))),
main = deparse(substitute(x)),
...) {
meet_criteria(ylab, allow_class = "character", has_length = 1)
meet_criteria(xlab, allow_class = "character", has_length = 1)
@ -576,7 +576,7 @@ plot.rsi <- function(x,
#' @export
#' @noRd
barplot.rsi <- function(height,
main = paste("Resistance Overview of", deparse(substitute(height))),
main = deparse(substitute(height)),
xlab = "Antimicrobial Interpretation",
ylab = "Frequency",
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
@ -738,7 +738,11 @@ plot_colours_subtitle_guideline <- function(x, mo, ab, guideline, colours_RSI, f
ab_name(ab, language = NULL, tolower = TRUE), " in ", moname)
guideline_txt <- ""
} else {
guideline_txt <- paste0("(", guideline, ")")
guideline_txt <- guideline
if (isTRUE(list(...)$uti)) {
guideline_txt <- paste("UTIs,", guideline_txt)
}
guideline_txt <- paste0("(", guideline_txt, ")")
}
sub <- bquote(.(abname)~"-"~italic(.(moname))~.(guideline_txt))
} else {

View File

@ -34,7 +34,7 @@
#' @param ... ignored, only in place to allow future extensions
#' @details The base \R function [sample()] is used for generating values.
#'
#' Generated values are based on the latest EUCAST guideline implemented in the [rsi_translation] data set. To create specific generated values per bug or drug, set the `mo` and/or `ab` argument.
#' Generated values are based on the EUCAST `r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))` guideline as implemented in the [rsi_translation] data set. To create specific generated values per bug or drug, set the `mo` and/or `ab` argument.
#' @return class `<mic>` for [random_mic()] (see [as.mic()]) and class `<disk>` for [random_disk()] (see [as.disk()])
#' @name random
#' @rdname random
@ -89,6 +89,7 @@ random_rsi <- function(size = NULL, prob_RSI = c(0.33, 0.33, 0.33), ...) {
}
random_exec <- function(type, size, mo = NULL, ab = NULL) {
check_dataset_integrity()
df <- rsi_translation %pm>%
pm_filter(guideline %like% "EUCAST") %pm>%
pm_arrange(pm_desc(guideline)) %pm>%
@ -106,7 +107,7 @@ random_exec <- function(type, size, mo = NULL, ab = NULL) {
if (nrow(df_new) > 0) {
df <- df_new
} else {
warning_("No rows found that match mo '", mo, "', ignoring argument `mo`", call = FALSE)
warning_("in `random_", tolower(type), "()`: no rows found that match mo '", mo, "', ignoring argument `mo`")
}
}
@ -117,7 +118,7 @@ random_exec <- function(type, size, mo = NULL, ab = NULL) {
if (nrow(df_new) > 0) {
df <- df_new
} else {
warning_("No rows found that match ab '", ab, "', ignoring argument `ab`", call = FALSE)
warning_("in `random_", tolower(type), "()`: no rows found that match ab '", ab, "', ignoring argument `ab`")
}
}

View File

@ -34,7 +34,7 @@
#' @param year_max highest year to use in the prediction model, defaults to 10 years after today
#' @param year_every unit of sequence between lowest year found in the data and `year_max`
#' @param minimum minimal amount of available isolates per year to include. Years containing less observations will be estimated by the model.
#' @param model the statistical model of choice. This could be a generalised linear regression model with binomial distribution (i.e. using `glm(..., family = binomial)``, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance. See *Details* for all valid options.
#' @param model the statistical model of choice. This could be a generalised linear regression model with binomial distribution (i.e. using `glm(..., family = binomial)`, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance. See *Details* for all valid options.
#' @param I_as_S a [logical] to indicate whether values `"I"` should be treated as `"S"` (will otherwise be treated as `"R"`). The default, `TRUE`, follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section *Interpretation of S, I and R* below.
#' @param preserve_measurements a [logical] to indicate whether predictions of years that are actually available in the data should be overwritten by the original data. The standard errors of those years will be `NA`.
#' @param info a [logical] to indicate whether textual analysis should be printed with the name and [summary()] of the statistical model.
@ -153,7 +153,7 @@ resistance_predict <- function(x,
x <- dots[which(dots.names == "tbl")]
}
if ("I_as_R" %in% dots.names) {
warning_("`I_as_R is deprecated - use I_as_S instead.", call = FALSE)
warning_("in `resistance_predict()`: I_as_R is deprecated - use I_as_S instead.")
}
}

381
R/rsi.R
View File

@ -33,7 +33,7 @@
#' @param ab any (vector of) text that can be coerced to a valid antimicrobial code with [as.ab()]
#' @param uti (Urinary Tract Infection) A vector with [logical]s (`TRUE` or `FALSE`) to specify whether a UTI specific interpretation from the guideline should be chosen. For using [as.rsi()] on a [data.frame], this can also be a column containing [logical]s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See *Examples*.
#' @inheritParams first_isolate
#' @param guideline defaults to the latest included EUCAST guideline, see *Details* for all options
#' @param guideline defaults to EUCAST `r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))` (the latest implemented EUCAST guideline in the [rsi_translation] data set), supports 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)))`) and 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)))`), see *Details*
#' @param conserve_capped_values a [logical] to indicate that MIC values starting with `">"` (but not `">="`) must always return "R" , and that MIC values starting with `"<"` (but not `"<="`) must always return "S"
#' @param add_intrinsic_resistance *(only useful when using a EUCAST guideline)* a [logical] to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in *Klebsiella* species. Determination is based on the [intrinsic_resistant] data set, that itself is based on `r format_eucast_version_nr(3.3)`.
#' @param reference_data a [data.frame] to be used for interpretation, which defaults to the [rsi_translation] data set. Changing this argument allows for using own interpretation guidelines. This argument must contain a data set that is equal in structure to the [rsi_translation] data set (same column names and column types). Please note that the `guideline` argument will be ignored when `reference_data` is manually set.
@ -67,7 +67,7 @@
#'
#' For interpreting MIC values as well as disk diffusion diameters, currently implemented guidelines are 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)))`) and 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)))`).
#'
#' Thus, the `guideline` argument must be set to e.g., ``r paste0('"', subset(rsi_translation, guideline %like% "EUCAST")$guideline[1], '"')`` or ``r paste0('"', subset(rsi_translation, guideline %like% "CLSI")$guideline[1], '"')``. By simply using `"EUCAST"` (the default) or `"CLSI"` as input, the latest version of that guideline will automatically be selected. You can set your own data set using the `reference_data` argument. The `guideline` argument will then be ignored.
#' Thus, the `guideline` argument must be set to e.g., ``r paste0('"', subset(rsi_translation, guideline %like% "EUCAST")$guideline[1], '"')`` or ``r paste0('"', subset(rsi_translation, guideline %like% "CLSI")$guideline[1], '"')``. By simply using `"EUCAST"` (the default) or `"CLSI"` as input, the latest included version of that guideline will automatically be selected. You can set your own data set using the `reference_data` argument. The `guideline` argument will then be ignored.
#'
#' ## After Interpretation
#'
@ -179,7 +179,7 @@
#' example_isolates %>%
#' mutate_if(is.rsi.eligible, as.rsi)
#'
#' # note: from dplyr 1.0.0 on, this will be:
#' # since dplyr 1.0.0, this can also be:
#' # example_isolates %>%
#' # mutate(across(where(is.rsi.eligible), as.rsi))
#' }
@ -189,7 +189,7 @@ as.rsi <- function(x, ...) {
}
#' @rdname as.rsi
#' @details `NA_rsi_` is a missing value of the new `<rsi>` class.
#' @details `NA_rsi_` is a missing value of the new `<rsi>` class, analogous to e.g. base \R's [`NA_character_`][base::NA].
#' @export
NA_rsi_ <- set_clean_class(factor(NA, levels = c("S", "I", "R"), ordered = TRUE),
new_class = c("rsi", "ordered", "factor"))
@ -233,9 +233,9 @@ is.rsi.eligible <- function(x, threshold = 0.05) {
} else if (!any(c("R", "S", "I") %in% x, na.rm = TRUE) & !all(is.na(x))) {
return(FALSE)
} else {
x <- x[!is.na(x) & !is.null(x) & x != ""]
x <- x[!is.na(x) & !is.null(x) & !x %in% c("", "-", "NULL")]
if (length(x) == 0) {
# no other values than NA or ""
# no other values than empty
cur_col <- get_current_column()
if (!is.null(cur_col)) {
ab <- suppressWarnings(as.ab(cur_col, fast_mode = TRUE, info = FALSE))
@ -257,7 +257,7 @@ is.rsi.eligible <- function(x, threshold = 0.05) {
}
#' @export
# extra param: warn (never throw warning)
# extra param: warn (logical, to never throw a warning)
as.rsi.default <- function(x, ...) {
if (is.rsi(x)) {
return(x)
@ -284,16 +284,17 @@ as.rsi.default <- function(x, ...) {
if (all(x %unlike% "(R|S|I)", na.rm = TRUE)) {
# check if they are actually MICs or disks
if (all_valid_mics(x)) {
warning_("The input seems to contain MIC values. You can transform them with `as.mic()` before running `as.rsi()` to interpret them.", call = FALSE)
warning_("in `as.rsi()`: the input seems to contain MIC values. You can transform them with `as.mic()` before running `as.rsi()` to interpret them.")
} else if (all_valid_disks(x)) {
warning_("The input seems to contain disk diffusion values. You can transform them with `as.disk()` before running `as.rsi()` to interpret them.", call = FALSE)
warning_("in `as.rsi()`: the input seems to contain disk diffusion values. You can transform them with `as.disk()` before running `as.rsi()` to interpret them.")
}
}
# trim leading and trailing spaces, new lines, etc.
x <- trimws2(as.character(unlist(x)))
x[x %in% c(NA, "", "-", "NULL")] <- NA_character_
x.bak <- x
na_before <- length(x[is.na(x) | x == ""])
na_before <- length(x[is.na(x)])
# correct for translations
trans_R <- unlist(TRANSLATIONS[which(TRANSLATIONS$pattern == "Resistant"),
@ -310,11 +311,15 @@ as.rsi.default <- function(x, ...) {
x[x %like% "([^a-z]|^)sus(cep(tible)?)?"] <- "S"
x[x %like% "([^a-z]|^)int(er(mediate)?)?|incr.*exp"] <- "I"
# remove other invalid characters
x <- gsub("[^rsiRSIHi]+", "", x, perl = TRUE)
# some labs now report "H" instead of "I" to not interfere with EUCAST prior to 2019
x <- gsub("H", "I", x, ignore.case = TRUE)
# set to capitals
x <- toupper(x)
x <- gsub("[^RSIHDU]+", "", x, perl = TRUE)
# some labs now report "H" instead of "I" to not interfere with EUCAST prior to 2019
x <- gsub("^H$", "I", x, perl = TRUE)
# and MIPS uses D for Dose-dependent (which is I, but it will throw a note)
x <- gsub("^D$", "I", x, perl = TRUE)
# and MIPS uses U for "susceptible urine"
x <- gsub("^U$", "S", x, perl = TRUE)
# in cases of "S;S" keep S, but in case of "S;I" make it NA
x <- gsub("^S+$", "S", x)
x <- gsub("^I+$", "I", x)
@ -328,11 +333,20 @@ as.rsi.default <- function(x, ...) {
unique() %pm>%
sort() %pm>%
vector_and(quotes = TRUE)
warning_(na_after - na_before, " results truncated (",
warning_("in `as.rsi()`: ", na_after - na_before, " results truncated (",
round(((na_after - na_before) / length(x)) * 100),
"%) that were invalid antimicrobial interpretations: ",
list_missing, call = FALSE)
}
if (any(toupper(x.bak[!is.na(x.bak)]) == "U") && message_not_thrown_before("as.rsi", "U")) {
warning_("in `as.rsi()`: 'U' was interpreted as 'S', following some laboratory systems")
}
if (any(toupper(x.bak[!is.na(x.bak)]) == "D") && message_not_thrown_before("as.rsi", "D")) {
warning_("in `as.rsi()`: 'D' (dose-dependent) was interpreted as 'I', following some laboratory systems")
}
if (any(toupper(x.bak[!is.na(x.bak)]) == "H") && message_not_thrown_before("as.rsi", "H")) {
warning_("in `as.rsi()`: 'H' was interpreted as 'I', following some laboratory systems")
}
}
}
@ -351,89 +365,17 @@ as.rsi.mic <- function(x,
add_intrinsic_resistance = FALSE,
reference_data = AMR::rsi_translation,
...) {
meet_criteria(x)
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
meet_criteria(ab, allow_class = c("ab", "character"))
meet_criteria(guideline, allow_class = "character", has_length = 1)
meet_criteria(uti, allow_class = "logical", has_length = c(1, length(x)))
meet_criteria(conserve_capped_values, allow_class = "logical", has_length = 1)
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1)
meet_criteria(reference_data, allow_class = "data.frame")
check_reference_data(reference_data)
# for dplyr's across()
cur_column_dplyr <- import_fn("cur_column", "dplyr", error_on_fail = FALSE)
if (!is.null(cur_column_dplyr) && tryCatch(is.data.frame(get_current_data("ab", call = 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)
}
# for auto-determining mo
mo_var_found <- ""
if (is.null(mo)) {
tryCatch({
df <- get_current_data(arg_name = "mo", call = -3) # will return an error if not found
mo <- NULL
try({
mo <- suppressMessages(search_type_in_df(df, "mo"))
}, silent = TRUE)
if (!is.null(df) && !is.null(mo) && is.data.frame(df)) {
mo_var_found <- paste0(" based on column '", font_bold(mo), "'")
mo <- df[, mo, drop = TRUE]
}
}, error = function(e)
stop_('No information was supplied about the microorganisms (missing argument `mo`). See ?as.rsi.\n\n',
"To transform certain columns with e.g. mutate_at(), use `data %>% mutate_at(vars(...), as.rsi, mo = .$x)`, where x is your column with microorganisms.\n",
"To tranform all disk diffusion zones in a data set, use `data %>% as.rsi()` or data %>% mutate_if(is.disk, as.rsi).", call = FALSE)
)
}
if (length(ab) == 1 && ab %like% "as.mic") {
stop_('No unambiguous name was supplied about the antibiotic (argument `ab`). See ?as.rsi.', call = FALSE)
}
ab_coerced <- suppressWarnings(as.ab(ab))
mo_coerced <- suppressWarnings(as.mo(mo))
guideline_coerced <- get_guideline(guideline, reference_data)
if (is.na(ab_coerced)) {
message_("Returning NAs for unknown drug: '", font_bold(ab),
"'. Rename this column to a drug name or code, and check the output with `as.ab()`.",
add_fn = font_red,
as_note = FALSE)
return(as.rsi(rep(NA, length(x))))
}
if (length(mo_coerced) == 1) {
mo_coerced <- rep(mo_coerced, length(x))
}
if (length(uti) == 1) {
uti <- rep(uti, length(x))
}
agent_formatted <- paste0("'", font_bold(ab), "'")
agent_name <- ab_name(ab_coerced, tolower = TRUE, language = NULL)
if (generalise_antibiotic_name(ab) != generalise_antibiotic_name(agent_name)) {
agent_formatted <- paste0(agent_formatted, " (", ab_coerced, ", ", agent_name, ")")
}
message_("=> Interpreting MIC values of ", ifelse(isTRUE(list(...)$is_data.frame), "column ", ""),
agent_formatted,
mo_var_found,
" according to ", ifelse(identical(reference_data, AMR::rsi_translation),
font_bold(guideline_coerced),
"manually defined 'reference_data'"),
"... ",
appendLF = FALSE,
as_note = FALSE)
result <- exec_as.rsi(method = "mic",
x = x,
mo = mo_coerced,
ab = ab_coerced,
guideline = guideline_coerced,
uti = uti,
conserve_capped_values = conserve_capped_values,
add_intrinsic_resistance = add_intrinsic_resistance,
reference_data = reference_data) # exec_as.rsi will return message 'OK'
result
as_rsi_method(method_short = "mic",
method_long = "MIC values",
x = x,
mo = mo,
ab = ab,
guideline = guideline,
uti = uti,
conserve_capped_values = conserve_capped_values,
add_intrinsic_resistance = add_intrinsic_resistance,
reference_data = reference_data,
...)
}
#' @rdname as.rsi
@ -446,88 +388,17 @@ as.rsi.disk <- function(x,
add_intrinsic_resistance = FALSE,
reference_data = AMR::rsi_translation,
...) {
meet_criteria(x)
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
meet_criteria(ab, allow_class = c("ab", "character"))
meet_criteria(guideline, allow_class = "character", has_length = 1)
meet_criteria(uti, allow_class = "logical", has_length = c(1, length(x)))
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1)
meet_criteria(reference_data, allow_class = "data.frame")
check_reference_data(reference_data)
# for dplyr's across()
cur_column_dplyr <- import_fn("cur_column", "dplyr", error_on_fail = FALSE)
if (!is.null(cur_column_dplyr) && tryCatch(is.data.frame(get_current_data("ab", call = 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)
}
# for auto-determining mo
mo_var_found <- ""
if (is.null(mo)) {
tryCatch({
df <- get_current_data(arg_name = "mo", call = -3) # will return an error if not found
mo <- NULL
try({
mo <- suppressMessages(search_type_in_df(df, "mo"))
}, silent = TRUE)
if (!is.null(df) && !is.null(mo) && is.data.frame(df)) {
mo_var_found <- paste0(" based on column '", font_bold(mo), "'")
mo <- df[, mo, drop = TRUE]
}
}, error = function(e)
stop_('No information was supplied about the microorganisms (missing argument `mo`). See ?as.rsi.\n\n',
"To transform certain columns with e.g. mutate_at(), use `data %>% mutate_at(vars(...), as.rsi, mo = .$x)`, where x is your column with microorganisms.\n",
"To tranform all disk diffusion zones in a data set, use `data %>% as.rsi()` or data %>% mutate_if(is.disk, as.rsi).", call = FALSE)
)
}
if (length(ab) == 1 && ab %like% "as.disk") {
stop_('No unambiguous name was supplied about the antibiotic (argument `ab`). See ?as.rsi.', call = FALSE)
}
ab_coerced <- suppressWarnings(as.ab(ab))
mo_coerced <- suppressWarnings(as.mo(mo))
guideline_coerced <- get_guideline(guideline, reference_data)
if (is.na(ab_coerced)) {
message_("Returning NAs for unknown drug: '", font_bold(ab),
"'. Rename this column to a drug name or code, and check the output with `as.ab()`.",
add_fn = font_red,
as_note = FALSE)
return(as.rsi(rep(NA, length(x))))
}
if (length(mo_coerced) == 1) {
mo_coerced <- rep(mo_coerced, length(x))
}
if (length(uti) == 1) {
uti <- rep(uti, length(x))
}
agent_formatted <- paste0("'", font_bold(ab), "'")
agent_name <- ab_name(ab_coerced, tolower = TRUE, language = NULL)
if (generalise_antibiotic_name(ab) != generalise_antibiotic_name(agent_name)) {
agent_formatted <- paste0(agent_formatted, " (", ab_coerced, ", ", agent_name, ")")
}
message_("=> Interpreting disk zones of ", ifelse(isTRUE(list(...)$is_data.frame), "column ", ""),
agent_formatted,
mo_var_found,
" according to ", ifelse(identical(reference_data, AMR::rsi_translation),
font_bold(guideline_coerced),
"manually defined 'reference_data'"),
"... ",
appendLF = FALSE,
as_note = FALSE)
result <- exec_as.rsi(method = "disk",
x = x,
mo = mo_coerced,
ab = ab_coerced,
guideline = guideline_coerced,
uti = uti,
conserve_capped_values = FALSE,
add_intrinsic_resistance = add_intrinsic_resistance,
reference_data = reference_data) # exec_as.rsi will return message 'OK'
result
as_rsi_method(method_short = "disk",
method_long = "disk diffusion zones",
x = x,
mo = mo,
ab = ab,
guideline = guideline,
uti = uti,
conserve_capped_values = FALSE,
add_intrinsic_resistance = add_intrinsic_resistance,
reference_data = reference_data,
...)
}
#' @rdname as.rsi
@ -732,6 +603,105 @@ get_guideline <- function(guideline, reference_data) {
guideline_param
}
as_rsi_method <- function(method_short = "mic",
method_long = "MIC values",
x = x,
mo = NULL,
ab = deparse(substitute(x)),
guideline = "EUCAST",
uti = FALSE,
conserve_capped_values = FALSE,
add_intrinsic_resistance = FALSE,
reference_data = AMR::rsi_translation,
...) {
meet_criteria(x)
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
meet_criteria(ab, allow_class = c("ab", "character"))
meet_criteria(guideline, allow_class = "character", has_length = 1)
meet_criteria(uti, allow_class = "logical", has_length = c(1, length(x)))
meet_criteria(conserve_capped_values, allow_class = "logical", has_length = 1)
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1)
meet_criteria(reference_data, allow_class = "data.frame")
check_reference_data(reference_data)
# for dplyr's across()
cur_column_dplyr <- import_fn("cur_column", "dplyr", error_on_fail = FALSE)
if (!is.null(cur_column_dplyr) && tryCatch(is.data.frame(get_current_data("ab", call = 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)
}
# for auto-determining mo
mo_var_found <- ""
if (is.null(mo)) {
tryCatch({
df <- get_current_data(arg_name = "mo", call = -3) # will return an error if not found
mo <- NULL
try({
mo <- suppressMessages(search_type_in_df(df, "mo"))
}, silent = TRUE)
if (!is.null(df) && !is.null(mo) && is.data.frame(df)) {
mo_var_found <- paste0(" based on column '", font_bold(mo), "'")
mo <- df[, mo, drop = TRUE]
}
}, error = function(e) {
mo <- NULL
})
}
if (is.null(mo)) {
stop_("No information was supplied about the microorganisms (missing argument `mo` and no column of class <mo> found). See ?as.rsi.\n\n",
"To transform certain columns with e.g. mutate(), use `data %>% mutate(across(..., as.rsi, mo = x))`, where x is your column with microorganisms.\n",
"To tranform all ", method_long, " in a data set, use `data %>% as.rsi()` or `data %>% mutate(across(where(is.", method_short, "), as.rsi))`.", call = FALSE)
}
if (length(ab) == 1 && ab %like% paste0("as.", method_short)) {
stop_('No unambiguous name was supplied about the antibiotic (argument `ab`). See ?as.rsi.', call = FALSE)
}
ab_coerced <- suppressWarnings(as.ab(ab))
mo_coerced <- suppressWarnings(as.mo(mo))
guideline_coerced <- get_guideline(guideline, reference_data)
if (is.na(ab_coerced)) {
message_("Returning NAs for unknown drug: '", font_bold(ab),
"'. Rename this column to a drug name or code, and check the output with `as.ab()`.",
add_fn = font_red,
as_note = FALSE)
return(as.rsi(rep(NA, length(x))))
}
if (length(mo_coerced) == 1) {
mo_coerced <- rep(mo_coerced, length(x))
}
if (length(uti) == 1) {
uti <- rep(uti, length(x))
}
agent_formatted <- paste0("'", font_bold(ab), "'")
agent_name <- ab_name(ab_coerced, tolower = TRUE, language = NULL)
if (generalise_antibiotic_name(ab) != generalise_antibiotic_name(agent_name)) {
agent_formatted <- paste0(agent_formatted, " (", ab_coerced, ", ", agent_name, ")")
}
message_("=> Interpreting ", method_long, " of ", ifelse(isTRUE(list(...)$is_data.frame), "column ", ""),
agent_formatted,
mo_var_found,
" according to ", ifelse(identical(reference_data, AMR::rsi_translation),
font_bold(guideline_coerced),
"manually defined 'reference_data'"),
"... ",
appendLF = FALSE,
as_note = FALSE)
result <- exec_as.rsi(method = method_short,
x = x,
mo = mo_coerced,
ab = ab_coerced,
guideline = guideline_coerced,
uti = uti,
conserve_capped_values = conserve_capped_values,
add_intrinsic_resistance = add_intrinsic_resistance,
reference_data = reference_data) # exec_as.rsi will return message 'OK'
result
}
exec_as.rsi <- function(method,
x,
mo,
@ -744,7 +714,7 @@ exec_as.rsi <- function(method,
metadata_mo <- get_mo_failures_uncertainties_renamed()
x_bak <- data.frame(x_mo = paste0(x, mo), stringsAsFactors = FALSE)
df <- unique(data.frame(x, mo), stringsAsFactors = FALSE)
df <- unique(data.frame(x, mo, x_mo = paste0(x, mo), stringsAsFactors = FALSE))
x <- df$x
mo <- df$mo
@ -754,7 +724,7 @@ exec_as.rsi <- function(method,
x <- as.disk(x) # when as.rsi.disk is called directly
}
warned <- FALSE
rise_warning <- FALSE
method_param <- toupper(method)
genera <- mo_genus(mo, language = NULL)
@ -799,13 +769,6 @@ exec_as.rsi <- function(method,
lookup_lancefield <- paste(mo_lancefield, ab)
lookup_other <- paste(mo_other, ab)
if (length(unique(paste(trans$mo, trans$ab))) == length(unique(paste(trans$mo, trans$ab, trans$uti))) &&
any(trans$uti == TRUE, na.rm = TRUE) && all(uti == FALSE)) {
message_("WARNING.", add_fn = list(font_yellow, font_bold), as_note = FALSE)
warning_("Introducing NA: interpretation of ", font_bold(ab_name(ab, tolower = TRUE)), " for some microorganisms is only available for (uncomplicated) urinary tract infections (UTI). Use argument `uti` to set which isolates are from urine. See ?as.rsi.", call = FALSE)
warned <- TRUE
}
any_is_intrinsic_resistant <- FALSE
for (i in seq_len(length(x))) {
@ -815,7 +778,7 @@ exec_as.rsi <- function(method,
if (isTRUE(add_intrinsic_resistance) & is_intrinsic_r) {
if (guideline_coerced %unlike% "EUCAST") {
if (message_not_thrown_before("as.rsi", "msg2")) {
warning_("Using 'add_intrinsic_resistance' is only useful when using EUCAST guidelines, since the rules for intrinsic resistance are based on EUCAST.", call = FALSE)
warning_("in `as.rsi()`: using 'add_intrinsic_resistance' is only useful when using EUCAST guidelines, since the rules for intrinsic resistance are based on EUCAST.")
}
} else {
new_rsi[i] <- "R"
@ -824,7 +787,7 @@ exec_as.rsi <- function(method,
}
get_record <- trans %pm>%
# no subsetting to UTI for now
# no subsetting to UTI here
subset(lookup %in% c(lookup_mo[i],
lookup_genus[i],
lookup_family[i],
@ -833,6 +796,11 @@ exec_as.rsi <- function(method,
lookup_lancefield[i],
lookup_other[i]))
if (any(get_record$uti == TRUE, na.rm = TRUE) && message_not_thrown_before("as.rsi", "msg3", ab)) {
warning_("in `as.rsi()`: interpretation of ", font_bold(ab_name(ab, tolower = TRUE)), " is only available for (uncomplicated) urinary tract infections (UTI) for some microorganisms. Use argument `uti` to set which isolates are from urine. See ?as.rsi.")
rise_warning <- TRUE
}
if (isTRUE(uti[i])) {
get_record <- get_record %pm>%
# be as specific as possible (i.e. prefer species over genus):
@ -850,18 +818,20 @@ exec_as.rsi <- function(method,
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") {
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",
new_rsi[i] <- quick_case_when(isTRUE(conserve_capped_values) & isTRUE(x[i] %like% "^<[0-9]") ~ "S",
isTRUE(conserve_capped_values) & isTRUE(x[i] %like% "^>[0-9]") ~ "R",
# these basically call `<=.mic()` and `>=.mic()`:
x[i] <= get_record$breakpoint_S ~ "S",
x[i] >= get_record$breakpoint_R ~ "R",
isTRUE(x[i] <= get_record$breakpoint_S) ~ "S",
guideline_coerced %like% "EUCAST" & isTRUE(x[i] > get_record$breakpoint_R) ~ "R",
guideline_coerced %like% "CLSI" & isTRUE(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
TRUE ~ NA_character_)
} else if (method == "disk") {
new_rsi[i] <- quick_case_when(isTRUE(as.double(x[i]) >= as.double(get_record$breakpoint_S)) ~ "S",
isTRUE(as.double(x[i]) <= as.double(get_record$breakpoint_R)) ~ "R",
guideline_coerced %like% "EUCAST" & isTRUE(as.double(x[i]) < as.double(get_record$breakpoint_R)) ~ "R",
guideline_coerced %like% "CLSI" & isTRUE(as.double(x[i]) <= as.double(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
@ -872,20 +842,21 @@ exec_as.rsi <- function(method,
if (any_is_intrinsic_resistant & guideline_coerced %like% "EUCAST" & !isTRUE(add_intrinsic_resistance)) {
# found some intrinsic resistance, but was not applied
message_("WARNING.", add_fn = list(font_yellow, font_bold), as_note = FALSE)
if (message_not_thrown_before("as.rsi", "msg3")) {
warning_("Found intrinsic resistance in some bug/drug combinations, although it was not applied.\nUse `as.rsi(..., add_intrinsic_resistance = TRUE)` to apply it.", call = FALSE)
if (message_not_thrown_before("as.rsi", "msg4")) {
warning_("in `as.rsi()`: found intrinsic resistance in some bug/drug combinations, although it was not applied.\nUse `as.rsi(..., add_intrinsic_resistance = TRUE)` to apply it.")
}
warned <- TRUE
rise_warning <- TRUE
}
new_rsi <- x_bak %pm>%
pm_left_join(data.frame(x_mo = paste0(df$x, df$mo), new_rsi,
pm_left_join(data.frame(x_mo = paste0(x, mo), new_rsi,
stringsAsFactors = FALSE),
by = "x_mo") %pm>%
pm_pull(new_rsi)
if (warned == FALSE) {
if (isTRUE(rise_warning)) {
message_("WARNING.", add_fn = list(font_yellow, font_bold), as_note = FALSE)
} else {
message_(" OK.", add_fn = list(font_green, font_bold), as_note = FALSE)
}
@ -937,13 +908,13 @@ freq.rsi <- function(x, ...) {
.add_header = list(
Drug = paste0(ab_name(ab, language = NULL), " (", ab, ", ", paste(ab_atc(ab), collapse = "/"), ")"),
`Drug group` = ab_group(ab, language = NULL),
`%SI` = percentage(susceptibility(x, minimum = 0, as_percent = FALSE),
digits = digits)))
`%SI` = trimws(percentage(susceptibility(x, minimum = 0, as_percent = FALSE),
digits = digits))))
} else {
cleaner::freq.default(x = x, ...,
.add_header = list(
`%SI` = percentage(susceptibility(x, minimum = 0, as_percent = FALSE),
digits = digits)))
`%SI` = trimws(percentage(susceptibility(x, minimum = 0, as_percent = FALSE),
digits = digits))))
}
}

View File

@ -95,7 +95,7 @@ rsi_calc <- function(...,
}
if (is.null(x)) {
warning_("argument is NULL (check if columns exist): returning NA", call = FALSE)
warning_("argument is NULL (check if columns exist): returning NA")
if (as_percent == TRUE) {
return(NA_character_)
} else {

Binary file not shown.

View File

@ -193,7 +193,7 @@ translate_AMR <- function(from,
any_form_in_patterns <- tryCatch(
any(from_unique %like% paste0("(", paste(gsub(" +\\(.*", "", df_trans$pattern), collapse = "|"), ")")),
error = function(e) {
warning_("Translation not possible. Please open an issue on GitHub (https://github.com/msberends/AMR/issues).", call = FALSE)
warning_("Translation not possible. Please open an issue on GitHub (https://github.com/msberends/AMR/issues).")
return(FALSE)
})

View File

@ -27,7 +27,7 @@
#'
#' All antimicrobial drugs and their official names, ATC codes, ATC groups and defined daily dose (DDD) are included in this package, using the WHO Collaborating Centre for Drug Statistics Methodology.
#' @section WHOCC:
#' \if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr}
#' \if{html}{\figure{logo_who.png}{options: height="60" style=margin-bottom:"5"} \cr}
#' This package contains **all ~550 antibiotic, antimycotic and antiviral drugs** and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, <https://www.whocc.no>) and the Pharmaceuticals Community Register of the European Commission (<https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>).
#'
#' These have become the gold standard for international drug utilisation monitoring and research.

33
R/zzz.R
View File

@ -26,6 +26,11 @@
# set up package environment, used by numerous AMR functions
pkg_env <- new.env(hash = FALSE)
pkg_env$mo_failed <- character(0)
pkg_env$mo_field_abbreviations <- c("AIEC", "ATEC", "BORSA", "CRSM", "DAEC", "EAEC",
"EHEC", "EIEC", "EPEC", "ETEC", "GISA", "MRPA",
"MRSA", "MRSE", "MSSA", "MSSE", "NMEC", "PISP",
"PRSP", "STEC", "UPEC", "VISA", "VISP", "VRE",
"VRSA", "VRSP")
# determine info icon for messages
utf8_supported <- isTRUE(base::l10n_info()$`UTF-8`)
@ -111,21 +116,7 @@ if (utf8_supported && !is_latex) {
# Helper functions --------------------------------------------------------
create_AB_lookup <- function() {
AB_lookup <- AMR::antibiotics
AB_lookup$generalised_name <- generalise_antibiotic_name(AB_lookup$name)
AB_lookup$generalised_synonyms <- lapply(AB_lookup$synonyms, generalise_antibiotic_name)
AB_lookup$generalised_abbreviations <- lapply(AB_lookup$abbreviations, generalise_antibiotic_name)
AB_lookup$generalised_loinc <- lapply(AB_lookup$loinc, generalise_antibiotic_name)
AB_lookup$generalised_all <- unname(lapply(as.list(as.data.frame(t(AB_lookup[,
c("ab", "atc", "cid", "name",
colnames(AB_lookup)[colnames(AB_lookup) %like% "generalised"]),
drop = FALSE]),
stringsAsFactors = FALSE)),
function(x) {
x <- generalise_antibiotic_name(unname(unlist(x)))
x[x != ""]
}))
AB_lookup
cbind(AMR::antibiotics, AB_LOOKUP)
}
create_MO_lookup <- function() {
@ -140,12 +131,12 @@ create_MO_lookup <- function() {
MO_lookup[which(is.na(MO_lookup$kingdom_index)), "kingdom_index"] <- 5
# use this paste instead of `fullname` to work with Viridans Group Streptococci, etc.
MO_lookup$fullname_lower <- tolower(trimws(paste(MO_lookup$genus,
MO_lookup$species,
MO_lookup$subspecies)))
ind <- MO_lookup$genus == "" | grepl("^[(]unknown ", MO_lookup$fullname, perl = TRUE)
MO_lookup[ind, "fullname_lower"] <- tolower(MO_lookup[ind, "fullname"])
MO_lookup$fullname_lower <- trimws(gsub("[^.a-z0-9/ \\-]+", "", MO_lookup$fullname_lower, perl = TRUE))
if (length(MO_FULLNAME_LOWER) == nrow(MO_lookup)) {
MO_lookup$fullname_lower <- MO_FULLNAME_LOWER
} else {
MO_lookup$fullname_lower <- ""
warning("MO table updated - Run: source(\"data-raw/_internals.R\")", call. = FALSE)
}
# add a column with only "e coli" like combinations
MO_lookup$g_species <- gsub("^([a-z])[a-z]+ ([a-z]+) ?.*", "\\1 \\2", MO_lookup$fullname_lower, perl = TRUE)

View File

@ -1 +1,2 @@
* This package has a data folder size of ~1.7 MB, which might return a NOTE on some R CMD CHECKs. This package size is needed to provide users reference data for the complete taxonomy of microorganisms - one of the most important features of this package, as it has been in the 16 previous releases of this package. All data sets were compressed using `compression = "xz"` to make them as small as possible.
Extra release for fixing image options, as requested by CRAN team on 17 February 2022 (Kurt Hornik).

Binary file not shown.

View File

@ -122,9 +122,44 @@ create_species_cons_cops <- function(type = c("CoNS", "CoPS")) {
"mo", drop = TRUE]
}
}
create_MO_fullname_lower <- function() {
MO_lookup <- AMR::microorganisms
# use this paste instead of `fullname` to work with Viridans Group Streptococci, etc.
MO_lookup$fullname_lower <- tolower(trimws(paste(MO_lookup$genus,
MO_lookup$species,
MO_lookup$subspecies)))
ind <- MO_lookup$genus == "" | grepl("^[(]unknown ", MO_lookup$fullname, perl = TRUE)
MO_lookup[ind, "fullname_lower"] <- tolower(MO_lookup[ind, "fullname"])
MO_lookup$fullname_lower <- trimws(gsub("[^.a-z0-9/ \\-]+", "", MO_lookup$fullname_lower, perl = TRUE))
MO_lookup$fullname_lower
}
MO_CONS <- create_species_cons_cops("CoNS")
MO_COPS <- create_species_cons_cops("CoPS")
MO_STREP_ABCG <- as.mo(MO_lookup[which(MO_lookup$genus == "Streptococcus"), "mo", drop = TRUE], Lancefield = TRUE) %in% c("B_STRPT_GRPA", "B_STRPT_GRPB", "B_STRPT_GRPC", "B_STRPT_GRPG")
MO_FULLNAME_LOWER <- create_MO_fullname_lower()
MO_PREVALENT_GENERA <- c("Absidia", "Acholeplasma", "Acremonium", "Actinotignum", "Aedes", "Alistipes", "Alloprevotella",
"Alternaria", "Anaerosalibacter", "Ancylostoma", "Angiostrongylus", "Anisakis", "Anopheles",
"Apophysomyces", "Arachnia", "Aspergillus", "Aureobasidium", "Bacteroides", "Basidiobolus",
"Beauveria", "Bergeyella", "Blastocystis", "Blastomyces", "Borrelia", "Brachyspira", "Branhamella",
"Butyricimonas", "Candida", "Capillaria", "Capnocytophaga", "Catabacter", "Cetobacterium", "Chaetomium",
"Chlamydia", "Chlamydophila", "Chryseobacterium", "Chrysonilia", "Cladophialophora", "Cladosporium",
"Conidiobolus", "Contracaecum", "Cordylobia", "Cryptococcus", "Curvularia", "Deinococcus", "Demodex",
"Dermatobia", "Diphyllobothrium", "Dirofilaria", "Dysgonomonas", "Echinostoma", "Elizabethkingia",
"Empedobacter", "Enterobius", "Exophiala", "Exserohilum", "Fasciola", "Flavobacterium", "Fonsecaea",
"Fusarium", "Fusobacterium", "Giardia", "Haloarcula", "Halobacterium", "Halococcus", "Hendersonula",
"Heterophyes", "Histoplasma", "Hymenolepis", "Hypomyces", "Hysterothylacium", "Lelliottia",
"Leptosphaeria", "Leptotrichia", "Lucilia", "Lumbricus", "Malassezia", "Malbranchea", "Metagonimus",
"Microsporum", "Mortierella", "Mucor", "Mycocentrospora", "Mycoplasma", "Myroides", "Necator",
"Nectria", "Ochroconis", "Odoribacter", "Oesophagostomum", "Oidiodendron", "Opisthorchis",
"Ornithobacterium", "Parabacteroides", "Pediculus", "Pedobacter", "Phlebotomus", "Phocaeicola",
"Phocanema", "Phoma", "Piedraia", "Pithomyces", "Pityrosporum", "Porphyromonas", "Prevotella",
"Pseudallescheria", "Pseudoterranova", "Pulex", "Rhizomucor", "Rhizopus", "Rhodotorula", "Riemerella",
"Saccharomyces", "Sarcoptes", "Scolecobasidium", "Scopulariopsis", "Scytalidium", "Sphingobacterium",
"Spirometra", "Spiroplasma", "Sporobolomyces", "Stachybotrys", "Streptobacillus", "Strongyloides",
"Syngamus", "Taenia", "Tannerella", "Tenacibaculum", "Terrimonas", "Toxocara", "Treponema", "Trichinella",
"Trichobilharzia", "Trichoderma", "Trichomonas", "Trichophyton", "Trichosporon", "Trichostrongylus",
"Trichuris", "Tritirachium", "Trombicula", "Tunga", "Ureaplasma", "Victivallis", "Wautersiella",
"Weeksella", "Wuchereria")
# antibiotic groups
# (these will also be used for eucast_rules() and understanding data-raw/eucast_rules.tsv)
@ -160,6 +195,24 @@ AB_BETALACTAMS <- c(AB_PENICILLINS, AB_CEPHALOSPORINS, AB_CARBAPENEMS)
# this will be used for documentation:
DEFINED_AB_GROUPS <- ls(envir = globalenv())
DEFINED_AB_GROUPS <- DEFINED_AB_GROUPS[!DEFINED_AB_GROUPS %in% globalenv_before_ab]
create_AB_lookup <- function() {
AB_lookup <- AMR::antibiotics
AB_lookup$generalised_name <- generalise_antibiotic_name(AB_lookup$name)
AB_lookup$generalised_synonyms <- lapply(AB_lookup$synonyms, generalise_antibiotic_name)
AB_lookup$generalised_abbreviations <- lapply(AB_lookup$abbreviations, generalise_antibiotic_name)
AB_lookup$generalised_loinc <- lapply(AB_lookup$loinc, generalise_antibiotic_name)
AB_lookup$generalised_all <- unname(lapply(as.list(as.data.frame(t(AB_lookup[,
c("ab", "atc", "cid", "name",
colnames(AB_lookup)[colnames(AB_lookup) %like% "generalised"]),
drop = FALSE]),
stringsAsFactors = FALSE)),
function(x) {
x <- generalise_antibiotic_name(unname(unlist(x)))
x[x != ""]
}))
AB_lookup[, colnames(AB_lookup)[colnames(AB_lookup) %like% "^generalised"]]
}
AB_LOOKUP <- create_AB_lookup()
# Export to package as internal data ----
usethis::use_data(EUCAST_RULES_DF,
@ -169,6 +222,9 @@ usethis::use_data(EUCAST_RULES_DF,
MO_CONS,
MO_COPS,
MO_STREP_ABCG,
MO_FULLNAME_LOWER,
MO_PREVALENT_GENERA,
AB_LOOKUP,
AB_AMINOGLYCOSIDES,
AB_AMINOPENICILLINS,
AB_ANTIFUNGALS,
@ -220,7 +276,9 @@ changed_md5 <- function(object) {
}
# give official names to ABs and MOs
rsi <- dplyr::mutate(rsi_translation, ab = ab_name(ab), mo = mo_name(mo))
rsi <- AMR::rsi_translation %>%
mutate(mo_name = mo_name(mo, language = NULL), .after = mo) %>%
mutate(ab_name = ab_name(ab, language = NULL), .after = ab)
if (changed_md5(rsi)) {
usethis::ui_info(paste0("Saving {usethis::ui_value('rsi_translation')} to {usethis::ui_value('/data-raw/')}"))
write_md5(rsi)
@ -241,7 +299,7 @@ if (changed_md5(mo)) {
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)
try(openxlsx::write.xlsx(dplyr::select(mo, -snomed), "data-raw/microorganisms.xlsx"), silent = TRUE)
}
if (changed_md5(microorganisms.old)) {
@ -280,8 +338,8 @@ if (changed_md5(av)) {
}
# give official names to ABs and MOs
intrinsicR <- data.frame(microorganism = mo_name(intrinsic_resistant$mo),
antibiotic = ab_name(intrinsic_resistant$ab),
intrinsicR <- data.frame(microorganism = mo_name(intrinsic_resistant$mo, language = NULL),
antibiotic = ab_name(intrinsic_resistant$ab, language = NULL),
stringsAsFactors = FALSE)
if (changed_md5(intrinsicR)) {
usethis::ui_info(paste0("Saving {usethis::ui_value('intrinsic_resistant')} to {usethis::ui_value('/data-raw/')}"))

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
ee4434541c7b6529b391d2684748e28b
19af89838b60bc8549d4474609629e8d

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -278,9 +278,9 @@
"Adelosina duthiersi" "Quinqueloculina duthiersi" "Schlumberger, 1886" 3
"Adelosina linneiana" "Pseudotriloculina linneiana" "DOrbigny, 1839" 3
"Aecidium ipomoeae-panduratae" "Albugo ipomoeae-panduratae" "Schwein, 1822" 3
"Aedimorphus alboannulatus" "Aedes alboannulatus" "Theobald, 1905" 3
"Aedimorphus albotaeniatus" "Aedes albotaeniatus" "Theobald, 1903" 3
"Aedimorphus australis" "Aedes australis" "Taylor, 1914" 3
"Aedimorphus alboannulatus" "Aedes alboannulatus" "Theobald, 1905" 2
"Aedimorphus albotaeniatus" "Aedes albotaeniatus" "Theobald, 1903" 2
"Aedimorphus australis" "Aedes australis" "Taylor, 1914" 2
"Aegyria angustata" "Dysteria angustata" "Claparede et al., 1859" 3
"Aegyria astyla" "Dysteria astyla" "Maskell, 1887" 3
"Aegyria distyla" "Dysteria distyla" "Maskell, 1887" 3
@ -880,7 +880,7 @@
"Astacolus subaculeata" "Vaginulinopsis subaculeata" "Cushman, 1923" 3
"Astacolus sublegumen" "Vaginulinopsis sublegumen" "Parr, 1950" 3
"Asterellina pulchella" "Eoeponidella pulchella" "Parker, 1952" 3
"Asterias ocellifera" "Nectria ocellifera" "Lamarck, 1816" 3
"Asterias ocellifera" "Nectria ocellifera" "Lamarck, 1816" 2
"Asterigerinata pulchella" "Eoeponidella pulchella" "Parker, 1952" 3
"Asteromella anthemidis" "Phoma anthemidis" "Ruppr, 1958" 2
"Asteromella longissima" "Phoma longissima" "Petr" 2
@ -1324,8 +1324,8 @@
"Bacteriovorax marinus" "Halobacteriovorax marinus" "Baer et al., 2004" 2
"Bacteriovorax starrii" "Peredibacter starrii" "Baer et al., 2000" 2
"Bacteroides amylophilus" "Ruminobacter amylophilus" "Hamlin et al., 1956" 1
"Bacteroides asaccharolyticus" "Porphyromonas asaccharolytica" "Finegold et al., 1977" 3
"Bacteroides barnesiae" "Phocaeicola barnesiae" "Lan et al., 2006" 3
"Bacteroides asaccharolyticus" "Porphyromonas asaccharolytica" "Finegold et al., 1977" 2
"Bacteroides barnesiae" "Phocaeicola barnesiae" "Lan et al., 2006" 2
"Bacteroides bivius" "Prevotella bivia" "Holdeman et al., 1977" 2
"Bacteroides buccae" "Prevotella buccae" "Holdeman et al., 1982" 2
"Bacteroides buccalis" "Prevotella buccalis" "Shah et al., 1982" 2
@ -1333,32 +1333,32 @@
"Bacteroides capillus" "Prevotella buccae" "Kornman et al., 1982" 2
"Bacteroides cellulosolvens" "Pseudobacteroides cellulosolvens" "Murray et al., 1984" 2
"Bacteroides chinchillae" "Bacteroides sartorii" "Kitahara et al., 2011"
"Bacteroides chinchillae" "Phocaeicola sartorii" "Kitahara et al., 2011" 3
"Bacteroides chinchillae" "Phocaeicola sartorii" "Kitahara et al., 2011" 2
"Bacteroides coagulans" "Ezakiella coagulans" "Eggerth et al., 1933" 2
"Bacteroides coprocola" "Phocaeicola coprocola" "Kitahara et al., 2005" 3
"Bacteroides coprophilus" "Phocaeicola coprophilus" "Hayashi et al., 2016" 3
"Bacteroides coprocola" "Phocaeicola coprocola" "Kitahara et al., 2005" 2
"Bacteroides coprophilus" "Phocaeicola coprophilus" "Hayashi et al., 2016" 2
"Bacteroides corporis" "Prevotella corporis" "Johnson et al., 1983" 2
"Bacteroides denticola" "Prevotella denticola" "Shah et al., 1982" 2
"Bacteroides disiens" "Prevotella disiens" "Holdeman et al., 1977" 2
"Bacteroides distasonis" "Parabacteroides distasonis" "Eggerth et al., 1933" 3
"Bacteroides dorei" "Phocaeicola dorei" "Bakir et al., 2016" 3
"Bacteroides endodontalis" "Porphyromonas endodontalis" "Van Steenbergen et al., 1984" 3
"Bacteroides distasonis" "Parabacteroides distasonis" "Eggerth et al., 1933" 2
"Bacteroides dorei" "Phocaeicola dorei" "Bakir et al., 2016" 2
"Bacteroides endodontalis" "Porphyromonas endodontalis" "Van Steenbergen et al., 1984" 2
"Bacteroides forsythus" "Tannerella forsythia" "Tanner et al., 1986" 3
"Bacteroides furcosus" "Anaerorhabdus furcosa" "Hauduroy et al., 1937" 2
"Bacteroides gingivalis" "Porphyromonas gingivalis" "Coykendall et al., 1980" 3
"Bacteroides goldsteinii" "Parabacteroides goldsteinii" "Song et al., 2006" 3
"Bacteroides gingivalis" "Porphyromonas gingivalis" "Coykendall et al., 1980" 2
"Bacteroides goldsteinii" "Parabacteroides goldsteinii" "Song et al., 2006" 2
"Bacteroides gracilis" "Campylobacter gracilis" "Tanner et al., 1981" 2
"Bacteroides heparinolyticus" "Prevotella heparinolytica" "Okuda et al., 1985" 2
"Bacteroides hypermegas" "Megamonas hypermegale" "Harrison et al., 1963" 2
"Bacteroides intermedius" "Prevotella intermedia" "Johnson et al., 1983" 2
"Bacteroides levii" "Porphyromonas levii" "Johnson et al., 1983" 3
"Bacteroides levii" "Porphyromonas levii" "Johnson et al., 1983" 2
"Bacteroides loescheii" "Prevotella loescheii" "Holdeman et al., 1982" 2
"Bacteroides macacae" "Porphyromonas macacae" "Coykendall et al., 1980" 3
"Bacteroides massiliensis" "Phocaeicola massiliensis" "Fenner et al., 2016" 3
"Bacteroides macacae" "Porphyromonas macacae" "Coykendall et al., 1980" 2
"Bacteroides massiliensis" "Phocaeicola massiliensis" "Fenner et al., 2016" 2
"Bacteroides melaninogenicus" "Prevotella melaninogenica" "Roy et al., 1982" 2
"Bacteroides melaninogenicus intermedius" "Prevotella intermedia" "Holdeman et al., 1970" 2
"Bacteroides melaninogenicus macacae" "Porphyromonas macacae" "Slots et al., 1980" 3
"Bacteroides merdae" "Parabacteroides merdae" "Johnson et al., 1986" 3
"Bacteroides melaninogenicus macacae" "Porphyromonas macacae" "Slots et al., 1980" 2
"Bacteroides merdae" "Parabacteroides merdae" "Johnson et al., 1986" 2
"Bacteroides microfusus" "Rikenella microfusus" "Kaneuchi et al., 1978" 3
"Bacteroides multiacidus" "Mitsuokella multacida" "Mitsuoka et al., 1974" 2
"Bacteroides nodosus" "Dichelobacter nodosus" "Mraz, 1963" 1
@ -1366,19 +1366,19 @@
"Bacteroides oralis" "Prevotella oralis" "Loesche et al., 1964" 2
"Bacteroides oris" "Prevotella oris" "Holdeman et al., 1982" 2
"Bacteroides oulorum" "Prevotella oulorum" "Shah et al., 1985" 2
"Bacteroides paurosaccharolyticus" "Phocaeicola paurosaccharolyticus" "Ueki et al., 2011" 3
"Bacteroides paurosaccharolyticus" "Phocaeicola paurosaccharolyticus" "Ueki et al., 2011" 2
"Bacteroides pentosaceus" "Prevotella buccae" "Shah et al., 1982" 2
"Bacteroides plebeius" "Phocaeicola plebeius" "Kitahara et al., 2005" 3
"Bacteroides plebeius" "Phocaeicola plebeius" "Kitahara et al., 2005" 2
"Bacteroides pneumosintes" "Dialister pneumosintes" "Holdeman et al., 1970" 2
"Bacteroides praeacutus" "Tissierella praeacuta" "Holdeman et al., 1970" 2
"Bacteroides putredinis" "Alistipes putredinis" "Kelly, 1957" 3
"Bacteroides putredinis" "Alistipes putredinis" "Kelly, 1957" 2
"Bacteroides ruminicola" "Prevotella ruminicola" "Bryant et al., 1958" 2
"Bacteroides ruminicola brevis" "Prevotella brevis" "Bryant et al., 1958" 2
"Bacteroides salanitronis" "Phocaeicola salanitronis" "Lan et al., 2006" 3
"Bacteroides salivosus" "Porphyromonas macacae" "Love et al., 1987" 3
"Bacteroides salanitronis" "Phocaeicola salanitronis" "Lan et al., 2006" 2
"Bacteroides salivosus" "Porphyromonas macacae" "Love et al., 1987" 2
"Bacteroides salyersae" "Bacteroides salyersiae" "Song et al., 2005" 2
"Bacteroides sartorii" "Phocaeicola sartorii" "Clavel et al., 2012" 3
"Bacteroides splanchnicus" "Odoribacter splanchnicus" "Werner et al., 1975" 3
"Bacteroides sartorii" "Phocaeicola sartorii" "Clavel et al., 2012" 2
"Bacteroides splanchnicus" "Odoribacter splanchnicus" "Werner et al., 1975" 2
"Bacteroides succinogenes" "Fibrobacter succinogenes" "Hungate, 1950" 3
"Bacteroides suis" "Bacteroides pyogenes" "Benno et al., 1983" 2
"Bacteroides tectum" "Bacteroides pyogenes" "Love et al., 2019" 2
@ -1386,7 +1386,7 @@
"Bacteroides termitidis" "Sebaldella termitidis" "Holdeman et al., 1970" 3
"Bacteroides ureolyticus" "Campylobacter ureolyticus" "Jackson et al., 1978" 2
"Bacteroides veroralis" "Prevotella veroralis" "Watabe et al., 1983" 2
"Bacteroides vulgatus" "Phocaeicola vulgatus" "Hahnke et al., 2016" 3
"Bacteroides vulgatus" "Phocaeicola vulgatus" "Hahnke et al., 2016" 2
"Bacteroides xylanolyticus" "Hungatella xylanolytica" "Scholten-Koerselman et al., 1988" 2
"Bacteroides zoogleoformans" "Prevotella zoogleoformans" "Cato et al., 1982"
"Bacteroides zoogleoformans" "Capsularis zoogleoformans" "Cato et al., 1982" 3
@ -1650,27 +1650,27 @@
"Bolivinita subangularis" "Saidovina subangularis" "Brady, 1881" 3
"Bolivinita subangularis lineata" "Saidovina subangularis lineata" "Cushman, 1933" 3
"Borelis (Fasciolites) pygmaea" "Neoalveolina pygmaea" "Hanzawa, 1930" 3
"Borrelia baltazardi" "Borrelia baltazardii" "Karimi et al., 1983" 3
"Borrelia bavariensis" "Borrelia garinii bavariensis" "Margos et al., 2020" 3
"Borrelia turdae" "Borrelia turdi" "Fukunaga et al., 1997" 3
"Borreliella" "Borrelia" "Adeolu et al., 2015" 3
"Borreliella afzelii" "Borrelia afzelii" "Adeolu et al., 2018" 3
"Borreliella americana" "Borrelia americana" "Adeolu et al., 2018" 3
"Borrelia baltazardi" "Borrelia baltazardii" "Karimi et al., 1983" 2
"Borrelia bavariensis" "Borrelia garinii bavariensis" "Margos et al., 2020" 2
"Borrelia turdae" "Borrelia turdi" "Fukunaga et al., 1997" 2
"Borreliella" "Borrelia" "Adeolu et al., 2015" 2
"Borreliella afzelii" "Borrelia afzelii" "Adeolu et al., 2018" 2
"Borreliella americana" "Borrelia americana" "Adeolu et al., 2018" 2
"Borreliella bavariensis" "Borrelia bavariensis" "Adeolu et al., 2015"
"Borreliella bavariensis" "Borrelia garinii bavariensis" "Adeolu et al., 2015" 3
"Borreliella bissettiae" "Borrelia bissettiae" "Gupta, 2020" 3
"Borreliella burgdorferi" "Borrelia burgdorferi" "Adeolu et al., 2015" 3
"Borreliella californiensis" "Borrelia californiensis" "Gupta, 2020" 3
"Borreliella carolinensis" "Borrelia carolinensis" "Adeolu et al., 2015" 3
"Borreliella garinii" "Borrelia garinii" "Adeolu et al., 2015" 3
"Borreliella japonica" "Borrelia japonica" "Adeolu et al., 2015" 3
"Borreliella kurtenbachii" "Borrelia kurtenbachii" "Adeolu et al., 2015" 3
"Borreliella lanei" "Borrelia lanei" "Gupta, 2020" 3
"Borreliella mayonii" "Borrelia mayonii" "Gupta, 2020" 3
"Borreliella sinica" "Borrelia sinica" "Adeolu et al., 2015" 3
"Borreliella spielmanii" "Borrelia spielmanii" "Adeolu et al., 2015" 3
"Borreliella valaisiana" "Borrelia valaisiana" "Adeolu et al., 2018" 3
"Borreliella yangtzensis" "Borrelia yangtzensis" "Gupta, 2020" 3
"Borreliella bavariensis" "Borrelia garinii bavariensis" "Adeolu et al., 2015" 2
"Borreliella bissettiae" "Borrelia bissettiae" "Gupta, 2020" 2
"Borreliella burgdorferi" "Borrelia burgdorferi" "Adeolu et al., 2015" 2
"Borreliella californiensis" "Borrelia californiensis" "Gupta, 2020" 2
"Borreliella carolinensis" "Borrelia carolinensis" "Adeolu et al., 2015" 2
"Borreliella garinii" "Borrelia garinii" "Adeolu et al., 2015" 2
"Borreliella japonica" "Borrelia japonica" "Adeolu et al., 2015" 2
"Borreliella kurtenbachii" "Borrelia kurtenbachii" "Adeolu et al., 2015" 2
"Borreliella lanei" "Borrelia lanei" "Gupta, 2020" 2
"Borreliella mayonii" "Borrelia mayonii" "Gupta, 2020" 2
"Borreliella sinica" "Borrelia sinica" "Adeolu et al., 2015" 2
"Borreliella spielmanii" "Borrelia spielmanii" "Adeolu et al., 2015" 2
"Borreliella valaisiana" "Borrelia valaisiana" "Adeolu et al., 2018" 2
"Borreliella yangtzensis" "Borrelia yangtzensis" "Gupta, 2020" 2
"Botryonipha aurantiaca" "Nectria aurantiaca" "Kuntze, 1891" 2
"Botryonipha flavipes" "Trichoderma flavipes" "Kuntze, 1891" 2
"Botryopyle setosa" "Amphimelissa setosa" "Cleve, 1899" 3
@ -1857,9 +1857,9 @@
"Buliminoides curta" "Seiglieina curta" "Seiglie, 1965" 3
"Buliminoides laevigata" "Fredsmithia laevigata" "Seiglie, 1964" 3
"Buliminoides milletti" "Floresina milletti" "Cushman, 1933" 3
"Buliminus mantongensis" "Giardia mantongensis" "Kobelt, 1899" 3
"Buliminus pharangensis" "Giardia pharangensis" "Dautzenberg et al., 1905" 3
"Bulimus siamensis" "Giardia siamensis" "Redfield, 1853" 3
"Buliminus mantongensis" "Giardia mantongensis" "Kobelt, 1899" 2
"Buliminus pharangensis" "Giardia pharangensis" "Dautzenberg et al., 1905" 2
"Bulimus siamensis" "Giardia siamensis" "Redfield, 1853" 2
"Bulla ovum" "Ovum ovum" "Linnaeus, 1758" 3
"Bullera aurantiaca" "Dioszegia aurantiaca" "Johri et al., 1984" 3
"Bullera begoniae" "Bulleribasidium begoniae" "Nakase et al., 2004" 3
@ -2009,7 +2009,7 @@
"Caliciopsis calicioides" "Exophiala calicioides" "Fitzp, 1920" 2
"Calidifontibacillus azotoformans" "Schinkia azotoformans" "Adiguzel et al., 2020" 2
"Calidifontibacillus oryziterrae" "Schinkia oryziterrae" "Adiguzel et al., 2020" 2
"Calliphora bicolor" "Lucilia bicolor" "Macquart, 1843" 3
"Calliphora bicolor" "Lucilia bicolor" "Macquart, 1843" 2
"Calomyxa longifila" "Minakatella longifila" "LGKrieglst, 1990" 3
"Calonectria calami" "Nectria calami" "Henn et al., 1900" 2
"Calonectria citrinoaurantia" "Nectria citrinoaurantia" "Sacc, 1883" 2
@ -2302,7 +2302,7 @@
"Cavostelium bisporum" "Echinostelium bisporum" "LSOlive et al., 1966" 3
"Celeribacter manganoxidans" "Pacificitalea manganoxidans" "Wang et al., 2015" 2
"Cellanthus biperforatus" "Elphidium biperforatus" "Whittaker et al., 1979" 3
"Cellia pretoriensis" "Anopheles pretoriensis" "Gough, 1910" 3
"Cellia pretoriensis" "Anopheles pretoriensis" "Gough, 1910" 2
"Cellulomonas cartae" "Cellulosimicrobium cellulans" "Stackebrandt et al., 1980" 2
"Cellulomonas cellulans" "Cellulosimicrobium cellulans" "Stackebrandt et al., 1988" 2
"Cellulomonas fermentans" "Actinotalea fermentans" "Bagnara et al., 1985" 2
@ -2522,11 +2522,11 @@
"Chlamydonella distyla" "Wilbertella distyla" "Jankowski, 2007" 3
"Chlamydonella polonica" "Chlamydonellopsis polonica" "Foissner et al., 1981" 3
"Chlamydonella stricta" "Wilbertiella stricta" "Deroux, 1976" 3
"Chlamydophila abortus" "Chlamydia abortus" "Everett et al., 1999" 3
"Chlamydophila felis" "Chlamydia felis" "Everett et al., 1999" 3
"Chlamydophila pecorum" "Chlamydia pecorum" "Everett et al., 1999" 3
"Chlamydophila pneumoniae" "Chlamydia pneumoniae" "Everett et al., 1999" 3
"Chlamydophila psittaci" "Chlamydia psittaci" "Everett et al., 1999" 3
"Chlamydophila abortus" "Chlamydia abortus" "Everett et al., 1999" 2
"Chlamydophila felis" "Chlamydia felis" "Everett et al., 1999" 2
"Chlamydophila pecorum" "Chlamydia pecorum" "Everett et al., 1999" 2
"Chlamydophila pneumoniae" "Chlamydia pneumoniae" "Everett et al., 1999" 2
"Chlamydophila psittaci" "Chlamydia psittaci" "Everett et al., 1999" 2
"Chlamydotomus beigelii" "Geotrichum beigelii" "Trevis, 1879" 3
"Chlamydozyma pulcherrima" "Metschnikowia pulcherrima" "Wick, 1964" 3
"Chlamydozyma reukaufii" "Metschnikowia reukaufii" "Wick, 1964" 3
@ -2599,8 +2599,8 @@
"Chrysalogonium piramidale" "Acostina piramidale" "Acosta, 1940" 3
"Chryseobacterium arothri" "Chryseobacterium hominis" "Campbell et al., 2008" 2
"Chryseobacterium greenlandense" "Chryseobacterium aquaticum greenlandense" "Loveland-Curtze et al., 2016" 2
"Chryseobacterium meningosepticum" "Elizabethkingia meningoseptica" "Vandamme et al., 1994" 3
"Chryseobacterium miricola" "Elizabethkingia miricola" "Li et al., 2004" 3
"Chryseobacterium meningosepticum" "Elizabethkingia meningoseptica" "Vandamme et al., 1994" 2
"Chryseobacterium miricola" "Elizabethkingia miricola" "Li et al., 2004" 2
"Chryseomonas" "Pseudomonas" "Holmes et al., 1987" 1
"Chryseomonas luteola" "Pseudomonas luteola" "Holmes et al., 1987" 1
"Chryseomonas polytricha" "Pseudomonas luteola" "Holmes et al., 1986" 1
@ -3331,11 +3331,11 @@
"Cucurbitaria urceolus" "Nectria urceolus" "Kuntze, 1898" 2
"Cucurbitaria uredinicola" "Nectria uredinicola" "Kuntze, 1898" 2
"Cucurbitaria verrucosa" "Nectria verrucosa" "Kuntze, 1898" 2
"Culex auratus" "Aedes auratus" "Leicester, 1908" 3
"Culex sticticus" "Aedes sticticus" "Meigen, 1838" 3
"Culex sudanensis" "Aedes sudanensis" "Theobald, 1911" 3
"Culex sylvaticus" "Aedes sylvaticus" "Meigen, 1818" 3
"Culicada annulipes" "Aedes annulipes" "Taylor, 1914" 3
"Culex auratus" "Aedes auratus" "Leicester, 1908" 2
"Culex sticticus" "Aedes sticticus" "Meigen, 1838" 2
"Culex sudanensis" "Aedes sudanensis" "Theobald, 1911" 2
"Culex sylvaticus" "Aedes sylvaticus" "Meigen, 1818" 2
"Culicada annulipes" "Aedes annulipes" "Taylor, 1914" 2
"Cuneolina angusta" "Textulariella angusta" "Cushman, 1919" 3
"Cunninghamia infundibulifera" "Choanephora infundibulifera" "Curr, 1873" 3
"Cupravidus yeoncheonense" "Cupriavidus yeoncheonensis" "Singh et al., 2015" 2
@ -3456,11 +3456,11 @@
"Cytophaga diffluens" "Persicobacter diffluens" "Reichenbach, 1989" 3
"Cytophaga fermentans" "Saccharicrinis fermentans" "Bachmann, 1955" 3
"Cytophaga flevensis" "Flavobacterium flevense" "Van der Meulen et al., 1974" 2
"Cytophaga heparina" "Pedobacter heparinus" "Christensen, 1980" 3
"Cytophaga heparina" "Pedobacter heparinus" "Christensen, 1980" 2
"Cytophaga johnsonae" "Flavobacterium johnsoniae" "Stanier, 1947" 2
"Cytophaga latercula" "Aquimarina latercula" "Lewin, 1969" 3
"Cytophaga lytica" "Cellulophaga lytica" "Lewin, 1969" 3
"Cytophaga marina" "Tenacibaculum maritimum" "Reichenbach, 1989" 3
"Cytophaga marina" "Tenacibaculum maritimum" "Reichenbach, 1989" 2
"Cytophaga marinoflava" "Leeuwenhoekiella marinoflava" "Reichenbach, 1989" 3
"Cytophaga pectinovora" "Flavobacterium pectinovorum" "Reichenbach, 1989" 2
"Cytophaga psychrophila" "Flavobacterium psychrophilum" "Reichenbach, 1989" 2
@ -3514,11 +3514,11 @@
"Defluviimonas pyrenivorans" "Acidimangrovimonas pyrenivorans" "Zhang et al., 2018" 2
"Dehalospirillum" "Sulfurospirillum" "Scholz-Muramatsu et al., 2002" 2
"Dehalospirillum multivorans" "Sulfurospirillum multivorans" "Scholz-Muramatsu et al., 2002" 2
"Deinobacter" "Deinococcus" "Oyaizu et al., 1987" 3
"Deinobacter grandis" "Deinococcus grandis" "Oyaizu et al., 1987" 3
"Deinobacter" "Deinococcus" "Oyaizu et al., 1987" 2
"Deinobacter grandis" "Deinococcus grandis" "Oyaizu et al., 1987" 2
"Deinococcus erythromyxa" "Kocuria rosea" "Brooks et al., 1981" 2
"Deinococcus mumbaiensis" "Deinococcus ficus" "Shashidhar et al., 2006" 3
"Deinococcus xibeiensis" "Deinococcus wulumuqiensis" "Wang et al., 2010" 3
"Deinococcus mumbaiensis" "Deinococcus ficus" "Shashidhar et al., 2006" 2
"Deinococcus xibeiensis" "Deinococcus wulumuqiensis" "Wang et al., 2010" 2
"Dekkeromyces aestuarii" "Kluyveromyces aestuarii" "Kock-Krat, 1982" 3
"Dekkeromyces delphensis" "Nakaseomyces delphensis" "Novak et al., 1961" 3
"Dekkeromyces dobzhanskii" "Kluyveromyces dobzhanskii" "Santa Maria et al., 1970" 3
@ -3745,7 +3745,7 @@
"Deuterammina williamsoni" "Lepidodeuterammina williamsoni" "Bronnimann et al., 1988" 3
"Devosia nitraria" "Devosia nitrariae" "Xu et al., 2018" 2
"Devosia subaequoris" "Devosia soli" "Lee, 2007" 2
"Dexiogonimus ciureanus" "Metagonimus ciureanus" "Witenberg, 1929" 3
"Dexiogonimus ciureanus" "Metagonimus ciureanus" "Witenberg, 1929" 2
"Dexiotricha centralis" "Dexiotrichides centralis" "Stokes, 1885" 3
"Diacanthocapsa brevithorax" "Theocapsomma brevithorax" "Dumitrica, 1970" 3
"Diachaeella bulbillosa" "Diachea bulbillosa" "Hohn, 1909" 3
@ -3772,11 +3772,11 @@
"Diaphorobacter polyhydroxybutyrativorans" "Diaphorobacter nitroreducens" "Qiu et al., 2015" 2
"Diatoma anceps" "Meridion anceps" "Kirchn" 3
"Diatoma hyalina" "Fragilaria hyalina" "Kutzing" 3
"Dibothriocephalus archeri" "Diphyllobothrium archeri" "Leiper et al., 1914" 3
"Dibothriocephalus hians" "Diphyllobothrium hians" "Luhe, 1899" 3
"Dibothriocephalus lashleyi" "Diphyllobothrium lashleyi" "Leiper et al., 1914" 3
"Dibothriocephalus pygoscelis" "Diphyllobothrium pygoscelis" "Rennie et al., 1912" 3
"Dibothriocephalus schistochilus" "Diphyllobothrium schistochilus" "Germanos, 1895" 3
"Dibothriocephalus archeri" "Diphyllobothrium archeri" "Leiper et al., 1914" 2
"Dibothriocephalus hians" "Diphyllobothrium hians" "Luhe, 1899" 2
"Dibothriocephalus lashleyi" "Diphyllobothrium lashleyi" "Leiper et al., 1914" 2
"Dibothriocephalus pygoscelis" "Diphyllobothrium pygoscelis" "Rennie et al., 1912" 2
"Dibothriocephalus schistochilus" "Diphyllobothrium schistochilus" "Germanos, 1895" 2
"Dicaeoma brassicae" "Alternaria brassicae" "Kuntze, 1898" 2
"Dichotomomyces cejpii" "Aspergillus cejpii" "Scott, 1970" 2
"Dickeya dieffenbachiae" "Dickeya dadantii dieffenbachiae" "Samson et al., 2005" 1
@ -3938,7 +3938,7 @@
"Diplodina pedicularis" "Leptosphaeria pedicularis" "Lind, 1924" 2
"Diplodinium lunula" "Gymnodinium lunula" "Klebs, 1912" 3
"Diplodinium uncinata" "Blepharocorys uncinata" "Fiorentini, 1890" 3
"Diplogonoporus balaenopterae" "Diphyllobothrium balaenopterae" "Lonnberg, 1892" 3
"Diplogonoporus balaenopterae" "Diphyllobothrium balaenopterae" "Lonnberg, 1892" 2
"Diplophrys stercorea" "Sorodiplophrys stercorea" "Cienk, 1876" 3
"Diplophysa saprolegniae" "Olpidiopsis saprolegniae" "Schrot, 1886" 3
"Diploplenodomus piskorzii" "Phoma piskorzii" "Petr, 1923" 2
@ -4105,7 +4105,7 @@
"Drechslera spicifera" "Curvularia spicifera" "Arx, 1975" 2
"Drechslera subpapendorfii" "Curvularia subpapendorfii" "Mouch, 1975" 2
"Drechslera tripogonis" "Curvularia tripogonis" "Patil et al., 1972" 2
"Drepanidotaenia dusmeti" "Hymenolepis dusmeti" "Lopez-Neyra, 1942" 3
"Drepanidotaenia dusmeti" "Hymenolepis dusmeti" "Lopez-Neyra, 1942" 2
"Drepanomonas simulans" "Microthorax simulans" "Kahl, 1926" 3
"Drulanta edenshawi" "Parahsuum edenshawi" "Carter, 1988" 3
"Drulanta mostleri" "Parahsuum mostleri" "Yeh, 1987" 3
@ -4174,8 +4174,8 @@
"Eidamia viridescens" "Trichoderma viridescens" "Horne et al., 1923" 2
"Eilohedra weddellensis" "Alabaminella weddellensis" "Earland, 1936" 3
"Electothigma acuminatus" "Metopus acuminatus" "Jankowski, 1967" 3
"Elizabethkingia anophelis endophytica" "Elizabethkingia anophelis" "Garcia-Lopez et al., 2020" 3
"Elizabethkingia endophytica" "Elizabethkingia anophelis" "Kampfer et al., 2015" 3
"Elizabethkingia anophelis endophytica" "Elizabethkingia anophelis" "Garcia-Lopez et al., 2020" 2
"Elizabethkingia endophytica" "Elizabethkingia anophelis" "Kampfer et al., 2015" 2
"Elkelangia" "Novosphingopyxis" "Hordt et al., 2020" 2
"Elkelangia baekryungensis" "Novosphingopyxis baekryungensis" "Hordt et al., 2020" 2
"Ellipsolagena bidens" "Parafissurina bidens" "Cushman, 1930" 3
@ -4255,7 +4255,7 @@
"Emericella spectabilis" "Aspergillus spectabilis" "Chr, 1978" 2
"Emericella unguis" "Aspergillus unguis" "Malloch et al., 1972" 2
"Emmonsia crescens" "Ajellomyces crescens" "Emmons et al., 1960" 3
"Empedobacter falsenii" "Wautersiella falsenii" "Zhang et al., 2014" 3
"Empedobacter falsenii" "Wautersiella falsenii" "Zhang et al., 2014" 2
"Enantiocristellaria navicula" "Saracenaria navicula" "DOrbigny, 1840" 3
"Encephalitozoon cuniculi" "Nosema cuniculi" "Levaditi et al., 1923" 3
"Encephalitozoon ixodis" "Unikaryon ixodis" "Weiser et al., 1975" 3
@ -4341,7 +4341,7 @@
"Enteridium splendens" "Reticularia splendens" "TMacbr, 1899" 3
"Enterobacter aerogenes" "Klebsiella aerogenes" "Hormaeche et al., 1960" 1
"Enterobacter agglomerans" "Pantoea agglomerans" "Ewing et al., 1972" 1
"Enterobacter amnigenus" "Lelliottia amnigena" "Izard et al., 1981" 1
"Enterobacter amnigenus" "Lelliottia amnigena" "Izard et al., 1981" 2
"Enterobacter arachidis" "Kosakonia arachidis" "Madhaiyan et al., 2010" 1
"Enterobacter cowanii" "Kosakonia cowanii" "Inoue et al., 2001" 1
"Enterobacter dissolvens" "Enterobacter cloacae dissolvens" "Brenner et al., 1988" 1
@ -4352,7 +4352,7 @@
"Enterobacter massiliensis" "Metakosakonia massiliensis" "Lagier et al., 2014"
"Enterobacter massiliensis" "Phytobacter massiliensis" "Lagier et al., 2014" 1
"Enterobacter muelleri" "Enterobacter asburiae" "Kampfer et al., 2015" 1
"Enterobacter nimipressuralis" "Lelliottia nimipressuralis" "Brenner et al., 1988" 1
"Enterobacter nimipressuralis" "Lelliottia nimipressuralis" "Brenner et al., 1988" 2
"Enterobacter oligotrophica" "Enterobacter oligotrophicus" "Akita et al., 2020" 1
"Enterobacter oryzae" "Kosakonia oryzae" "Peng et al., 2009" 1
"Enterobacter oryzendophyticus" "Kosakonia oryzendophytica" "Hardoim et al., 2015" 1
@ -4527,7 +4527,7 @@
"Erwinia herbicola" "Pantoea agglomerans" "Dye, 1964" 1
"Erwinia milletiae" "Pantoea agglomerans" "Magrou, 1937" 1
"Erwinia nigrifluens" "Brenneria nigrifluens" "Wilson et al., 1957" 1
"Erwinia nimipressuralis" "Lelliottia nimipressuralis" "Dye, 1969" 1
"Erwinia nimipressuralis" "Lelliottia nimipressuralis" "Dye, 1969" 2
"Erwinia paradisiaca" "Dickeya paradisiaca" "Fernandez-Borrero et al., 1970" 1
"Erwinia persicinus" "Erwinia persicina" "Hao et al., 1990" 1
"Erwinia quercina" "Lonsdalea quercina" "Hildebrand et al., 1967" 1
@ -4844,33 +4844,33 @@
"Flaviramulus ichthyoenteri" "Wocania ichthyoenteri" "Zhang et al., 2013" 3
"Flavirhabdus" "Lacinutrix" "Shakeela et al., 2015" 3
"Flavirhabdus iliipiscaria" "Lacinutrix iliipiscaria" "Shakeela et al., 2015" 3
"Flavobacterium anatoliense" "Myroides anatoliensis" "Kacagan et al., 2013" 3
"Flavobacterium anatoliense" "Myroides anatoliensis" "Kacagan et al., 2013" 2
"Flavobacterium balustinum" "Chryseobacterium balustinum" "Harrison, 1929" 2
"Flavobacterium bomensis" "Flavobacterium bomense" "Liu et al., 2019" 2
"Flavobacterium branchiophila" "Flavobacterium branchiophilum" "Wakabayashi et al., 1989" 2
"Flavobacterium breve" "Empedobacter brevis" "Holmes et al., 1982" 3
"Flavobacterium breve" "Empedobacter brevis" "Holmes et al., 1982" 2
"Flavobacterium capsulatum" "Novosphingobium capsulatum" "Leifson, 1962" 2
"Flavobacterium ceti" "Myroides ceti" "Vela et al., 2013" 3
"Flavobacterium cloacae" "Myroides cloacae" "Liu et al., 2017" 3
"Flavobacterium ceti" "Myroides ceti" "Vela et al., 2013" 2
"Flavobacterium cloacae" "Myroides cloacae" "Liu et al., 2017" 2
"Flavobacterium daemonensis" "Flavobacterium daemonense" "Ngo et al., 2015" 2
"Flavobacterium esteraromaticum" "Microbacterium esteraromaticum" "Bergey et al., 1930" 2
"Flavobacterium ferrugineum" "Terrimonas ferruginea" "Sickles et al., 1934" 3
"Flavobacterium ferrugineum" "Terrimonas ferruginea" "Sickles et al., 1934" 2
"Flavobacterium gleum" "Chryseobacterium gleum" "Holmes et al., 1984" 2
"Flavobacterium gondwanense" "Psychroflexus gondwanensis" "Dobson et al., 1993" 3
"Flavobacterium halmephilium" "Halomonas halmophila" "Elazari-Volcani, 1940" 1
"Flavobacterium halmophilum" "Halomonas halmophila" "Corrig Elazari-Volcani, 1940" 1
"Flavobacterium heparinum" "Pedobacter heparinus" "Payza et al., 1956" 3
"Flavobacterium heparinum" "Pedobacter heparinus" "Payza et al., 1956" 2
"Flavobacterium indologenes" "Chryseobacterium indologenes" "Yabuuchi et al., 1983" 2
"Flavobacterium indoltheticum" "Chryseobacterium indoltheticum" "Campbell et al., 1951" 2
"Flavobacterium jejuensis" "Flavobacterium jejuense" "Park et al., 2016" 2
"Flavobacterium johnsonae" "Flavobacterium johnsoniae" "Bernardet et al., 1996" 2
"Flavobacterium kyungheensis" "Flavobacterium kyungheense" "Son et al., 2014" 2
"Flavobacterium marinotypicum" "Microbacterium maritypicum" "ZoBell et al., 1944" 2
"Flavobacterium marinum" "Myroides aquimaris" "Song et al., 2013" 3
"Flavobacterium meningosepticum" "Elizabethkingia meningoseptica" "King, 1959" 3
"Flavobacterium mizutaii" "Sphingobacterium mizutaii" "Holmes et al., 1988" 3
"Flavobacterium multivorum" "Sphingobacterium multivorum" "Holmes et al., 1981" 3
"Flavobacterium odoratum" "Myroides odoratus" "Stutzer, 1929" 3
"Flavobacterium marinum" "Myroides aquimaris" "Song et al., 2013" 2
"Flavobacterium meningosepticum" "Elizabethkingia meningoseptica" "King, 1959" 2
"Flavobacterium mizutaii" "Sphingobacterium mizutaii" "Holmes et al., 1988" 2
"Flavobacterium multivorum" "Sphingobacterium multivorum" "Holmes et al., 1981" 2
"Flavobacterium odoratum" "Myroides odoratus" "Stutzer, 1929" 2
"Flavobacterium okeanokoites" "Planomicrobium okeanokoites" "ZoBell et al., 1944"
"Flavobacterium okeanokoites" "Planococcus okeanokoites" "ZoBell et al., 1944" 2
"Flavobacterium qiangtangensis" "Flavobacterium qiangtangense" "Huang et al., 2015" 2
@ -4878,12 +4878,12 @@
"Flavobacterium salegens" "Salegentibacter salegens" "Dobson et al., 1993" 3
"Flavobacterium scophthalmum" "Chryseobacterium scophthalmum" "Mudarris et al., 1994" 2
"Flavobacterium spartansii" "Flavobacterium tructae" "Loch et al., 2019" 2
"Flavobacterium spiritivorum" "Sphingobacterium spiritivorum" "Holmes et al., 1982" 3
"Flavobacterium spiritivorum" "Sphingobacterium spiritivorum" "Holmes et al., 1982" 2
"Flavobacterium tangerina" "Flavobacterium tangerinum" "Li et al., 2020" 2
"Flavobacterium thalpophilum" "Sphingobacterium thalpophilum" "Holmes et al., 1983" 3
"Flavobacterium thalpophilum" "Sphingobacterium thalpophilum" "Holmes et al., 1983" 2
"Flavobacterium uliginosum" "Zobellia uliginosa" "ZoBell et al., 1944" 3
"Flavobacterium viscosus" "Flavobacterium viscosum" "Li et al., 2020" 2
"Flavobacterium yabuuchiae" "Sphingobacterium spiritivorum" "Holmes et al., 1988" 3
"Flavobacterium yabuuchiae" "Sphingobacterium spiritivorum" "Holmes et al., 1988" 2
"Flavobacterium zhairuonensis" "Flavobacterium zhairuonense" "Debnath et al., 2020" 2
"Flectobacillus glomeratus" "Polaribacter glomeratus" "McGuire et al., 1988" 3
"Flectobacillus marinus" "Cyclobacterium marinum" "Borrall et al., 1978" 3
@ -4895,8 +4895,8 @@
"Flexibacter filiformis" "Chitinophaga filiformis" "Reichenbach, 1989" 3
"Flexibacter japonensis" "Chitinophaga japonensis" "Fujita et al., 1997" 3
"Flexibacter litoralis" "Bernardetia litoralis" "Lewin, 1969" 3
"Flexibacter maritimus" "Tenacibaculum maritimum" "Wakabayashi et al., 1989" 3
"Flexibacter ovolyticus" "Tenacibaculum ovolyticum" "Hansen et al., 1992" 3
"Flexibacter maritimus" "Tenacibaculum maritimum" "Wakabayashi et al., 1989" 2
"Flexibacter ovolyticus" "Tenacibaculum ovolyticum" "Hansen et al., 1992" 2
"Flexibacter polymorphus" "Garritya polymorpha" "Lewin, 1974" 3
"Flexibacter psychrophilus" "Flavobacterium psychrophilum" "Bernardet et al., 1989" 2
"Flexibacter roseolus" "Hugenholtzia roseola" "Lewin et al., 2016" 3
@ -5338,7 +5338,7 @@
"Gordonia rubropertinctus" "Gordonia rubripertincta" "Stackebrandt et al., 1989" 2
"Gordonibacter faecihominis" "Gordonibacter urolithinfaciens" "Jin et al., 2015" 2
"Gottfriedia acidiceler" "Gottfriedia acidiceleris" "Gupta et al., 2020" 2
"Grabhamia australis" "Aedes australis" "Strickland, 1911" 3
"Grabhamia australis" "Aedes australis" "Strickland, 1911" 2
"Grahamella" "Bartonella" "Ristic et al., 1984" 2
"Grahamella peromysci" "Bartonella peromysci" "Ristic et al., 1984" 2
"Grahamella talpae" "Bartonella talpae" "Ristic et al., 1984" 2
@ -5486,20 +5486,20 @@
"Haloarcobacter ebronensis" "Halarcobacter ebronensis" "Perez-Cataluna et al., 2019"
"Haloarcobacter ebronensis" "Arcobacter ebronensis" "Perez-Cataluna et al., 2019" 2
"Haloarcula mukohataei" "Halomicrobium mukohataei" "Ihara et al., 1997" 3
"Halobacterium cutirubrum" "Halobacterium salinarum" "Elazari-Volcani, 1957" 3
"Halobacterium cutirubrum" "Halobacterium salinarum" "Elazari-Volcani, 1957" 2
"Halobacterium denitrificans" "Haloferax denitrificans" "Tomlinson et al., 1986" 3
"Halobacterium distributum" "Halorubrum distributum" "Zvyagintseva et al., 1989" 3
"Halobacterium distributus" "Halorubrum distributum" "Zvyagintseva et al., 1989" 3
"Halobacterium halobium" "Halobacterium salinarum" "Elazari-Volcani, 1957" 3
"Halobacterium halobium" "Halobacterium salinarum" "Elazari-Volcani, 1957" 2
"Halobacterium lacusprofundi" "Halorubrum lacusprofundi" "Franzmann et al., 1989" 3
"Halobacterium mediterranei" "Haloferax mediterranei" "Rodriguez-Valera et al., 1983" 3
"Halobacterium pharaonis" "Natronomonas pharaonis" "Soliman et al., 1983" 3
"Halobacterium piscisalsi" "Halobacterium salinarum" "Yachai et al., 2008" 3
"Halobacterium piscisalsi" "Halobacterium salinarum" "Yachai et al., 2008" 2
"Halobacterium saccharovorum" "Halorubrum saccharovorum" "Tomlinson et al., 1977" 3
"Halobacterium salinarium" "Halobacterium salinarum" "Elazari-Volcani, 1957" 3
"Halobacterium salinarium" "Halobacterium salinarum" "Elazari-Volcani, 1957" 2
"Halobacterium sodomense" "Halorubrum sodomense" "Oren, 1983" 3
"Halobacterium trapanicum" "Halorubrum trapanicum" "Elazari-Volcani, 1957" 3
"Halobacterium vallismortis" "Haloarcula vallismortis" "Gonzalez et al., 1979" 3
"Halobacterium vallismortis" "Haloarcula vallismortis" "Gonzalez et al., 1979" 2
"Halobacterium volcanii" "Haloferax volcanii" "Mullakhanbhai et al., 1975" 3
"Halobacteroides acetoethylicus" "Halanaerobium acetethylicum" "Rengpipat et al., 1989" 2
"Halobacteroides lacunaris" "Halanaerobacter lacunarum" "Zhilina et al., 1992" 2
@ -5780,7 +5780,7 @@
"Hendersonia pinicola" "Hendersonula pinicola" "Trotter, 1972" 2
"Hendersonia symploci" "Hendersonula symploci" "Berk et al., 1873" 2
"Hennebertia ovalis" "Wardomyces ovalis" "Morelet, 1969" 3
"Hepatiarius longissimus" "Opisthorchis longissimus" "Feizullaev, 1961" 3
"Hepatiarius longissimus" "Opisthorchis longissimus" "Feizullaev, 1961" 2
"Heptameria acuta" "Leptosphaeria acuta" "Cooke, 1889" 2
"Heptameria albopunctata" "Leptosphaeria albopunctata" "Cooke, 1889" 2
"Heptameria artemisiae" "Leptosphaeria artemisiae" "Cooke, 1889" 2
@ -5853,7 +5853,7 @@
"Heteroconium chaetospira" "Cladophialophora chaetospira" "Ellis, 1976" 2
"Heterolepa haidingeri" "Cibicides haidingeri" "DOrbigny, 1846" 3
"Heteropatellina frustratiformis" "Ungulatelloides frustratiformis" "McCulloch, 1977" 3
"Heterophyes yokogawai" "Metagonimus yokogawai" "Katsurada, 1912" 3
"Heterophyes yokogawai" "Metagonimus yokogawai" "Katsurada, 1912" 2
"Heterospiroloculina bikiniensis" "Inaequalina bikiniensis" "McCulloch, 1977" 3
"Heterospiroloculina culebraensis" "Inaequalina culebraensis" "McCulloch, 1977" 3
"Heterosporium algarum" "Cladosporium algarum" "Cooke et al., 1890" 2
@ -5972,8 +5972,8 @@
"Huaishuia" "Celeribacter" "Wang et al., 2012" 2
"Huaishuia halophila" "Celeribacter halophilus" "Wang et al., 2012" 2
"Hughesiella euricoi" "Ceratocystis euricoi" "Bat et al., 1956" 3
"Hulecoeteomyia fluviatilis" "Aedes fluviatilis" "Leicester, 1908" 3
"Hulecoeteomyia milsoni" "Aedes milsoni" "Taylor, 1916" 3
"Hulecoeteomyia fluviatilis" "Aedes fluviatilis" "Leicester, 1908" 2
"Hulecoeteomyia milsoni" "Aedes milsoni" "Taylor, 1916" 2
"Humicoccus" "Nakamurella" "Yoon et al., 2007" 2
"Humicoccus flavidus" "Nakamurella flavida" "Yoon et al., 2007" 2
"Humicola minima" "Ochroconis minima" "Fassat, 1967" 2
@ -6942,7 +6942,7 @@
"Leifsonia pindariensis" "Microterricola pindariensis" "Reddy et al., 2008" 2
"Leiotrocha serpularum" "Cyclochaeta serpularum" "Fabre-Domergue, 1888" 3
"Leisingera nanhaiensis" "Sedimentitalea nanhaiensis" "Sun et al., 2014" 2
"Lelliottia aquatilis" "Lelliottia jeotgali" "Kampfer et al., 2018" 1
"Lelliottia aquatilis" "Lelliottia jeotgali" "Kampfer et al., 2018" 2
"Lembus armatus" "Philasterides armatus" "Kahl, 1926" 3
"Lembus kenti" "Cohnilembus kenti" "Kahl, 1931" 3
"Lembus pusillus" "Pseudocohnilembus pusillus" "Quennerstedt, 1869" 3
@ -7208,7 +7208,7 @@
"Lonsdalea quercina iberica" "Lonsdalea iberica" "Brady et al., 2012" 1
"Lonsdalea quercina populi" "Lonsdalea populi" "Toth et al., 2013" 1
"Lonsdalea quercina quercina" "Lonsdalea quercina" "Brady et al., 2012" 1
"Loossia dobrogiensis" "Metagonimus dobrogiensis" "Ciurea, 1915" 3
"Loossia dobrogiensis" "Metagonimus dobrogiensis" "Ciurea, 1915" 2
"Lophocorys neatum" "Lophocyrtis neatum" "Sanfilippo, 1990" 3
"Lophophyton gallinae" "Microsporum gallinae" "Matr et al., 1899" 3
"Loxocephalus colpidiopsis" "Dexiotricha colpidiopsis" "Kahl, 1926" 3
@ -7490,7 +7490,7 @@
"Mesoflavibacter sabulilitoris" "Mesoflavibacter zeaxanthinifaciens sabulilitoris" "Park et al., 2014" 3
"Mesomycoplasma molaris" "Mesomycoplasma molare" "Gupta et al., 2018" 3
"Mesonia maritimus" "Mesonia maritima" "Sung et al., 2017" 3
"Mesoplasma pleciae" "Acholeplasma pleciae" "Tully et al., 1994" 3
"Mesoplasma pleciae" "Acholeplasma pleciae" "Tully et al., 1994" 2
"Metacarinina charlesensis" "Laticarinina charlesensis" "McCulloch, 1977" 3
"Metacarinina chathamensis" "Laticarinina chathamensis" "McCulloch, 1977" 3
"Metacarinina hoodensis" "Laticarinina hoodensis" "McCulloch, 1977" 3
@ -7882,7 +7882,7 @@
"Monosporium sclerotiale" "Scedosporium sclerotiale" "Pepere, 1914" 3
"Monosporium sepedonioides" "Chrysosporium sepedonioides" "Harz, 1872" 3
"Moorella thermoautotrophica" "Moorella thermoacetica" "Collins et al., 1994" 2
"Moraxella anatipestifer" "Riemerella anatipestifer" "Bruner et al., 1954" 3
"Moraxella anatipestifer" "Riemerella anatipestifer" "Bruner et al., 1954" 2
"Moraxella phenylpyruvica" "Psychrobacter phenylpyruvicus" "Bovre et al., 1967" 1
"Moraxella urethralis" "Oligella urethralis" "Lautrop et al., 1970" 2
"Morella entamoebae" "Sphaerita entamoebae" "Perez Reyes, 1964" 3
@ -7898,7 +7898,7 @@
"Mrazekia niphargi" "Microsporidium niphargi" "Poisson, 1924" 3
"Mrazekia piscicola" "Jirovecia piscicola" "Cepede, 1924" 3
"Mrazekia tetraspora" "Scipionospora tetraspora" "Leger et al., 1922" 3
"Mucidus africanus" "Aedes africanus" "Theobald, 1901" 3
"Mucidus africanus" "Aedes africanus" "Theobald, 1901" 2
"Mucor angarensis" "Circinella angarensis" "Schostak, 1897" 3
"Mucor arrhizus" "Rhizopus arrhizus" "Hagem, 1908" 2
"Mucor assamensis" "Hyphomucor assamensis" "Mehrotra et al., 1970" 3
@ -7926,7 +7926,7 @@
"Muricauda antarctica" "Muricauda taeanensis" "Wu et al., 2013" 3
"Muricauda lutea" "Croceivirga lutea" "Wang et al., 2017" 3
"Muriicola lacisalsi" "Maritimibacter lacisalsi" "Wang et al., 2021" 2
"Musca azurea" "Lucilia azurea" "Doleschall, 1858" 3
"Musca azurea" "Lucilia azurea" "Doleschall, 1858" 2
"Mya nitens" "Ervilia nitens" "Montagu, 1808" 3
"Myceloblastanon albicans" "Candida albicans" "Ota, 1927" 2
"Myceloblastanon guilliermondii" "Meyerozyma guilliermondii" "Ota, 1927" 3
@ -8221,7 +8221,7 @@
"Mycterotrix ovata" "Maryna ovata" "Gelei, 1950" 3
"Myllocercion rhodanon" "Schadelfusslerus rhodanon" "Foreman, 1968" 3
"Myrionecta rubrum" "Mesodinium rubrum" "Jankowski, 1976" 3
"Myroides xuanwuensis" "Myroides odoratimimus xuanwuensis" "Zhang et al., 2014" 3
"Myroides xuanwuensis" "Myroides odoratimimus xuanwuensis" "Zhang et al., 2014" 2
"Myxococcus coralloides" "Corallococcus coralloides" "Thaxter, 1892" 2
"Myxococcus disciformis" "Archangium disciforme" "Thaxter, 1904" 2
"Myxococcus flavescens" "Myxococcus virescens" "Yamanaka et al., 1990" 2
@ -8231,8 +8231,8 @@
"Myxotrichum johnstonii" "Gymnoascus johnstonii" "Massee et al., 1902" 3
"Myzocytium humicola" "Myzocytiopsis humicola" "Barron et al., 1975" 3
"Myzocytium vermicola" "Myzocytiopsis vermicola" "Fisch, 1892" 3
"Myzorhynchus minutus" "Anopheles minutus" "Theobald, 1903" 3
"Myzorhynchus pallidus" "Anopheles pallidus" "Swellengrebel, 1919" 3
"Myzorhynchus minutus" "Anopheles minutus" "Theobald, 1903" 2
"Myzorhynchus pallidus" "Anopheles pallidus" "Swellengrebel, 1919" 2
"Mzabimyces" "Halopolyspora" "Saker et al., 2015" 2
"Mzabimyces algeriensis" "Halopolyspora algeriensis" "Saker et al., 2015" 2
"Naematelia aurantia" "Tremella aurantia" "Burt, 1921" 3
@ -9265,8 +9265,8 @@
"Orcadella operculata" "Licea operculata" "Wingate, 1889" 3
"Orcadella parasitica" "Licea parasitica" "Hagelst, 1942" 3
"Orcadella pusilla" "Licea pusilla" "Hagelst, 1942" 3
"Oribaculum" "Porphyromonas" "Moore et al., 1994" 3
"Oribaculum catoniae" "Porphyromonas catoniae" "Moore et al., 1994" 3
"Oribaculum" "Porphyromonas" "Moore et al., 1994" 2
"Oribaculum catoniae" "Porphyromonas catoniae" "Moore et al., 1994" 2
"Ornatispora frondicola" "Stachybotrys frondicola" "Hyde et al., 1999" 2
"Ornatispora gamsii" "Stachybotrys gamsii" "Hyde et al., 1999" 2
"Ornatispora nepalensis" "Stachybotrys nepalensis" "Whitton et al., 2012" 2
@ -9602,7 +9602,7 @@
"Pedobacter huanghensis" "Daejeonella huanghensis" "Qiu et al., 2014" 3
"Pedobacter luteus" "Daejeonella lutea" "Oh et al., 2013" 3
"Pedobacter oryzae" "Daejeonella oryzae" "Jeon et al., 2009" 3
"Pedobacter piscium" "Pedobacter antarcticus" "Steyn et al., 2014" 3
"Pedobacter piscium" "Pedobacter antarcticus" "Steyn et al., 2014" 2
"Pedobacter ruber" "Daejeonella rubra" "Margesin et al., 2013" 3
"Pedobacter saltans" "Pseudopedobacter saltans" "Steyn et al., 1998" 3
"Pedobacter tournemirensis" "Arcticibacter tournemirensis" "Urios et al., 2013" 3
@ -9828,7 +9828,7 @@
"Petersenia andreei" "Sirolpidium andreei" "Sparrow, 1936" 3
"Petersenia catenophlyctidis" "Cornumyces catenophlyctidis" "Sundaram, 1968" 3
"Petersenia irregularis" "Cornumyces irregularis" "Sparrow, 1943" 3
"Petraeus vignei" "Giardia vignei" "Rochebrune, 1882" 3
"Petraeus vignei" "Giardia vignei" "Rochebrune, 1882" 2
"Petriella boulangeri" "Microascus boulangeri" "Curzi, 1930" 3
"Petriellidium boydii" "Pseudallescheria boydii" "Malloch, 1970" 2
"Petriellidium desertorum" "Scedosporium desertorum" "Arx et al., 1973" 3
@ -9850,8 +9850,8 @@
"Phacellium geranii" "Graphium geranii" "Braun, 1993" 3
"Phacellium ligulariae" "Graphium ligulariae" "Braun, 1993" 3
"Phacellium trifolii" "Graphium trifolii" "Braun, 1993" 3
"Phaenicia azurea" "Lucilia azurea" "Robineau-Desvoidy, 1863" 3
"Phaenicia pallescens" "Lucilia pallescens" "Shannon, 1924" 3
"Phaenicia azurea" "Lucilia azurea" "Robineau-Desvoidy, 1863" 2
"Phaenicia pallescens" "Lucilia pallescens" "Shannon, 1924" 2
"Phaenicosphaera mammilla" "Hegleria mammilla" "Sheng et al., 1985" 3
"Phaeobacter aquaemixtae" "Leisingera aquaemixtae" "Park et al., 2014" 2
"Phaeobacter arcticus" "Pseudophaeobacter arcticus" "Zhang et al., 2008" 2
@ -9895,7 +9895,7 @@
"Phloeophthora syringae" "Phytophthora syringae" "Kleb, 1906" 3
"Phloeospora trifolii" "Leptosphaeria trifolii" "Cavara, 1878" 2
"Phlyctospora persoonii" "Elaphomyces persoonii" "Corda, 1854" 3
"Phocaeicola chinchillae" "Phocaeicola sartorii" "Garcia-Lopez et al., 2020" 3
"Phocaeicola chinchillae" "Phocaeicola sartorii" "Garcia-Lopez et al., 2020" 2
"Phoma acuta" "Leptosphaeria acuta" "Fuckel, 1870" 2
"Phoma errabunda" "Leptosphaeria errabunda" "Desm, 1849" 2
"Phoma macrocapsa" "Leptosphaeria macrocapsa" "Trail, 1886" 2
@ -10127,7 +10127,7 @@
"Plagiotricha camelus" "Trichoda camelus" "Bory, 1824" 3
"Plagiotricha sinuata" "Trichoda sinuata" "Bory, 1824" 3
"Plagiotricha succisa" "Psilotricha succisa" "Bory, 1824" 3
"Planaria punctata" "Fasciola punctata" "Muller, 1776" 3
"Planaria punctata" "Fasciola punctata" "Muller, 1776" 2
"Planctomyces brasiliensis" "Rubinisphaera brasiliensis" "Schlesner, 1990" 3
"Planctomyces limnophilus" "Planctopirus limnophila" "Hirsch et al., 1986" 3
"Planctomyces maris" "Gimesia maris" "Bauld et al., 1980" 3
@ -10432,8 +10432,8 @@
"Porphyrobacter mercurialis" "Croceibacterium mercuriale" "Coil et al., 2016" 2
"Porphyrobacter neustonensis" "Erythrobacter neustonensis" "Fuerst et al., 2020" 2
"Porphyrobacter sanguineus" "Erythrobacter sanguineus" "Hiraishi et al., 2002" 2
"Porphyromonas cansulci" "Porphyromonas crevioricanis" "Collins et al., 1994" 3
"Porphyromonas salivosa" "Porphyromonas macacae" "Love et al., 1992" 3
"Porphyromonas cansulci" "Porphyromonas crevioricanis" "Collins et al., 1994" 2
"Porphyromonas salivosa" "Porphyromonas macacae" "Love et al., 1992" 2
"Posadasia esteriformis" "Coccidioides esteriformis" "Canton, 1898" 3
"Poseidonibacter lekithochrous" "Arcobacter lekithochrous" "Perez-Cataluna et al., 2019" 2
"Pottsiocles hannae" "Manuelophrya hannae" "Guhl, 1985" 3
@ -10450,7 +10450,7 @@
"Prauserella flava" "Prauserella salsuginis" "Li et al., 2009" 2
"Prevotella oulora" "Prevotella oulorum" "Shah et al., 1990" 2
"Prevotella ruminicola brevis" "Prevotella brevis" "Shah et al., 1990" 2
"Prevotella tannerae" "Alloprevotella tannerae" "Moore et al., 1994" 3
"Prevotella tannerae" "Alloprevotella tannerae" "Moore et al., 1994" 2
"Prevotella zoogleoformans" "Capsularis zoogleoformans" "Shah et al., 1994" 3
"Primorskyibacter insulae" "Pseudoprimorskyibacter insulae" "Park et al., 2015" 2
"Procandida albicans" "Candida albicans" "Novak et al., 1961" 2
@ -11111,7 +11111,7 @@
"Rectocibicidella robertsi" "Dyocibicides robertsi" "McLean, 1956" 3
"Rectoglandulina rotundata" "Pseudonodosaria rotundata" "Reuss, 1850" 3
"Recurvoides trochamminiformis" "Recurvoidatus trochamminiformis" "Saidova, 1961" 3
"Reedomyia sudanensis" "Aedes sudanensis" "Theobald, 1913" 3
"Reedomyia sudanensis" "Aedes sudanensis" "Theobald, 1913" 2
"Reichenbachia" "Reichenbachiella" "Nedashkovskaya et al., 2003" 3
"Reichenbachia agariperforans" "Reichenbachiella agariperforans" "Nedashkovskaya et al., 2003" 3
"Remaneica gonzalezi" "Remaneicella gonzalezi" "Seiglie, 1964" 3
@ -11462,7 +11462,7 @@
"Rotalina truncatulinoides" "Globorotalia truncatulinoides" "DOrbigny, 1839" 3
"Rotamorphina minuta" "Valvulineria minuta" "Schubert, 1904" 3
"Rothia dentocariosus" "Rothia dentocariosa" "Georg et al., 1967" 2
"Roubaudiella caerulea" "Lucilia caerulea" "Seguy, 1925" 3
"Roubaudiella caerulea" "Lucilia caerulea" "Seguy, 1925" 2
"Rozella itersoniliae" "Pleotrachelus itersoniliae" "Barr et al., 1980" 3
"Rozella septigena" "Rozellopsis septigena" "Cornu, 1872" 3
"Rozella simulans" "Rozellopsis simulans" "Fisch, 1882" 3
@ -11790,16 +11790,16 @@
"Septotrochammina gonzalezi" "Remaneicella gonzalezi" "Seiglie, 1964" 3
"Serpens" "Pseudomonas" "Hespell, 1977" 1
"Serpens flexibilis" "Pseudomonas flexibilis" "Hespell, 1977" 1
"Serpula" "Brachyspira" "Stanton et al., 1991" 3
"Serpula hyodysenteriae" "Brachyspira hyodysenteriae" "Stanton et al., 1991" 3
"Serpula innocens" "Brachyspira innocens" "Stanton et al., 1991" 3
"Serpulina" "Brachyspira" "Stanton, 1992" 3
"Serpulina alvinipulli" "Brachyspira alvinipulli" "Stanton et al., 1998" 3
"Serpulina hyodysenteriae" "Brachyspira hyodysenteriae" "Stanton et al., 1992" 3
"Serpulina innocens" "Brachyspira innocens" "Stanton et al., 1992" 3
"Serpulina intermedia" "Brachyspira intermedia" "Stanton et al., 1997" 3
"Serpulina murdochii" "Brachyspira murdochii" "Stanton et al., 1997" 3
"Serpulina pilosicoli" "Brachyspira pilosicoli" "Trott et al., 1996" 3
"Serpula" "Brachyspira" "Stanton et al., 1991" 2
"Serpula hyodysenteriae" "Brachyspira hyodysenteriae" "Stanton et al., 1991" 2
"Serpula innocens" "Brachyspira innocens" "Stanton et al., 1991" 2
"Serpulina" "Brachyspira" "Stanton, 1992" 2
"Serpulina alvinipulli" "Brachyspira alvinipulli" "Stanton et al., 1998" 2
"Serpulina hyodysenteriae" "Brachyspira hyodysenteriae" "Stanton et al., 1992" 2
"Serpulina innocens" "Brachyspira innocens" "Stanton et al., 1992" 2
"Serpulina intermedia" "Brachyspira intermedia" "Stanton et al., 1997" 2
"Serpulina murdochii" "Brachyspira murdochii" "Stanton et al., 1997" 2
"Serpulina pilosicoli" "Brachyspira pilosicoli" "Trott et al., 1996" 2
"Serratia glossinae" "Serratia fonticola" "Geiger et al., 2010" 1
"Serratia marcescens sakuensis" "Serratia marcescens" "Ajithkumar et al., 2003" 1
"Serratia marinorubra" "Serratia rubidaea" "ZoBell et al., 1944" 1
@ -12111,12 +12111,12 @@
"Sphaerulina amicta" "Appendichordella amicta" "Kohlm, 1962" 3
"Sphaerulina tanaceti" "Leptosphaeria tanaceti" "Shoemaker, 1976" 2
"Sphinctocystis elliptica" "Cymatopleura elliptica" "Kuntze" 3
"Sphingobacterium antarcticum" "Pedobacter antarcticus" "Shivaji et al., 1992" 3
"Sphingobacterium antarcticus" "Pedobacter antarcticus" "Shivaji et al., 1992" 3
"Sphingobacterium heparinum" "Pedobacter heparinus" "Takeuchi et al., 1993" 3
"Sphingobacterium mizutae" "Sphingobacterium mizutaii" "Yabuuchi et al., 1983" 3
"Sphingobacterium pakistanensis" "Sphingobacterium pakistanense" "Ahmed et al., 2015" 3
"Sphingobacterium piscium" "Pedobacter antarcticus" "Takeuchi et al., 1993" 3
"Sphingobacterium antarcticum" "Pedobacter antarcticus" "Shivaji et al., 1992" 2
"Sphingobacterium antarcticus" "Pedobacter antarcticus" "Shivaji et al., 1992" 2
"Sphingobacterium heparinum" "Pedobacter heparinus" "Takeuchi et al., 1993" 2
"Sphingobacterium mizutae" "Sphingobacterium mizutaii" "Yabuuchi et al., 1983" 2
"Sphingobacterium pakistanensis" "Sphingobacterium pakistanense" "Ahmed et al., 2015" 2
"Sphingobacterium piscium" "Pedobacter antarcticus" "Takeuchi et al., 1993" 2
"Sphingobium algicola" "Sphingobium limneticum" "Lee et al., 2017" 2
"Sphingobium barthaii" "Sphingobium fuliginis" "Maeda et al., 2015" 2
"Sphingobium chinhatense" "Sphingobium indicum" "Dadhwal et al., 2020" 2
@ -12415,7 +12415,7 @@
"Staurosphaera pusilla" "Stigmosphaerostylus pusilla" "Hinde, 1899" 3
"Staurosphaera sedecimporata" "Emiluvia sedecimporata" "Rust, 1885" 3
"Staurosphaera trispinosa" "Staurolonche trispinosa" "Kozur et al., 1979" 3
"Stegomyia wellmanii" "Aedes wellmanii" "Theobald, 1910" 3
"Stegomyia wellmanii" "Aedes wellmanii" "Theobald, 1910" 2
"Steinia balladynula" "Oxytricha balladynula" "Kahl, 1932" 3
"Steinia candens" "Cyrtohymena candens" "Kahl, 1932" 3
"Steinia citrina" "Cyrtohymena citrina" "Berger et al., 1987" 3
@ -12487,7 +12487,7 @@
"Stemphylium uredinis" "Alternaria uredinis" "Thirum, 1947" 2
"Stenella gynoxidicola" "Cladosporium gynoxidicola" "Mulder, 1982" 2
"Stenopterobia delicatissima" "Surirella delicatissima" "Van Heurck, 1896" 3
"Stenoscutus africanus" "Aedes africanus" "Theobald, 1909" 3
"Stenoscutus africanus" "Aedes africanus" "Theobald, 1909" 2
"Stenothermobacter" "Nonlabens" "Lau et al., 2006" 3
"Stenothermobacter spongiae" "Nonlabens spongiae" "Lau et al., 2006" 3
"Stenotrophomonas africana" "Stenotrophomonas maltophilia" "Drancourt et al., 1997" 1
@ -12889,7 +12889,7 @@
"Strombidium viride" "Limnostrombidium viride" "Kahl, 1932" 3
"Strombilidium tonsuratum" "Strobilidium tonsuratum" "Meunier, 1907" 3
"Strongylidium wilberti" "Hemiamphisiella wilberti" "Foissner, 1982" 3
"Strophalosia warwicki" "Capillaria warwicki" "Maxwell, 1954" 3
"Strophalosia warwicki" "Capillaria warwicki" "Maxwell, 1954" 2
"Stylocapsa catenarum" "Plicaforacapsa catenarum" "Matsuoka, 1982" 3
"Stylocapsa oblongula" "Kilinora oblongula" "Kocher, 1981" 3
"Stylocapsa spiralis" "Kilinora spiralis" "Matsuoka, 1982" 3
@ -12986,7 +12986,7 @@
"Tachysoma siseris" "Oxytricha siseris" "Stiller, 1974" 3
"Tachysoma tricornis" "Oxytricha tricornis" "Milne, 1886" 3
"Taeniolella boppii" "Cladophialophora boppii" "Borelli, 1983" 2
"Taeniorhynchus africanus" "Aedes africanus" "Neveu-Lemaire, 1906" 3
"Taeniorhynchus africanus" "Aedes africanus" "Neveu-Lemaire, 1906" 2
"Talaromyces brevicompactus" "Hamigera brevicompactus" "Kong, 1999" 3
"Talaromyces byssochlamydoides" "Rasamsonia byssochlamydoides" "Stolk et al., 1972" 3
"Talaromyces cejpii" "Aspergillus cejpii" "Milko, 1964" 2
@ -13539,8 +13539,8 @@
"Tremella simplex" "Phaeotremella simplex" "Jacks et al., 1940" 3
"Tremella translucens" "Sirotrema translucens" "Gordon, 1938" 3
"Treponema caldaria" "Treponema caldarium" "Abt et al., 2013" 2
"Treponema hyodysenteriae" "Brachyspira hyodysenteriae" "Harris et al., 1972" 3
"Treponema innocens" "Brachyspira innocens" "Kinyon et al., 1979" 3
"Treponema hyodysenteriae" "Brachyspira hyodysenteriae" "Harris et al., 1972" 2
"Treponema innocens" "Brachyspira innocens" "Kinyon et al., 1979" 2
"Treponema stenostrepta" "Treponema stenostreptum" "Abt et al., 2013" 2
"Tretomphalus bermudezi" "Cymbaloporetta bermudezi" "Sellier de Civrieux, 1976" 3
"Tretomphalus concinnus" "Tretomphaloides concinnus" "Brady, 1884" 3
@ -14161,7 +14161,7 @@
"Wautersia paucula" "Cupriavidus pauculus" "Vaneechoutte et al., 2004" 2
"Wautersia respiraculi" "Cupriavidus respiraculi" "Vaneechoutte et al., 2004" 2
"Wautersia taiwanensis" "Cupriavidus taiwanensis" "Vaneechoutte et al., 2004" 2
"Weeksella zoohelcum" "Bergeyella zoohelcum" "Holmes et al., 1987" 3
"Weeksella zoohelcum" "Bergeyella zoohelcum" "Holmes et al., 1987" 2
"Weiseria spinosa" "Golbergia spinosa" "Golberg, 1971" 3
"Weissella jogaejeotgali" "Weissella thailandensis" "Lee et al., 2015" 2
"Weissella kimchii" "Weissella cibaria" "Choi et al., 2002" 2

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1 +1 @@
638a06636d8b547c2cb9d1ec243ecb7e
4709adde8932f9e887fbd892a27ad929

View File

@ -26,8 +26,8 @@
# Reproduction of the `microorganisms` data set
# Data retrieved from the Catalogue of Life (CoL):
# https://download.catalogueoflife.org/col/monthly/life/
# (download latest dwca, such as https://download.catalogueoflife.org/col/monthly/2020-12-01_dwca.zip)
# https://download.catalogueoflife.org/col/monthly/
# (download latest dwca, such as https://download.catalogueoflife.org/col/monthly/2022-01-14_dwca.zip)
# Data retrieved from the Global Biodiversity Information Facility (GBIF):
# https://doi.org/10.15468/rffz4x
#
@ -168,32 +168,6 @@ rm(ref_taxonomy)
rm(data_col.bak)
rm(data_dsmz.bak)
mo_found_in_NL <- c("Absidia", "Acremonium", "Actinotignum", "Aedes", "Alternaria", "Anaerosalibacter", "Ancylostoma",
"Angiostrongylus", "Anisakis", "Anopheles", "Apophysomyces", "Arachnia", "Ascaris", "Aspergillus",
"Aureobacterium", "Aureobasidium", "Bacteroides", "Balantidum", "Basidiobolus", "Beauveria",
"Bilophilia", "Blastocystis", "Branhamella", "Brochontrix", "Brugia", "Calymmatobacterium", "Candida", "Capillaria",
"Capnocytophaga", "Catabacter", "Cdc", "Chaetomium", "Chilomastix", "Chryseobacterium",
"Chryseomonas", "Chrysonilia", "Cladophialophora", "Cladosporium", "Clonorchis", "Conidiobolus",
"Contracaecum", "Cordylobia", "Cryptococcus", "Curvularia", "Demodex", "Dermatobia", "Dicrocoelium",
"Dioctophyma", "Diphyllobothrium", "Dipylidium", "Dirofilaria", "Dracunculus", "Echinococcus",
"Echinostoma", "Elisabethkingia", "Enterobius", "Enteromonas", "Euascomycetes", "Exophiala",
"Exserohilum", "Fasciola", "Fasciolopsis", "Flavobacterium", "Fonsecaea", "Fusarium", "Fusobacterium",
"Giardia", "Gnathostoma", "Hendersonula", "Heterophyes", "Hymenolepis", "Hypomyces",
"Hysterothylacium", "Kloeckera", "Koserella", "Larva", "Lecythophora", "Leishmania", "Lelliottia",
"Leptomyxida", "Leptosphaeria", "Leptotrichia", "Loa", "Lucilia", "Lumbricus", "Malassezia",
"Malbranchea", "Mansonella", "Mesocestoides", "Metagonimus", "Metarrhizium", "Molonomonas",
"Mortierella", "Mucor", "Multiceps", "Mycocentrospora", "Mycoplasma", "Nanophetus", "Nattrassia",
"Necator", "Nectria", "Novospingobium", "Ochroconis", "Oesophagostomum", "Oidiodendron", "Onchocerca",
"Opisthorchis", "Opistorchis", "Paragonimus", "Paramyxovirus", "Pediculus", "Phlebotomus",
"Phocanema", "Phoma", "Phthirus", "Piedraia", "Pithomyces", "Pityrosporum", "Prevotella",
"Pseudallescheria", "Pseudoterranova", "Pulex", "Retortamonas", "Rhizomucor", "Rhizopus",
"Rhodotorula", "Salinococcus", "Sanguibacteroides", "Sarcophagidae", "Sarcoptes", "Schistosoma",
"Scolecobasidium", "Scopulariopsis", "Scytalidium", "Spirometra", "Sporobolomyces", "Stachybotrys",
"Stenotrophomononas", "Stomatococcus", "Strongyloides", "Syncephalastraceae", "Syngamus", "Taenia",
"Ternidens", "Torulopsis", "Toxocara", "Toxoplasma", "Treponema", "Trichinella", "Trichobilharzia", "Trichoderma",
"Trichomonas", "Trichophyton", "Trichosporon", "Trichostrongylus", "Trichuris", "Tritirachium",
"Trombicula", "Trypanosoma", "Tunga", "Ureaplasma", "Wuchereria")
MOs <- data_total %>%
filter(
(
@ -205,7 +179,7 @@ MOs <- data_total %>%
& !order %in% c("Eurotiales", "Microascales", "Mucorales", "Saccharomycetales", "Schizosaccharomycetales", "Tremellales", "Onygenales", "Pneumocystales"))
)
# or the genus has to be one of the genera we found in our hospitals last decades (Northern Netherlands, 2002-2018)
| genus %in% mo_found_in_NL
| genus %in% MO_PREVALENT_GENERA
) %>%
# really no Plantae (e.g. Dracunculus exist both as worm and as plant)
filter(kingdom != "Plantae") %>%
@ -398,7 +372,7 @@ MOs <- MOs %>%
"Firmicutes",
"Actinobacteria",
"Sarcomastigophora")
| genus %in% mo_found_in_NL
| genus %in% MO_PREVALENT_GENERA
| rank %in% c("kingdom", "phylum", "class", "order", "family"))
~ 2,
TRUE ~ 3

View File

@ -276,18 +276,7 @@ MOs <- MOs %>%
"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")
| genus %in% MO_PREVALENT_GENERA
| rank %in% c("kingdom", "phylum", "class", "order", "family"))
~ 2,
TRUE ~ 3

View File

@ -24,6 +24,7 @@
# ==================================================================== #
# This script runs in under a minute and renews all guidelines of CLSI and EUCAST!
# Run it with source("data-raw/reproduction_of_rsi_translation.R")
library(dplyr)
library(readr)
@ -32,9 +33,9 @@ library(AMR)
# Install the WHONET software on Windows (http://www.whonet.org/software.html),
# and copy the folder C:\WHONET\Codes to data-raw/WHONET/Codes
DRGLST <- readr::read_tsv("data-raw/WHONET/Codes/DRGLST.txt", na = c("", "NA", "-"))
DRGLST1 <- readr::read_tsv("data-raw/WHONET/Codes/DRGLST1.txt", na = c("", "NA", "-"))
ORGLIST <- readr::read_tsv("data-raw/WHONET/Codes/ORGLIST.txt", na = c("", "NA", "-"))
DRGLST <- read_tsv("data-raw/WHONET/Codes/DRGLST.txt", na = c("", "NA", "-"), show_col_types = FALSE)
DRGLST1 <- read_tsv("data-raw/WHONET/Codes/DRGLST1.txt", na = c("", "NA", "-"), show_col_types = FALSE)
ORGLIST <- read_tsv("data-raw/WHONET/Codes/ORGLIST.txt", na = c("", "NA", "-"), show_col_types = FALSE)
# create data set for generic rules (i.e., AB-specific but not MO-specific)
rsi_generic <- DRGLST %>%
@ -128,11 +129,30 @@ rsi_translation[which(rsi_translation$breakpoint_R == 257), "breakpoint_R"] <- m
rsi_translation[which(rsi_translation$breakpoint_R == 513), "breakpoint_R"] <- m[which(m == 512) + 1]
rsi_translation[which(rsi_translation$breakpoint_R == 1025), "breakpoint_R"] <- m[which(m == 1024) + 1]
# WHONET adds one log2 level to the R breakpoint for their software, e.g. in AMC in Enterobacterales:
# EUCAST 2021 guideline: S <= 8 and R > 8
# WHONET file: S <= 8 and R >= 16
# this will make an MIC of 12 I, which should be R, so:
eucast_mics <- which(rsi_translation$guideline %like% "EUCAST" &
rsi_translation$method == "MIC" &
log2(as.double(rsi_translation$breakpoint_R)) - log2(as.double(rsi_translation$breakpoint_S)) != 0 &
!is.na(rsi_translation$breakpoint_R))
old_R <- rsi_translation[eucast_mics, "breakpoint_R", drop = TRUE]
old_S <- rsi_translation[eucast_mics, "breakpoint_S", drop = TRUE]
new_R <- 2 ^ (log2(old_R) - 1)
new_R[new_R < old_S | is.na(as.mic(new_R))] <- old_S[new_R < old_S | is.na(as.mic(new_R))]
rsi_translation[eucast_mics, "breakpoint_R"] <- new_R
eucast_disks <- which(rsi_translation$guideline %like% "EUCAST" &
rsi_translation$method == "DISK" &
rsi_translation$breakpoint_S - rsi_translation$breakpoint_R != 0 &
!is.na(rsi_translation$breakpoint_R))
rsi_translation[eucast_disks, "breakpoint_R"] <- rsi_translation[eucast_disks, "breakpoint_R", drop = TRUE] + 1
# Greek symbols and EM dash symbols are not allowed by CRAN, so replace them with ASCII:
rsi_translation$disk_dose <- gsub("μ", "u", rsi_translation$disk_dose, fixed = TRUE)
rsi_translation$disk_dose <- gsub("", "-", rsi_translation$disk_dose, fixed = TRUE)
# save to package
usethis::use_data(rsi_translation, overwrite = TRUE)
usethis::use_data(rsi_translation, overwrite = TRUE, compress = "xz")
rm(rsi_translation)
devtools::load_all(".")

View File

@ -1 +1 @@
d8083b68d4e492ea8e87c1eae4da4196
75a10b41a8bd4f4788520f3407431e66

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

68
data-raw/toxoplasma.R Normal file
View File

@ -0,0 +1,68 @@
microorganisms <- microorganisms |> bind_rows(
# Toxoplasma
data.frame(mo = "P_TXPL_GOND", # species
fullname = "Toxoplasma gondii",
kingdom = "(unknown kingdom)",
phylum = "Apicomplexa",
class = "Conoidasida",
order = "Eucoccidiorida",
family = "Sarcocystidae",
genus = "Toxoplasma",
species = "gondii",
subspecies = "",
rank = "species",
ref = "Nicolle et al., 1908",
species_id = NA_real_,
source = "manually added",
prevalence = 2,
stringsAsFactors = FALSE),
data.frame(mo = "P_TXPL", # genus
fullname = "Toxoplasma",
kingdom = "(unknown kingdom)",
phylum = "Apicomplexa",
class = "Conoidasida",
order = "Eucoccidiorida",
family = "Sarcocystidae",
genus = "Toxoplasma",
species = "",
subspecies = "",
rank = "genus",
ref = "Nicolle et al., 1909",
species_id = NA_real_,
source = "manually added",
prevalence = 2,
stringsAsFactors = FALSE),
data.frame(mo = "[FAM]_SRCCYSTD", # family
fullname = "Sarcocystidae",
kingdom = "(unknown kingdom)",
phylum = "Apicomplexa",
class = "Conoidasida",
order = "Eucoccidiorida",
family = "Sarcocystidae",
genus = "",
species = "",
subspecies = "",
rank = "family",
ref = "Poche, 1913",
species_id = NA_real_,
source = "manually added",
prevalence = 2,
stringsAsFactors = FALSE),
data.frame(mo = "[ORD]_EUCCCDRD", # order
fullname = "Eucoccidiorida",
kingdom = "(unknown kingdom)",
phylum = "Apicomplexa",
class = "Conoidasida",
order = "Eucoccidiorida",
family = "",
genus = "",
species = "",
subspecies = "",
rank = "order",
ref = "Leger et al., 1910",
species_id = NA_real_,
source = "manually added",
prevalence = 2,
stringsAsFactors = FALSE),
) |>
arrange(fullname)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -43,7 +43,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="Released version">1.8.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9014</span>
</span>
</div>
@ -57,7 +57,7 @@
</a>
</li>
<li class="dropdown">
<a href="https://msberends.github.io/AMR/#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<a href="https://msberends.github.io/AMR/#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa fa-question-circle"></span>
How to
@ -210,7 +210,7 @@ Content not found. Please use links in the navbar.
<div class="pkgdown">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.6.</p>
</div>
</footer>

View File

@ -17,7 +17,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="Released version">1.8.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9014</span>
</span>
</div>
@ -30,7 +30,7 @@
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa fa-question-circle"></span>
How to
@ -420,7 +420,7 @@ END OF TERMS AND CONDITIONS
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.0.</p>
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.6.</p>
</div>
</footer></div>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
// Hide empty <a> tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) -->
// v0.0.1
// Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020.
document.addEventListener('DOMContentLoaded', function() {
const codeList = document.getElementsByClassName("sourceCode");
for (var i = 0; i < codeList.length; i++) {
var linkList = codeList[i].getElementsByTagName('a');
for (var j = 0; j < linkList.length; j++) {
if (linkList[j].innerHTML === "") {
linkList[j].setAttribute('aria-hidden', 'true');
}
}
}
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -1,12 +0,0 @@
// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
// be compatible with the behavior of Pandoc < 2.8).
document.addEventListener('DOMContentLoaded', function(e) {
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
var i, h, a;
for (i = 0; i < hs.length; i++) {
h = hs[i];
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
a = h.attributes;
while (a.length > 0) h.removeAttribute(a[0].name);
}
});

View File

@ -1,12 +0,0 @@
// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
// be compatible with the behavior of Pandoc < 2.8).
document.addEventListener('DOMContentLoaded', function(e) {
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
var i, h, a;
for (i = 0; i < hs.length; i++) {
h = hs[i];
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
a = h.attributes;
while (a.length > 0) h.removeAttribute(a[0].name);
}
});

View File

@ -44,7 +44,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="Released version">1.8.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9008</span>
</span>
</div>
@ -58,7 +58,7 @@
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa fa-question-circle"></span>
How to
@ -201,18 +201,39 @@
<div class="section level2">
<h2 id="introduction">Introduction<a class="anchor" aria-label="anchor" href="#introduction"></a>
</h2>
<p>What are EUCAST rules? The European Committee on Antimicrobial Susceptibility Testing (EUCAST) states <a href="https://www.eucast.org/expert_rules_and_intrinsic_resistance/" class="external-link">on their website</a>:</p>
<p>What are EUCAST rules? The European Committee on Antimicrobial
Susceptibility Testing (EUCAST) states <a href="https://www.eucast.org/expert_rules_and_intrinsic_resistance/" class="external-link">on
their website</a>:</p>
<blockquote>
<p><em>EUCAST expert rules are a tabulated collection of expert knowledge on intrinsic resistances, exceptional resistance phenotypes and interpretive rules that may be applied to antimicrobial susceptibility testing in order to reduce errors and make appropriate recommendations for reporting particular resistances.</em></p>
<p><em>EUCAST expert rules are a tabulated collection of expert
knowledge on intrinsic resistances, exceptional resistance phenotypes
and interpretive rules that may be applied to antimicrobial
susceptibility testing in order to reduce errors and make appropriate
recommendations for reporting particular resistances.</em></p>
</blockquote>
<p>In Europe, a lot of medical microbiological laboratories already apply these rules (<a href="https://www.eurosurveillance.org/content/10.2807/1560-7917.ES2015.20.2.21008" class="external-link">Brown <em>et al.</em>, 2015</a>). Our package features their latest insights on intrinsic resistance and unusual phenotypes (v3.3, 2021).</p>
<p>Moreover, the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function we use for this purpose can also apply additional rules, like forcing <help title="ATC: J01CA01">ampicillin</help> = R in isolates when <help title="ATC: J01CR02">amoxicillin/clavulanic acid</help> = R.</p>
<p>In Europe, a lot of medical microbiological laboratories already
apply these rules (<a href="https://www.eurosurveillance.org/content/10.2807/1560-7917.ES2015.20.2.21008" class="external-link">Brown
<em>et al.</em>, 2015</a>). Our package features their latest insights
on intrinsic resistance and unusual phenotypes (v3.3, 2021).</p>
<p>Moreover, the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function we use for this
purpose can also apply additional rules, like forcing
<help title="ATC: J01CA01">ampicillin</help> = R in isolates when
<help title="ATC: J01CR02">amoxicillin/clavulanic acid</help> = R.</p>
</div>
<div class="section level2">
<h2 id="examples">Examples<a class="anchor" aria-label="anchor" href="#examples"></a>
</h2>
<p>These rules can be used to discard impossible bug-drug combinations in your data. For example, <em>Klebsiella</em> produces beta-lactamase that prevents ampicillin (or amoxicillin) from working against it. In other words, practically every strain of <em>Klebsiella</em> is resistant to ampicillin.</p>
<p>Sometimes, laboratory data can still contain such strains with ampicillin being susceptible to ampicillin. This could be because an antibiogram is available before an identification is available, and the antibiogram is then not re-interpreted based on the identification (namely, <em>Klebsiella</em>). EUCAST expert rules solve this, that can be applied using <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>:</p>
<p>These rules can be used to discard impossible bug-drug combinations
in your data. For example, <em>Klebsiella</em> produces beta-lactamase
that prevents ampicillin (or amoxicillin) from working against it. In
other words, practically every strain of <em>Klebsiella</em> is
resistant to ampicillin.</p>
<p>Sometimes, laboratory data can still contain such strains with
ampicillin being susceptible to ampicillin. This could be because an
antibiogram is available before an identification is available, and the
antibiogram is then not re-interpreted based on the identification
(namely, <em>Klebsiella</em>). EUCAST expert rules solve this, that can
be applied using <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>:</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">oops</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>mo <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"Klebsiella"</span>,
<span class="st">"Escherichia"</span><span class="op">)</span>,
@ -226,7 +247,10 @@
<span class="co"># mo ampicillin</span>
<span class="co"># 1 Klebsiella R</span>
<span class="co"># 2 Escherichia S</span></code></pre></div>
<p>A more convenient function is <code><a href="../reference/mo_property.html">mo_is_intrinsic_resistant()</a></code> that uses the same guideline, but allows to check for one or more specific microorganisms or antibiotics:</p>
<p>A more convenient function is
<code><a href="../reference/mo_property.html">mo_is_intrinsic_resistant()</a></code> that uses the same guideline,
but allows to check for one or more specific microorganisms or
antibiotics:</p>
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="../reference/mo_property.html">mo_is_intrinsic_resistant</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"Klebsiella"</span>, <span class="st">"Escherichia"</span><span class="op">)</span>,
<span class="st">"ampicillin"</span><span class="op">)</span>
@ -235,7 +259,11 @@
<span class="fu"><a href="../reference/mo_property.html">mo_is_intrinsic_resistant</a></span><span class="op">(</span><span class="st">"Klebsiella"</span>,
<span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"ampicillin"</span>, <span class="st">"kanamycin"</span><span class="op">)</span><span class="op">)</span>
<span class="co"># [1] TRUE FALSE</span></code></pre></div>
<p>EUCAST rules can not only be used for correction, they can also be used for filling in known resistance and susceptibility based on results of other antimicrobials drugs. This process is called <em>interpretive reading</em>, is basically a form of imputation, and is part of the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function as well:</p>
<p>EUCAST rules can not only be used for correction, they can also be
used for filling in known resistance and susceptibility based on results
of other antimicrobials drugs. This process is called <em>interpretive
reading</em>, is basically a form of imputation, and is part of the
<code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function as well:</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>mo <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"Staphylococcus aureus"</span>,
<span class="st">"Enterococcus faecalis"</span>,
@ -402,7 +430,7 @@
<div class="pkgdown">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer>

View File

@ -0,0 +1,15 @@
// Hide empty <a> tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) -->
// v0.0.1
// Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020.
document.addEventListener('DOMContentLoaded', function() {
const codeList = document.getElementsByClassName("sourceCode");
for (var i = 0; i < codeList.length; i++) {
var linkList = codeList[i].getElementsByTagName('a');
for (var j = 0; j < linkList.length; j++) {
if (linkList[j].innerHTML === "") {
linkList[j].setAttribute('aria-hidden', 'true');
}
}
}
});

View File

@ -1,12 +0,0 @@
// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
// be compatible with the behavior of Pandoc < 2.8).
document.addEventListener('DOMContentLoaded', function(e) {
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
var i, h, a;
for (i = 0; i < hs.length; i++) {
h = hs[i];
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
a = h.attributes;
while (a.length > 0) h.removeAttribute(a[0].name);
}
});

View File

@ -44,7 +44,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="Released version">1.8.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9008</span>
</span>
</div>
@ -58,7 +58,7 @@
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa fa-question-circle"></span>
How to
@ -188,7 +188,8 @@
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header toc-ignore">
<h1 data-toc-skip>How to determine multi-drug resistance (MDR)</h1>
<h1 data-toc-skip>How to determine multi-drug resistance
(MDR)</h1>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/HEAD/vignettes/MDR.Rmd" class="external-link"><code>vignettes/MDR.Rmd</code></a></small>
@ -198,54 +199,87 @@
<p>With the function <code><a href="../reference/mdro.html">mdro()</a></code>, you can determine which micro-organisms are multi-drug resistant organisms (MDRO).</p>
<p>With the function <code><a href="../reference/mdro.html">mdro()</a></code>, you can determine which
micro-organisms are multi-drug resistant organisms (MDRO).</p>
<div class="section level3">
<h3 id="type-of-input">Type of input<a class="anchor" aria-label="anchor" href="#type-of-input"></a>
</h3>
<p>The <code><a href="../reference/mdro.html">mdro()</a></code> function takes a data set as input, such as a regular <code>data.frame</code>. It tries to automatically determine the right columns for info about your isolates, such as the name of the species and all columns with results of antimicrobial agents. See the help page for more info about how to set the right settings for your data with the command <code><a href="../reference/mdro.html">?mdro</a></code>.</p>
<p>For WHONET data (and most other data), all settings are automatically set correctly.</p>
<p>The <code><a href="../reference/mdro.html">mdro()</a></code> function takes a data set as input, such as a
regular <code>data.frame</code>. It tries to automatically determine the
right columns for info about your isolates, such as the name of the
species and all columns with results of antimicrobial agents. See the
help page for more info about how to set the right settings for your
data with the command <code><a href="../reference/mdro.html">?mdro</a></code>.</p>
<p>For WHONET data (and most other data), all settings are automatically
set correctly.</p>
</div>
<div class="section level3">
<h3 id="guidelines">Guidelines<a class="anchor" aria-label="anchor" href="#guidelines"></a>
</h3>
<p>The <code><a href="../reference/mdro.html">mdro()</a></code> function support multiple guidelines. You can select a guideline with the <code>guideline</code> parameter. Currently supported guidelines are (case-insensitive):</p>
<p>The <code><a href="../reference/mdro.html">mdro()</a></code> function support multiple guidelines. You can
select a guideline with the <code>guideline</code> parameter. Currently
supported guidelines are (case-insensitive):</p>
<ul>
<li>
<p><code>guideline = "CMI2012"</code> (default)</p>
<p>Magiorakos AP, Srinivasan A <em>et al.</em> “Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance.” Clinical Microbiology and Infection (2012) (<a href="https://www.clinicalmicrobiologyandinfection.com/article/S1198-743X(14)61632-3/fulltext" class="external-link">link</a>)</p>
<p>Magiorakos AP, Srinivasan A <em>et al.</em> “Multidrug-resistant,
extensively drug-resistant and pandrug-resistant bacteria: an
international expert proposal for interim standard definitions for
acquired resistance.” Clinical Microbiology and Infection (2012) (<a href="https://www.clinicalmicrobiologyandinfection.com/article/S1198-743X(14)61632-3/fulltext" class="external-link">link</a>)</p>
</li>
<li>
<p><code>guideline = "EUCAST3.2"</code> (or simply <code>guideline = "EUCAST"</code>)</p>
<p>The European international guideline - EUCAST Expert Rules Version 3.2 “Intrinsic Resistance and Unusual Phenotypes” (<a href="https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/2020/Intrinsic_Resistance_and_Unusual_Phenotypes_Tables_v3.2_20200225.pdf" class="external-link">link</a>)</p>
<p><code>guideline = "EUCAST3.2"</code> (or simply
<code>guideline = "EUCAST"</code>)</p>
<p>The European international guideline - EUCAST Expert Rules Version
3.2 “Intrinsic Resistance and Unusual Phenotypes” (<a href="https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/2020/Intrinsic_Resistance_and_Unusual_Phenotypes_Tables_v3.2_20200225.pdf" class="external-link">link</a>)</p>
</li>
<li>
<p><code>guideline = "EUCAST3.1"</code></p>
<p>The European international guideline - EUCAST Expert Rules Version 3.1 “Intrinsic Resistance and Exceptional Phenotypes Tables” (<a href="https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf" class="external-link">link</a>)</p>
<p>The European international guideline - EUCAST Expert Rules Version
3.1 “Intrinsic Resistance and Exceptional Phenotypes Tables” (<a href="https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf" class="external-link">link</a>)</p>
</li>
<li>
<p><code>guideline = "TB"</code></p>
<p>The international guideline for multi-drug resistant tuberculosis - World Health Organization “Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis” (<a href="https://www.who.int/tb/publications/pmdt_companionhandbook/en/" class="external-link">link</a>)</p>
<p>The international guideline for multi-drug resistant tuberculosis -
World Health Organization “Companion handbook to the WHO guidelines for
the programmatic management of drug-resistant tuberculosis” (<a href="https://www.who.int/tb/publications/pmdt_companionhandbook/en/" class="external-link">link</a>)</p>
</li>
<li>
<p><code>guideline = "MRGN"</code></p>
<p>The German national guideline - Mueller <em>et al.</em> (2015) Antimicrobial Resistance and Infection Control 4:7. DOI: 10.1186/s13756-015-0047-6</p>
<p>The German national guideline - Mueller <em>et al.</em> (2015)
Antimicrobial Resistance and Infection Control 4:7. DOI:
10.1186/s13756-015-0047-6</p>
</li>
<li>
<p><code>guideline = "BRMO"</code></p>
<p>The Dutch national guideline - Rijksinstituut voor Volksgezondheid en Milieu “WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) (ZKH)” (<a href="https://www.rivm.nl/wip-richtlijn-brmo-bijzonder-resistente-micro-organismen-zkh" class="external-link">link</a>)</p>
<p>The Dutch national guideline - Rijksinstituut voor Volksgezondheid en
Milieu “WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen)
(ZKH)” (<a href="https://www.rivm.nl/wip-richtlijn-brmo-bijzonder-resistente-micro-organismen-zkh" class="external-link">link</a>)</p>
</li>
</ul>
<p>Please suggest your own (country-specific) guidelines by letting us know: <a href="https://github.com/msberends/AMR/issues/new" class="external-link uri">https://github.com/msberends/AMR/issues/new</a>.</p>
<p>Please suggest your own (country-specific) guidelines by letting us
know: <a href="https://github.com/msberends/AMR/issues/new" class="external-link uri">https://github.com/msberends/AMR/issues/new</a>.</p>
<div class="section level4">
<h4 id="custom-guidelines">Custom Guidelines<a class="anchor" aria-label="anchor" href="#custom-guidelines"></a>
</h4>
<p>You can also use your own custom guideline. Custom guidelines can be set with the <code><a href="../reference/mdro.html">custom_mdro_guideline()</a></code> function. This is of great importance if you have custom rules to determine MDROs in your hospital, e.g., rules that are dependent on ward, state of contact isolation or other variables in your data.</p>
<p>If you are familiar with <code><a href="https://dplyr.tidyverse.org/reference/case_when.html" class="external-link">case_when()</a></code> of the <code>dplyr</code> package, you will recognise the input method to set your own rules. Rules must be set using what R considers to be the formula notation:</p>
<p>You can also use your own custom guideline. Custom guidelines can be
set with the <code><a href="../reference/mdro.html">custom_mdro_guideline()</a></code> function. This is of
great importance if you have custom rules to determine MDROs in your
hospital, e.g., rules that are dependent on ward, state of contact
isolation or other variables in your data.</p>
<p>If you are familiar with <code><a href="https://dplyr.tidyverse.org/reference/case_when.html" class="external-link">case_when()</a></code> of the
<code>dplyr</code> package, you will recognise the input method to set
your own rules. Rules must be set using what R considers to be the
formula notation:</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">custom</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/mdro.html">custom_mdro_guideline</a></span><span class="op">(</span><span class="va">CIP</span> <span class="op">==</span> <span class="st">"R"</span> <span class="op">&amp;</span> <span class="va">age</span> <span class="op">&gt;</span> <span class="fl">60</span> <span class="op">~</span> <span class="st">"Elderly Type A"</span>,
<span class="va">ERY</span> <span class="op">==</span> <span class="st">"R"</span> <span class="op">&amp;</span> <span class="va">age</span> <span class="op">&gt;</span> <span class="fl">60</span> <span class="op">~</span> <span class="st">"Elderly Type B"</span><span class="op">)</span></code></pre></div>
<p>If a row/an isolate matches the first rule, the value after the first <code>~</code> (in this case <em>Elderly Type A</em>) will be set as MDRO value. Otherwise, the second rule will be tried and so on. The maximum number of rules is unlimited.</p>
<p>You can print the rules set in the console for an overview. Colours will help reading it if your console supports colours.</p>
<p>If a row/an isolate matches the first rule, the value after the first
<code>~</code> (in this case <em>Elderly Type A</em>) will be set as
MDRO value. Otherwise, the second rule will be tried and so on. The
maximum number of rules is unlimited.</p>
<p>You can print the rules set in the console for an overview. Colours
will help reading it if your console supports colours.</p>
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">custom</span>
<span class="co"># A set of custom MDRO rules:</span>
@ -255,7 +289,8 @@
<span class="co"># </span>
<span class="co"># Unmatched rows will return NA.</span>
<span class="co"># Results will be of class &lt;factor&gt;, with ordered levels: Negative &lt; Elderly Type A &lt; Elderly Type B</span></code></pre></div>
<p>The outcome of the function can be used for the <code>guideline</code> argument in the <code><a href="../reference/mdro.html">mdro()</a></code> function:</p>
<p>The outcome of the function can be used for the
<code>guideline</code> argument in the <code><a href="../reference/mdro.html">mdro()</a></code> function:</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/mdro.html">mdro</a></span><span class="op">(</span><span class="va">example_isolates</span>, guideline <span class="op">=</span> <span class="va">custom</span><span class="op">)</span>
<span class="co"># Determining MDROs based on custom rules, resulting in factor levels:</span>
@ -266,14 +301,25 @@
<span class="co"># x</span>
<span class="co"># Negative Elderly Type A Elderly Type B </span>
<span class="co"># 1070 198 732</span></code></pre></div>
<p>The rules set (the <code>custom</code> object in this case) could be exported to a shared file location using <code><a href="https://rdrr.io/r/base/readRDS.html" class="external-link">saveRDS()</a></code> if you collaborate with multiple users. The custom rules set could then be imported using <code><a href="https://rdrr.io/r/base/readRDS.html" class="external-link">readRDS()</a></code>.</p>
<p>The rules set (the <code>custom</code> object in this case) could be
exported to a shared file location using <code><a href="https://rdrr.io/r/base/readRDS.html" class="external-link">saveRDS()</a></code> if you
collaborate with multiple users. The custom rules set could then be
imported using <code><a href="https://rdrr.io/r/base/readRDS.html" class="external-link">readRDS()</a></code>.</p>
</div>
</div>
<div class="section level3">
<h3 id="examples">Examples<a class="anchor" aria-label="anchor" href="#examples"></a>
</h3>
<p>The <code><a href="../reference/mdro.html">mdro()</a></code> function always returns an ordered <code>factor</code> for predefined guidelines. For example, the output of the default guideline by Magiorakos <em>et al.</em> returns a <code>factor</code> with levels Negative, MDR, XDR or PDR in that order.</p>
<p>The next example uses the <code>example_isolates</code> data set. This is a data set included with this package and contains full antibiograms of 2,000 microbial isolates. It reflects reality and can be used to practise AMR data analysis. If we test the MDR/XDR/PDR guideline on this data set, we get:</p>
<p>The <code><a href="../reference/mdro.html">mdro()</a></code> function always returns an ordered
<code>factor</code> for predefined guidelines. For example, the output
of the default guideline by Magiorakos <em>et al.</em> returns a
<code>factor</code> with levels Negative, MDR, XDR or PDR in
that order.</p>
<p>The next example uses the <code>example_isolates</code> data set.
This is a data set included with this package and contains full
antibiograms of 2,000 microbial isolates. It reflects reality and can be
used to practise AMR data analysis. If we test the MDR/XDR/PDR guideline
on this data set, we get:</p>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org" class="external-link">dplyr</a></span><span class="op">)</span> <span class="co"># to support pipes: %&gt;%</span>
<span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/msberends/cleaner" class="external-link">cleaner</a></span><span class="op">)</span> <span class="co"># to create frequency tables</span></code></pre></div>
@ -295,18 +341,34 @@
<span class="co"># Table 3 - Enterobacteriaceae... OK.</span>
<span class="co"># Table 4 - Pseudomonas aeruginosa... OK.</span>
<span class="co"># Table 5 - Acinetobacter spp.... OK.</span>
<span class="co"># Warning: NA introduced for isolates where the available percentage of antimicrobial</span>
<span class="co"># classes was below 50% (set with `pct_required_classes`)</span></code></pre></div>
<p>Only results with R are considered as resistance. Use <code>combine_SI = FALSE</code> to also consider I as resistance.</p>
<p>Determining multidrug-resistant organisms (MDRO), according to: Guideline: Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance. Author(s): Magiorakos AP, Srinivasan A, Carey RB, …, Vatopoulos A, Weber JT, Monnet DL Source: Clinical Microbiology and Infection 18:3, 2012; doi: 10.1111/j.1469-0691.2011.03570.x</p>
<span class="co"># Warning: in `mdro()`: NA introduced for isolates where the available percentage of</span>
<span class="co"># antimicrobial classes was below 50% (set with `pct_required_classes`)</span></code></pre></div>
<p>Only results with R are considered as resistance. Use
<code>combine_SI = FALSE</code> to also consider I as resistance.</p>
<p>Determining multidrug-resistant organisms (MDRO), according to:
Guideline: Multidrug-resistant, extensively drug-resistant and
pandrug-resistant bacteria: an international expert proposal for interim
standard definitions for acquired resistance. Author(s): Magiorakos AP,
Srinivasan A, Carey RB, …, Vatopoulos A, Weber JT, Monnet DL Source:
Clinical Microbiology and Infection 18:3, 2012; doi:
10.1111/j.1469-0691.2011.03570.x</p>
<p>(16 isolates had no test results)</p>
<p><strong>Frequency table</strong></p>
<p>Class: factor &gt; ordered (numeric)<br>
Length: 2,000<br>
Levels: 4: Negative &lt; Multi-drug-resistant (MDR) &lt; Extensively drug-resistant …<br>
Levels: 4: Negative &lt; Multi-drug-resistant (MDR) &lt; Extensively
drug-resistant …<br>
Available: 1,729 (86.45%, NA: 271 = 13.55%)<br>
Unique: 2</p>
<table class="table">
<table style="width:100%;" class="table">
<colgroup>
<col width="4%">
<col width="38%">
<col width="9%">
<col width="12%">
<col width="16%">
<col width="19%">
</colgroup>
<thead><tr class="header">
<th align="left"></th>
<th align="left">Item</th>
@ -320,21 +382,22 @@ Unique: 2</p>
<td align="left">1</td>
<td align="left">Negative</td>
<td align="right">1601</td>
<td align="right">92.60%</td>
<td align="right">92.6%</td>
<td align="right">1601</td>
<td align="right">92.60%</td>
<td align="right">92.6%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Multi-drug-resistant (MDR)</td>
<td align="right">128</td>
<td align="right">7.40%</td>
<td align="right">7.4%</td>
<td align="right">1729</td>
<td align="right">100.00%</td>
<td align="right">100.0%</td>
</tr>
</tbody>
</table>
<p>For another example, I will create a data set to determine multi-drug resistant TB:</p>
<p>For another example, I will create a data set to determine multi-drug
resistant TB:</p>
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># random_rsi() is a helper function to generate</span>
<span class="co"># a random vector with values S, I and R</span>
@ -345,7 +408,8 @@ Unique: 2</p>
pyrazinamide <span class="op">=</span> <span class="fu"><a href="../reference/random.html">random_rsi</a></span><span class="op">(</span><span class="fl">5000</span><span class="op">)</span>,
moxifloxacin <span class="op">=</span> <span class="fu"><a href="../reference/random.html">random_rsi</a></span><span class="op">(</span><span class="fl">5000</span><span class="op">)</span>,
kanamycin <span class="op">=</span> <span class="fu"><a href="../reference/random.html">random_rsi</a></span><span class="op">(</span><span class="fl">5000</span><span class="op">)</span><span class="op">)</span></code></pre></div>
<p>Because all column names are automatically verified for valid drug names or codes, this would have worked exactly the same way:</p>
<p>Because all column names are automatically verified for valid drug
names or codes, this would have worked exactly the same way:</p>
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">my_TB_data</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>RIF <span class="op">=</span> <span class="fu"><a href="../reference/random.html">random_rsi</a></span><span class="op">(</span><span class="fl">5000</span><span class="op">)</span>,
INH <span class="op">=</span> <span class="fu"><a href="../reference/random.html">random_rsi</a></span><span class="op">(</span><span class="fl">5000</span><span class="op">)</span>,
@ -358,20 +422,21 @@ Unique: 2</p>
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="va">my_TB_data</span><span class="op">)</span>
<span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span>
<span class="co"># 1 I R I S R S</span>
<span class="co"># 2 I S R R S R</span>
<span class="co"># 3 R I S I R S</span>
<span class="co"># 4 S S I R I S</span>
<span class="co"># 5 S R S S S I</span>
<span class="co"># 6 S R R S R I</span>
<span class="co"># 1 R I R R I S</span>
<span class="co"># 2 I I S S R S</span>
<span class="co"># 3 I S R R S R</span>
<span class="co"># 4 R I S R R I</span>
<span class="co"># 5 R I I I R I</span>
<span class="co"># 6 R I R S R I</span>
<span class="co"># kanamycin</span>
<span class="co"># 1 S</span>
<span class="co"># 2 I</span>
<span class="co"># 3 R</span>
<span class="co"># 4 R</span>
<span class="co"># 1 R</span>
<span class="co"># 2 R</span>
<span class="co"># 3 S</span>
<span class="co"># 4 I</span>
<span class="co"># 5 I</span>
<span class="co"># 6 R</span></code></pre></div>
<p>We can now add the interpretation of MDR-TB to our data set. You can use:</p>
<p>We can now add the interpretation of MDR-TB to our data set. You can
use:</p>
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="../reference/mdro.html">mdro</a></span><span class="op">(</span><span class="va">my_TB_data</span>, guideline <span class="op">=</span> <span class="st">"TB"</span><span class="op">)</span></code></pre></div>
<p>or its shortcut <code><a href="../reference/mdro.html">mdr_tb()</a></code>:</p>
@ -390,17 +455,26 @@ Unique: 2</p>
<span class="co"># management of drug-resistant tuberculosis</span>
<span class="co"># Author(s): WHO (World Health Organization)</span>
<span class="co"># Version: WHO/HTM/TB/2014.11, 2014</span>
<span class="co"># Source: https://www.who.int/tb/publications/pmdt_companionhandbook/en/</span></code></pre></div>
<span class="co"># Source: https://www.who.int/publications/i/item/9789241548809</span></code></pre></div>
<p>Create a frequency table of the results:</p>
<div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html" class="external-link">freq</a></span><span class="op">(</span><span class="va">my_TB_data</span><span class="op">$</span><span class="va">mdr</span><span class="op">)</span></code></pre></div>
<p><strong>Frequency table</strong></p>
<p>Class: factor &gt; ordered (numeric)<br>
Length: 5,000<br>
Levels: 5: Negative &lt; Mono-resistant &lt; Poly-resistant &lt; Multi-drug-resistant &lt;<br>
Available: 5,000 (100.0%, NA: 0 = 0.0%)<br>
Levels: 5: Negative &lt; Mono-resistant &lt; Poly-resistant &lt;
Multi-drug-resistant &lt;<br>
Available: 5,000 (100%, NA: 0 = 0%)<br>
Unique: 5</p>
<table class="table">
<table style="width:100%;" class="table">
<colgroup>
<col width="4%">
<col width="38%">
<col width="9%">
<col width="12%">
<col width="16%">
<col width="19%">
</colgroup>
<thead><tr class="header">
<th align="left"></th>
<th align="left">Item</th>
@ -413,40 +487,40 @@ Unique: 5</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Mono-resistant</td>
<td align="right">3250</td>
<td align="right">65.00%</td>
<td align="right">3250</td>
<td align="right">65.00%</td>
<td align="right">3218</td>
<td align="right">64.36%</td>
<td align="right">3218</td>
<td align="right">64.36%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Negative</td>
<td align="right">975</td>
<td align="right">19.50%</td>
<td align="right">4225</td>
<td align="right">84.50%</td>
<td align="right">979</td>
<td align="right">19.58%</td>
<td align="right">4197</td>
<td align="right">83.94%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Multi-drug-resistant</td>
<td align="right">474</td>
<td align="right">9.48%</td>
<td align="right">4699</td>
<td align="right">93.98%</td>
<td align="right">458</td>
<td align="right">9.16%</td>
<td align="right">4655</td>
<td align="right">93.10%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Poly-resistant</td>
<td align="right">203</td>
<td align="right">4.06%</td>
<td align="right">4902</td>
<td align="right">98.04%</td>
<td align="right">237</td>
<td align="right">4.74%</td>
<td align="right">4892</td>
<td align="right">97.84%</td>
</tr>
<tr class="odd">
<td align="left">5</td>
<td align="left">Extensively drug-resistant</td>
<td align="right">98</td>
<td align="right">1.96%</td>
<td align="right">108</td>
<td align="right">2.16%</td>
<td align="right">5000</td>
<td align="right">100.00%</td>
</tr>
@ -470,7 +544,7 @@ Unique: 5</p>
<div class="pkgdown">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer>

View File

@ -0,0 +1,15 @@
// Hide empty <a> tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) -->
// v0.0.1
// Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020.
document.addEventListener('DOMContentLoaded', function() {
const codeList = document.getElementsByClassName("sourceCode");
for (var i = 0; i < codeList.length; i++) {
var linkList = codeList[i].getElementsByTagName('a');
for (var j = 0; j < linkList.length; j++) {
if (linkList[j].innerHTML === "") {
linkList[j].setAttribute('aria-hidden', 'true');
}
}
}
});

View File

@ -1,12 +0,0 @@
// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
// be compatible with the behavior of Pandoc < 2.8).
document.addEventListener('DOMContentLoaded', function(e) {
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
var i, h, a;
for (i = 0; i < hs.length; i++) {
h = hs[i];
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
a = h.attributes;
while (a.length > 0) h.removeAttribute(a[0].name);
}
});

View File

@ -1,12 +0,0 @@
// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
// be compatible with the behavior of Pandoc < 2.8).
document.addEventListener('DOMContentLoaded', function(e) {
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
var i, h, a;
for (i = 0; i < hs.length; i++) {
h = hs[i];
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
a = h.attributes;
while (a.length > 0) h.removeAttribute(a[0].name);
}
});

View File

@ -44,7 +44,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="Released version">1.8.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9008</span>
</span>
</div>
@ -58,7 +58,7 @@
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa fa-question-circle"></span>
How to
@ -188,7 +188,8 @@
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header toc-ignore">
<h1 data-toc-skip>How to conduct principal component analysis (PCA) for AMR</h1>
<h1 data-toc-skip>How to conduct principal component analysis
(PCA) for AMR</h1>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/HEAD/vignettes/PCA.Rmd" class="external-link"><code>vignettes/PCA.Rmd</code></a></small>
@ -198,19 +199,21 @@
<p><strong>NOTE: This page will be updated soon, as the pca() function is currently being developed.</strong></p>
<div class="section level1">
<h1 id="introduction">Introduction<a class="anchor" aria-label="anchor" href="#introduction"></a>
</h1>
<p><strong>NOTE: This page will be updated soon, as the pca() function
is currently being developed.</strong></p>
<div class="section level2">
<h2 id="introduction">Introduction<a class="anchor" aria-label="anchor" href="#introduction"></a>
</h2>
</div>
<div class="section level1">
<h1 id="transforming">Transforming<a class="anchor" aria-label="anchor" href="#transforming"></a>
</h1>
<p>For PCA, we need to transform our AMR data first. This is what the <code>example_isolates</code> data set in this package looks like:</p>
<div class="section level2">
<h2 id="transforming">Transforming<a class="anchor" aria-label="anchor" href="#transforming"></a>
</h2>
<p>For PCA, we need to transform our AMR data first. This is what the
<code>example_isolates</code> data set in this package looks like:</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://msberends.github.io/AMR">AMR</a></span><span class="op">)</span>
<code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://msberends.github.io/AMR/">AMR</a></span><span class="op">)</span>
<span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org" class="external-link">dplyr</a></span><span class="op">)</span>
<span class="fu"><a href="https://pillar.r-lib.org/reference/glimpse.html" class="external-link">glimpse</a></span><span class="op">(</span><span class="va">example_isolates</span><span class="op">)</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/glimpse.html" class="external-link">glimpse</a></span><span class="op">(</span><span class="va">example_isolates</span><span class="op">)</span>
<span class="co"># Rows: 2,000</span>
<span class="co"># Columns: 49</span>
<span class="co"># $ date <span style="color: #949494; font-style: italic;">&lt;date&gt;</span> 2002-01-02, 2002-01-03, 2002-01-07, 2002-01-07, 2002-…</span>
@ -262,7 +265,8 @@
<span class="co"># $ COL <span style="color: #949494; font-style: italic;">&lt;rsi&gt;</span> NA, NA, R, R, R, R, R, R, R, R, R, R, NA, NA, NA, R, R…</span>
<span class="co"># $ MUP <span style="color: #949494; font-style: italic;">&lt;rsi&gt;</span> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…</span>
<span class="co"># $ RIF <span style="color: #949494; font-style: italic;">&lt;rsi&gt;</span> R, R, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, R, R, R,…</span></code></pre></div>
<p>Now to transform this to a data set with only resistance percentages per taxonomic order and genus:</p>
<p>Now to transform this to a data set with only resistance percentages
per taxonomic order and genus:</p>
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">resistance_data</span> <span class="op">&lt;-</span> <span class="va">example_isolates</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html" class="external-link">group_by</a></span><span class="op">(</span>order <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_order</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span>, <span class="co"># group on anything, like order</span>
@ -283,35 +287,44 @@
<span class="co"># <span style="color: #BCBCBC;">5</span> Caryophanales Gemella <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span></span>
<span class="co"># <span style="color: #BCBCBC;">6</span> Caryophanales Listeria <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span></span></code></pre></div>
</div>
<div class="section level1">
<h1 id="perform-principal-component-analysis">Perform principal component analysis<a class="anchor" aria-label="anchor" href="#perform-principal-component-analysis"></a>
</h1>
<p>The new <code><a href="../reference/pca.html">pca()</a></code> function will automatically filter on rows that contain numeric values in all selected variables, so we now only need to do:</p>
<div class="section level2">
<h2 id="perform-principal-component-analysis">Perform principal component analysis<a class="anchor" aria-label="anchor" href="#perform-principal-component-analysis"></a>
</h2>
<p>The new <code><a href="../reference/pca.html">pca()</a></code> function will automatically filter on rows
that contain numeric values in all selected variables, so we now only
need to do:</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">pca_result</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/pca.html">pca</a></span><span class="op">(</span><span class="va">resistance_data</span><span class="op">)</span>
<span class="co"># Columns selected for PCA: "AMC", "CAZ", "CTX", "CXM", "GEN", "SXT", "TMP"</span>
<span class="co"># and "TOB". Total observations available: 7.</span></code></pre></div>
<p>The result can be reviewed with the good old <code><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary()</a></code> function:</p>
<p>The result can be reviewed with the good old <code><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary()</a></code>
function:</p>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">pca_result</span><span class="op">)</span>
<span class="co"># Groups (n=4, named as 'order'):</span>
<span class="co"># [1] "Caryophanales" "Enterobacterales" "Lactobacillales" "Pseudomonadales"</span>
<span class="co"># Importance of components:</span>
<span class="co"># PC1 PC2 PC3 PC4 PC5 PC6 PC7</span>
<span class="co"># Standard deviation 2.1539 1.6807 0.6138 0.33879 0.20808 0.03140 5.121e-17</span>
<span class="co"># Standard deviation 2.1539 1.6807 0.6138 0.33879 0.20808 0.03140 5.674e-17</span>
<span class="co"># Proportion of Variance 0.5799 0.3531 0.0471 0.01435 0.00541 0.00012 0.000e+00</span>
<span class="co"># Cumulative Proportion 0.5799 0.9330 0.9801 0.99446 0.99988 1.00000 1.000e+00</span></code></pre></div>
<pre><code><span class="co"># Groups (n=4, named as 'order'):</span>
<span class="co"># [1] "Caryophanales" "Enterobacterales" "Lactobacillales" "Pseudomonadales"</span></code></pre>
<p>Good news. The first two components explain a total of 93.3% of the variance (see the PC1 and PC2 values of the <em>Proportion of Variance</em>. We can create a so-called biplot with the base R <code><a href="https://rdrr.io/r/stats/biplot.html" class="external-link">biplot()</a></code> function, to see which antimicrobial resistance per drug explain the difference per microorganism.</p>
<p>Good news. The first two components explain a total of 93.3% of the
variance (see the PC1 and PC2 values of the <em>Proportion of
Variance</em>. We can create a so-called biplot with the base R
<code><a href="https://rdrr.io/r/stats/biplot.html" class="external-link">biplot()</a></code> function, to see which antimicrobial resistance
per drug explain the difference per microorganism.</p>
</div>
<div class="section level1">
<h1 id="plotting-the-results">Plotting the results<a class="anchor" aria-label="anchor" href="#plotting-the-results"></a>
</h1>
<div class="section level2">
<h2 id="plotting-the-results">Plotting the results<a class="anchor" aria-label="anchor" href="#plotting-the-results"></a>
</h2>
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/stats/biplot.html" class="external-link">biplot</a></span><span class="op">(</span><span class="va">pca_result</span><span class="op">)</span></code></pre></div>
<p><img src="PCA_files/figure-html/unnamed-chunk-5-1.png" width="750"></p>
<p>But we cant see the explanation of the points. Perhaps this works better with our new <code><a href="../reference/ggplot_pca.html">ggplot_pca()</a></code> function, that automatically adds the right labels and even groups:</p>
<p>But we cant see the explanation of the points. Perhaps this works
better with our new <code><a href="../reference/ggplot_pca.html">ggplot_pca()</a></code> function, that
automatically adds the right labels and even groups:</p>
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="../reference/ggplot_pca.html">ggplot_pca</a></span><span class="op">(</span><span class="va">pca_result</span><span class="op">)</span></code></pre></div>
<p><img src="PCA_files/figure-html/unnamed-chunk-6-1.png" width="750"></p>
@ -340,7 +353,7 @@
<div class="pkgdown">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer>

View File

@ -0,0 +1,15 @@
// Hide empty <a> tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) -->
// v0.0.1
// Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020.
document.addEventListener('DOMContentLoaded', function() {
const codeList = document.getElementsByClassName("sourceCode");
for (var i = 0; i < codeList.length; i++) {
var linkList = codeList[i].getElementsByTagName('a');
for (var j = 0; j < linkList.length; j++) {
if (linkList[j].innerHTML === "") {
linkList[j].setAttribute('aria-hidden', 'true');
}
}
}
});

Some files were not shown because too many files have changed in this diff Show More