mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 20:02:04 +02:00
Compare commits
17 Commits
v2.0.0
...
5f9769a4f7
Author | SHA1 | Date | |
---|---|---|---|
5f9769a4f7 | |||
8179092c57 | |||
91fa73dedf | |||
bf08d136a0 | |||
9de19fdc49 | |||
9148a2dcf4 | |||
2758615cd0 | |||
02322ac2ee | |||
cabffb22fd | |||
ad3061c754 | |||
1a02d302d4 | |||
ed70f95380 | |||
147f9112e9 | |||
549790c2a6 | |||
c28cfa3a77 | |||
dd7cc86485 | |||
68aa98f294 |
@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 2.0.0
|
Version: 2.0.0.9015
|
||||||
Date: 2023-03-12
|
Date: 2023-05-12
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||||
data analysis and to work with microbial and antimicrobial properties by
|
data analysis and to work with microbial and antimicrobial properties by
|
||||||
|
@ -330,6 +330,7 @@ export(mo_gbif)
|
|||||||
export(mo_genus)
|
export(mo_genus)
|
||||||
export(mo_gramstain)
|
export(mo_gramstain)
|
||||||
export(mo_info)
|
export(mo_info)
|
||||||
|
export(mo_is_anaerobic)
|
||||||
export(mo_is_gram_negative)
|
export(mo_is_gram_negative)
|
||||||
export(mo_is_gram_positive)
|
export(mo_is_gram_positive)
|
||||||
export(mo_is_intrinsic_resistant)
|
export(mo_is_intrinsic_resistant)
|
||||||
@ -339,6 +340,7 @@ export(mo_lpsn)
|
|||||||
export(mo_matching_score)
|
export(mo_matching_score)
|
||||||
export(mo_name)
|
export(mo_name)
|
||||||
export(mo_order)
|
export(mo_order)
|
||||||
|
export(mo_oxygen_tolerance)
|
||||||
export(mo_pathogenicity)
|
export(mo_pathogenicity)
|
||||||
export(mo_phylum)
|
export(mo_phylum)
|
||||||
export(mo_property)
|
export(mo_property)
|
||||||
|
15
NEWS.md
15
NEWS.md
@ -1,3 +1,18 @@
|
|||||||
|
# AMR 2.0.0.9015
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
* Added oxygen tolerance to over 25,000 bacteria in the `microorganisms` data set
|
||||||
|
* Added `mo_oxygen_tolerance()` to retrieve the values
|
||||||
|
* Added `mo_is_anaerobic()` to determine which species are obligate anaerobic bacteria
|
||||||
|
* Added LPSN and GBIF identifiers, and oxygen tolerance to `mo_info()`
|
||||||
|
* formatting fix for `sir_interpretation_history()`
|
||||||
|
* Fixed some WHONET codes for microorganisms and consequently a couple of entries in `clinical_breakpoints`
|
||||||
|
* Added microbial codes for Gram-negative/positive anaerobic bacteria
|
||||||
|
* `mo_rank()` now returns `NA` for 'unknown' microorganisms (`B_ANAER`, `B_ANAER-NEG`, `B_ANAER-POS`, `B_GRAMN`, `B_GRAMP`, `F_FUNGUS`, `F_YEAST`, and `UNKNOWN`)
|
||||||
|
* Fixed a bug for `as.mo()` that led to coercion of `NA` values when using custom microorganism codes
|
||||||
|
* Added SAS Transport files (file extension `.xpt`) to [our download page](https://msberends.github.io/AMR/articles/datasets.html) to use in SAS software
|
||||||
|
|
||||||
|
|
||||||
# AMR 2.0.0
|
# AMR 2.0.0
|
||||||
|
|
||||||
This is a new major release of the AMR package, with great new additions but also some breaking changes for current users. These are all listed below.
|
This is a new major release of the AMR package, with great new additions but also some breaking changes for current users. These are all listed below.
|
||||||
|
@ -505,7 +505,7 @@ word_wrap <- function(...,
|
|||||||
|
|
||||||
# clean introduced whitespace between fullstops
|
# clean introduced whitespace between fullstops
|
||||||
msg <- gsub("[.] +[.]", "..", msg)
|
msg <- gsub("[.] +[.]", "..", msg)
|
||||||
# remove extra space that was introduced (e.g. "Smith et al., 2022")
|
# remove extra space that was introduced (e.g. "Smith et al. , 2022")
|
||||||
msg <- gsub(". ,", ".,", msg, fixed = TRUE)
|
msg <- gsub(". ,", ".,", msg, fixed = TRUE)
|
||||||
msg <- gsub("[ ,", "[,", msg, fixed = TRUE)
|
msg <- gsub("[ ,", "[,", msg, fixed = TRUE)
|
||||||
msg <- gsub("/ /", "//", msg, fixed = TRUE)
|
msg <- gsub("/ /", "//", msg, fixed = TRUE)
|
||||||
@ -644,10 +644,13 @@ format_included_data_number <- function(data) {
|
|||||||
rounder <- -3 # round on thousands
|
rounder <- -3 # round on thousands
|
||||||
} else if (n > 1000) {
|
} else if (n > 1000) {
|
||||||
rounder <- -2 # round on hundreds
|
rounder <- -2 # round on hundreds
|
||||||
|
} else if (n < 50) {
|
||||||
|
# do not round
|
||||||
|
rounder <- 0
|
||||||
} else {
|
} else {
|
||||||
rounder <- -1 # round on tens
|
rounder <- -1 # round on tens
|
||||||
}
|
}
|
||||||
paste0("~", format(round(n, rounder), decimal.mark = ".", big.mark = " "))
|
paste0(ifelse(rounder == 0, "", "~"), format(round(n, rounder), decimal.mark = ".", big.mark = " "))
|
||||||
}
|
}
|
||||||
|
|
||||||
# for eucast_rules() and mdro(), creates markdown output with URLs and names
|
# for eucast_rules() and mdro(), creates markdown output with URLs and names
|
||||||
@ -670,10 +673,15 @@ create_eucast_ab_documentation <- function() {
|
|||||||
atcs <- ab_atc(ab, only_first = TRUE)
|
atcs <- ab_atc(ab, only_first = TRUE)
|
||||||
# only keep ABx with an ATC code:
|
# only keep ABx with an ATC code:
|
||||||
ab <- ab[!is.na(atcs)]
|
ab <- ab[!is.na(atcs)]
|
||||||
|
atcs <- atcs[!is.na(atcs)]
|
||||||
|
|
||||||
|
# sort all vectors on name:
|
||||||
ab_names <- ab_name(ab, language = NULL, tolower = TRUE)
|
ab_names <- ab_name(ab, language = NULL, tolower = TRUE)
|
||||||
ab <- ab[order(ab_names)]
|
ab <- ab[order(ab_names)]
|
||||||
|
atcs <- atcs[order(ab_names)]
|
||||||
ab_names <- ab_names[order(ab_names)]
|
ab_names <- ab_names[order(ab_names)]
|
||||||
atc_txt <- paste0("[", atcs[!is.na(atcs)], "](", ab_url(ab), ")")
|
# create the text:
|
||||||
|
atc_txt <- paste0("[", atcs, "](", ab_url(ab), ")")
|
||||||
out <- paste0(ab_names, " (`", ab, "`, ", atc_txt, ")", collapse = ", ")
|
out <- paste0(ab_names, " (`", ab, "`, ", atc_txt, ")", collapse = ", ")
|
||||||
substr(out, 1, 1) <- toupper(substr(out, 1, 1))
|
substr(out, 1, 1) <- toupper(substr(out, 1, 1))
|
||||||
out
|
out
|
||||||
|
@ -224,7 +224,7 @@
|
|||||||
#' # in an Rmd file, you would just need to return `ureido` in a chunk,
|
#' # in an Rmd file, you would just need to return `ureido` in a chunk,
|
||||||
#' # but to be explicit here:
|
#' # but to be explicit here:
|
||||||
#' if (requireNamespace("knitr")) {
|
#' if (requireNamespace("knitr")) {
|
||||||
#' knitr::knit_print(ureido)
|
#' cat(knitr::knit_print(ureido))
|
||||||
#' }
|
#' }
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
|
@ -247,19 +247,14 @@ add_custom_microorganisms <- function(x) {
|
|||||||
"CUSTOM",
|
"CUSTOM",
|
||||||
seq.int(from = current + 1, to = current + nrow(x), by = 1),
|
seq.int(from = current + 1, to = current + nrow(x), by = 1),
|
||||||
"_",
|
"_",
|
||||||
toupper(unname(abbreviate(
|
trimws(
|
||||||
gsub(
|
paste(abbreviate_mo(x$genus, 5),
|
||||||
" +", " _ ",
|
abbreviate_mo(x$species, 4, hyphen_as_space = TRUE),
|
||||||
gsub(
|
abbreviate_mo(x$subspecies, 4, hyphen_as_space = TRUE),
|
||||||
"[^A-Za-z0-9-]", " ",
|
sep = "_"),
|
||||||
trimws2(paste(x$genus, x$species, x$subspecies))
|
whitespace = "_"))
|
||||||
)
|
|
||||||
),
|
|
||||||
minlength = 10
|
|
||||||
)))
|
|
||||||
)
|
|
||||||
stop_if(anyDuplicated(c(as.character(AMR_env$MO_lookup$mo), x$mo)), "MO codes must be unique and not match existing MO codes of the AMR package")
|
stop_if(anyDuplicated(c(as.character(AMR_env$MO_lookup$mo), x$mo)), "MO codes must be unique and not match existing MO codes of the AMR package")
|
||||||
|
|
||||||
# add to package ----
|
# add to package ----
|
||||||
AMR_env$custom_mo_codes <- c(AMR_env$custom_mo_codes, x$mo)
|
AMR_env$custom_mo_codes <- c(AMR_env$custom_mo_codes, x$mo)
|
||||||
class(AMR_env$MO_lookup$mo) <- "character"
|
class(AMR_env$MO_lookup$mo) <- "character"
|
||||||
@ -306,3 +301,26 @@ clear_custom_microorganisms <- function() {
|
|||||||
AMR_env$mo_uncertainties <- AMR_env$mo_uncertainties[0, , drop = FALSE]
|
AMR_env$mo_uncertainties <- AMR_env$mo_uncertainties[0, , drop = FALSE]
|
||||||
message_("Cleared ", nr2char(n - n2), " custom record", ifelse(n - n2 > 1, "s", ""), " from the internal `microorganisms` data set.")
|
message_("Cleared ", nr2char(n - n2), " custom record", ifelse(n - n2 > 1, "s", ""), " from the internal `microorganisms` data set.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abbreviate_mo <- function(x, minlength = 5, prefix = "", hyphen_as_space = FALSE, ...) {
|
||||||
|
if (hyphen_as_space == TRUE) {
|
||||||
|
x <- gsub("-", " ", x, fixed = TRUE)
|
||||||
|
}
|
||||||
|
# keep a starting Latin ae
|
||||||
|
suppressWarnings(
|
||||||
|
gsub("(\u00C6|\u00E6)+",
|
||||||
|
"AE",
|
||||||
|
toupper(
|
||||||
|
paste0(prefix,
|
||||||
|
abbreviate(
|
||||||
|
gsub("^ae",
|
||||||
|
"\u00E6\u00E6",
|
||||||
|
x,
|
||||||
|
ignore.case = TRUE),
|
||||||
|
minlength = minlength,
|
||||||
|
use.classes = TRUE,
|
||||||
|
method = "both.sides",
|
||||||
|
...
|
||||||
|
))))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
9
R/data.R
9
R/data.R
@ -93,6 +93,7 @@
|
|||||||
#' - `rank`\cr Text of the taxonomic rank of the microorganism, such as `"species"` or `"genus"`
|
#' - `rank`\cr Text of the taxonomic rank of the microorganism, such as `"species"` or `"genus"`
|
||||||
#' - `ref`\cr Author(s) and year of related scientific publication. This contains only the *first surname* and year of the *latest* authors, e.g. "Wallis *et al.* 2006 *emend.* Smith and Jones 2018" becomes "Smith *et al.*, 2018". This field is directly retrieved from the source specified in the column `source`. Moreover, accents were removed to comply with CRAN that only allows ASCII characters, e.g. "V`r "\u00e1\u0148ov\u00e1"`" becomes "Vanova".
|
#' - `ref`\cr Author(s) and year of related scientific publication. This contains only the *first surname* and year of the *latest* authors, e.g. "Wallis *et al.* 2006 *emend.* Smith and Jones 2018" becomes "Smith *et al.*, 2018". This field is directly retrieved from the source specified in the column `source`. Moreover, accents were removed to comply with CRAN that only allows ASCII characters, e.g. "V`r "\u00e1\u0148ov\u00e1"`" becomes "Vanova".
|
||||||
#' - `lpsn`\cr Identifier ('Record number') of the List of Prokaryotic names with Standing in Nomenclature (LPSN). This will be the first/highest LPSN identifier to keep one identifier per row. For example, *Acetobacter ascendens* has LPSN Record number 7864 and 11011. Only the first is available in the `microorganisms` data set.
|
#' - `lpsn`\cr Identifier ('Record number') of the List of Prokaryotic names with Standing in Nomenclature (LPSN). This will be the first/highest LPSN identifier to keep one identifier per row. For example, *Acetobacter ascendens* has LPSN Record number 7864 and 11011. Only the first is available in the `microorganisms` data set.
|
||||||
|
#' - `oxygen_tolerance` \cr Oxygen tolerance, either `r vector_or(microorganisms$oxygen_tolerance)`. These data were retrieved from BacDive (see *Source*). Items that contain "likely" are missing from BacDive and were extrapolated from other species within the same genus to guess the oxygen tolerance. Currently `r round(length(microorganisms$oxygen_tolerance[which(!is.na(microorganisms$oxygen_tolerance))]) / nrow(microorganisms[which(microorganisms$kingdom == "Bacteria"), ]) * 100, 1)`% of all `r format_included_data_number(nrow(microorganisms[which(microorganisms$kingdom == "Bacteria"), ]))` bacteria in the data set contain an oxygen tolerance.
|
||||||
#' - `lpsn_parent`\cr LPSN identifier of the parent taxon
|
#' - `lpsn_parent`\cr LPSN identifier of the parent taxon
|
||||||
#' - `lpsn_renamed_to`\cr LPSN identifier of the currently valid taxon
|
#' - `lpsn_renamed_to`\cr LPSN identifier of the currently valid taxon
|
||||||
#' - `gbif`\cr Identifier ('taxonID') of the Global Biodiversity Information Facility (GBIF)
|
#' - `gbif`\cr Identifier ('taxonID') of the Global Biodiversity Information Facility (GBIF)
|
||||||
@ -120,12 +121,12 @@
|
|||||||
#' ### Manual additions
|
#' ### Manual additions
|
||||||
#' For convenience, some entries were added manually:
|
#' For convenience, some entries were added manually:
|
||||||
#'
|
#'
|
||||||
#' - `r format_included_data_number(which(microorganisms$genus == "Salmonella" & microorganisms$species == "enterica" & microorganisms$source == "manually added"))` entries for the city-like serovars of *Salmonellae*
|
#' - `r format_included_data_number(microorganisms[which(microorganisms$source == "manually added" & microorganisms$genus == "Salmonella"), , drop = FALSE])` entries of *Salmonella*, such as the city-like serovars and groups A to H
|
||||||
#' - 11 entries of *Streptococcus* (beta-haemolytic: groups A, B, C, D, F, G, H, K and unspecified; other: viridans, milleri)
|
#' - `r format_included_data_number(microorganisms[which(microorganisms$source == "manually added" & microorganisms$genus == "Streptococcus"), , drop = FALSE])` entries of *Streptococcus*, such as the beta-haemolytic groups A to K, viridans, and milleri
|
||||||
#' - 2 entries of *Staphylococcus* (coagulase-negative (CoNS) and coagulase-positive (CoPS))
|
#' - 2 entries of *Staphylococcus* (coagulase-negative (CoNS) and coagulase-positive (CoPS))
|
||||||
#' - 1 entry of *Blastocystis* (*B. hominis*), although it officially does not exist (Noel *et al.* 2005, PMID 15634993)
|
#' - 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
|
#' - 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
|
||||||
#' - 6 other 'undefined' entries (unknown, unknown Gram negatives, unknown Gram positives, unknown yeast, unknown fungus, and unknown anaerobic bacteria)
|
#' - 8 other 'undefined' entries (unknown, unknown Gram-negatives, unknown Gram-positives, unknown yeast, unknown fungus, and unknown anaerobic Gram-pos/Gram-neg bacteria)
|
||||||
#'
|
#'
|
||||||
#' The syntax used to transform the original data to a cleansed \R format, can be found here: <https://github.com/msberends/AMR/blob/main/data-raw/reproduction_of_microorganisms.R>.
|
#' The syntax used to transform the original data to a cleansed \R format, can be found here: <https://github.com/msberends/AMR/blob/main/data-raw/reproduction_of_microorganisms.R>.
|
||||||
#'
|
#'
|
||||||
@ -145,6 +146,8 @@
|
|||||||
#' * Grimont *et al.* (2007). Antigenic Formulae of the Salmonella Serovars, 9th Edition. WHO Collaborating Centre for Reference and Research on *Salmonella* (WHOCC-SALM).
|
#' * Grimont *et al.* (2007). Antigenic Formulae of the Salmonella Serovars, 9th Edition. WHO Collaborating Centre for Reference and Research on *Salmonella* (WHOCC-SALM).
|
||||||
#'
|
#'
|
||||||
#' * Bartlett *et al.* (2022). **A comprehensive list of bacterial pathogens infecting humans** *Microbiology* 168:001269; \doi{10.1099/mic.0.001269}
|
#' * Bartlett *et al.* (2022). **A comprehensive list of bacterial pathogens infecting humans** *Microbiology* 168:001269; \doi{10.1099/mic.0.001269}
|
||||||
|
#'
|
||||||
|
#' * Reimer *et al.* (2022). ***BacDive* in 2022: the knowledge base for standardized bacterial and archaeal data.** *Nucleic Acids Res.* 2022 Jan 7;50(D1):D741-D746; \doi{10.1093/nar/gkab961}
|
||||||
#' @seealso [as.mo()], [mo_property()], [microorganisms.codes], [intrinsic_resistant]
|
#' @seealso [as.mo()], [mo_property()], [microorganisms.codes], [intrinsic_resistant]
|
||||||
#' @examples
|
#' @examples
|
||||||
#' microorganisms
|
#' microorganisms
|
||||||
|
@ -57,7 +57,7 @@ italicise_taxonomy <- function(string, type = c("markdown", "ansi")) {
|
|||||||
before <- "*"
|
before <- "*"
|
||||||
after <- "*"
|
after <- "*"
|
||||||
} else if (type == "ansi") {
|
} else if (type == "ansi") {
|
||||||
if (!has_colour()) {
|
if (!has_colour() && !identical(Sys.getenv("IN_PKGDOWN"), "true")) {
|
||||||
return(string)
|
return(string)
|
||||||
}
|
}
|
||||||
before <- "\033[3m"
|
before <- "\033[3m"
|
||||||
|
3
R/like.R
3
R/like.R
@ -49,6 +49,9 @@
|
|||||||
#' @seealso [grepl()]
|
#' @seealso [grepl()]
|
||||||
|
|
||||||
#' @examples
|
#' @examples
|
||||||
|
#' # data.table has a more limited version of %like%, so unload it:
|
||||||
|
#' try(detach("package:data.table", unload = TRUE), silent = TRUE)
|
||||||
|
#'
|
||||||
#' a <- "This is a test"
|
#' a <- "This is a test"
|
||||||
#' b <- "TEST"
|
#' b <- "TEST"
|
||||||
#' a %like% b
|
#' a %like% b
|
||||||
|
60
R/mo.R
60
R/mo.R
@ -95,13 +95,14 @@
|
|||||||
#' 1. Berends MS *et al.* (2022). **AMR: An R Package for Working with Antimicrobial Resistance Data**. *Journal of Statistical Software*, 104(3), 1-31; \doi{10.18637/jss.v104.i03}
|
#' 1. Berends MS *et al.* (2022). **AMR: An R Package for Working with Antimicrobial Resistance Data**. *Journal of Statistical Software*, 104(3), 1-31; \doi{10.18637/jss.v104.i03}
|
||||||
#' 2. Becker K *et al.* (2014). **Coagulase-Negative Staphylococci.** *Clin Microbiol Rev.* 27(4): 870-926; \doi{10.1128/CMR.00109-13}
|
#' 2. Becker K *et al.* (2014). **Coagulase-Negative Staphylococci.** *Clin Microbiol Rev.* 27(4): 870-926; \doi{10.1128/CMR.00109-13}
|
||||||
#' 3. Becker K *et al.* (2019). **Implications of identifying the recently defined members of the *S. aureus* complex, *S. argenteus* and *S. schweitzeri*: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS).** *Clin Microbiol Infect*; \doi{10.1016/j.cmi.2019.02.028}
|
#' 3. Becker K *et al.* (2019). **Implications of identifying the recently defined members of the *S. aureus* complex, *S. argenteus* and *S. schweitzeri*: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS).** *Clin Microbiol Infect*; \doi{10.1016/j.cmi.2019.02.028}
|
||||||
#' 4. Becker K *et al.* (2020). **Emergence of coagulase-negative staphylococci** *Expert Rev Anti Infect Ther.* 18(4):349-366; \doi{10.1080/14787210.2020.1730813}
|
#' 4. Becker K *et al.* (2020). **Emergence of coagulase-negative staphylococci.** *Expert Rev Anti Infect Ther.* 18(4):349-366; \doi{10.1080/14787210.2020.1730813}
|
||||||
#' 5. Lancefield RC (1933). **A serological differentiation of human and other groups of hemolytic streptococci**. *J Exp Med.* 57(4): 571-95; \doi{10.1084/jem.57.4.571}
|
#' 5. Lancefield RC (1933). **A serological differentiation of human and other groups of hemolytic streptococci.** *J Exp Med.* 57(4): 571-95; \doi{10.1084/jem.57.4.571}
|
||||||
#' 6. Berends MS *et al.* (2022). **Trends in Occurrence and Phenotypic Resistance of Coagulase-Negative Staphylococci (CoNS) Found in Human Blood in the Northern Netherlands between 2013 and 2019** *Microorganisms* 10(9), 1801; \doi{10.3390/microorganisms10091801}
|
#' 6. Berends MS *et al.* (2022). **Trends in Occurrence and Phenotypic Resistance of Coagulase-Negative Staphylococci (CoNS) Found in Human Blood in the Northern Netherlands between 2013 and 2019/** *Micro.rganisms* 10(9), 1801; \doi{10.3390/microorganisms10091801}
|
||||||
#' 7. `r TAXONOMY_VERSION$LPSN$citation` Accessed from <`r TAXONOMY_VERSION$LPSN$url`> on `r documentation_date(TAXONOMY_VERSION$LPSN$accessed_date)`.
|
#' 7. `r TAXONOMY_VERSION$LPSN$citation` Accessed from <`r TAXONOMY_VERSION$LPSN$url`> on `r documentation_date(TAXONOMY_VERSION$LPSN$accessed_date)`.
|
||||||
#' 8. `r TAXONOMY_VERSION$GBIF$citation` Accessed from <`r TAXONOMY_VERSION$GBIF$url`> on `r documentation_date(TAXONOMY_VERSION$GBIF$accessed_date)`.
|
#' 8. `r TAXONOMY_VERSION$GBIF$citation` Accessed from <`r TAXONOMY_VERSION$GBIF$url`> on `r documentation_date(TAXONOMY_VERSION$GBIF$accessed_date)`.
|
||||||
#' 9. `r TAXONOMY_VERSION$SNOMED$citation` URL: <`r TAXONOMY_VERSION$SNOMED$url`>
|
#' 9. `r TAXONOMY_VERSION$SNOMED$citation` URL: <`r TAXONOMY_VERSION$SNOMED$url`>
|
||||||
#' 10. Bartlett A *et al.* (2022). **A comprehensive list of bacterial pathogens infecting humans** *Microbiology* 168:001269; \doi{10.1099/mic.0.001269}
|
#' 10. Bartlett A *et al.* (2022). **A comprehensive list of bacterial pathogens infecting humans** *Microbiology* 168:001269; \doi{10.1099/mic.0.001269}
|
||||||
|
#' 11. Reimer *et al.* (2022). ***BacDive* in 2022: the knowledge base for standardized bacterial and archaeal data.** *Nucleic Acids Res.* 2022 Jan 7;50(D1):D741-D746; \doi{10.1093/nar/gkab961}
|
||||||
#' @export
|
#' @export
|
||||||
#' @return A [character] [vector] with additional class [`mo`]
|
#' @return A [character] [vector] with additional class [`mo`]
|
||||||
#' @seealso [microorganisms] for the [data.frame] that is being used to determine ID's.
|
#' @seealso [microorganisms] for the [data.frame] that is being used to determine ID's.
|
||||||
@ -214,10 +215,10 @@ as.mo <- function(x,
|
|||||||
# From known codes ----
|
# From known codes ----
|
||||||
out[is.na(out) & toupper(x) %in% AMR::microorganisms.codes$code] <- AMR::microorganisms.codes$mo[match(toupper(x)[is.na(out) & toupper(x) %in% AMR::microorganisms.codes$code], AMR::microorganisms.codes$code)]
|
out[is.na(out) & toupper(x) %in% AMR::microorganisms.codes$code] <- AMR::microorganisms.codes$mo[match(toupper(x)[is.na(out) & toupper(x) %in% AMR::microorganisms.codes$code], AMR::microorganisms.codes$code)]
|
||||||
# From SNOMED ----
|
# From SNOMED ----
|
||||||
if (any(is.na(out) & !is.na(x)) && any(is.na(out) & x %in% unlist(AMR_env$MO_lookup$snomed), na.rm = TRUE)) {
|
# based on this extremely fast gem: https://stackoverflow.com/a/11002456/4575331
|
||||||
# found this extremely fast gem here: https://stackoverflow.com/a/11002456/4575331
|
snomeds <- unlist(AMR_env$MO_lookup$snomed)
|
||||||
out[is.na(out) & x %in% unlist(AMR_env$MO_lookup$snomed)] <- AMR_env$MO_lookup$mo[rep(seq_along(AMR_env$MO_lookup$snomed), vapply(FUN.VALUE = double(1), AMR_env$MO_lookup$snomed, length))[match(x[is.na(out) & x %in% unlist(AMR_env$MO_lookup$snomed)], unlist(AMR_env$MO_lookup$snomed))]]
|
snomeds <- snomeds[!is.na(snomeds)]
|
||||||
}
|
out[is.na(out) & x %in% snomeds] <- AMR_env$MO_lookup$mo[rep(seq_along(AMR_env$MO_lookup$snomed), vapply(FUN.VALUE = double(1), AMR_env$MO_lookup$snomed, length))[match(x[is.na(out) & x %in% snomeds], snomeds)]]
|
||||||
# From other familiar output ----
|
# From other familiar output ----
|
||||||
# such as Salmonella groups, colloquial names, etc.
|
# such as Salmonella groups, colloquial names, etc.
|
||||||
out[is.na(out)] <- convert_colloquial_input(x[is.na(out)])
|
out[is.na(out)] <- convert_colloquial_input(x[is.na(out)])
|
||||||
@ -547,7 +548,7 @@ mo_cleaning_regex <- function() {
|
|||||||
"|",
|
"|",
|
||||||
"([({]|\\[).+([})]|\\])",
|
"([({]|\\[).+([})]|\\])",
|
||||||
"|",
|
"|",
|
||||||
"(^| )(e?spp|e?ssp|e?ss|e?sp|e?subsp|sube?species|biovar|biotype|serovar|serogr.?up|e?species)[.]*( |$|(complex|group)$))"
|
"(^| )(e?spp|e?ssp|e?ss|e?sp|e?subsp|sube?species|biovar|biotype|serovar|var|serogr.?up|e?species)[.]*( |$|(complex|group)$))"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -888,8 +889,6 @@ print.mo_uncertainties <- function(x, n = 10, ...) {
|
|||||||
),
|
),
|
||||||
collapse = "\n"
|
collapse = "\n"
|
||||||
),
|
),
|
||||||
# Add "Based on {input}" text if it differs from the original input
|
|
||||||
ifelse(x[i, ]$original_input != x[i, ]$input, paste0(strrep(" ", nchar(x[i, ]$original_input) + 6), "Based on input \"", x[i, ]$input, "\""), ""),
|
|
||||||
# Add note if result was coerced to accepted taxonomic name
|
# Add note if result was coerced to accepted taxonomic name
|
||||||
ifelse(x[i, ]$keep_synonyms == FALSE & x[i, ]$mo %in% AMR_env$MO_lookup$mo[which(AMR_env$MO_lookup$status == "synonym")],
|
ifelse(x[i, ]$keep_synonyms == FALSE & x[i, ]$mo %in% AMR_env$MO_lookup$mo[which(AMR_env$MO_lookup$status == "synonym")],
|
||||||
paste0(
|
paste0(
|
||||||
@ -947,25 +946,25 @@ convert_colloquial_input <- function(x) {
|
|||||||
out <- rep(NA_character_, length(x))
|
out <- rep(NA_character_, length(x))
|
||||||
|
|
||||||
# Streptococci, like GBS = Group B Streptococci (B_STRPT_GRPB)
|
# Streptococci, like GBS = Group B Streptococci (B_STRPT_GRPB)
|
||||||
out[x %like_case% "^g[abcdfghkl]s$"] <- gsub("g([abcdfghkl])s",
|
out[x %like_case% "^g[abcdefghijkl]s$"] <- gsub("g([abcdefghijkl])s",
|
||||||
"B_STRPT_GRP\\U\\1",
|
"B_STRPT_GRP\\U\\1",
|
||||||
x[x %like_case% "^g[abcdfghkl]s$"],
|
x[x %like_case% "^g[abcdefghijkl]s$"],
|
||||||
perl = TRUE
|
perl = TRUE
|
||||||
)
|
)
|
||||||
# Streptococci in different languages, like "estreptococos grupo B"
|
# Streptococci in different languages, like "estreptococos grupo B"
|
||||||
out[x %like_case% "strepto[ck]o[ck].* [abcdfghkl]$"] <- gsub(".*e?strepto[ck]o[ck].* ([abcdfghkl])$",
|
out[x %like_case% "strepto[ck]o[ck].* [abcdefghijkl]$"] <- gsub(".*e?strepto[ck]o[ck].* ([abcdefghijkl])$",
|
||||||
"B_STRPT_GRP\\U\\1",
|
"B_STRPT_GRP\\U\\1",
|
||||||
x[x %like_case% "strepto[ck]o[ck].* [abcdfghkl]$"],
|
x[x %like_case% "strepto[ck]o[ck].* [abcdefghijkl]$"],
|
||||||
perl = TRUE
|
perl = TRUE
|
||||||
)
|
)
|
||||||
out[x %like_case% "strep[a-z]* group [abcdfghkl]$"] <- gsub(".* ([abcdfghkl])$",
|
out[x %like_case% "strep[a-z]* group [abcdefghijkl]$"] <- gsub(".* ([abcdefghijkl])$",
|
||||||
"B_STRPT_GRP\\U\\1",
|
"B_STRPT_GRP\\U\\1",
|
||||||
x[x %like_case% "strep[a-z]* group [abcdfghkl]$"],
|
x[x %like_case% "strep[a-z]* group [abcdefghijkl]$"],
|
||||||
perl = TRUE
|
perl = TRUE
|
||||||
)
|
)
|
||||||
out[x %like_case% "group [abcdfghkl] strepto[ck]o[ck]"] <- gsub(".*group ([abcdfghkl]) strepto[ck]o[ck].*",
|
out[x %like_case% "group [abcdefghijkl] strepto[ck]o[ck]"] <- gsub(".*group ([abcdefghijkl]) strepto[ck]o[ck].*",
|
||||||
"B_STRPT_GRP\\U\\1",
|
"B_STRPT_GRP\\U\\1",
|
||||||
x[x %like_case% "group [abcdfghkl] strepto[ck]o[ck]"],
|
x[x %like_case% "group [abcdefghijkl] strepto[ck]o[ck]"],
|
||||||
perl = TRUE
|
perl = TRUE
|
||||||
)
|
)
|
||||||
out[x %like_case% "ha?emoly.*strep"] <- "B_STRPT_HAEM"
|
out[x %like_case% "ha?emoly.*strep"] <- "B_STRPT_HAEM"
|
||||||
@ -975,14 +974,14 @@ convert_colloquial_input <- function(x) {
|
|||||||
out[x %like_case% "(viridans.* (strepto|^s).*|^vgs[^a-z]*$)"] <- "B_STRPT_VIRI"
|
out[x %like_case% "(viridans.* (strepto|^s).*|^vgs[^a-z]*$)"] <- "B_STRPT_VIRI"
|
||||||
|
|
||||||
# Salmonella in different languages, like "Salmonella grupo B"
|
# Salmonella in different languages, like "Salmonella grupo B"
|
||||||
out[x %like_case% "salmonella.* [abcd]$"] <- gsub(".*salmonella.* ([abcd])$",
|
out[x %like_case% "salmonella.* [abcdefgh]$"] <- gsub(".*salmonella.* ([abcdefgh])$",
|
||||||
"B_SLMNL_GRP\\U\\1",
|
"B_SLMNL_GRP\\U\\1",
|
||||||
x[x %like_case% "salmonella.* [abcd]$"],
|
x[x %like_case% "salmonella.* [abcdefgh]$"],
|
||||||
perl = TRUE
|
perl = TRUE
|
||||||
)
|
)
|
||||||
out[x %like_case% "group [abcd] salmonella"] <- gsub(".*group ([abcd]) salmonella*",
|
out[x %like_case% "group [abcdefgh] salmonella"] <- gsub(".*group ([abcdefgh]) salmonella*",
|
||||||
"B_SLMNL_GRP\\U\\1",
|
"B_SLMNL_GRP\\U\\1",
|
||||||
x[x %like_case% "group [abcd] salmonella"],
|
x[x %like_case% "group [abcdefgh] salmonella"],
|
||||||
perl = TRUE
|
perl = TRUE
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -995,8 +994,10 @@ convert_colloquial_input <- function(x) {
|
|||||||
out[x %like_case% "( |^)gram[-]( |$)"] <- "B_GRAMN"
|
out[x %like_case% "( |^)gram[-]( |$)"] <- "B_GRAMN"
|
||||||
out[x %like_case% "gram[ -]?pos.*"] <- "B_GRAMP"
|
out[x %like_case% "gram[ -]?pos.*"] <- "B_GRAMP"
|
||||||
out[x %like_case% "( |^)gram[+]( |$)"] <- "B_GRAMP"
|
out[x %like_case% "( |^)gram[+]( |$)"] <- "B_GRAMP"
|
||||||
|
out[x %like_case% "anaerob[a-z]+ .*gram[ -]?neg.*"] <- "B_ANAER-NEG"
|
||||||
|
out[x %like_case% "anaerob[a-z]+ .*gram[ -]?pos.*"] <- "B_ANAER-POS"
|
||||||
out[is.na(out) & x %like_case% "anaerob[a-z]+ (micro)?.*organism"] <- "B_ANAER"
|
out[is.na(out) & x %like_case% "anaerob[a-z]+ (micro)?.*organism"] <- "B_ANAER"
|
||||||
|
|
||||||
# yeasts and fungi
|
# yeasts and fungi
|
||||||
out[x %like_case% "^yeast?"] <- "F_YEAST"
|
out[x %like_case% "^yeast?"] <- "F_YEAST"
|
||||||
out[x %like_case% "^fung(us|i)"] <- "F_FUNGUS"
|
out[x %like_case% "^fung(us|i)"] <- "F_FUNGUS"
|
||||||
@ -1006,7 +1007,7 @@ convert_colloquial_input <- function(x) {
|
|||||||
out[x %like_case% "gono[ck]o[ck]"] <- "B_NESSR_GNRR"
|
out[x %like_case% "gono[ck]o[ck]"] <- "B_NESSR_GNRR"
|
||||||
out[x %like_case% "pneumo[ck]o[ck]"] <- "B_STRPT_PNMN"
|
out[x %like_case% "pneumo[ck]o[ck]"] <- "B_STRPT_PNMN"
|
||||||
|
|
||||||
# unexisting names (xxx and con are WHONET codes)
|
# unexisting names (con is the WHONET code for contamination)
|
||||||
out[x %in% c("con", "other", "none", "unknown") | x %like_case% "virus"] <- "UNKNOWN"
|
out[x %in% c("con", "other", "none", "unknown") | x %like_case% "virus"] <- "UNKNOWN"
|
||||||
|
|
||||||
# WHONET has a lot of E. coli and Vibrio cholerae names
|
# WHONET has a lot of E. coli and Vibrio cholerae names
|
||||||
@ -1017,18 +1018,23 @@ convert_colloquial_input <- function(x) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
italicise <- function(x) {
|
italicise <- function(x) {
|
||||||
|
if (!has_colour()) {
|
||||||
|
return(x)
|
||||||
|
}
|
||||||
out <- font_italic(x, collapse = NULL)
|
out <- font_italic(x, collapse = NULL)
|
||||||
|
# city-like serovars of Salmonella (start with a capital)
|
||||||
out[x %like_case% "Salmonella [A-Z]"] <- paste(
|
out[x %like_case% "Salmonella [A-Z]"] <- paste(
|
||||||
font_italic("Salmonella"),
|
font_italic("Salmonella"),
|
||||||
gsub("Salmonella ", "", x[x %like_case% "Salmonella [A-Z]"])
|
gsub("Salmonella ", "", x[x %like_case% "Salmonella [A-Z]"])
|
||||||
)
|
)
|
||||||
|
# streptococcal groups
|
||||||
out[x %like_case% "Streptococcus [A-Z]"] <- paste(
|
out[x %like_case% "Streptococcus [A-Z]"] <- paste(
|
||||||
font_italic("Streptococcus"),
|
font_italic("Streptococcus"),
|
||||||
gsub("Streptococcus ", "", x[x %like_case% "Streptococcus [A-Z]"])
|
gsub("Streptococcus ", "", x[x %like_case% "Streptococcus [A-Z]"])
|
||||||
)
|
)
|
||||||
if (has_colour()) {
|
# be sure not to make these italic
|
||||||
out <- gsub("(Group|group|Complex|complex)(\033\\[23m)?", "\033[23m\\1", out, perl = TRUE)
|
out <- gsub("([ -]*)(Group|group|Complex|complex)(\033\\[23m)?", "\033[23m\\1\\2", out, perl = TRUE)
|
||||||
}
|
out <- gsub("(\033\\[3m)?(Beta[-]haemolytic|Coagulase[-](postive|negative)) ", "\\2 \033[3m", out, perl = TRUE)
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,8 @@
|
|||||||
#' Determination of yeasts ([mo_is_yeast()]) will be based on the taxonomic kingdom and class. *Budding yeasts* are fungi of the phylum Ascomycota, class Saccharomycetes (also called Hemiascomycetes). *True yeasts* are aggregated into the underlying order Saccharomycetales. Thus, for all microorganisms that are member of the taxonomic class Saccharomycetes, the function will return `TRUE`. It returns `FALSE` otherwise (or `NA` when the input is `NA` or the MO code is `UNKNOWN`).
|
#' Determination of yeasts ([mo_is_yeast()]) will be based on the taxonomic kingdom and class. *Budding yeasts* are fungi of the phylum Ascomycota, class Saccharomycetes (also called Hemiascomycetes). *True yeasts* are aggregated into the underlying order Saccharomycetales. Thus, for all microorganisms that are member of the taxonomic class Saccharomycetes, the function will return `TRUE`. It returns `FALSE` otherwise (or `NA` when the input is `NA` or the MO code is `UNKNOWN`).
|
||||||
#'
|
#'
|
||||||
#' Determination of intrinsic resistance ([mo_is_intrinsic_resistant()]) will be based on the [intrinsic_resistant] data set, which is based on `r format_eucast_version_nr(3.3)`. The [mo_is_intrinsic_resistant()] function can be vectorised over both argument `x` (input for microorganisms) and `ab` (input for antibiotics).
|
#' Determination of intrinsic resistance ([mo_is_intrinsic_resistant()]) will be based on the [intrinsic_resistant] data set, which is based on `r format_eucast_version_nr(3.3)`. The [mo_is_intrinsic_resistant()] function can be vectorised over both argument `x` (input for microorganisms) and `ab` (input for antibiotics).
|
||||||
|
#'
|
||||||
|
#' Determination of bacterial oxygen tolerance ([mo_oxygen_tolerance()]) will be based on BacDive, see *Source*. The function [mo_is_anaerobic()] only returns `TRUE` if the oxygen tolerance is `"anaerobe"`, indicting an obligate anaerobic species or genus. It always returns `FALSE` for species outside the taxonomic kingdom of Bacteria.
|
||||||
#'
|
#'
|
||||||
#' The function [mo_url()] will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.
|
#' The function [mo_url()] will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.
|
||||||
#'
|
#'
|
||||||
@ -480,7 +482,7 @@ mo_gramstain <- function(x, language = get_AMR_locale(), keep_synonyms = getOpti
|
|||||||
# but class Negativicutes (of phylum Bacillota) are Gram-negative!
|
# but class Negativicutes (of phylum Bacillota) are Gram-negative!
|
||||||
mo_class(x.mo, language = NULL, keep_synonyms = keep_synonyms) != "Negativicutes")
|
mo_class(x.mo, language = NULL, keep_synonyms = keep_synonyms) != "Negativicutes")
|
||||||
# and of course our own ID for Gram-positives
|
# and of course our own ID for Gram-positives
|
||||||
| x.mo == "B_GRAMP"] <- "Gram-positive"
|
| x.mo %in% c("B_GRAMP", "B_ANAER-POS")] <- "Gram-positive"
|
||||||
|
|
||||||
load_mo_uncertainties(metadata)
|
load_mo_uncertainties(metadata)
|
||||||
translate_into_language(x, language = language, only_unknown = FALSE)
|
translate_into_language(x, language = language, only_unknown = FALSE)
|
||||||
@ -589,6 +591,40 @@ mo_is_intrinsic_resistant <- function(x, ab, language = get_AMR_locale(), keep_s
|
|||||||
paste(x, ab) %in% AMR_env$intrinsic_resistant
|
paste(x, ab) %in% AMR_env$intrinsic_resistant
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#' @rdname mo_property
|
||||||
|
#' @export
|
||||||
|
mo_oxygen_tolerance <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) {
|
||||||
|
if (missing(x)) {
|
||||||
|
# this tries to find the data and an 'mo' column
|
||||||
|
x <- find_mo_col(fn = "mo_oxygen_tolerance")
|
||||||
|
}
|
||||||
|
meet_criteria(x, allow_NA = TRUE)
|
||||||
|
language <- validate_language(language)
|
||||||
|
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||||
|
|
||||||
|
mo_validate(x = x, property = "oxygen_tolerance", language = language, keep_synonyms = keep_synonyms, ...)
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname mo_property
|
||||||
|
#' @export
|
||||||
|
mo_is_anaerobic <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) {
|
||||||
|
if (missing(x)) {
|
||||||
|
# this tries to find the data and an 'mo' column
|
||||||
|
x <- find_mo_col(fn = "mo_is_anaerobic")
|
||||||
|
}
|
||||||
|
meet_criteria(x, allow_NA = TRUE)
|
||||||
|
language <- validate_language(language)
|
||||||
|
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||||
|
|
||||||
|
x.mo <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...)
|
||||||
|
metadata <- get_mo_uncertainties()
|
||||||
|
oxygen <- mo_oxygen_tolerance(x.mo, language = NULL, keep_synonyms = keep_synonyms)
|
||||||
|
load_mo_uncertainties(metadata)
|
||||||
|
out <- oxygen == "anaerobe" & !is.na(oxygen)
|
||||||
|
out[x.mo %in% c(NA_character_, "UNKNOWN")] <- NA
|
||||||
|
out
|
||||||
|
}
|
||||||
|
|
||||||
#' @rdname mo_property
|
#' @rdname mo_property
|
||||||
#' @export
|
#' @export
|
||||||
mo_snomed <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) {
|
mo_snomed <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) {
|
||||||
@ -791,9 +827,12 @@ mo_info <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("A
|
|||||||
status = mo_status(y, language = language, keep_synonyms = keep_synonyms),
|
status = mo_status(y, language = language, keep_synonyms = keep_synonyms),
|
||||||
synonyms = mo_synonyms(y, keep_synonyms = keep_synonyms),
|
synonyms = mo_synonyms(y, keep_synonyms = keep_synonyms),
|
||||||
gramstain = mo_gramstain(y, language = language, keep_synonyms = keep_synonyms),
|
gramstain = mo_gramstain(y, language = language, keep_synonyms = keep_synonyms),
|
||||||
|
oxygen_tolerance = mo_oxygen_tolerance(y, language = language, keep_synonyms = keep_synonyms),
|
||||||
url = unname(mo_url(y, open = FALSE, keep_synonyms = keep_synonyms)),
|
url = unname(mo_url(y, open = FALSE, keep_synonyms = keep_synonyms)),
|
||||||
ref = mo_ref(y, keep_synonyms = keep_synonyms),
|
ref = mo_ref(y, keep_synonyms = keep_synonyms),
|
||||||
snomed = unlist(mo_snomed(y, keep_synonyms = keep_synonyms))
|
snomed = unlist(mo_snomed(y, keep_synonyms = keep_synonyms)),
|
||||||
|
lpsn = mo_lpsn(y, language = language, keep_synonyms = keep_synonyms),
|
||||||
|
gbif = mo_gbif(y, language = language, keep_synonyms = keep_synonyms)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
9
R/zzz.R
9
R/zzz.R
@ -59,16 +59,15 @@ AMR_env$sir_interpretation_history <- data.frame(
|
|||||||
datetime = Sys.time()[0],
|
datetime = Sys.time()[0],
|
||||||
index = integer(0),
|
index = integer(0),
|
||||||
ab_input = character(0),
|
ab_input = character(0),
|
||||||
ab_considered = character(0),
|
ab_guideline = set_clean_class(character(0), c("ab", "character")),
|
||||||
mo_input = character(0),
|
mo_input = character(0),
|
||||||
mo_considered = character(0),
|
mo_guideline = set_clean_class(character(0), c("mo", "character")),
|
||||||
guideline = character(0),
|
guideline = character(0),
|
||||||
ref_table = character(0),
|
ref_table = character(0),
|
||||||
method = character(0),
|
method = character(0),
|
||||||
breakpoint_S = double(0),
|
|
||||||
breakpoint_R = double(0),
|
|
||||||
input = double(0),
|
input = double(0),
|
||||||
interpretation = character(0),
|
outcome = NA_sir_[0],
|
||||||
|
breakpoint_S_R = character(0),
|
||||||
stringsAsFactors = FALSE
|
stringsAsFactors = FALSE
|
||||||
)
|
)
|
||||||
AMR_env$custom_ab_codes <- character(0)
|
AMR_env$custom_ab_codes <- character(0)
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
# source("data-raw/_pre_commit_hook.R")
|
# source("data-raw/_pre_commit_hook.R")
|
||||||
|
|
||||||
library(dplyr, warn.conflicts = FALSE)
|
library(dplyr, warn.conflicts = FALSE)
|
||||||
|
try(detach("package:data.table", unload = TRUE), silent = TRUE) # to prevent like() to precede over AMR::like
|
||||||
devtools::load_all(quiet = TRUE)
|
devtools::load_all(quiet = TRUE)
|
||||||
|
|
||||||
suppressMessages(set_AMR_locale("English"))
|
suppressMessages(set_AMR_locale("English"))
|
||||||
@ -164,12 +165,12 @@ MO_PREVALENT_GENERA <- c(
|
|||||||
"Halococcus", "Hendersonula", "Heterophyes", "Histomonas", "Histoplasma", "Hymenolepis", "Hypomyces",
|
"Halococcus", "Hendersonula", "Heterophyes", "Histomonas", "Histoplasma", "Hymenolepis", "Hypomyces",
|
||||||
"Hysterothylacium", "Leishmania", "Malassezia", "Malbranchea", "Metagonimus", "Meyerozyma", "Microsporidium",
|
"Hysterothylacium", "Leishmania", "Malassezia", "Malbranchea", "Metagonimus", "Meyerozyma", "Microsporidium",
|
||||||
"Microsporum", "Mortierella", "Mucor", "Mycocentrospora", "Necator", "Nectria", "Ochroconis", "Oesophagostomum",
|
"Microsporum", "Mortierella", "Mucor", "Mycocentrospora", "Necator", "Nectria", "Ochroconis", "Oesophagostomum",
|
||||||
"Oidiodendron", "Opisthorchis", "Pediculus", "Phlebotomus", "Phoma", "Pichia", "Piedraia", "Pithomyces",
|
"Oidiodendron", "Opisthorchis", "Pediculus", "Penicillium", "Phlebotomus", "Phoma", "Pichia", "Piedraia", "Pithomyces",
|
||||||
"Pityrosporum", "Pneumocystis", "Pseudallescheria", "Pseudoterranova", "Pulex", "Rhizomucor", "Rhizopus",
|
"Pityrosporum", "Pneumocystis", "Pseudallescheria", "Pseudoterranova", "Pulex", "Rhizomucor", "Rhizopus",
|
||||||
"Rhodotorula", "Saccharomyces", "Sarcoptes", "Scolecobasidium", "Scopulariopsis", "Scytalidium", "Spirometra",
|
"Rhodotorula", "Saccharomyces", "Sarcoptes", "Scolecobasidium", "Scopulariopsis", "Scytalidium", "Spirometra",
|
||||||
"Sporobolomyces", "Stachybotrys", "Strongyloides", "Syngamus", "Taenia", "Toxocara", "Trichinella", "Trichobilharzia",
|
"Sporobolomyces", "Stachybotrys", "Strongyloides", "Syngamus", "Taenia", "Talaromyces", "Toxocara", "Trichinella",
|
||||||
"Trichoderma", "Trichomonas", "Trichophyton", "Trichosporon", "Trichostrongylus", "Trichuris", "Tritirachium",
|
"Trichobilharzia", "Trichoderma", "Trichomonas", "Trichophyton", "Trichosporon", "Trichostrongylus", "Trichuris",
|
||||||
"Trombicula", "Trypanosoma", "Tunga", "Wuchereria"
|
"Tritirachium", "Trombicula", "Trypanosoma", "Tunga", "Wuchereria"
|
||||||
)
|
)
|
||||||
|
|
||||||
# antibiotic groups
|
# antibiotic groups
|
||||||
@ -365,7 +366,7 @@ if (changed_md5(clin_break)) {
|
|||||||
write_md5(clin_break)
|
write_md5(clin_break)
|
||||||
try(saveRDS(clin_break, "data-raw/clinical_breakpoints.rds", version = 2, compress = "xz"), silent = TRUE)
|
try(saveRDS(clin_break, "data-raw/clinical_breakpoints.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||||
try(write.table(clin_break, "data-raw/clinical_breakpoints.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
try(write.table(clin_break, "data-raw/clinical_breakpoints.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||||
try(haven::write_sas(clin_break, "data-raw/clinical_breakpoints.sas"), silent = TRUE)
|
try(haven::write_xpt(clin_break, "data-raw/clinical_breakpoints.xpt"), silent = TRUE)
|
||||||
try(haven::write_sav(clin_break, "data-raw/clinical_breakpoints.sav"), silent = TRUE)
|
try(haven::write_sav(clin_break, "data-raw/clinical_breakpoints.sav"), silent = TRUE)
|
||||||
try(haven::write_dta(clin_break, "data-raw/clinical_breakpoints.dta"), silent = TRUE)
|
try(haven::write_dta(clin_break, "data-raw/clinical_breakpoints.dta"), silent = TRUE)
|
||||||
try(openxlsx::write.xlsx(clin_break, "data-raw/clinical_breakpoints.xlsx"), silent = TRUE)
|
try(openxlsx::write.xlsx(clin_break, "data-raw/clinical_breakpoints.xlsx"), silent = TRUE)
|
||||||
@ -381,7 +382,7 @@ if (changed_md5(microorganisms)) {
|
|||||||
mo <- microorganisms
|
mo <- microorganisms
|
||||||
mo$snomed <- max_50_snomed
|
mo$snomed <- max_50_snomed
|
||||||
mo <- dplyr::mutate_if(mo, ~ !is.numeric(.), as.character)
|
mo <- dplyr::mutate_if(mo, ~ !is.numeric(.), as.character)
|
||||||
try(haven::write_sas(mo, "data-raw/microorganisms.sas"), silent = TRUE)
|
try(haven::write_xpt(mo, "data-raw/microorganisms.xpt"), silent = TRUE)
|
||||||
try(haven::write_sav(mo, "data-raw/microorganisms.sav"), silent = TRUE)
|
try(haven::write_sav(mo, "data-raw/microorganisms.sav"), silent = TRUE)
|
||||||
try(haven::write_dta(mo, "data-raw/microorganisms.dta"), silent = TRUE)
|
try(haven::write_dta(mo, "data-raw/microorganisms.dta"), silent = TRUE)
|
||||||
mo_all_snomed <- microorganisms %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
|
mo_all_snomed <- microorganisms %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
|
||||||
@ -396,7 +397,7 @@ if (changed_md5(ab)) {
|
|||||||
usethis::ui_info(paste0("Saving {usethis::ui_value('antibiotics')} to {usethis::ui_value('data-raw/')}"))
|
usethis::ui_info(paste0("Saving {usethis::ui_value('antibiotics')} to {usethis::ui_value('data-raw/')}"))
|
||||||
write_md5(ab)
|
write_md5(ab)
|
||||||
try(saveRDS(antibiotics, "data-raw/antibiotics.rds", version = 2, compress = "xz"), silent = TRUE)
|
try(saveRDS(antibiotics, "data-raw/antibiotics.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||||
try(haven::write_sas(ab, "data-raw/antibiotics.sas"), silent = TRUE)
|
try(haven::write_xpt(ab, "data-raw/antibiotics.xpt"), silent = TRUE)
|
||||||
try(haven::write_sav(ab, "data-raw/antibiotics.sav"), silent = TRUE)
|
try(haven::write_sav(ab, "data-raw/antibiotics.sav"), silent = TRUE)
|
||||||
try(haven::write_dta(ab, "data-raw/antibiotics.dta"), silent = TRUE)
|
try(haven::write_dta(ab, "data-raw/antibiotics.dta"), silent = TRUE)
|
||||||
ab_lists <- antibiotics %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
|
ab_lists <- antibiotics %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
|
||||||
@ -411,7 +412,7 @@ if (changed_md5(av)) {
|
|||||||
usethis::ui_info(paste0("Saving {usethis::ui_value('antivirals')} to {usethis::ui_value('data-raw/')}"))
|
usethis::ui_info(paste0("Saving {usethis::ui_value('antivirals')} to {usethis::ui_value('data-raw/')}"))
|
||||||
write_md5(av)
|
write_md5(av)
|
||||||
try(saveRDS(antivirals, "data-raw/antivirals.rds", version = 2, compress = "xz"), silent = TRUE)
|
try(saveRDS(antivirals, "data-raw/antivirals.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||||
try(haven::write_sas(av, "data-raw/antivirals.sas"), silent = TRUE)
|
try(haven::write_xpt(av, "data-raw/antivirals.xpt"), silent = TRUE)
|
||||||
try(haven::write_sav(av, "data-raw/antivirals.sav"), silent = TRUE)
|
try(haven::write_sav(av, "data-raw/antivirals.sav"), silent = TRUE)
|
||||||
try(haven::write_dta(av, "data-raw/antivirals.dta"), silent = TRUE)
|
try(haven::write_dta(av, "data-raw/antivirals.dta"), silent = TRUE)
|
||||||
av_lists <- antivirals %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
|
av_lists <- antivirals %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
|
||||||
@ -432,7 +433,7 @@ if (changed_md5(intrinsicR)) {
|
|||||||
write_md5(intrinsicR)
|
write_md5(intrinsicR)
|
||||||
try(saveRDS(intrinsicR, "data-raw/intrinsic_resistant.rds", version = 2, compress = "xz"), silent = TRUE)
|
try(saveRDS(intrinsicR, "data-raw/intrinsic_resistant.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||||
try(write.table(intrinsicR, "data-raw/intrinsic_resistant.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
try(write.table(intrinsicR, "data-raw/intrinsic_resistant.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||||
try(haven::write_sas(intrinsicR, "data-raw/intrinsic_resistant.sas"), silent = TRUE)
|
try(haven::write_xpt(intrinsicR, "data-raw/intrinsic_resistant.xpt"), silent = TRUE)
|
||||||
try(haven::write_sav(intrinsicR, "data-raw/intrinsic_resistant.sav"), silent = TRUE)
|
try(haven::write_sav(intrinsicR, "data-raw/intrinsic_resistant.sav"), silent = TRUE)
|
||||||
try(haven::write_dta(intrinsicR, "data-raw/intrinsic_resistant.dta"), silent = TRUE)
|
try(haven::write_dta(intrinsicR, "data-raw/intrinsic_resistant.dta"), silent = TRUE)
|
||||||
try(openxlsx::write.xlsx(intrinsicR, "data-raw/intrinsic_resistant.xlsx"), silent = TRUE)
|
try(openxlsx::write.xlsx(intrinsicR, "data-raw/intrinsic_resistant.xlsx"), silent = TRUE)
|
||||||
@ -445,7 +446,7 @@ if (changed_md5(dosage)) {
|
|||||||
write_md5(dosage)
|
write_md5(dosage)
|
||||||
try(saveRDS(dosage, "data-raw/dosage.rds", version = 2, compress = "xz"), silent = TRUE)
|
try(saveRDS(dosage, "data-raw/dosage.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||||
try(write.table(dosage, "data-raw/dosage.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
try(write.table(dosage, "data-raw/dosage.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||||
try(haven::write_sas(dosage, "data-raw/dosage.sas"), silent = TRUE)
|
try(haven::write_xpt(dosage, "data-raw/dosage.xpt"), silent = TRUE)
|
||||||
try(haven::write_sav(dosage, "data-raw/dosage.sav"), silent = TRUE)
|
try(haven::write_sav(dosage, "data-raw/dosage.sav"), silent = TRUE)
|
||||||
try(haven::write_dta(dosage, "data-raw/dosage.dta"), silent = TRUE)
|
try(haven::write_dta(dosage, "data-raw/dosage.dta"), silent = TRUE)
|
||||||
try(openxlsx::write.xlsx(dosage, "data-raw/dosage.xlsx"), silent = TRUE)
|
try(openxlsx::write.xlsx(dosage, "data-raw/dosage.xlsx"), silent = TRUE)
|
||||||
|
BIN
data-raw/antibiotics.xpt
Normal file
BIN
data-raw/antibiotics.xpt
Normal file
Binary file not shown.
BIN
data-raw/antivirals.xpt
Normal file
BIN
data-raw/antivirals.xpt
Normal file
Binary file not shown.
19616
data-raw/bacdive.csv
Normal file
19616
data-raw/bacdive.csv
Normal file
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
|||||||
68467f5179638ac5622281df53a5ea75
|
0a9ea3545d68b95108a28096d975388f
|
||||||
|
Binary file not shown.
Binary file not shown.
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.
BIN
data-raw/clinical_breakpoints.xpt
Normal file
BIN
data-raw/clinical_breakpoints.xpt
Normal file
Binary file not shown.
BIN
data-raw/dosage.xpt
Normal file
BIN
data-raw/dosage.xpt
Normal file
Binary file not shown.
BIN
data-raw/intrinsic_resistant.xpt
Normal file
BIN
data-raw/intrinsic_resistant.xpt
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
|||||||
7846247d4113c4e8f550cfd2cb87467f
|
63cc9e5166dc50c7b474bb809557c392
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
104295
data-raw/microorganisms.txt
104295
data-raw/microorganisms.txt
File diff suppressed because one or more lines are too long
Binary file not shown.
BIN
data-raw/microorganisms.xpt
Normal file
BIN
data-raw/microorganisms.xpt
Normal file
Binary file not shown.
@ -33,81 +33,73 @@
|
|||||||
library(dplyr)
|
library(dplyr)
|
||||||
library(readr)
|
library(readr)
|
||||||
library(tidyr)
|
library(tidyr)
|
||||||
library(AMR)
|
devtools::load_all()
|
||||||
|
|
||||||
# Install the WHONET 2022 software on Windows (http://www.whonet.org/software.html),
|
# Install the WHONET 2022 software on Windows (http://www.whonet.org/software.html),
|
||||||
# and copy the folder C:\WHONET\Resources to the data-raw/WHONET/ folder
|
# and copy the folder C:\WHONET\Resources to the data-raw/WHONET/ folder
|
||||||
# (for ASIARS-Net update, also copy C:\WHONET\Codes to the data-raw/WHONET/ folder)
|
# (for ASIARS-Net update, also copy C:\WHONET\Codes to the data-raw/WHONET/ folder)
|
||||||
|
|
||||||
# Load source data ----
|
|
||||||
|
# MICROORGANISMS WHONET CODES ----
|
||||||
|
|
||||||
whonet_organisms <- read_tsv("data-raw/WHONET/Resources/Organisms.txt", na = c("", "NA", "-"), show_col_types = FALSE) %>%
|
whonet_organisms <- read_tsv("data-raw/WHONET/Resources/Organisms.txt", na = c("", "NA", "-"), show_col_types = FALSE) %>%
|
||||||
# remove old taxonomic names
|
# remove old taxonomic names
|
||||||
filter(TAXONOMIC_STATUS == "C") %>%
|
filter(TAXONOMIC_STATUS == "C") %>%
|
||||||
transmute(ORGANISM_CODE = tolower(WHONET_ORG_CODE), ORGANISM) %>%
|
transmute(ORGANISM_CODE = tolower(WHONET_ORG_CODE), ORGANISM) %>%
|
||||||
# what's wrong here? 'sau' is both S. areus and S. aureus sp. aureus
|
|
||||||
mutate(
|
mutate(
|
||||||
|
# what's wrong here? all these are only in the table on subspecies level (where species == subspecies), not on species level
|
||||||
ORGANISM = if_else(ORGANISM_CODE == "sau", "Staphylococcus aureus", ORGANISM),
|
ORGANISM = if_else(ORGANISM_CODE == "sau", "Staphylococcus aureus", ORGANISM),
|
||||||
ORGANISM = if_else(ORGANISM_CODE == "pam", "Pasteurella multocida", ORGANISM)
|
ORGANISM = if_else(ORGANISM_CODE == "pam", "Pasteurella multocida", ORGANISM),
|
||||||
|
ORGANISM = if_else(ORGANISM_CODE == "kpn", "Klebsiella pneumoniae", ORGANISM),
|
||||||
|
ORGANISM = if_else(ORGANISM_CODE == "caj", "Campylobacter jejuni", ORGANISM),
|
||||||
|
ORGANISM = if_else(ORGANISM_CODE == "mmo", "Morganella morganii", ORGANISM),
|
||||||
|
ORGANISM = if_else(ORGANISM_CODE == "sap", "Staphylococcus saprophyticus", ORGANISM),
|
||||||
|
ORGANISM = if_else(ORGANISM_CODE == "fne", "Fusobacterium necrophorum", ORGANISM),
|
||||||
|
ORGANISM = if_else(ORGANISM_CODE == "fnu", "Fusobacterium nucleatum", ORGANISM),
|
||||||
|
ORGANISM = if_else(ORGANISM_CODE == "sdy", "Streptococcus dysgalactiae", ORGANISM),
|
||||||
|
ORGANISM = if_else(ORGANISM_CODE == "axy", "Achromobacter xylosoxidans", ORGANISM),
|
||||||
|
# and this one was called Issatchenkia orientalis, but it should be:
|
||||||
|
ORGANISM = if_else(ORGANISM_CODE == "ckr", "Candida krusei", ORGANISM)
|
||||||
)
|
)
|
||||||
whonet_breakpoints <- read_tsv("data-raw/WHONET/Resources/Breakpoints.txt", na = c("", "NA", "-"), show_col_types = FALSE) %>%
|
|
||||||
filter(BREAKPOINT_TYPE == "Human", GUIDELINES %in% c("CLSI", "EUCAST"))
|
|
||||||
whonet_antibiotics <- read_tsv("data-raw/WHONET/Resources/Antibiotics.txt", na = c("", "NA", "-"), show_col_types = FALSE) %>%
|
|
||||||
arrange(WHONET_ABX_CODE) %>%
|
|
||||||
distinct(WHONET_ABX_CODE, .keep_all = TRUE)
|
|
||||||
|
|
||||||
|
|
||||||
# Transform data ----
|
|
||||||
|
|
||||||
|
# add some general codes
|
||||||
whonet_organisms <- whonet_organisms %>%
|
whonet_organisms <- whonet_organisms %>%
|
||||||
bind_rows(data.frame(
|
bind_rows(data.frame(
|
||||||
ORGANISM_CODE = c("ebc", "cof"),
|
ORGANISM_CODE = c("ebc", "cof"),
|
||||||
ORGANISM = c("Enterobacterales", "Campylobacter")
|
ORGANISM = c("Enterobacterales", "Campylobacter")
|
||||||
))
|
))
|
||||||
|
|
||||||
breakpoints <- whonet_breakpoints %>%
|
whonet_organisms.bak <- whonet_organisms
|
||||||
mutate(ORGANISM_CODE = tolower(ORGANISM_CODE)) %>%
|
# generate the mo codes and add their names
|
||||||
left_join(whonet_organisms) %>%
|
whonet_organisms <- whonet_organisms.bak %>%
|
||||||
filter(ORGANISM %unlike% "(^cdc |Gram.*variable|virus)")
|
mutate(mo = as.mo(gsub("(sero[a-z]*| complex| nontypable| non[-][a-zA-Z]+|var[.]| not .*|sp[.],.*|, .*variant.*|, .*toxin.*|, microaer.*| beta-haem[.])", "", ORGANISM),
|
||||||
# this ones lack a MO name, they will become "UNKNOWN":
|
keep_synonyms = TRUE,
|
||||||
breakpoints %>%
|
language = "en"),
|
||||||
filter(is.na(ORGANISM)) %>%
|
mo = case_when(ORGANISM %like% "Anaerobic" & ORGANISM %like% "negative" ~ as.mo("B_ANAER-NEG"),
|
||||||
pull(ORGANISM_CODE) %>%
|
ORGANISM %like% "Anaerobic" & ORGANISM %like% "positive" ~ as.mo("B_ANAER-POS"),
|
||||||
unique()
|
ORGANISM %like% "Anaerobic" ~ as.mo("B_ANAER"),
|
||||||
|
TRUE ~ mo),
|
||||||
|
mo_name = mo_name(mo,
|
||||||
# Generate new lookup table for microorganisms ----
|
keep_synonyms = TRUE,
|
||||||
|
language = "en"))
|
||||||
new_mo_codes <- breakpoints %>%
|
# check if coercion at least resembles the first part (genus)
|
||||||
distinct(ORGANISM_CODE, ORGANISM) %>%
|
new_mo_codes <- whonet_organisms %>%
|
||||||
mutate(ORGANISM = ORGANISM %>%
|
|
||||||
gsub("Issatchenkia orientalis", "Candida krusei", .) %>%
|
|
||||||
gsub(", nutritionally variant", "", .) %>%
|
|
||||||
gsub(", toxin-.*producing", "", .)) %>%
|
|
||||||
mutate(
|
mutate(
|
||||||
mo = as.mo(ORGANISM, language = NULL, keep_synonyms = FALSE),
|
first_part = sapply(ORGANISM, function(x) strsplit(gsub("[^a-zA-Z _-]+", "", x), " ")[[1]][1], USE.NAMES = FALSE),
|
||||||
mo_name = mo_name(mo, language = NULL)
|
keep = mo_name %like_case% first_part | ORGANISM %like% "Gram " | ORGANISM == "Other" | ORGANISM %like% "anaerobic")
|
||||||
)
|
# update microorganisms.codes with the latest WHONET codes
|
||||||
|
microorganisms.codes <- microorganisms.codes %>%
|
||||||
|
# remove all old WHONET codes, whether we (in the end) keep them or not
|
||||||
|
filter(!toupper(code) %in% toupper(whonet_organisms$ORGANISM_CODE)) %>%
|
||||||
|
# and add the new ones
|
||||||
|
bind_rows(new_mo_codes %>%
|
||||||
|
filter(keep == TRUE) %>%
|
||||||
|
transmute(code = toupper(ORGANISM_CODE),
|
||||||
|
mo = mo)) %>%
|
||||||
|
arrange(code)
|
||||||
|
|
||||||
|
# Run this part to update ASIARS-Net:
|
||||||
# Update microorganisms.codes with the latest WHONET codes ----
|
# start
|
||||||
|
|
||||||
# these will be changed :
|
|
||||||
new_mo_codes %>%
|
|
||||||
mutate(code = toupper(ORGANISM_CODE)) %>%
|
|
||||||
rename(mo_new = mo) %>%
|
|
||||||
left_join(microorganisms.codes %>% rename(mo_old = mo)) %>%
|
|
||||||
filter(mo_old != mo_new)
|
|
||||||
|
|
||||||
microorganisms.codes <- microorganisms.codes %>%
|
|
||||||
filter(!code %in% toupper(new_mo_codes$ORGANISM_CODE)) %>%
|
|
||||||
bind_rows(new_mo_codes %>% transmute(code = toupper(ORGANISM_CODE), mo = mo) %>% filter(!is.na(mo))) %>%
|
|
||||||
arrange(code) %>%
|
|
||||||
as_tibble()
|
|
||||||
usethis::use_data(microorganisms.codes, overwrite = TRUE, compress = "xz", version = 2)
|
|
||||||
rm(microorganisms.codes)
|
|
||||||
devtools::load_all()
|
|
||||||
|
|
||||||
# update ASIARS-Net?
|
|
||||||
asiarsnet <- read_tsv("data-raw/WHONET/Codes/ASIARS_Net_Organisms_ForwardLookup.txt")
|
asiarsnet <- read_tsv("data-raw/WHONET/Codes/ASIARS_Net_Organisms_ForwardLookup.txt")
|
||||||
asiarsnet <- asiarsnet %>%
|
asiarsnet <- asiarsnet %>%
|
||||||
mutate(WHONET_Code = toupper(WHONET_Code)) %>%
|
mutate(WHONET_Code = toupper(WHONET_Code)) %>%
|
||||||
@ -129,21 +121,64 @@ microorganisms.codes <- microorganisms.codes %>%
|
|||||||
filter(!code %in% c(insert1$code, insert2$code)) %>%
|
filter(!code %in% c(insert1$code, insert2$code)) %>%
|
||||||
bind_rows(insert1, insert2) %>%
|
bind_rows(insert1, insert2) %>%
|
||||||
arrange(code)
|
arrange(code)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# save to package
|
||||||
|
usethis::use_data(microorganisms.codes, overwrite = TRUE, compress = "xz", version = 2)
|
||||||
|
rm(microorganisms.codes)
|
||||||
|
devtools::load_all()
|
||||||
|
|
||||||
|
|
||||||
# Create new breakpoint table ----
|
# BREAKPOINTS ----
|
||||||
|
|
||||||
|
# now that we have the right MO codes, get the breakpoints and convert them
|
||||||
|
whonet_breakpoints <- read_tsv("data-raw/WHONET/Resources/Breakpoints.txt", na = c("", "NA", "-"), show_col_types = FALSE) %>%
|
||||||
|
filter(BREAKPOINT_TYPE == "Human", GUIDELINES %in% c("CLSI", "EUCAST"))
|
||||||
|
whonet_antibiotics <- read_tsv("data-raw/WHONET/Resources/Antibiotics.txt", na = c("", "NA", "-"), show_col_types = FALSE) %>%
|
||||||
|
arrange(WHONET_ABX_CODE) %>%
|
||||||
|
distinct(WHONET_ABX_CODE, .keep_all = TRUE)
|
||||||
|
|
||||||
|
breakpoints <- whonet_breakpoints %>%
|
||||||
|
mutate(code = toupper(ORGANISM_CODE)) %>%
|
||||||
|
left_join(bind_rows(microorganisms.codes,
|
||||||
|
# GEN (Generic) and ALL (All) are PK/PD codes
|
||||||
|
data.frame(code = c("ALL", "GEN"),
|
||||||
|
mo = rep(as.mo("UNKNOWN"), 2))))
|
||||||
|
# these ones lack a MO name, they cannot be used:
|
||||||
|
unknown <- breakpoints %>%
|
||||||
|
filter(is.na(mo)) %>%
|
||||||
|
pull(code) %>%
|
||||||
|
unique()
|
||||||
|
breakpoints %>%
|
||||||
|
filter(code %in% unknown)
|
||||||
|
breakpoints <- breakpoints %>%
|
||||||
|
filter(!is.na(mo))
|
||||||
|
|
||||||
|
# and these ones have unknown antibiotics according to WHONET itself:
|
||||||
|
breakpoints %>%
|
||||||
|
filter(!WHONET_ABX_CODE %in% whonet_antibiotics$WHONET_ABX_CODE) %>%
|
||||||
|
count(YEAR, GUIDELINES, WHONET_ABX_CODE) %>%
|
||||||
|
arrange(desc(YEAR))
|
||||||
|
# we cannot use them
|
||||||
|
breakpoints <- breakpoints %>%
|
||||||
|
filter(WHONET_ABX_CODE %in% whonet_antibiotics$WHONET_ABX_CODE)
|
||||||
|
# now check with our own antibiotics
|
||||||
|
breakpoints %>%
|
||||||
|
filter(!toupper(WHONET_ABX_CODE) %in% antibiotics$ab) %>%
|
||||||
|
pull(WHONET_ABX_CODE) %>%
|
||||||
|
unique()
|
||||||
|
# they are at the moment all old codes that have right replacements in `antibiotics`, so we can use as.ab()
|
||||||
|
|
||||||
breakpoints_new <- breakpoints %>%
|
breakpoints_new <- breakpoints %>%
|
||||||
# only last 10 years
|
# only last available 10 years
|
||||||
filter(YEAR > as.double(format(Sys.Date(), "%Y")) - 10) %>%
|
filter(YEAR > max(YEAR) - 10) %>%
|
||||||
# "all" and "gen" (general) must become UNKNOWNs:
|
|
||||||
mutate(ORGANISM_CODE = if_else(ORGANISM_CODE %in% c("all", "gen"), "UNKNOWN", ORGANISM_CODE)) %>%
|
|
||||||
transmute(
|
transmute(
|
||||||
guideline = paste(GUIDELINES, YEAR),
|
guideline = paste(GUIDELINES, YEAR),
|
||||||
method = TEST_METHOD,
|
method = TEST_METHOD,
|
||||||
site = gsub("Urinary tract infection", "UTI", SITE_OF_INFECTION),
|
site = gsub(".*(UTI|urinary|urine).*", "UTI", SITE_OF_INFECTION, ignore.case = TRUE),
|
||||||
mo = as.mo(ORGANISM_CODE, keep_synonyms = FALSE),
|
mo,
|
||||||
rank_index = case_when(
|
rank_index = case_when(
|
||||||
|
is.na(mo_rank(mo)) ~ 6, # for UNKNOWN, B_GRAMN, B_ANAER, B_ANAER-NEG, etc.
|
||||||
mo_rank(mo) %like% "(infra|sub)" ~ 1,
|
mo_rank(mo) %like% "(infra|sub)" ~ 1,
|
||||||
mo_rank(mo) == "species" ~ 2,
|
mo_rank(mo) == "species" ~ 2,
|
||||||
mo_rank(mo) == "genus" ~ 3,
|
mo_rank(mo) == "genus" ~ 3,
|
||||||
@ -156,17 +191,22 @@ breakpoints_new <- breakpoints %>%
|
|||||||
disk_dose = POTENCY,
|
disk_dose = POTENCY,
|
||||||
breakpoint_S = S,
|
breakpoint_S = S,
|
||||||
breakpoint_R = R,
|
breakpoint_R = R,
|
||||||
uti = SITE_OF_INFECTION %like% "(UTI|urinary|urine)"
|
uti = ifelse(is.na(site), FALSE, site == "UTI")
|
||||||
) %>%
|
) %>%
|
||||||
# Greek symbols and EM dash symbols are not allowed by CRAN, so replace them with ASCII:
|
# Greek symbols and EM dash symbols are not allowed by CRAN, so replace them with ASCII:
|
||||||
mutate(disk_dose = disk_dose %>%
|
mutate(disk_dose = disk_dose %>%
|
||||||
gsub("μ", "u", ., fixed = TRUE) %>%
|
gsub("μ", "u", ., fixed = TRUE) %>% # this is 'mu', \u03bc
|
||||||
gsub("µ", "u", ., fixed = TRUE) %>% # this is another micro sign, although we cannot see it
|
gsub("µ", "u", ., fixed = TRUE) %>% # this is 'micro', u00b5 (yes, they look the same)
|
||||||
gsub("–", "-", ., fixed = TRUE)) %>%
|
gsub("–", "-", ., fixed = TRUE)) %>%
|
||||||
arrange(desc(guideline), ab, mo, method) %>%
|
arrange(desc(guideline), ab, mo, method) %>%
|
||||||
filter(!(is.na(breakpoint_S) & is.na(breakpoint_R)) & !is.na(mo) & !is.na(ab)) %>%
|
filter(!(is.na(breakpoint_S) & is.na(breakpoint_R)) & !is.na(mo) & !is.na(ab)) %>%
|
||||||
distinct(guideline, ab, mo, method, site, breakpoint_S, .keep_all = TRUE)
|
distinct(guideline, ab, mo, method, site, breakpoint_S, .keep_all = TRUE)
|
||||||
|
|
||||||
|
# check the strange duplicates
|
||||||
|
breakpoints_new %>%
|
||||||
|
mutate(id = paste(guideline, ab, mo, method, site)) %>%
|
||||||
|
filter(id %in% .$id[which(duplicated(id))])
|
||||||
|
|
||||||
# clean disk zones and MICs
|
# clean disk zones and MICs
|
||||||
breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_S"] <- as.double(as.disk(breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_S", drop = TRUE]))
|
breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_S"] <- as.double(as.disk(breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_S", drop = TRUE]))
|
||||||
breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_R"] <- as.double(as.disk(breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_R", drop = TRUE]))
|
breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_R"] <- as.double(as.disk(breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_R", drop = TRUE]))
|
||||||
@ -185,7 +225,7 @@ breakpoints_new[which(breakpoints_new$breakpoint_R == 513), "breakpoint_R"] <- m
|
|||||||
breakpoints_new[which(breakpoints_new$breakpoint_R == 1025), "breakpoint_R"] <- m[which(m == 1024) + 1]
|
breakpoints_new[which(breakpoints_new$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:
|
# 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
|
# EUCAST 2022 guideline: S <= 8 and R > 8
|
||||||
# WHONET file: S <= 8 and R >= 16
|
# WHONET file: S <= 8 and R >= 16
|
||||||
breakpoints_new %>% filter(guideline == "EUCAST 2022", ab == "AMC", mo == "B_[ORD]_ENTRBCTR", method == "MIC")
|
breakpoints_new %>% filter(guideline == "EUCAST 2022", ab == "AMC", mo == "B_[ORD]_ENTRBCTR", method == "MIC")
|
||||||
# this will make an MIC of 12 I, which should be R, so:
|
# this will make an MIC of 12 I, which should be R, so:
|
||||||
@ -208,6 +248,11 @@ breakpoints_new %>% filter(guideline == "EUCAST 2022", ab == "AMC", mo == "B_[OR
|
|||||||
# compare with current version
|
# compare with current version
|
||||||
clinical_breakpoints %>% filter(guideline == "EUCAST 2022", ab == "AMC", mo == "B_[ORD]_ENTRBCTR", method == "MIC")
|
clinical_breakpoints %>% filter(guideline == "EUCAST 2022", ab == "AMC", mo == "B_[ORD]_ENTRBCTR", method == "MIC")
|
||||||
|
|
||||||
|
# check dimensions
|
||||||
|
dim(breakpoints_new)
|
||||||
|
dim(clinical_breakpoints)
|
||||||
|
|
||||||
|
|
||||||
# Save to package ----
|
# Save to package ----
|
||||||
|
|
||||||
clinical_breakpoints <- breakpoints_new
|
clinical_breakpoints <- breakpoints_new
|
||||||
|
@ -147,23 +147,6 @@ df_remove_nonASCII <- function(df) {
|
|||||||
AMR:::dataset_UTF8_to_ASCII()
|
AMR:::dataset_UTF8_to_ASCII()
|
||||||
}
|
}
|
||||||
|
|
||||||
abbreviate_mo <- function(x, minlength = 5, prefix = "", hyphen_as_space = FALSE, ...) {
|
|
||||||
if (hyphen_as_space == TRUE) {
|
|
||||||
x <- gsub("-", " ", x, fixed = TRUE)
|
|
||||||
}
|
|
||||||
# keep a starting Latin ae
|
|
||||||
suppressWarnings(
|
|
||||||
gsub("^ae", "\u00E6\u00E6", x, ignore.case = TRUE) %>%
|
|
||||||
abbreviate(
|
|
||||||
minlength = minlength,
|
|
||||||
use.classes = TRUE,
|
|
||||||
method = "both.sides", ...
|
|
||||||
) %>%
|
|
||||||
paste0(prefix, .) %>%
|
|
||||||
toupper() %>%
|
|
||||||
gsub("(\u00C6|\u00E6)+", "AE", .)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
# to retrieve LPSN and authors from LPSN website
|
# to retrieve LPSN and authors from LPSN website
|
||||||
get_lpsn_and_author <- function(rank, name) {
|
get_lpsn_and_author <- function(rank, name) {
|
||||||
@ -936,8 +919,8 @@ mo_phylum <- taxonomy %>%
|
|||||||
) %>%
|
) %>%
|
||||||
group_by(kingdom) %>%
|
group_by(kingdom) %>%
|
||||||
mutate(
|
mutate(
|
||||||
mo_phylum8 = abbreviate_mo(phylum, minlength = 8, prefix = "[PHL]_"),
|
mo_phylum8 = AMR:::abbreviate_mo(phylum, minlength = 8, prefix = "[PHL]_"),
|
||||||
mo_phylum9 = abbreviate_mo(phylum, minlength = 9, prefix = "[PHL]_"),
|
mo_phylum9 = AMR:::abbreviate_mo(phylum, minlength = 9, prefix = "[PHL]_"),
|
||||||
mo_phylum = ifelse(!is.na(mo_old), mo_old, mo_phylum8),
|
mo_phylum = ifelse(!is.na(mo_old), mo_old, mo_phylum8),
|
||||||
mo_duplicated = duplicated(mo_phylum),
|
mo_duplicated = duplicated(mo_phylum),
|
||||||
mo_phylum = ifelse(mo_duplicated, mo_phylum9, mo_phylum),
|
mo_phylum = ifelse(mo_duplicated, mo_phylum9, mo_phylum),
|
||||||
@ -963,8 +946,8 @@ mo_class <- taxonomy %>%
|
|||||||
) %>%
|
) %>%
|
||||||
group_by(kingdom) %>%
|
group_by(kingdom) %>%
|
||||||
mutate(
|
mutate(
|
||||||
mo_class8 = abbreviate_mo(class, minlength = 8, prefix = "[CLS]_"),
|
mo_class8 = AMR:::abbreviate_mo(class, minlength = 8, prefix = "[CLS]_"),
|
||||||
mo_class9 = abbreviate_mo(class, minlength = 9, prefix = "[CLS]_"),
|
mo_class9 = AMR:::abbreviate_mo(class, minlength = 9, prefix = "[CLS]_"),
|
||||||
mo_class = ifelse(!is.na(mo_old), mo_old, mo_class8),
|
mo_class = ifelse(!is.na(mo_old), mo_old, mo_class8),
|
||||||
mo_duplicated = duplicated(mo_class),
|
mo_duplicated = duplicated(mo_class),
|
||||||
mo_class = ifelse(mo_duplicated, mo_class9, mo_class),
|
mo_class = ifelse(mo_duplicated, mo_class9, mo_class),
|
||||||
@ -990,8 +973,8 @@ mo_order <- taxonomy %>%
|
|||||||
) %>%
|
) %>%
|
||||||
group_by(kingdom) %>%
|
group_by(kingdom) %>%
|
||||||
mutate(
|
mutate(
|
||||||
mo_order8 = abbreviate_mo(order, minlength = 8, prefix = "[ORD]_"),
|
mo_order8 = AMR:::abbreviate_mo(order, minlength = 8, prefix = "[ORD]_"),
|
||||||
mo_order9 = abbreviate_mo(order, minlength = 9, prefix = "[ORD]_"),
|
mo_order9 = AMR:::abbreviate_mo(order, minlength = 9, prefix = "[ORD]_"),
|
||||||
mo_order = ifelse(!is.na(mo_old), mo_old, mo_order8),
|
mo_order = ifelse(!is.na(mo_old), mo_old, mo_order8),
|
||||||
mo_duplicated = duplicated(mo_order),
|
mo_duplicated = duplicated(mo_order),
|
||||||
mo_order = ifelse(mo_duplicated, mo_order9, mo_order),
|
mo_order = ifelse(mo_duplicated, mo_order9, mo_order),
|
||||||
@ -1017,8 +1000,8 @@ mo_family <- taxonomy %>%
|
|||||||
) %>%
|
) %>%
|
||||||
group_by(kingdom) %>%
|
group_by(kingdom) %>%
|
||||||
mutate(
|
mutate(
|
||||||
mo_family8 = abbreviate_mo(family, minlength = 8, prefix = "[FAM]_"),
|
mo_family8 = AMR:::abbreviate_mo(family, minlength = 8, prefix = "[FAM]_"),
|
||||||
mo_family9 = abbreviate_mo(family, minlength = 9, prefix = "[FAM]_"),
|
mo_family9 = AMR:::abbreviate_mo(family, minlength = 9, prefix = "[FAM]_"),
|
||||||
mo_family = ifelse(!is.na(mo_old), mo_old, mo_family8),
|
mo_family = ifelse(!is.na(mo_old), mo_old, mo_family8),
|
||||||
mo_duplicated = duplicated(mo_family),
|
mo_duplicated = duplicated(mo_family),
|
||||||
mo_family = ifelse(mo_duplicated, mo_family9, mo_family),
|
mo_family = ifelse(mo_duplicated, mo_family9, mo_family),
|
||||||
@ -1046,11 +1029,11 @@ mo_genus <- taxonomy %>%
|
|||||||
group_by(kingdom) %>%
|
group_by(kingdom) %>%
|
||||||
# generate new MO codes for genus and set the right one
|
# generate new MO codes for genus and set the right one
|
||||||
mutate(
|
mutate(
|
||||||
mo_genus_new5 = abbreviate_mo(genus, 5),
|
mo_genus_new5 = AMR:::abbreviate_mo(genus, 5),
|
||||||
mo_genus_new5b = paste0(abbreviate_mo(genus, 5), 1),
|
mo_genus_new5b = paste0(AMR:::abbreviate_mo(genus, 5), 1),
|
||||||
mo_genus_new6 = abbreviate_mo(genus, 6),
|
mo_genus_new6 = AMR:::abbreviate_mo(genus, 6),
|
||||||
mo_genus_new7 = abbreviate_mo(genus, 7),
|
mo_genus_new7 = AMR:::abbreviate_mo(genus, 7),
|
||||||
mo_genus_new8 = abbreviate_mo(genus, 8),
|
mo_genus_new8 = AMR:::abbreviate_mo(genus, 8),
|
||||||
mo_genus_new = case_when(
|
mo_genus_new = case_when(
|
||||||
!is.na(mo_genus_old) ~ mo_genus_old,
|
!is.na(mo_genus_old) ~ mo_genus_old,
|
||||||
!mo_genus_new5 %in% mo_genus_old ~ mo_genus_new5,
|
!mo_genus_new5 %in% mo_genus_old ~ mo_genus_new5,
|
||||||
@ -1092,12 +1075,12 @@ mo_species <- taxonomy %>%
|
|||||||
distinct(kingdom, genus, species, .keep_all = TRUE) %>%
|
distinct(kingdom, genus, species, .keep_all = TRUE) %>%
|
||||||
group_by(kingdom, genus) %>%
|
group_by(kingdom, genus) %>%
|
||||||
mutate(
|
mutate(
|
||||||
mo_species_new4 = abbreviate_mo(species, 4, hyphen_as_space = TRUE),
|
mo_species_new4 = AMR:::abbreviate_mo(species, 4, hyphen_as_space = TRUE),
|
||||||
mo_species_new5 = abbreviate_mo(species, 5, hyphen_as_space = TRUE),
|
mo_species_new5 = AMR:::abbreviate_mo(species, 5, hyphen_as_space = TRUE),
|
||||||
mo_species_new5b = paste0(abbreviate_mo(species, 5, hyphen_as_space = TRUE), 1),
|
mo_species_new5b = paste0(AMR:::abbreviate_mo(species, 5, hyphen_as_space = TRUE), 1),
|
||||||
mo_species_new6 = abbreviate_mo(species, 6, hyphen_as_space = TRUE),
|
mo_species_new6 = AMR:::abbreviate_mo(species, 6, hyphen_as_space = TRUE),
|
||||||
mo_species_new7 = abbreviate_mo(species, 7, hyphen_as_space = TRUE),
|
mo_species_new7 = AMR:::abbreviate_mo(species, 7, hyphen_as_space = TRUE),
|
||||||
mo_species_new8 = abbreviate_mo(species, 8, hyphen_as_space = TRUE),
|
mo_species_new8 = AMR:::abbreviate_mo(species, 8, hyphen_as_space = TRUE),
|
||||||
mo_species_new = case_when(
|
mo_species_new = case_when(
|
||||||
!is.na(mo_species_old) ~ mo_species_old,
|
!is.na(mo_species_old) ~ mo_species_old,
|
||||||
!mo_species_new4 %in% mo_species_old ~ mo_species_new4,
|
!mo_species_new4 %in% mo_species_old ~ mo_species_new4,
|
||||||
@ -1141,12 +1124,12 @@ mo_subspecies <- taxonomy %>%
|
|||||||
distinct(kingdom, genus, species, subspecies, .keep_all = TRUE) %>%
|
distinct(kingdom, genus, species, subspecies, .keep_all = TRUE) %>%
|
||||||
group_by(kingdom, genus, species) %>%
|
group_by(kingdom, genus, species) %>%
|
||||||
mutate(
|
mutate(
|
||||||
mo_subspecies_new4 = abbreviate_mo(subspecies, 4, hyphen_as_space = TRUE),
|
mo_subspecies_new4 = AMR:::abbreviate_mo(subspecies, 4, hyphen_as_space = TRUE),
|
||||||
mo_subspecies_new5 = abbreviate_mo(subspecies, 5, hyphen_as_space = TRUE),
|
mo_subspecies_new5 = AMR:::abbreviate_mo(subspecies, 5, hyphen_as_space = TRUE),
|
||||||
mo_subspecies_new5b = paste0(abbreviate_mo(subspecies, 5, hyphen_as_space = TRUE), 1),
|
mo_subspecies_new5b = paste0(AMR:::abbreviate_mo(subspecies, 5, hyphen_as_space = TRUE), 1),
|
||||||
mo_subspecies_new6 = abbreviate_mo(subspecies, 6, hyphen_as_space = TRUE),
|
mo_subspecies_new6 = AMR:::abbreviate_mo(subspecies, 6, hyphen_as_space = TRUE),
|
||||||
mo_subspecies_new7 = abbreviate_mo(subspecies, 7, hyphen_as_space = TRUE),
|
mo_subspecies_new7 = AMR:::abbreviate_mo(subspecies, 7, hyphen_as_space = TRUE),
|
||||||
mo_subspecies_new8 = abbreviate_mo(subspecies, 8, hyphen_as_space = TRUE),
|
mo_subspecies_new8 = AMR:::abbreviate_mo(subspecies, 8, hyphen_as_space = TRUE),
|
||||||
mo_subspecies_new = case_when(
|
mo_subspecies_new = case_when(
|
||||||
!is.na(mo_subspecies_old) ~ mo_subspecies_old,
|
!is.na(mo_subspecies_old) ~ mo_subspecies_old,
|
||||||
!mo_subspecies_new4 %in% mo_subspecies_old ~ mo_subspecies_new4,
|
!mo_subspecies_new4 %in% mo_subspecies_old ~ mo_subspecies_new4,
|
||||||
@ -1348,6 +1331,84 @@ taxonomy <- taxonomy %>%
|
|||||||
left_join(snomed, by = "fullname")
|
left_join(snomed, by = "fullname")
|
||||||
|
|
||||||
|
|
||||||
|
# Add oxygen tolerance (aerobe/anaerobe) ----------------------------------
|
||||||
|
|
||||||
|
# We will use the BacDive data base for this:
|
||||||
|
# - go to https://bacdive.dsmz.de/advsearch and filter 'Oxygen tolerance' on "*"
|
||||||
|
# - click on the 'Download tabel as CSV' button
|
||||||
|
#
|
||||||
|
bacdive <- vroom::vroom("data-raw/bacdive.csv", skip = 2) %>%
|
||||||
|
select(species, oxygen = `Oxygen tolerance`)
|
||||||
|
bacdive <- bacdive %>%
|
||||||
|
# fill in missing species from previous rows
|
||||||
|
mutate(species = ifelse(is.na(species), lag(species), species)) %>%
|
||||||
|
filter(!is.na(species), !is.na(oxygen), oxygen %unlike% "tolerant", species %unlike% "unclassified") %>%
|
||||||
|
mutate(mo = as.mo(species, keep_synonyms = FALSE))
|
||||||
|
bacdive <- bacdive %>%
|
||||||
|
# now determine type per species
|
||||||
|
group_by(mo) %>%
|
||||||
|
summarise(species = first(species),
|
||||||
|
oxygen_tolerance = case_when(any(oxygen %like% "facultative") ~ "facultative anaerobe",
|
||||||
|
all(oxygen == "microaerophile") ~ "microaerophile",
|
||||||
|
all(oxygen %in% c("anaerobe", "obligate anaerobe")) ~ "anaerobe",
|
||||||
|
all(oxygen %in% c("anaerobe", "obligate anaerobe", "microaerophile")) ~ "anaerobe/microaerophile",
|
||||||
|
all(oxygen %in% c("aerobe", "obligate aerobe")) ~ "aerobe",
|
||||||
|
all(!oxygen %in% c("anaerobe", "obligate anaerobe")) ~ "aerobe",
|
||||||
|
all(c("aerobe", "anaerobe") %in% oxygen) ~ "facultative anaerobe",
|
||||||
|
TRUE ~ NA_character_))
|
||||||
|
# now find all synonyms and copy them from their current taxonomic names
|
||||||
|
synonyms <- as.mo(unique(unlist(mo_synonyms(bacdive$mo, keep_synonyms = TRUE))),
|
||||||
|
keep_synonyms = TRUE)
|
||||||
|
syns <- tibble(species = synonyms,
|
||||||
|
mo = synonyms %>% mo_current() %>% as.mo()) %>%
|
||||||
|
filter(species != mo) %>%
|
||||||
|
mutate(species = mo_name(species, keep_synonyms = TRUE)) %>%
|
||||||
|
left_join(bacdive %>% select(mo, oxygen_tolerance)) %>%
|
||||||
|
# set mo to mo of the synonym
|
||||||
|
mutate(mo = as.mo(species, keep_synonyms = TRUE)) %>%
|
||||||
|
select(all_of(colnames(bacdive)))
|
||||||
|
|
||||||
|
bacdive <- bacdive %>%
|
||||||
|
bind_rows(syns) %>%
|
||||||
|
distinct()
|
||||||
|
|
||||||
|
bacdive_genus <- bacdive %>%
|
||||||
|
mutate(oxygen = oxygen_tolerance) %>%
|
||||||
|
group_by(species = mo_genus(mo)) %>%
|
||||||
|
summarise(oxygen_tolerance = case_when(any(oxygen == "facultative anaerobe") ~ "facultative anaerobe",
|
||||||
|
any(oxygen == "anaerobe/microaerophile") ~ "anaerobe/microaerophile",
|
||||||
|
all(oxygen == "microaerophile") ~ "microaerophile",
|
||||||
|
all(oxygen == "anaerobe") ~ "anaerobe",
|
||||||
|
all(oxygen == "aerobe") ~ "aerobe",
|
||||||
|
TRUE ~ "facultative anaerobe"))
|
||||||
|
|
||||||
|
bacdive <- bacdive %>%
|
||||||
|
filter(species %unlike% " sp[.]") %>%
|
||||||
|
bind_rows(bacdive_genus) %>%
|
||||||
|
arrange(species) %>%
|
||||||
|
mutate(mo = as.mo(species, keep_synonyms = TRUE))
|
||||||
|
|
||||||
|
other_species <- microorganisms %>%
|
||||||
|
filter(kingdom == "Bacteria", rank == "species", !mo %in% bacdive$mo, genus %in% bacdive$species) %>%
|
||||||
|
select(species = fullname, genus, mo2 = mo) %>%
|
||||||
|
left_join(bacdive, by = c("genus" = "species")) %>%
|
||||||
|
mutate(oxygen_tolerance = ifelse(oxygen_tolerance %in% c("aerobe", "anaerobe", "microaerophile", "anaerobe/microaerophile"),
|
||||||
|
oxygen_tolerance,
|
||||||
|
paste("likely", oxygen_tolerance))) %>%
|
||||||
|
select(species, oxygen_tolerance, mo = mo2) %>%
|
||||||
|
distinct(species, .keep_all = TRUE)
|
||||||
|
|
||||||
|
bacdive <- bacdive %>%
|
||||||
|
bind_rows(other_species) %>%
|
||||||
|
arrange(species) %>%
|
||||||
|
distinct(mo, .keep_all = TRUE) %>%
|
||||||
|
select(-species)
|
||||||
|
|
||||||
|
taxonomy <- taxonomy %>%
|
||||||
|
left_join(bacdive, by = "mo") %>%
|
||||||
|
relocate(oxygen_tolerance, .after = ref)
|
||||||
|
|
||||||
|
|
||||||
# Clean data set ----------------------------------------------------------
|
# Clean data set ----------------------------------------------------------
|
||||||
|
|
||||||
# format to tibble and check again for invalid characters
|
# format to tibble and check again for invalid characters
|
||||||
@ -1380,6 +1441,9 @@ for (nm in to_restore) {
|
|||||||
|
|
||||||
# Save to package ---------------------------------------------------------
|
# Save to package ---------------------------------------------------------
|
||||||
|
|
||||||
|
# set class <mo> if still needed (if you run only this part coming from other scripts)
|
||||||
|
class(microorganisms$mo) <- c("mo", "character")
|
||||||
|
microorganisms <- microorganisms %>% arrange(fullname)
|
||||||
usethis::use_data(microorganisms, overwrite = TRUE, version = 2, compress = "xz")
|
usethis::use_data(microorganisms, overwrite = TRUE, version = 2, compress = "xz")
|
||||||
rm(microorganisms)
|
rm(microorganisms)
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ Coagulase-positive Staphylococcus TRUE TRUE FALSE TRUE 凝固酶阳性葡萄球
|
|||||||
Beta-haemolytic Streptococcus TRUE TRUE FALSE TRUE β-溶血性链球菌 Beta-hemolytický streptokok Beta-haemolytiske streptokokker Beta-hemolytische Streptococcus Beeta-hemolyyttinen streptokokki Streptococcus Bêta-hémolytique Beta-hämolytischer Streptococcus Β-αιμολυτικός στρεπτόκοκκος Streptococcus Beta-emolitico ベータ溶血性レンサ球菌 Beta-hemolytiske streptokokker Streptococcus beta-hemolityczny Streptococcus Beta-hemolítico Streptococ beta-hemolitic Бета-гемолитический стрептококк Streptococcus Beta-hemolítico Beta-hemolytiska streptokocker Beta-hemolitik Streptokok Бета-гемолітичний стрептокок
|
Beta-haemolytic Streptococcus TRUE TRUE FALSE TRUE β-溶血性链球菌 Beta-hemolytický streptokok Beta-haemolytiske streptokokker Beta-hemolytische Streptococcus Beeta-hemolyyttinen streptokokki Streptococcus Bêta-hémolytique Beta-hämolytischer Streptococcus Β-αιμολυτικός στρεπτόκοκκος Streptococcus Beta-emolitico ベータ溶血性レンサ球菌 Beta-hemolytiske streptokokker Streptococcus beta-hemolityczny Streptococcus Beta-hemolítico Streptococ beta-hemolitic Бета-гемолитический стрептококк Streptococcus Beta-hemolítico Beta-hemolytiska streptokocker Beta-hemolitik Streptokok Бета-гемолітичний стрептокок
|
||||||
unknown Gram-negatives TRUE TRUE FALSE TRUE 不明革兰氏阴性菌 neznámé gramnegativní ukendte Gram-negative onbekende Gram-negatieven tuntemattomat gramnegatiiviset Gram négatifs inconnus unbekannte Gramnegativen άγνωστοι αρνητικοί κατά Gram Gram negativi sconosciuti 不明なグラム陰性菌 ukjent Gram-negative Nieznane bakterie Gram-ujemne Gram negativos desconhecidos Gram-negative necunoscute неизвестные грамотрицательные Gram negativos desconocidos okända gramnegativa bakterier bilinmeyen Gram-negatifler невідомі грамнегативні
|
unknown Gram-negatives TRUE TRUE FALSE TRUE 不明革兰氏阴性菌 neznámé gramnegativní ukendte Gram-negative onbekende Gram-negatieven tuntemattomat gramnegatiiviset Gram négatifs inconnus unbekannte Gramnegativen άγνωστοι αρνητικοί κατά Gram Gram negativi sconosciuti 不明なグラム陰性菌 ukjent Gram-negative Nieznane bakterie Gram-ujemne Gram negativos desconhecidos Gram-negative necunoscute неизвестные грамотрицательные Gram negativos desconocidos okända gramnegativa bakterier bilinmeyen Gram-negatifler невідомі грамнегативні
|
||||||
unknown Gram-positives TRUE TRUE FALSE TRUE 不明革兰氏阳性菌 neznámé grampozitivní ukendte Gram-positive onbekende Gram-positieven tuntemattomat grampositiiviset Gram positifs inconnus unbekannte Grampositiven άγνωστοι θετικοί κατά Gram Gram positivi sconosciuti 未知のグラム陽性菌 ukjent Gram-positive Nieznane bakterie Gram-dodatnie Gram positivos desconhecidos Gram-pozitive necunoscute неизвестные грамположительные Gram positivos desconocidos okända Gram-positiva bilinmeyen Gram-pozitifler невідомі грампозитивні
|
unknown Gram-positives TRUE TRUE FALSE TRUE 不明革兰氏阳性菌 neznámé grampozitivní ukendte Gram-positive onbekende Gram-positieven tuntemattomat grampositiiviset Gram positifs inconnus unbekannte Grampositiven άγνωστοι θετικοί κατά Gram Gram positivi sconosciuti 未知のグラム陽性菌 ukjent Gram-positive Nieznane bakterie Gram-dodatnie Gram positivos desconhecidos Gram-pozitive necunoscute неизвестные грамположительные Gram positivos desconocidos okända Gram-positiva bilinmeyen Gram-pozitifler невідомі грампозитивні
|
||||||
|
unknown anaerobic Gram-negatives TRUE TRUE FALSE TRUE ukendte anaerobe Gram-negative onbekende anaerobe Gram-negatieven unbekannte anaerobe Gramnegativen
|
||||||
|
unknown anaerobic Gram-positives TRUE TRUE FALSE TRUE ukendte anaerobe Gram-positive onbekende anaerobe Gram-positieven unbekannte anaerobe Grampositiven
|
||||||
unknown fungus TRUE TRUE FALSE TRUE 未知真菌 neznámé houby ukendt svamp onbekende schimmel tuntematon sieni champignon inconnu unbekannter Pilze άγνωστος μύκητας fungo sconosciuto 未知真菌 ukjent sopp Nieznany grzyb fungo desconhecido ciuperci necunoscute неизвестный грибок hongo desconocido Okänd svamp bilinmeyen mantar невідомий гриб
|
unknown fungus TRUE TRUE FALSE TRUE 未知真菌 neznámé houby ukendt svamp onbekende schimmel tuntematon sieni champignon inconnu unbekannter Pilze άγνωστος μύκητας fungo sconosciuto 未知真菌 ukjent sopp Nieznany grzyb fungo desconhecido ciuperci necunoscute неизвестный грибок hongo desconocido Okänd svamp bilinmeyen mantar невідомий гриб
|
||||||
unknown yeast TRUE TRUE FALSE TRUE 未知酵母菌 neznámé kvasinky ukendt gær onbekende gist tuntematon hiiva levure inconnue unbekannte Hefe άγνωστος ζυμομύκητας lievito sconosciuto 未知酵母 ukjent gjær Nieznany drożdżak levedura desconhecida drojdie necunoscută неизвестные дрожжи levadura desconocida Okänd jäst bilinmeyen maya невідомі дріжджі
|
unknown yeast TRUE TRUE FALSE TRUE 未知酵母菌 neznámé kvasinky ukendt gær onbekende gist tuntematon hiiva levure inconnue unbekannte Hefe άγνωστος ζυμομύκητας lievito sconosciuto 未知酵母 ukjent gjær Nieznany drożdżak levedura desconhecida drojdie necunoscută неизвестные дрожжи levadura desconocida Okänd jäst bilinmeyen maya невідомі дріжджі
|
||||||
unknown name TRUE TRUE FALSE TRUE 不明名称 neznámý název ukendt navn onbekende naam tuntematon nimi nom inconnu unbekannte Name άγνωστο όνομα nome sconosciuto 名称未知 ukjent navn nieznana nazwa nome desconhecido nume necunoscut неизвестное название nombre desconocido okänt namn bilinmeyen isim невідома назва
|
unknown name TRUE TRUE FALSE TRUE 不明名称 neznámý název ukendt navn onbekende naam tuntematon nimi nom inconnu unbekannte Name άγνωστο όνομα nome sconosciuto 名称未知 ukjent navn nieznana nazwa nome desconhecido nume necunoscut неизвестное название nombre desconocido okänt namn bilinmeyen isim невідома назва
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -41,3 +41,6 @@ suppressMessages(
|
|||||||
expect_identical(as.character(as.mo("ENT_ASB_CLO")), "ENT_ASB_CLO")
|
expect_identical(as.character(as.mo("ENT_ASB_CLO")), "ENT_ASB_CLO")
|
||||||
expect_identical(mo_name("ENT_ASB_CLO"), "Enterobacter asburiae/cloacae")
|
expect_identical(mo_name("ENT_ASB_CLO"), "Enterobacter asburiae/cloacae")
|
||||||
expect_identical(mo_gramstain("ENT_ASB_CLO", language = NULL), "Gram-negative")
|
expect_identical(mo_gramstain("ENT_ASB_CLO", language = NULL), "Gram-negative")
|
||||||
|
|
||||||
|
expect_identical(paste("B", AMR:::abbreviate_mo("Klebsiella"), AMR:::abbreviate_mo("pneumoniae", 4), sep = "_"),
|
||||||
|
as.character(as.mo("Klebsiella pneumoniae")))
|
@ -279,13 +279,8 @@ expect_equal(suppressWarnings(as.mo("Virus")), as.mo("UNKNOWN"))
|
|||||||
expect_equal(length(summary(example_isolates$mo)), 6)
|
expect_equal(length(summary(example_isolates$mo)), 6)
|
||||||
|
|
||||||
# WHONET codes and NA/NaN
|
# WHONET codes and NA/NaN
|
||||||
expect_equal(
|
expect_true(all(is.na(as.mo(c("xxx", "na", "nan")))))
|
||||||
as.character(as.mo(c("xxx", "na", "nan"), debug = TRUE)),
|
expect_equal(as.character(as.mo(c("con", "eco"))), c("UNKNOWN", "B_ESCHR_COLI"))
|
||||||
rep(NA_character_, 3)
|
|
||||||
)
|
|
||||||
expect_equal(as.character(as.mo("con")), "UNKNOWN")
|
|
||||||
expect_equal(as.character(as.mo("xxx")), NA_character_)
|
|
||||||
expect_equal(as.character(as.mo(c("xxx", "con", "eco"))), c(NA_character_, "UNKNOWN", "B_ESCHR_COLI"))
|
|
||||||
expect_equal(
|
expect_equal(
|
||||||
as.character(suppressWarnings(as.mo(c("other", "none", "unknown")))),
|
as.character(suppressWarnings(as.mo(c("other", "none", "unknown")))),
|
||||||
rep("UNKNOWN", 3)
|
rep("UNKNOWN", 3)
|
||||||
|
@ -96,13 +96,15 @@ expect_true(length(mo_synonyms("Candida albicans")) > 1)
|
|||||||
expect_inherits(mo_synonyms(c("Candida albicans", "Escherichia coli")), "list")
|
expect_inherits(mo_synonyms(c("Candida albicans", "Escherichia coli")), "list")
|
||||||
expect_equal(names(mo_info("Escherichia coli")), c(
|
expect_equal(names(mo_info("Escherichia coli")), c(
|
||||||
"mo",
|
"mo",
|
||||||
"kingdom", "phylum", "class", "order",
|
"kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies",
|
||||||
"family", "genus", "species", "subspecies",
|
"status", "synonyms", "gramstain", "oxygen_tolerance",
|
||||||
"status", "synonyms", "gramstain", "url", "ref",
|
"url", "ref", "snomed", "lpsn", "gbif"
|
||||||
"snomed"
|
|
||||||
))
|
))
|
||||||
expect_inherits(mo_info(c("Escherichia coli", "Staphylococcus aureus")), "list")
|
expect_inherits(mo_info(c("Escherichia coli", "Staphylococcus aureus")), "list")
|
||||||
|
|
||||||
|
expect_identical(mo_oxygen_tolerance(c("Klebsiella pneumoniae", "Clostridioides difficile")),
|
||||||
|
c("aerobe", "anaerobe"))
|
||||||
|
|
||||||
expect_equal(as.character(table(mo_pathogenicity(example_isolates$mo))),
|
expect_equal(as.character(table(mo_pathogenicity(example_isolates$mo))),
|
||||||
c("1561", "422", "1", "16"))
|
c("1561", "422", "1", "16"))
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||||
# ==================================================================== #
|
# ==================================================================== #
|
||||||
|
|
||||||
expect_identical(mo_genus("B_GRAMP", language = "pt"), "(Gram positivos desconhecidos)")
|
expect_identical(mo_genus("B_GRAMP", language = "pt"), "(gênero desconhecido)")
|
||||||
|
|
||||||
expect_identical(mo_fullname("CoNS", "cs"), "Koaguláza-negativní stafylokok (KNS)")
|
expect_identical(mo_fullname("CoNS", "cs"), "Koaguláza-negativní stafylokok (KNS)")
|
||||||
expect_identical(mo_fullname("CoNS", "da"), "Koagulase-negative stafylokokker (KNS)")
|
expect_identical(mo_fullname("CoNS", "da"), "Koagulase-negative stafylokokker (KNS)")
|
||||||
|
@ -47,7 +47,7 @@ antibiogram(
|
|||||||
|
|
||||||
\item{antibiotics}{vector of any antibiotic name or code (will be evaluated with \code{\link[=as.ab]{as.ab()}}, column name of \code{x}, or (any combinations of) \link[=antibiotic_class_selectors]{antibiotic selectors} such as \code{\link[=aminoglycosides]{aminoglycosides()}} or \code{\link[=carbapenems]{carbapenems()}}. For combination antibiograms, this can also be set to values separated with \code{"+"}, such as "TZP+TOB" or "cipro + genta", given that columns resembling such antibiotics exist in \code{x}. See \emph{Examples}.}
|
\item{antibiotics}{vector of any antibiotic name or code (will be evaluated with \code{\link[=as.ab]{as.ab()}}, column name of \code{x}, or (any combinations of) \link[=antibiotic_class_selectors]{antibiotic selectors} such as \code{\link[=aminoglycosides]{aminoglycosides()}} or \code{\link[=carbapenems]{carbapenems()}}. For combination antibiograms, this can also be set to values separated with \code{"+"}, such as "TZP+TOB" or "cipro + genta", given that columns resembling such antibiotics exist in \code{x}. See \emph{Examples}.}
|
||||||
|
|
||||||
\item{mo_transform}{a character to transform microorganism input - must be "name", "shortname", "gramstain", or one of the column names of the \link{microorganisms} data set: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence", or "snomed". Can also be \code{NULL} to not transform the input.}
|
\item{mo_transform}{a character to transform microorganism input - must be "name", "shortname", "gramstain", or one of the column names of the \link{microorganisms} data set: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "oxygen_tolerance", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence", or "snomed". Can also be \code{NULL} to not transform the input.}
|
||||||
|
|
||||||
\item{ab_transform}{a character to transform antibiotic input - must be one of the column names of the \link{antibiotics} data set: "ab", "cid", "name", "group", "atc", "atc_group1", "atc_group2", "abbreviations", "synonyms", "oral_ddd", "oral_units", "iv_ddd", "iv_units", or "loinc". Can also be \code{NULL} to not transform the input.}
|
\item{ab_transform}{a character to transform antibiotic input - must be one of the column names of the \link{antibiotics} data set: "ab", "cid", "name", "group", "atc", "atc_group1", "atc_group2", "abbreviations", "synonyms", "oral_ddd", "oral_units", "iv_ddd", "iv_units", or "loinc". Can also be \code{NULL} to not transform the input.}
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ ureido <- antibiogram(example_isolates,
|
|||||||
# in an Rmd file, you would just need to return `ureido` in a chunk,
|
# in an Rmd file, you would just need to return `ureido` in a chunk,
|
||||||
# but to be explicit here:
|
# but to be explicit here:
|
||||||
if (requireNamespace("knitr")) {
|
if (requireNamespace("knitr")) {
|
||||||
knitr::knit_print(ureido)
|
cat(knitr::knit_print(ureido))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,13 +121,14 @@ The coercion rules consider the prevalence of microorganisms in humans, which is
|
|||||||
\item Berends MS \emph{et al.} (2022). \strong{AMR: An R Package for Working with Antimicrobial Resistance Data}. \emph{Journal of Statistical Software}, 104(3), 1-31; \doi{10.18637/jss.v104.i03}
|
\item Berends MS \emph{et al.} (2022). \strong{AMR: An R Package for Working with Antimicrobial Resistance Data}. \emph{Journal of Statistical Software}, 104(3), 1-31; \doi{10.18637/jss.v104.i03}
|
||||||
\item Becker K \emph{et al.} (2014). \strong{Coagulase-Negative Staphylococci.} \emph{Clin Microbiol Rev.} 27(4): 870-926; \doi{10.1128/CMR.00109-13}
|
\item Becker K \emph{et al.} (2014). \strong{Coagulase-Negative Staphylococci.} \emph{Clin Microbiol Rev.} 27(4): 870-926; \doi{10.1128/CMR.00109-13}
|
||||||
\item Becker K \emph{et al.} (2019). \strong{Implications of identifying the recently defined members of the \emph{S. aureus} complex, \emph{S. argenteus} and \emph{S. schweitzeri}: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS).} \emph{Clin Microbiol Infect}; \doi{10.1016/j.cmi.2019.02.028}
|
\item Becker K \emph{et al.} (2019). \strong{Implications of identifying the recently defined members of the \emph{S. aureus} complex, \emph{S. argenteus} and \emph{S. schweitzeri}: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS).} \emph{Clin Microbiol Infect}; \doi{10.1016/j.cmi.2019.02.028}
|
||||||
\item Becker K \emph{et al.} (2020). \strong{Emergence of coagulase-negative staphylococci} \emph{Expert Rev Anti Infect Ther.} 18(4):349-366; \doi{10.1080/14787210.2020.1730813}
|
\item Becker K \emph{et al.} (2020). \strong{Emergence of coagulase-negative staphylococci.} \emph{Expert Rev Anti Infect Ther.} 18(4):349-366; \doi{10.1080/14787210.2020.1730813}
|
||||||
\item Lancefield RC (1933). \strong{A serological differentiation of human and other groups of hemolytic streptococci}. \emph{J Exp Med.} 57(4): 571-95; \doi{10.1084/jem.57.4.571}
|
\item Lancefield RC (1933). \strong{A serological differentiation of human and other groups of hemolytic streptococci.} \emph{J Exp Med.} 57(4): 571-95; \doi{10.1084/jem.57.4.571}
|
||||||
\item Berends MS \emph{et al.} (2022). \strong{Trends in Occurrence and Phenotypic Resistance of Coagulase-Negative Staphylococci (CoNS) Found in Human Blood in the Northern Netherlands between 2013 and 2019} \emph{Microorganisms} 10(9), 1801; \doi{10.3390/microorganisms10091801}
|
\item Berends MS \emph{et al.} (2022). \strong{Trends in Occurrence and Phenotypic Resistance of Coagulase-Negative Staphylococci (CoNS) Found in Human Blood in the Northern Netherlands between 2013 and 2019/} \emph{Micro.rganisms} 10(9), 1801; \doi{10.3390/microorganisms10091801}
|
||||||
\item Parte, AC \emph{et al.} (2020). \strong{List of Prokaryotic names with Standing in Nomenclature (LPSN) moves to the DSMZ.} International Journal of Systematic and Evolutionary Microbiology, 70, 5607-5612; \doi{10.1099/ijsem.0.004332}. Accessed from \url{https://lpsn.dsmz.de} on 11 December, 2022.
|
\item Parte, AC \emph{et al.} (2020). \strong{List of Prokaryotic names with Standing in Nomenclature (LPSN) moves to the DSMZ.} International Journal of Systematic and Evolutionary Microbiology, 70, 5607-5612; \doi{10.1099/ijsem.0.004332}. Accessed from \url{https://lpsn.dsmz.de} on 11 December, 2022.
|
||||||
\item GBIF Secretariat (2022). GBIF Backbone Taxonomy. Checklist dataset \doi{10.15468/39omei}. Accessed from \url{https://www.gbif.org} on 11 December, 2022.
|
\item GBIF Secretariat (2022). GBIF Backbone Taxonomy. Checklist dataset \doi{10.15468/39omei}. Accessed from \url{https://www.gbif.org} on 11 December, 2022.
|
||||||
\item Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microoganism', OID 2.16.840.1.114222.4.11.1009 (v12). URL: \url{https://phinvads.cdc.gov}
|
\item Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microoganism', OID 2.16.840.1.114222.4.11.1009 (v12). URL: \url{https://phinvads.cdc.gov}
|
||||||
\item Bartlett A \emph{et al.} (2022). \strong{A comprehensive list of bacterial pathogens infecting humans} \emph{Microbiology} 168:001269; \doi{10.1099/mic.0.001269}
|
\item Bartlett A \emph{et al.} (2022). \strong{A comprehensive list of bacterial pathogens infecting humans} \emph{Microbiology} 168:001269; \doi{10.1099/mic.0.001269}
|
||||||
|
\item Reimer \emph{et al.} (2022). \strong{\emph{BacDive} in 2022: the knowledge base for standardized bacterial and archaeal data.} \emph{Nucleic Acids Res.} 2022 Jan 7;50(D1):D741-D746; \doi{10.1093/nar/gkab961}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +161,7 @@ Furthermore,
|
|||||||
\item Any genus present in the \strong{established} list also has \code{prevalence = 1.0} in the \link{microorganisms} data set;
|
\item Any genus present in the \strong{established} list also has \code{prevalence = 1.0} in the \link{microorganisms} data set;
|
||||||
\item Any other genus present in the \strong{putative} list has \code{prevalence = 1.25} in the \link{microorganisms} data set;
|
\item Any other genus present in the \strong{putative} list has \code{prevalence = 1.25} in the \link{microorganisms} data set;
|
||||||
\item Any other species or subspecies of which the genus is present in the two aforementioned groups, has \code{prevalence = 1.5} in the \link{microorganisms} data set;
|
\item Any other species or subspecies of which the genus is present in the two aforementioned groups, has \code{prevalence = 1.5} in the \link{microorganisms} data set;
|
||||||
\item Any \emph{non-bacterial} genus, species or subspecies of which the genus is present in the following list, has \code{prevalence = 1.5} in the \link{microorganisms} data set: \emph{Absidia}, \emph{Acanthamoeba}, \emph{Acremonium}, \emph{Aedes}, \emph{Alternaria}, \emph{Amoeba}, \emph{Ancylostoma}, \emph{Angiostrongylus}, \emph{Anisakis}, \emph{Anopheles}, \emph{Apophysomyces}, \emph{Aspergillus}, \emph{Aureobasidium}, \emph{Basidiobolus}, \emph{Beauveria}, \emph{Blastocystis}, \emph{Blastomyces}, \emph{Candida}, \emph{Capillaria}, \emph{Chaetomium}, \emph{Chrysonilia}, \emph{Cladophialophora}, \emph{Cladosporium}, \emph{Conidiobolus}, \emph{Contracaecum}, \emph{Cordylobia}, \emph{Cryptococcus}, \emph{Curvularia}, \emph{Demodex}, \emph{Dermatobia}, \emph{Dientamoeba}, \emph{Diphyllobothrium}, \emph{Dirofilaria}, \emph{Echinostoma}, \emph{Entamoeba}, \emph{Enterobius}, \emph{Exophiala}, \emph{Exserohilum}, \emph{Fasciola}, \emph{Fonsecaea}, \emph{Fusarium}, \emph{Giardia}, \emph{Haloarcula}, \emph{Halobacterium}, \emph{Halococcus}, \emph{Hendersonula}, \emph{Heterophyes}, \emph{Histomonas}, \emph{Histoplasma}, \emph{Hymenolepis}, \emph{Hypomyces}, \emph{Hysterothylacium}, \emph{Leishmania}, \emph{Malassezia}, \emph{Malbranchea}, \emph{Metagonimus}, \emph{Meyerozyma}, \emph{Microsporidium}, \emph{Microsporum}, \emph{Mortierella}, \emph{Mucor}, \emph{Mycocentrospora}, \emph{Necator}, \emph{Nectria}, \emph{Ochroconis}, \emph{Oesophagostomum}, \emph{Oidiodendron}, \emph{Opisthorchis}, \emph{Pediculus}, \emph{Phlebotomus}, \emph{Phoma}, \emph{Pichia}, \emph{Piedraia}, \emph{Pithomyces}, \emph{Pityrosporum}, \emph{Pneumocystis}, \emph{Pseudallescheria}, \emph{Pseudoterranova}, \emph{Pulex}, \emph{Rhizomucor}, \emph{Rhizopus}, \emph{Rhodotorula}, \emph{Saccharomyces}, \emph{Sarcoptes}, \emph{Scolecobasidium}, \emph{Scopulariopsis}, \emph{Scytalidium}, \emph{Spirometra}, \emph{Sporobolomyces}, \emph{Stachybotrys}, \emph{Strongyloides}, \emph{Syngamus}, \emph{Taenia}, \emph{Toxocara}, \emph{Trichinella}, \emph{Trichobilharzia}, \emph{Trichoderma}, \emph{Trichomonas}, \emph{Trichophyton}, \emph{Trichosporon}, \emph{Trichostrongylus}, \emph{Trichuris}, \emph{Tritirachium}, \emph{Trombicula}, \emph{Trypanosoma}, \emph{Tunga}, or \emph{Wuchereria};
|
\item Any \emph{non-bacterial} genus, species or subspecies of which the genus is present in the following list, has \code{prevalence = 1.5} in the \link{microorganisms} data set: \emph{Absidia}, \emph{Acanthamoeba}, \emph{Acremonium}, \emph{Aedes}, \emph{Alternaria}, \emph{Amoeba}, \emph{Ancylostoma}, \emph{Angiostrongylus}, \emph{Anisakis}, \emph{Anopheles}, \emph{Apophysomyces}, \emph{Aspergillus}, \emph{Aureobasidium}, \emph{Basidiobolus}, \emph{Beauveria}, \emph{Blastocystis}, \emph{Blastomyces}, \emph{Candida}, \emph{Capillaria}, \emph{Chaetomium}, \emph{Chrysonilia}, \emph{Cladophialophora}, \emph{Cladosporium}, \emph{Conidiobolus}, \emph{Contracaecum}, \emph{Cordylobia}, \emph{Cryptococcus}, \emph{Curvularia}, \emph{Demodex}, \emph{Dermatobia}, \emph{Dientamoeba}, \emph{Diphyllobothrium}, \emph{Dirofilaria}, \emph{Echinostoma}, \emph{Entamoeba}, \emph{Enterobius}, \emph{Exophiala}, \emph{Exserohilum}, \emph{Fasciola}, \emph{Fonsecaea}, \emph{Fusarium}, \emph{Giardia}, \emph{Haloarcula}, \emph{Halobacterium}, \emph{Halococcus}, \emph{Hendersonula}, \emph{Heterophyes}, \emph{Histomonas}, \emph{Histoplasma}, \emph{Hymenolepis}, \emph{Hypomyces}, \emph{Hysterothylacium}, \emph{Leishmania}, \emph{Malassezia}, \emph{Malbranchea}, \emph{Metagonimus}, \emph{Meyerozyma}, \emph{Microsporidium}, \emph{Microsporum}, \emph{Mortierella}, \emph{Mucor}, \emph{Mycocentrospora}, \emph{Necator}, \emph{Nectria}, \emph{Ochroconis}, \emph{Oesophagostomum}, \emph{Oidiodendron}, \emph{Opisthorchis}, \emph{Pediculus}, \emph{Penicillium}, \emph{Phlebotomus}, \emph{Phoma}, \emph{Pichia}, \emph{Piedraia}, \emph{Pithomyces}, \emph{Pityrosporum}, \emph{Pneumocystis}, \emph{Pseudallescheria}, \emph{Pseudoterranova}, \emph{Pulex}, \emph{Rhizomucor}, \emph{Rhizopus}, \emph{Rhodotorula}, \emph{Saccharomyces}, \emph{Sarcoptes}, \emph{Scolecobasidium}, \emph{Scopulariopsis}, \emph{Scytalidium}, \emph{Spirometra}, \emph{Sporobolomyces}, \emph{Stachybotrys}, \emph{Strongyloides}, \emph{Syngamus}, \emph{Taenia}, \emph{Talaromyces}, \emph{Toxocara}, \emph{Trichinella}, \emph{Trichobilharzia}, \emph{Trichoderma}, \emph{Trichomonas}, \emph{Trichophyton}, \emph{Trichosporon}, \emph{Trichostrongylus}, \emph{Trichuris}, \emph{Tritirachium}, \emph{Trombicula}, \emph{Trypanosoma}, \emph{Tunga}, or \emph{Wuchereria};
|
||||||
\item All other records have \code{prevalence = 2.0} in the \link{microorganisms} data set.
|
\item All other records have \code{prevalence = 2.0} in the \link{microorganisms} data set.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ After using \code{\link[=as.sir]{as.sir()}}, you can use the \code{\link[=eucast
|
|||||||
|
|
||||||
\subsection{Machine-Readable Clinical Breakpoints}{
|
\subsection{Machine-Readable Clinical Breakpoints}{
|
||||||
|
|
||||||
The repository of this package \href{https://github.com/msberends/AMR/blob/main/data-raw/clinical_breakpoints.txt}{contains a machine-readable version} of all guidelines. This is a CSV file consisting of 18 308 rows and 11 columns. This file is machine-readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial drug and the microorganism. \strong{This allows for easy implementation of these rules in laboratory information systems (LIS)}. Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed.
|
The repository of this package \href{https://github.com/msberends/AMR/blob/main/data-raw/clinical_breakpoints.txt}{contains a machine-readable version} of all guidelines. This is a CSV file consisting of 18 271 rows and 11 columns. This file is machine-readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial drug and the microorganism. \strong{This allows for easy implementation of these rules in laboratory information systems (LIS)}. Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed.
|
||||||
}
|
}
|
||||||
|
|
||||||
\subsection{Other}{
|
\subsection{Other}{
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
\alias{clinical_breakpoints}
|
\alias{clinical_breakpoints}
|
||||||
\title{Data Set with Clinical Breakpoints for SIR Interpretation}
|
\title{Data Set with Clinical Breakpoints for SIR Interpretation}
|
||||||
\format{
|
\format{
|
||||||
A \link[tibble:tibble]{tibble} with 18 308 observations and 11 variables:
|
A \link[tibble:tibble]{tibble} with 18 271 observations and 11 variables:
|
||||||
\itemize{
|
\itemize{
|
||||||
\item \code{guideline}\cr Name of the guideline
|
\item \code{guideline}\cr Name of the guideline
|
||||||
\item \code{method}\cr Either "DISK" or "MIC"
|
\item \code{method}\cr Either "DISK" or "MIC"
|
||||||
|
@ -60,7 +60,7 @@ eucast_rules(df, rules = "custom", custom_rules = x, info = FALSE)
|
|||||||
|
|
||||||
\subsection{Using taxonomic properties in rules}{
|
\subsection{Using taxonomic properties in rules}{
|
||||||
|
|
||||||
There is one exception in columns used for the rules: all column names of the \link{microorganisms} data set can also be used, but do not have to exist in the data set. These column names are: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence", and "snomed". Thus, this next example will work as well, despite the fact that the \code{df} data set does not contain a column \code{genus}:
|
There is one exception in columns used for the rules: all column names of the \link{microorganisms} data set can also be used, but do not have to exist in the data set. These column names are: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "oxygen_tolerance", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence", and "snomed". Thus, this next example will work as well, despite the fact that the \code{df} data set does not contain a column \code{genus}:
|
||||||
|
|
||||||
\if{html}{\out{<div class="sourceCode r">}}\preformatted{y <- custom_eucast_rules(TZP == "S" & genus == "Klebsiella" ~ aminopenicillins == "S",
|
\if{html}{\out{<div class="sourceCode r">}}\preformatted{y <- custom_eucast_rules(TZP == "S" & genus == "Klebsiella" ~ aminopenicillins == "S",
|
||||||
TZP == "R" & genus == "Klebsiella" ~ aminopenicillins == "R")
|
TZP == "R" & genus == "Klebsiella" ~ aminopenicillins == "R")
|
||||||
|
File diff suppressed because one or more lines are too long
@ -46,6 +46,9 @@ These \code{\link[=like]{like()}} and \verb{\%like\%}/\verb{\%unlike\%} function
|
|||||||
Using RStudio? The \verb{\%like\%}/\verb{\%unlike\%} functions can also be directly inserted in your code from the Addins menu and can have its own keyboard shortcut like \code{Shift+Ctrl+L} or \code{Shift+Cmd+L} (see menu \code{Tools} > \verb{Modify Keyboard Shortcuts...}). If you keep pressing your shortcut, the inserted text will be iterated over \verb{\%like\%} -> \verb{\%unlike\%} -> \verb{\%like_case\%} -> \verb{\%unlike_case\%}.
|
Using RStudio? The \verb{\%like\%}/\verb{\%unlike\%} functions can also be directly inserted in your code from the Addins menu and can have its own keyboard shortcut like \code{Shift+Ctrl+L} or \code{Shift+Cmd+L} (see menu \code{Tools} > \verb{Modify Keyboard Shortcuts...}). If you keep pressing your shortcut, the inserted text will be iterated over \verb{\%like\%} -> \verb{\%unlike\%} -> \verb{\%like_case\%} -> \verb{\%unlike_case\%}.
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
|
# data.table has a more limited version of \%like\%, so unload it:
|
||||||
|
try(detach("package:data.table", unload = TRUE), silent = TRUE)
|
||||||
|
|
||||||
a <- "This is a test"
|
a <- "This is a test"
|
||||||
b <- "TEST"
|
b <- "TEST"
|
||||||
a \%like\% b
|
a \%like\% b
|
||||||
|
File diff suppressed because one or more lines are too long
@ -3,9 +3,9 @@
|
|||||||
\docType{data}
|
\docType{data}
|
||||||
\name{microorganisms}
|
\name{microorganisms}
|
||||||
\alias{microorganisms}
|
\alias{microorganisms}
|
||||||
\title{Data Set with 52 142 Microorganisms}
|
\title{Data Set with 52 151 Microorganisms}
|
||||||
\format{
|
\format{
|
||||||
A \link[tibble:tibble]{tibble} with 52 142 observations and 22 variables:
|
A \link[tibble:tibble]{tibble} with 52 151 observations and 23 variables:
|
||||||
\itemize{
|
\itemize{
|
||||||
\item \code{mo}\cr ID of microorganism as used by this package
|
\item \code{mo}\cr ID of microorganism as used by this package
|
||||||
\item \code{fullname}\cr Full name, like \code{"Escherichia coli"}. For the taxonomic ranks genus, species and subspecies, this is the 'pasted' text of genus, species, and subspecies. For all taxonomic ranks higher than genus, this is the name of the taxon.
|
\item \code{fullname}\cr Full name, like \code{"Escherichia coli"}. For the taxonomic ranks genus, species and subspecies, this is the 'pasted' text of genus, species, and subspecies. For all taxonomic ranks higher than genus, this is the name of the taxon.
|
||||||
@ -14,6 +14,7 @@ A \link[tibble:tibble]{tibble} with 52 142 observations and 22 variables:
|
|||||||
\item \code{rank}\cr Text of the taxonomic rank of the microorganism, such as \code{"species"} or \code{"genus"}
|
\item \code{rank}\cr Text of the taxonomic rank of the microorganism, such as \code{"species"} or \code{"genus"}
|
||||||
\item \code{ref}\cr Author(s) and year of related scientific publication. This contains only the \emph{first surname} and year of the \emph{latest} authors, e.g. "Wallis \emph{et al.} 2006 \emph{emend.} Smith and Jones 2018" becomes "Smith \emph{et al.}, 2018". This field is directly retrieved from the source specified in the column \code{source}. Moreover, accents were removed to comply with CRAN that only allows ASCII characters, e.g. "Váňová" becomes "Vanova".
|
\item \code{ref}\cr Author(s) and year of related scientific publication. This contains only the \emph{first surname} and year of the \emph{latest} authors, e.g. "Wallis \emph{et al.} 2006 \emph{emend.} Smith and Jones 2018" becomes "Smith \emph{et al.}, 2018". This field is directly retrieved from the source specified in the column \code{source}. Moreover, accents were removed to comply with CRAN that only allows ASCII characters, e.g. "Váňová" becomes "Vanova".
|
||||||
\item \code{lpsn}\cr Identifier ('Record number') of the List of Prokaryotic names with Standing in Nomenclature (LPSN). This will be the first/highest LPSN identifier to keep one identifier per row. For example, \emph{Acetobacter ascendens} has LPSN Record number 7864 and 11011. Only the first is available in the \code{microorganisms} data set.
|
\item \code{lpsn}\cr Identifier ('Record number') of the List of Prokaryotic names with Standing in Nomenclature (LPSN). This will be the first/highest LPSN identifier to keep one identifier per row. For example, \emph{Acetobacter ascendens} has LPSN Record number 7864 and 11011. Only the first is available in the \code{microorganisms} data set.
|
||||||
|
\item \code{oxygen_tolerance} \cr Oxygen tolerance, either "aerobe", "anaerobe", "anaerobe/microaerophile", "facultative anaerobe", "likely facultative anaerobe", or "microaerophile". These data were retrieved from BacDive (see \emph{Source}). Items that contain "likely" are missing from BacDive and were extrapolated from other species within the same genus to guess the oxygen tolerance. Currently 73.4\% of all ~36 000 bacteria in the data set contain an oxygen tolerance.
|
||||||
\item \code{lpsn_parent}\cr LPSN identifier of the parent taxon
|
\item \code{lpsn_parent}\cr LPSN identifier of the parent taxon
|
||||||
\item \code{lpsn_renamed_to}\cr LPSN identifier of the currently valid taxon
|
\item \code{lpsn_renamed_to}\cr LPSN identifier of the currently valid taxon
|
||||||
\item \code{gbif}\cr Identifier ('taxonID') of the Global Biodiversity Information Facility (GBIF)
|
\item \code{gbif}\cr Identifier ('taxonID') of the Global Biodiversity Information Facility (GBIF)
|
||||||
@ -31,6 +32,7 @@ A \link[tibble:tibble]{tibble} with 52 142 observations and 22 variables:
|
|||||||
\item Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microoganism', OID 2.16.840.1.114222.4.11.1009 (v12). URL: \url{https://phinvads.cdc.gov}
|
\item Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microoganism', OID 2.16.840.1.114222.4.11.1009 (v12). URL: \url{https://phinvads.cdc.gov}
|
||||||
\item Grimont \emph{et al.} (2007). Antigenic Formulae of the Salmonella Serovars, 9th Edition. WHO Collaborating Centre for Reference and Research on \emph{Salmonella} (WHOCC-SALM).
|
\item Grimont \emph{et al.} (2007). Antigenic Formulae of the Salmonella Serovars, 9th Edition. WHO Collaborating Centre for Reference and Research on \emph{Salmonella} (WHOCC-SALM).
|
||||||
\item Bartlett \emph{et al.} (2022). \strong{A comprehensive list of bacterial pathogens infecting humans} \emph{Microbiology} 168:001269; \doi{10.1099/mic.0.001269}
|
\item Bartlett \emph{et al.} (2022). \strong{A comprehensive list of bacterial pathogens infecting humans} \emph{Microbiology} 168:001269; \doi{10.1099/mic.0.001269}
|
||||||
|
\item Reimer \emph{et al.} (2022). \strong{\emph{BacDive} in 2022: the knowledge base for standardized bacterial and archaeal data.} \emph{Nucleic Acids Res.} 2022 Jan 7;50(D1):D741-D746; \doi{10.1093/nar/gkab961}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\usage{
|
\usage{
|
||||||
@ -51,7 +53,7 @@ Included taxonomic data are:
|
|||||||
\item All ~36 000 (sub)species from the kingdoms of Archaea and Bacteria
|
\item All ~36 000 (sub)species from the kingdoms of Archaea and Bacteria
|
||||||
\item ~7 900 (sub)species from the kingdom of Fungi. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package. Only relevant fungi are covered (such as all species of \emph{Aspergillus}, \emph{Candida}, \emph{Cryptococcus}, \emph{Histoplasma}, \emph{Pneumocystis}, \emph{Saccharomyces} and \emph{Trichophyton}).
|
\item ~7 900 (sub)species from the kingdom of Fungi. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package. Only relevant fungi are covered (such as all species of \emph{Aspergillus}, \emph{Candida}, \emph{Cryptococcus}, \emph{Histoplasma}, \emph{Pneumocystis}, \emph{Saccharomyces} and \emph{Trichophyton}).
|
||||||
\item ~5 100 (sub)species from the kingdom of Protozoa
|
\item ~5 100 (sub)species from the kingdom of Protozoa
|
||||||
\item ~1 400 (sub)species from ~40 other relevant genera from the kingdom of Animalia (such as \emph{Strongyloides} and \emph{Taenia})
|
\item ~1 400 (sub)species from 43 other relevant genera from the kingdom of Animalia (such as \emph{Strongyloides} and \emph{Taenia})
|
||||||
\item All ~9 800 previously accepted names of all included (sub)species (these were taxonomically renamed)
|
\item All ~9 800 previously accepted names of all included (sub)species (these were taxonomically renamed)
|
||||||
\item The complete taxonomic tree of all included (sub)species: from kingdom to subspecies
|
\item The complete taxonomic tree of all included (sub)species: from kingdom to subspecies
|
||||||
\item The identifier of the parent taxons
|
\item The identifier of the parent taxons
|
||||||
@ -61,12 +63,12 @@ Included taxonomic data are:
|
|||||||
|
|
||||||
For convenience, some entries were added manually:
|
For convenience, some entries were added manually:
|
||||||
\itemize{
|
\itemize{
|
||||||
\item ~1 500 entries for the city-like serovars of \emph{Salmonellae}
|
\item ~1 500 entries of \emph{Salmonella}, such as the city-like serovars and groups A to H
|
||||||
\item 11 entries of \emph{Streptococcus} (beta-haemolytic: groups A, B, C, D, F, G, H, K and unspecified; other: viridans, milleri)
|
\item 15 entries of \emph{Streptococcus}, such as the beta-haemolytic groups A to K, viridans, and milleri
|
||||||
\item 2 entries of \emph{Staphylococcus} (coagulase-negative (CoNS) and coagulase-positive (CoPS))
|
\item 2 entries of \emph{Staphylococcus} (coagulase-negative (CoNS) and coagulase-positive (CoPS))
|
||||||
\item 1 entry of \emph{Blastocystis} (\emph{B. hominis}), although it officially does not exist (Noel \emph{et al.} 2005, PMID 15634993)
|
\item 1 entry of \emph{Blastocystis} (\emph{B. hominis}), although it officially does not exist (Noel \emph{et al.} 2005, PMID 15634993)
|
||||||
\item 1 entry of \emph{Moraxella} (\emph{M. catarrhalis}), which was formally named \emph{Branhamella catarrhalis} (Catlin, 1970) though this change was never accepted within the field of clinical microbiology
|
\item 1 entry of \emph{Moraxella} (\emph{M. catarrhalis}), which was formally named \emph{Branhamella catarrhalis} (Catlin, 1970) though this change was never accepted within the field of clinical microbiology
|
||||||
\item 6 other 'undefined' entries (unknown, unknown Gram negatives, unknown Gram positives, unknown yeast, unknown fungus, and unknown anaerobic bacteria)
|
\item 8 other 'undefined' entries (unknown, unknown Gram-negatives, unknown Gram-positives, unknown yeast, unknown fungus, and unknown anaerobic Gram-pos/Gram-neg bacteria)
|
||||||
}
|
}
|
||||||
|
|
||||||
The syntax used to transform the original data to a cleansed \R format, can be found here: \url{https://github.com/msberends/AMR/blob/main/data-raw/reproduction_of_microorganisms.R}.
|
The syntax used to transform the original data to a cleansed \R format, can be found here: \url{https://github.com/msberends/AMR/blob/main/data-raw/reproduction_of_microorganisms.R}.
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
\docType{data}
|
\docType{data}
|
||||||
\name{microorganisms.codes}
|
\name{microorganisms.codes}
|
||||||
\alias{microorganisms.codes}
|
\alias{microorganisms.codes}
|
||||||
\title{Data Set with 5 910 Common Microorganism Codes}
|
\title{Data Set with 5 754 Common Microorganism Codes}
|
||||||
\format{
|
\format{
|
||||||
A \link[tibble:tibble]{tibble} with 5 910 observations and 2 variables:
|
A \link[tibble:tibble]{tibble} with 5 754 observations and 2 variables:
|
||||||
\itemize{
|
\itemize{
|
||||||
\item \code{code}\cr Commonly used code of a microorganism
|
\item \code{code}\cr Commonly used code of a microorganism
|
||||||
\item \code{mo}\cr ID of the microorganism in the \link{microorganisms} data set
|
\item \code{mo}\cr ID of the microorganism in the \link{microorganisms} data set
|
||||||
|
@ -48,7 +48,7 @@ Furthermore,
|
|||||||
\item Any genus present in the \strong{established} list also has \code{prevalence = 1.0} in the \link{microorganisms} data set;
|
\item Any genus present in the \strong{established} list also has \code{prevalence = 1.0} in the \link{microorganisms} data set;
|
||||||
\item Any other genus present in the \strong{putative} list has \code{prevalence = 1.25} in the \link{microorganisms} data set;
|
\item Any other genus present in the \strong{putative} list has \code{prevalence = 1.25} in the \link{microorganisms} data set;
|
||||||
\item Any other species or subspecies of which the genus is present in the two aforementioned groups, has \code{prevalence = 1.5} in the \link{microorganisms} data set;
|
\item Any other species or subspecies of which the genus is present in the two aforementioned groups, has \code{prevalence = 1.5} in the \link{microorganisms} data set;
|
||||||
\item Any \emph{non-bacterial} genus, species or subspecies of which the genus is present in the following list, has \code{prevalence = 1.5} in the \link{microorganisms} data set: \emph{Absidia}, \emph{Acanthamoeba}, \emph{Acremonium}, \emph{Aedes}, \emph{Alternaria}, \emph{Amoeba}, \emph{Ancylostoma}, \emph{Angiostrongylus}, \emph{Anisakis}, \emph{Anopheles}, \emph{Apophysomyces}, \emph{Aspergillus}, \emph{Aureobasidium}, \emph{Basidiobolus}, \emph{Beauveria}, \emph{Blastocystis}, \emph{Blastomyces}, \emph{Candida}, \emph{Capillaria}, \emph{Chaetomium}, \emph{Chrysonilia}, \emph{Cladophialophora}, \emph{Cladosporium}, \emph{Conidiobolus}, \emph{Contracaecum}, \emph{Cordylobia}, \emph{Cryptococcus}, \emph{Curvularia}, \emph{Demodex}, \emph{Dermatobia}, \emph{Dientamoeba}, \emph{Diphyllobothrium}, \emph{Dirofilaria}, \emph{Echinostoma}, \emph{Entamoeba}, \emph{Enterobius}, \emph{Exophiala}, \emph{Exserohilum}, \emph{Fasciola}, \emph{Fonsecaea}, \emph{Fusarium}, \emph{Giardia}, \emph{Haloarcula}, \emph{Halobacterium}, \emph{Halococcus}, \emph{Hendersonula}, \emph{Heterophyes}, \emph{Histomonas}, \emph{Histoplasma}, \emph{Hymenolepis}, \emph{Hypomyces}, \emph{Hysterothylacium}, \emph{Leishmania}, \emph{Malassezia}, \emph{Malbranchea}, \emph{Metagonimus}, \emph{Meyerozyma}, \emph{Microsporidium}, \emph{Microsporum}, \emph{Mortierella}, \emph{Mucor}, \emph{Mycocentrospora}, \emph{Necator}, \emph{Nectria}, \emph{Ochroconis}, \emph{Oesophagostomum}, \emph{Oidiodendron}, \emph{Opisthorchis}, \emph{Pediculus}, \emph{Phlebotomus}, \emph{Phoma}, \emph{Pichia}, \emph{Piedraia}, \emph{Pithomyces}, \emph{Pityrosporum}, \emph{Pneumocystis}, \emph{Pseudallescheria}, \emph{Pseudoterranova}, \emph{Pulex}, \emph{Rhizomucor}, \emph{Rhizopus}, \emph{Rhodotorula}, \emph{Saccharomyces}, \emph{Sarcoptes}, \emph{Scolecobasidium}, \emph{Scopulariopsis}, \emph{Scytalidium}, \emph{Spirometra}, \emph{Sporobolomyces}, \emph{Stachybotrys}, \emph{Strongyloides}, \emph{Syngamus}, \emph{Taenia}, \emph{Toxocara}, \emph{Trichinella}, \emph{Trichobilharzia}, \emph{Trichoderma}, \emph{Trichomonas}, \emph{Trichophyton}, \emph{Trichosporon}, \emph{Trichostrongylus}, \emph{Trichuris}, \emph{Tritirachium}, \emph{Trombicula}, \emph{Trypanosoma}, \emph{Tunga}, or \emph{Wuchereria};
|
\item Any \emph{non-bacterial} genus, species or subspecies of which the genus is present in the following list, has \code{prevalence = 1.5} in the \link{microorganisms} data set: \emph{Absidia}, \emph{Acanthamoeba}, \emph{Acremonium}, \emph{Aedes}, \emph{Alternaria}, \emph{Amoeba}, \emph{Ancylostoma}, \emph{Angiostrongylus}, \emph{Anisakis}, \emph{Anopheles}, \emph{Apophysomyces}, \emph{Aspergillus}, \emph{Aureobasidium}, \emph{Basidiobolus}, \emph{Beauveria}, \emph{Blastocystis}, \emph{Blastomyces}, \emph{Candida}, \emph{Capillaria}, \emph{Chaetomium}, \emph{Chrysonilia}, \emph{Cladophialophora}, \emph{Cladosporium}, \emph{Conidiobolus}, \emph{Contracaecum}, \emph{Cordylobia}, \emph{Cryptococcus}, \emph{Curvularia}, \emph{Demodex}, \emph{Dermatobia}, \emph{Dientamoeba}, \emph{Diphyllobothrium}, \emph{Dirofilaria}, \emph{Echinostoma}, \emph{Entamoeba}, \emph{Enterobius}, \emph{Exophiala}, \emph{Exserohilum}, \emph{Fasciola}, \emph{Fonsecaea}, \emph{Fusarium}, \emph{Giardia}, \emph{Haloarcula}, \emph{Halobacterium}, \emph{Halococcus}, \emph{Hendersonula}, \emph{Heterophyes}, \emph{Histomonas}, \emph{Histoplasma}, \emph{Hymenolepis}, \emph{Hypomyces}, \emph{Hysterothylacium}, \emph{Leishmania}, \emph{Malassezia}, \emph{Malbranchea}, \emph{Metagonimus}, \emph{Meyerozyma}, \emph{Microsporidium}, \emph{Microsporum}, \emph{Mortierella}, \emph{Mucor}, \emph{Mycocentrospora}, \emph{Necator}, \emph{Nectria}, \emph{Ochroconis}, \emph{Oesophagostomum}, \emph{Oidiodendron}, \emph{Opisthorchis}, \emph{Pediculus}, \emph{Penicillium}, \emph{Phlebotomus}, \emph{Phoma}, \emph{Pichia}, \emph{Piedraia}, \emph{Pithomyces}, \emph{Pityrosporum}, \emph{Pneumocystis}, \emph{Pseudallescheria}, \emph{Pseudoterranova}, \emph{Pulex}, \emph{Rhizomucor}, \emph{Rhizopus}, \emph{Rhodotorula}, \emph{Saccharomyces}, \emph{Sarcoptes}, \emph{Scolecobasidium}, \emph{Scopulariopsis}, \emph{Scytalidium}, \emph{Spirometra}, \emph{Sporobolomyces}, \emph{Stachybotrys}, \emph{Strongyloides}, \emph{Syngamus}, \emph{Taenia}, \emph{Talaromyces}, \emph{Toxocara}, \emph{Trichinella}, \emph{Trichobilharzia}, \emph{Trichoderma}, \emph{Trichomonas}, \emph{Trichophyton}, \emph{Trichosporon}, \emph{Trichostrongylus}, \emph{Trichuris}, \emph{Tritirachium}, \emph{Trombicula}, \emph{Trypanosoma}, \emph{Tunga}, or \emph{Wuchereria};
|
||||||
\item All other records have \code{prevalence = 2.0} in the \link{microorganisms} data set.
|
\item All other records have \code{prevalence = 2.0} in the \link{microorganisms} data set.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
\alias{mo_is_gram_positive}
|
\alias{mo_is_gram_positive}
|
||||||
\alias{mo_is_yeast}
|
\alias{mo_is_yeast}
|
||||||
\alias{mo_is_intrinsic_resistant}
|
\alias{mo_is_intrinsic_resistant}
|
||||||
|
\alias{mo_oxygen_tolerance}
|
||||||
|
\alias{mo_is_anaerobic}
|
||||||
\alias{mo_snomed}
|
\alias{mo_snomed}
|
||||||
\alias{mo_ref}
|
\alias{mo_ref}
|
||||||
\alias{mo_authors}
|
\alias{mo_authors}
|
||||||
@ -177,6 +179,20 @@ mo_is_intrinsic_resistant(
|
|||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
|
mo_oxygen_tolerance(
|
||||||
|
x,
|
||||||
|
language = get_AMR_locale(),
|
||||||
|
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
|
||||||
|
...
|
||||||
|
)
|
||||||
|
|
||||||
|
mo_is_anaerobic(
|
||||||
|
x,
|
||||||
|
language = get_AMR_locale(),
|
||||||
|
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
|
||||||
|
...
|
||||||
|
)
|
||||||
|
|
||||||
mo_snomed(
|
mo_snomed(
|
||||||
x,
|
x,
|
||||||
language = get_AMR_locale(),
|
language = get_AMR_locale(),
|
||||||
@ -278,7 +294,7 @@ mo_property(
|
|||||||
|
|
||||||
\item{open}{browse the URL using \code{\link[utils:browseURL]{browseURL()}}}
|
\item{open}{browse the URL using \code{\link[utils:browseURL]{browseURL()}}}
|
||||||
|
|
||||||
\item{property}{one of the column names of the \link{microorganisms} data set: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence", or "snomed", or must be \code{"shortname"}}
|
\item{property}{one of the column names of the \link{microorganisms} data set: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "oxygen_tolerance", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence", or "snomed", or must be \code{"shortname"}}
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
\itemize{
|
\itemize{
|
||||||
@ -313,6 +329,8 @@ Determination of yeasts (\code{\link[=mo_is_yeast]{mo_is_yeast()}}) will be base
|
|||||||
|
|
||||||
Determination of intrinsic resistance (\code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}}) will be based on the \link{intrinsic_resistant} data set, which is based on \href{https://www.eucast.org/expert_rules_and_expected_phenotypes/}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3} (2021). The \code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}} function can be vectorised over both argument \code{x} (input for microorganisms) and \code{ab} (input for antibiotics).
|
Determination of intrinsic resistance (\code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}}) will be based on the \link{intrinsic_resistant} data set, which is based on \href{https://www.eucast.org/expert_rules_and_expected_phenotypes/}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3} (2021). The \code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}} function can be vectorised over both argument \code{x} (input for microorganisms) and \code{ab} (input for antibiotics).
|
||||||
|
|
||||||
|
Determination of bacterial oxygen tolerance (\code{\link[=mo_oxygen_tolerance]{mo_oxygen_tolerance()}}) will be based on BacDive, see \emph{Source}. The function \code{\link[=mo_is_anaerobic]{mo_is_anaerobic()}} only returns \code{TRUE} if the oxygen tolerance is \code{"anaerobe"}, indicting an obligate anaerobic species or genus. It always returns \code{FALSE} for species outside the taxonomic kingdom of Bacteria.
|
||||||
|
|
||||||
The function \code{\link[=mo_url]{mo_url()}} will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.
|
The function \code{\link[=mo_url]{mo_url()}} will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.
|
||||||
|
|
||||||
SNOMED codes (\code{\link[=mo_snomed]{mo_snomed()}}) are from the version of 1 July, 2021. See \emph{Source} and the \link{microorganisms} data set for more info.
|
SNOMED codes (\code{\link[=mo_snomed]{mo_snomed()}}) are from the version of 1 July, 2021. See \emph{Source} and the \link{microorganisms} data set for more info.
|
||||||
@ -332,13 +350,14 @@ This function uses \code{\link[=as.mo]{as.mo()}} internally, which uses an advan
|
|||||||
\item Berends MS \emph{et al.} (2022). \strong{AMR: An R Package for Working with Antimicrobial Resistance Data}. \emph{Journal of Statistical Software}, 104(3), 1-31; \doi{10.18637/jss.v104.i03}
|
\item Berends MS \emph{et al.} (2022). \strong{AMR: An R Package for Working with Antimicrobial Resistance Data}. \emph{Journal of Statistical Software}, 104(3), 1-31; \doi{10.18637/jss.v104.i03}
|
||||||
\item Becker K \emph{et al.} (2014). \strong{Coagulase-Negative Staphylococci.} \emph{Clin Microbiol Rev.} 27(4): 870-926; \doi{10.1128/CMR.00109-13}
|
\item Becker K \emph{et al.} (2014). \strong{Coagulase-Negative Staphylococci.} \emph{Clin Microbiol Rev.} 27(4): 870-926; \doi{10.1128/CMR.00109-13}
|
||||||
\item Becker K \emph{et al.} (2019). \strong{Implications of identifying the recently defined members of the \emph{S. aureus} complex, \emph{S. argenteus} and \emph{S. schweitzeri}: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS).} \emph{Clin Microbiol Infect}; \doi{10.1016/j.cmi.2019.02.028}
|
\item Becker K \emph{et al.} (2019). \strong{Implications of identifying the recently defined members of the \emph{S. aureus} complex, \emph{S. argenteus} and \emph{S. schweitzeri}: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS).} \emph{Clin Microbiol Infect}; \doi{10.1016/j.cmi.2019.02.028}
|
||||||
\item Becker K \emph{et al.} (2020). \strong{Emergence of coagulase-negative staphylococci} \emph{Expert Rev Anti Infect Ther.} 18(4):349-366; \doi{10.1080/14787210.2020.1730813}
|
\item Becker K \emph{et al.} (2020). \strong{Emergence of coagulase-negative staphylococci.} \emph{Expert Rev Anti Infect Ther.} 18(4):349-366; \doi{10.1080/14787210.2020.1730813}
|
||||||
\item Lancefield RC (1933). \strong{A serological differentiation of human and other groups of hemolytic streptococci}. \emph{J Exp Med.} 57(4): 571-95; \doi{10.1084/jem.57.4.571}
|
\item Lancefield RC (1933). \strong{A serological differentiation of human and other groups of hemolytic streptococci.} \emph{J Exp Med.} 57(4): 571-95; \doi{10.1084/jem.57.4.571}
|
||||||
\item Berends MS \emph{et al.} (2022). \strong{Trends in Occurrence and Phenotypic Resistance of Coagulase-Negative Staphylococci (CoNS) Found in Human Blood in the Northern Netherlands between 2013 and 2019} \emph{Microorganisms} 10(9), 1801; \doi{10.3390/microorganisms10091801}
|
\item Berends MS \emph{et al.} (2022). \strong{Trends in Occurrence and Phenotypic Resistance of Coagulase-Negative Staphylococci (CoNS) Found in Human Blood in the Northern Netherlands between 2013 and 2019/} \emph{Micro.rganisms} 10(9), 1801; \doi{10.3390/microorganisms10091801}
|
||||||
\item Parte, AC \emph{et al.} (2020). \strong{List of Prokaryotic names with Standing in Nomenclature (LPSN) moves to the DSMZ.} International Journal of Systematic and Evolutionary Microbiology, 70, 5607-5612; \doi{10.1099/ijsem.0.004332}. Accessed from \url{https://lpsn.dsmz.de} on 11 December, 2022.
|
\item Parte, AC \emph{et al.} (2020). \strong{List of Prokaryotic names with Standing in Nomenclature (LPSN) moves to the DSMZ.} International Journal of Systematic and Evolutionary Microbiology, 70, 5607-5612; \doi{10.1099/ijsem.0.004332}. Accessed from \url{https://lpsn.dsmz.de} on 11 December, 2022.
|
||||||
\item GBIF Secretariat (2022). GBIF Backbone Taxonomy. Checklist dataset \doi{10.15468/39omei}. Accessed from \url{https://www.gbif.org} on 11 December, 2022.
|
\item GBIF Secretariat (2022). GBIF Backbone Taxonomy. Checklist dataset \doi{10.15468/39omei}. Accessed from \url{https://www.gbif.org} on 11 December, 2022.
|
||||||
\item Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microoganism', OID 2.16.840.1.114222.4.11.1009 (v12). URL: \url{https://phinvads.cdc.gov}
|
\item Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microoganism', OID 2.16.840.1.114222.4.11.1009 (v12). URL: \url{https://phinvads.cdc.gov}
|
||||||
\item Bartlett A \emph{et al.} (2022). \strong{A comprehensive list of bacterial pathogens infecting humans} \emph{Microbiology} 168:001269; \doi{10.1099/mic.0.001269}
|
\item Bartlett A \emph{et al.} (2022). \strong{A comprehensive list of bacterial pathogens infecting humans} \emph{Microbiology} 168:001269; \doi{10.1099/mic.0.001269}
|
||||||
|
\item Reimer \emph{et al.} (2022). \strong{\emph{BacDive} in 2022: the knowledge base for standardized bacterial and archaeal data.} \emph{Nucleic Acids Res.} 2022 Jan 7;50(D1):D741-D746; \doi{10.1093/nar/gkab961}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ $(document).ready(function() {
|
|||||||
// add doctoral titles to authors
|
// add doctoral titles to authors
|
||||||
function doct_tit(x) {
|
function doct_tit(x) {
|
||||||
if (typeof(x) != "undefined") {
|
if (typeof(x) != "undefined") {
|
||||||
x = x.replace(/Author, maintainer/g, "Principle maintainer");
|
x = x.replace(/Author, maintainer/g, "Principal maintainer");
|
||||||
x = x.replace(/Author, contributor/g, "Contributing maintainer");
|
x = x.replace(/Author, contributor/g, "Contributing maintainer");
|
||||||
x = x.replace(/Thesis advisor/g, "(former) Doctoral advisor");
|
x = x.replace(/Thesis advisor/g, "(former) Doctoral advisor");
|
||||||
// contributors
|
// contributors
|
||||||
|
@ -247,60 +247,79 @@ our_data_1st[all(betalactams() == "R"), ]
|
|||||||
|
|
||||||
## Generate antibiograms
|
## Generate antibiograms
|
||||||
|
|
||||||
This package comes with `antibiogram()`, a function that automatically generates traditional, combined, syndromic, and even weighted-incidence syndromic combination antibiograms (WISCA). For R Markdown (such as this page) it automatically prints in the right table format.
|
Since AMR v2.0 (March 2023), it is very easy to create different types of antibiograms, with support for 20 different languages.
|
||||||
|
|
||||||
Below are some suggestions for how to generate the different antibiograms:
|
There are four antibiogram types, as proposed by Klinker *et al.* (2021, [DOI 10.1177/20499361211011373](https://doi.org/10.1177/20499361211011373)), and they are all supported by the new `antibiogram()` function:
|
||||||
|
|
||||||
|
1. **Traditional Antibiogram (TA)** e.g, for the susceptibility of *Pseudomonas aeruginosa* to piperacillin/tazobactam (TZP)
|
||||||
|
2. **Combination Antibiogram (CA)** e.g, for the sdditional susceptibility of *Pseudomonas aeruginosa* to TZP + tobramycin versus TZP alone
|
||||||
|
3. **Syndromic Antibiogram (SA)** e.g, for the susceptibility of *Pseudomonas aeruginosa* to TZP among respiratory specimens (obtained among ICU patients only)
|
||||||
|
4. **Weighted-Incidence Syndromic Combination Antibiogram (WISCA)** e.g, for the susceptibility of *Pseudomonas aeruginosa* to TZP among respiratory specimens (obtained among ICU patients only) for male patients age >=65 years with heart failure
|
||||||
|
|
||||||
|
In this section, we show how to use the `antibiogram()` function to create any of the above antibiogram types. For starters, this is what the included `example_isolates` data set looks like:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
# traditional:
|
example_isolates
|
||||||
antibiogram(our_data_1st)
|
|
||||||
antibiogram(our_data_1st,
|
|
||||||
ab_transform = "name"
|
|
||||||
)
|
|
||||||
antibiogram(our_data_1st,
|
|
||||||
ab_transform = "name",
|
|
||||||
language = "es"
|
|
||||||
) # support for 20 languages
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```{r}
|
### Traditional Antibiogram
|
||||||
# combined:
|
|
||||||
antibiogram(our_data_1st,
|
To create a traditional antibiogram, simply state which antibiotics should be used. The `antibiotics` argument in the `antibiogram()` function supports any (combination) of the previously mentioned antibiotic class selectors:
|
||||||
antibiotics = c("AMC", "AMC+CIP", "AMC+GEN")
|
|
||||||
)
|
```{r trad}
|
||||||
|
antibiogram(example_isolates,
|
||||||
|
antibiotics = c(aminoglycosides(), carbapenems()))
|
||||||
```
|
```
|
||||||
|
|
||||||
```{r}
|
Notice that the `antibiogram()` function automatically prints in the right format when using Quarto or R Markdown (such as this page), and even applies italics for taxonomic names (by using `italicise_taxonomy()` internally).
|
||||||
# for a syndromic antibiogram, we must fake some clinical conditions:
|
|
||||||
our_data_1st$condition <- sample(c("Cardial", "Respiratory", "Rheumatic"),
|
|
||||||
size = nrow(our_data_1st),
|
|
||||||
replace = TRUE
|
|
||||||
)
|
|
||||||
|
|
||||||
# syndromic:
|
It also uses the language of your OS if this is either `r AMR:::vector_or(vapply(FUN.VALUE = character(1), AMR:::LANGUAGES_SUPPORTED_NAMES, function(x) x$exonym), quotes = FALSE, sort = FALSE)`. In this next example, we force the language to be Spanish using the `language` argument:
|
||||||
antibiogram(our_data_1st,
|
|
||||||
syndromic_group = "condition"
|
```{r trad2}
|
||||||
)
|
antibiogram(example_isolates,
|
||||||
antibiogram(our_data_1st,
|
mo_transform = "gramstain",
|
||||||
# you can use AB selectors here as well:
|
antibiotics = aminoglycosides(),
|
||||||
antibiotics = c(penicillins(), aminoglycosides()),
|
ab_transform = "name",
|
||||||
syndromic_group = "condition",
|
language = "es")
|
||||||
mo_transform = "gramstain"
|
|
||||||
)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```{r}
|
### Combined Antibiogram
|
||||||
# WISCA:
|
|
||||||
# (we lack some details, but it could contain a filter on e.g. >65 year-old males)
|
To create a combined antibiogram, use antibiotic codes or names with a plus `+` character like this:
|
||||||
wisca <- antibiogram(our_data_1st,
|
|
||||||
antibiotics = c("AMC", "AMC+CIP", "AMC+GEN"),
|
```{r comb}
|
||||||
syndromic_group = "condition",
|
antibiogram(example_isolates,
|
||||||
mo_transform = "gramstain"
|
antibiotics = c("TZP", "TZP+TOB", "TZP+GEN"))
|
||||||
)
|
```
|
||||||
|
|
||||||
|
### Syndromic Antibiogram
|
||||||
|
|
||||||
|
To create a syndromic antibiogram, the `syndromic_group` argument must be used. This can be any column in the data, or e.g. an `ifelse()` with calculations based on certain columns:
|
||||||
|
|
||||||
|
```{r synd}
|
||||||
|
antibiogram(example_isolates,
|
||||||
|
antibiotics = c(aminoglycosides(), carbapenems()),
|
||||||
|
syndromic_group = "ward")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Weighted-Incidence Syndromic Combination Antibiogram (WISCA)
|
||||||
|
|
||||||
|
To create a WISCA, you must state combination therapy in the `antibiotics` argument (similar to the Combination Antibiogram), define a syndromic group with the `syndromic_group` argument (similar to the Syndromic Antibiogram) in which cases are predefined based on clinical or demographic characteristics (e.g., endocarditis in 75+ females). This next example is a simplification without clinical characteristics, but just gives an idea of how a WISCA can be created:
|
||||||
|
|
||||||
|
```{r wisca}
|
||||||
|
wisca <- antibiogram(example_isolates,
|
||||||
|
antibiotics = c("AMC", "AMC+CIP", "TZP", "TZP+TOB"),
|
||||||
|
mo_transform = "gramstain",
|
||||||
|
minimum = 10, # this should be >= 30, but now just as example
|
||||||
|
syndromic_group = ifelse(example_isolates$age >= 65 &
|
||||||
|
example_isolates$gender == "M",
|
||||||
|
"WISCA Group 1", "WISCA Group 2"))
|
||||||
wisca
|
wisca
|
||||||
```
|
```
|
||||||
|
|
||||||
Antibiograms can be plotted using `autoplot()` from the `ggplot2` packages, since this package provides an extension to that function:
|
### Plotting antibiograms
|
||||||
|
|
||||||
|
Antibiograms can be plotted using `autoplot()` from the `ggplot2` packages, since this `AMR` package provides an extension to that function:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
autoplot(wisca)
|
autoplot(wisca)
|
||||||
|
@ -50,6 +50,7 @@ download_txt <- function(filename) {
|
|||||||
feather <- paste0(filename, ".feather")
|
feather <- paste0(filename, ".feather")
|
||||||
parquet <- paste0(filename, ".parquet")
|
parquet <- paste0(filename, ".parquet")
|
||||||
sas <- paste0(filename, ".sas")
|
sas <- paste0(filename, ".sas")
|
||||||
|
xpt <- paste0(filename, ".xpt")
|
||||||
spss <- paste0(filename, ".sav")
|
spss <- paste0(filename, ".sav")
|
||||||
stata <- paste0(filename, ".dta")
|
stata <- paste0(filename, ".dta")
|
||||||
create_txt <- function(filename, type, software, exists) {
|
create_txt <- function(filename, type, software, exists) {
|
||||||
@ -70,6 +71,7 @@ download_txt <- function(filename) {
|
|||||||
file.exists(feather),
|
file.exists(feather),
|
||||||
file.exists(parquet),
|
file.exists(parquet),
|
||||||
file.exists(sas),
|
file.exists(sas),
|
||||||
|
file.exists(xpt),
|
||||||
file.exists(spss),
|
file.exists(spss),
|
||||||
file.exists(stata)
|
file.exists(stata)
|
||||||
)) {
|
)) {
|
||||||
@ -80,7 +82,8 @@ download_txt <- function(filename) {
|
|||||||
create_txt(excel, "xlsx", "Microsoft Excel workbook", file.exists(excel)),
|
create_txt(excel, "xlsx", "Microsoft Excel workbook", file.exists(excel)),
|
||||||
create_txt(feather, "feather", "Apache Feather file", file.exists(feather)),
|
create_txt(feather, "feather", "Apache Feather file", file.exists(feather)),
|
||||||
create_txt(parquet, "parquet", "Apache Parquet file", file.exists(parquet)),
|
create_txt(parquet, "parquet", "Apache Parquet file", file.exists(parquet)),
|
||||||
create_txt(sas, "sas", "SAS data file", file.exists(sas)),
|
create_txt(sas, "sas", "SAS data (SAS) file", file.exists(sas)),
|
||||||
|
create_txt(xpt, "xpt", "SAS transport (XPT) file", file.exists(xpt)),
|
||||||
create_txt(spss, "sav", "IBM SPSS Statistics data file", file.exists(spss)),
|
create_txt(spss, "sav", "IBM SPSS Statistics data file", file.exists(spss)),
|
||||||
create_txt(stata, "dta", "Stata DTA file", file.exists(stata))
|
create_txt(stata, "dta", "Stata DTA file", file.exists(stata))
|
||||||
)
|
)
|
||||||
@ -123,7 +126,7 @@ This data set is in R available as `microorganisms`, after you load the `AMR` pa
|
|||||||
|
|
||||||
`r download_txt("microorganisms")`
|
`r download_txt("microorganisms")`
|
||||||
|
|
||||||
**NOTE: The exported files for SAS, SPSS and Stata contain only the first 50 SNOMED codes per record, as their file size would otherwise exceed 100 MB; the file size limit of GitHub.** Advice? Use R instead.
|
**NOTE: The exported files for SAS, SPSS and Stata contain only the first 50 SNOMED codes per record, as their file size would otherwise exceed 100 MB; the file size limit of GitHub.** Their file structures and compression techniques are very inefficient. Advice? Use R instead. It's free and much better in many ways.
|
||||||
|
|
||||||
The tab-separated text file and Microsoft Excel workbook both contain all SNOMED codes as comma separated values.
|
The tab-separated text file and Microsoft Excel workbook both contain all SNOMED codes as comma separated values.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user