mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 05:26:13 +01:00
added taxonomic data from ITIS
This commit is contained in:
parent
7680e4edd8
commit
5d80cef338
@ -91,14 +91,18 @@ export(labels_rsi_count)
|
|||||||
export(left_join_microorganisms)
|
export(left_join_microorganisms)
|
||||||
export(like)
|
export(like)
|
||||||
export(mo_aerobic)
|
export(mo_aerobic)
|
||||||
|
export(mo_class)
|
||||||
export(mo_family)
|
export(mo_family)
|
||||||
export(mo_fullname)
|
export(mo_fullname)
|
||||||
export(mo_genus)
|
export(mo_genus)
|
||||||
export(mo_gramstain)
|
export(mo_gramstain)
|
||||||
|
export(mo_order)
|
||||||
|
export(mo_phylum)
|
||||||
export(mo_property)
|
export(mo_property)
|
||||||
export(mo_shortname)
|
export(mo_shortname)
|
||||||
export(mo_species)
|
export(mo_species)
|
||||||
export(mo_subspecies)
|
export(mo_subspecies)
|
||||||
|
export(mo_taxonomy)
|
||||||
export(mo_type)
|
export(mo_type)
|
||||||
export(n_rsi)
|
export(n_rsi)
|
||||||
export(p.symbol)
|
export(p.symbol)
|
||||||
|
6
NEWS.md
6
NEWS.md
@ -27,7 +27,11 @@
|
|||||||
* All old syntaxes will still work with this version, but will throw warnings
|
* All old syntaxes will still work with this version, but will throw warnings
|
||||||
* Function `labels_rsi_count` to print datalabels on a RSI `ggplot2` model
|
* Function `labels_rsi_count` to print datalabels on a RSI `ggplot2` model
|
||||||
* Functions `as.atc` and `is.atc` to transform/look up antibiotic ATC codes as defined by the WHO. The existing function `guess_atc` is now an alias of `as.atc`.
|
* Functions `as.atc` and `is.atc` to transform/look up antibiotic ATC codes as defined by the WHO. The existing function `guess_atc` is now an alias of `as.atc`.
|
||||||
* Aliases for existing function `mo_property`: `mo_family`, `mo_genus`, `mo_species`, `mo_subspecies`, `mo_fullname`, `mo_shortname`, `mo_aerobic`, `mo_type` and `mo_gramstain`. They also come with support for German, Dutch, French, Italian, Spanish and Portuguese, and it defaults to the systems locale:
|
* Aliases for existing function `mo_property` and new data from ITIS (Integrated Taxonomic Information System, https://www.itis.gov)
|
||||||
|
* Taxonomic names: `mo_phylum`, `mo_class`, `mo_order`, `mo_family`, `mo_genus`, `mo_species`, `mo_subspecies`
|
||||||
|
* Semantic names: `mo_fullname`, `mo_shortname`
|
||||||
|
* Microbial properties: `mo_aerobic`, `mo_type`, `mo_gramstain`.
|
||||||
|
They also come with support for German, Dutch, French, Italian, Spanish and Portuguese, and it defaults to the systems locale:
|
||||||
```r
|
```r
|
||||||
mo_gramstain("E. coli")
|
mo_gramstain("E. coli")
|
||||||
# [1] "Negative rods"
|
# [1] "Negative rods"
|
||||||
|
25
R/data.R
25
R/data.R
@ -123,34 +123,28 @@
|
|||||||
#' Data set with human pathogenic microorganisms
|
#' Data set with human pathogenic microorganisms
|
||||||
#'
|
#'
|
||||||
#' A data set containing (potential) human pathogenic microorganisms. MO codes can be looked up using \code{\link{guess_mo}}.
|
#' A data set containing (potential) human pathogenic microorganisms. MO codes can be looked up using \code{\link{guess_mo}}.
|
||||||
#' @format A \code{\link{tibble}} with 2,642 observations and 11 variables:
|
#' @format A \code{\link{tibble}} with 2,642 observations and 14 variables:
|
||||||
#' \describe{
|
#' \describe{
|
||||||
#' \item{\code{mo}}{ID of microorganism}
|
#' \item{\code{mo}}{ID of microorganism}
|
||||||
#' \item{\code{bactsys}}{Bactsyscode of microorganism}
|
#' \item{\code{bactsys}}{Bactsyscode of microorganism}
|
||||||
#' \item{\code{family}}{Family name of microorganism}
|
|
||||||
#' \item{\code{genus}}{Genus name of microorganism, like \code{"Echerichia"}}
|
#' \item{\code{genus}}{Genus name of microorganism, like \code{"Echerichia"}}
|
||||||
#' \item{\code{species}}{Species name of microorganism, like \code{"coli"}}
|
#' \item{\code{species}}{Species name of microorganism, like \code{"coli"}}
|
||||||
#' \item{\code{subspecies}}{Subspecies name of bio-/serovar of microorganism, like \code{"EHEC"}}
|
#' \item{\code{subspecies}}{Subspecies name of bio-/serovar of microorganism, like \code{"EHEC"}}
|
||||||
#' \item{\code{fullname}}{Full name, like \code{"Echerichia coli (EHEC)"}}
|
#' \item{\code{fullname}}{Full name, like \code{"Echerichia coli (EHEC)"}}
|
||||||
#' \item{\code{aerobic}}{Logical whether bacteria is aerobic}
|
|
||||||
#' \item{\code{type}}{Type of microorganism, like \code{"Bacteria"} and \code{"Fungus/yeast"}}
|
|
||||||
#' \item{\code{gramstain}}{Gram of microorganism, like \code{"Negative rods"}}
|
#' \item{\code{gramstain}}{Gram of microorganism, like \code{"Negative rods"}}
|
||||||
|
#' \item{\code{aerobic}}{Logical whether bacteria is aerobic}
|
||||||
|
#' \item{\code{family}}{Taxonomic family of the microorganism as found in ITIS, see Source}
|
||||||
|
#' \item{\code{order}}{Taxonomic order of the microorganism as found in ITIS, see Source}
|
||||||
|
#' \item{\code{class}}{Taxonomic class of the microorganism as found in ITIS, see Source}
|
||||||
|
#' \item{\code{phylum}}{Taxonomic phylum of the microorganism as found in ITIS, see Source}
|
||||||
|
#' \item{\code{type}}{Type of microorganism, like \code{"Bacteria"} and \code{"Fungus/yeast"}}
|
||||||
#' \item{\code{prevalence}}{A rounded integer based on prevalence of the microorganism. Used internally by \code{\link{as.mo}}, otherwise quite meaningless.}
|
#' \item{\code{prevalence}}{A rounded integer based on prevalence of the microorganism. Used internally by \code{\link{as.mo}}, otherwise quite meaningless.}
|
||||||
#' }
|
#' }
|
||||||
# source MOLIS (LIS of Certe) - \url{https://www.certe.nl}
|
#' @source Integrated Taxonomic Information System (ITIS) on-line database, \url{https://www.itis.gov}.
|
||||||
# new <- microorganisms %>% filter(genus == "Bacteroides") %>% .[1,]
|
|
||||||
# new[1, 'mo'] <- "DIAPNU"
|
|
||||||
# new[1, 'bactsys'] <- "DIAPNU"
|
|
||||||
# new[1, 'family'] <- "Veillonellaceae"
|
|
||||||
# new[1, 'genus'] <- "Dialister"
|
|
||||||
# new[1, 'species'] <- "pneumosintes"
|
|
||||||
# new[1, 'subspecies'] <- NA
|
|
||||||
# new[1, 'fullname'] <- paste(new[1, 'genus'], new[1, 'species'])
|
|
||||||
# microorganisms <- microorganisms %>% bind_rows(new) %>% arrange(mo)
|
|
||||||
#' @seealso \code{\link{guess_mo}} \code{\link{antibiotics}} \code{\link{microorganisms.umcg}}
|
#' @seealso \code{\link{guess_mo}} \code{\link{antibiotics}} \code{\link{microorganisms.umcg}}
|
||||||
"microorganisms"
|
"microorganisms"
|
||||||
|
|
||||||
#' Translation table for UMCG with ~1,100 microorganisms
|
#' Translation table for UMCG
|
||||||
#'
|
#'
|
||||||
#' A data set containing all bacteria codes of UMCG MMB. These codes can be joined to data with an ID from \code{\link{microorganisms}$mo} (using \code{\link{left_join_microorganisms}}). GLIMS codes can also be translated to valid \code{MO}s with \code{\link{guess_mo}}.
|
#' A data set containing all bacteria codes of UMCG MMB. These codes can be joined to data with an ID from \code{\link{microorganisms}$mo} (using \code{\link{left_join_microorganisms}}). GLIMS codes can also be translated to valid \code{MO}s with \code{\link{guess_mo}}.
|
||||||
#' @format A \code{\link{tibble}} with 1,095 observations and 2 variables:
|
#' @format A \code{\link{tibble}} with 1,095 observations and 2 variables:
|
||||||
@ -158,7 +152,6 @@
|
|||||||
#' \item{\code{umcg}}{Code of microorganism according to UMCG MMB}
|
#' \item{\code{umcg}}{Code of microorganism according to UMCG MMB}
|
||||||
#' \item{\code{mo}}{Code of microorganism in \code{\link{microorganisms}}}
|
#' \item{\code{mo}}{Code of microorganism in \code{\link{microorganisms}}}
|
||||||
#' }
|
#' }
|
||||||
# source MOLIS (LIS of Certe) - \url{https://www.certe.nl} \cr \cr GLIMS (LIS of UMCG) - \url{https://www.umcg.nl}
|
|
||||||
#' @seealso \code{\link{guess_mo}} \code{\link{microorganisms}}
|
#' @seealso \code{\link{guess_mo}} \code{\link{microorganisms}}
|
||||||
"microorganisms.umcg"
|
"microorganisms.umcg"
|
||||||
|
|
||||||
|
@ -34,15 +34,15 @@
|
|||||||
#' @details At default, the names of antibiotics will be shown on the plots using \code{\link{abname}}. This can be set with the option \code{get_antibiotic_names} (a logical value), so change it e.g. to \code{FALSE} with \code{options(get_antibiotic_names = FALSE)}.
|
#' @details At default, the names of antibiotics will be shown on the plots using \code{\link{abname}}. This can be set with the option \code{get_antibiotic_names} (a logical value), so change it e.g. to \code{FALSE} with \code{options(get_antibiotic_names = FALSE)}.
|
||||||
#'
|
#'
|
||||||
#' \strong{The functions}\cr
|
#' \strong{The functions}\cr
|
||||||
#' \code{geom_rsi} will take any variable from the data that has an \code{rsi} class (created with \code{\link{as.rsi}}) using \code{fun} (\code{\link{portion_df}} at default, could also be \code{\link{count_df}}) and will plot bars with the percentage R, I and S. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.
|
#' \code{geom_rsi} will take any variable from the data that has an \code{rsi} class (created with \code{\link{as.rsi}}) using \code{fun} (\code{\link{count_df}} at default, can also be \code{\link{portion_df}}) and will plot bars with the percentage R, I and S. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.
|
||||||
#'
|
#'
|
||||||
#' \code{facet_rsi} creates 2d plots (at default based on S/I/R) using \code{\link[ggplot2]{facet_wrap}}.
|
#' \code{facet_rsi} creates 2d plots (at default based on S/I/R) using \code{\link[ggplot2]{facet_wrap}}.
|
||||||
#'
|
#'
|
||||||
#' \code{scale_y_percent} transforms the y axis to a 0 to 100\% range using \code{\link[ggplot2]{scale_y_continuous}}.
|
#' \code{scale_y_percent} transforms the y axis to a 0 to 100\% range using \code{\link[ggplot2]{scale_continuous}}.
|
||||||
#'
|
#'
|
||||||
#' \code{scale_rsi_colours} sets colours to the bars: green for S, yellow for I and red for R, using \code{\link[ggplot2]{scale_fill_brewer}}.
|
#' \code{scale_rsi_colours} sets colours to the bars: green for S, yellow for I and red for R, using \code{\link[ggplot2]{scale_colour_brewer}}.
|
||||||
#'
|
#'
|
||||||
#' \code{theme_rsi} is a \code{\link[ggplot2]{theme}} with minimal distraction.
|
#' \code{theme_rsi} is a \code{ggplot \link[ggplot2]{theme}} with minimal distraction.
|
||||||
#'
|
#'
|
||||||
#' \code{labels_rsi_count} print datalabels on the bars with percentage and amount of isolates using \code{\link[ggplot2]{geom_text}}
|
#' \code{labels_rsi_count} print datalabels on the bars with percentage and amount of isolates using \code{\link[ggplot2]{geom_text}}
|
||||||
#'
|
#'
|
||||||
@ -71,10 +71,10 @@
|
|||||||
#' select(amox, nitr, fosf, trim, cipr) %>%
|
#' select(amox, nitr, fosf, trim, cipr) %>%
|
||||||
#' ggplot_rsi()
|
#' ggplot_rsi()
|
||||||
#'
|
#'
|
||||||
#' # get counts instead of percentages:
|
#' # get only portions and no counts:
|
||||||
#' septic_patients %>%
|
#' septic_patients %>%
|
||||||
#' select(amox, nitr, fosf, trim, cipr) %>%
|
#' select(amox, nitr, fosf, trim, cipr) %>%
|
||||||
#' ggplot_rsi(fun = count_df)
|
#' ggplot_rsi(fun = portion_df)
|
||||||
#'
|
#'
|
||||||
#' # add other ggplot2 parameters as you like:
|
#' # add other ggplot2 parameters as you like:
|
||||||
#' septic_patients %>%
|
#' septic_patients %>%
|
||||||
|
@ -27,14 +27,19 @@
|
|||||||
#' [1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870–926. \url{https://dx.doi.org/10.1128/CMR.00109-13}
|
#' [1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870–926. \url{https://dx.doi.org/10.1128/CMR.00109-13}
|
||||||
#'
|
#'
|
||||||
#' [2] Lancefield RC \strong{A serological differentiation of human and other groups of hemolytic streptococci}. 1933. J Exp Med. 57(4): 571–95. \url{https://dx.doi.org/10.1084/jem.57.4.571}
|
#' [2] Lancefield RC \strong{A serological differentiation of human and other groups of hemolytic streptococci}. 1933. J Exp Med. 57(4): 571–95. \url{https://dx.doi.org/10.1084/jem.57.4.571}
|
||||||
|
#'
|
||||||
|
#' [3] Integrated Taxonomic Information System (ITIS) on-line database, \url{https://www.itis.gov}.
|
||||||
#' @rdname mo_property
|
#' @rdname mo_property
|
||||||
#' @name mo_property
|
#' @name mo_property
|
||||||
#' @return Character or logical (only \code{mo_aerobic})
|
#' @return A logical (in case of \code{mo_aerobic}), a list (in case of \code{mo_taxonomy}), a character otherwise
|
||||||
#' @export
|
#' @export
|
||||||
#' @importFrom dplyr %>% left_join pull
|
#' @importFrom dplyr %>% left_join pull
|
||||||
#' @seealso \code{\link{microorganisms}}
|
#' @seealso \code{\link{microorganisms}}
|
||||||
#' @examples
|
#' @examples
|
||||||
#' # All properties
|
#' # All properties
|
||||||
|
#' mo_phylum("E. coli") # "Proteobacteria"
|
||||||
|
#' mo_class("E. coli") # "Gammaproteobacteria"
|
||||||
|
#' mo_order("E. coli") # "Enterobacteriales"
|
||||||
#' mo_family("E. coli") # "Enterobacteriaceae"
|
#' mo_family("E. coli") # "Enterobacteriaceae"
|
||||||
#' mo_genus("E. coli") # "Escherichia"
|
#' mo_genus("E. coli") # "Escherichia"
|
||||||
#' mo_species("E. coli") # "coli"
|
#' mo_species("E. coli") # "coli"
|
||||||
@ -105,30 +110,10 @@
|
|||||||
#' mo_fullname("S. pyogenes",
|
#' mo_fullname("S. pyogenes",
|
||||||
#' Lancefield = TRUE,
|
#' Lancefield = TRUE,
|
||||||
#' language = "nl") # "Streptococcus groep A"
|
#' language = "nl") # "Streptococcus groep A"
|
||||||
mo_family <- function(x) {
|
#'
|
||||||
mo_property(x, "family")
|
#'
|
||||||
}
|
#' # Complete taxonomy up to Phylum, returns a list
|
||||||
|
#' mo_taxonomy("E. coli")
|
||||||
#' @rdname mo_property
|
|
||||||
#' @export
|
|
||||||
mo_genus <- function(x, language = NULL) {
|
|
||||||
mo_property(x, "genus", language = language)
|
|
||||||
}
|
|
||||||
|
|
||||||
#' @rdname mo_property
|
|
||||||
#' @export
|
|
||||||
mo_species <- function(x, Becker = FALSE, Lancefield = FALSE, language = NULL) {
|
|
||||||
mo_property(x, "species", Becker = Becker, Lancefield = Lancefield, language = language)
|
|
||||||
}
|
|
||||||
|
|
||||||
#' @rdname mo_property
|
|
||||||
#' @export
|
|
||||||
mo_subspecies <- function(x, Becker = FALSE, Lancefield = FALSE, language = NULL) {
|
|
||||||
mo_property(x, "subspecies", Becker = Becker, Lancefield = Lancefield, language = language)
|
|
||||||
}
|
|
||||||
|
|
||||||
#' @rdname mo_property
|
|
||||||
#' @export
|
|
||||||
mo_fullname <- function(x, Becker = FALSE, Lancefield = FALSE, language = NULL) {
|
mo_fullname <- function(x, Becker = FALSE, Lancefield = FALSE, language = NULL) {
|
||||||
mo_property(x, "fullname", Becker = Becker, Lancefield = Lancefield, language = language)
|
mo_property(x, "fullname", Becker = Becker, Lancefield = Lancefield, language = language)
|
||||||
}
|
}
|
||||||
@ -164,6 +149,47 @@ mo_shortname <- function(x, Becker = FALSE, Lancefield = FALSE, language = NULL)
|
|||||||
mo_translate(result, language = language)
|
mo_translate(result, language = language)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#' @rdname mo_property
|
||||||
|
#' @export
|
||||||
|
mo_subspecies <- function(x, Becker = FALSE, Lancefield = FALSE, language = NULL) {
|
||||||
|
mo_property(x, "subspecies", Becker = Becker, Lancefield = Lancefield, language = language)
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname mo_property
|
||||||
|
#' @export
|
||||||
|
mo_species <- function(x, Becker = FALSE, Lancefield = FALSE, language = NULL) {
|
||||||
|
mo_property(x, "species", Becker = Becker, Lancefield = Lancefield, language = language)
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname mo_property
|
||||||
|
#' @export
|
||||||
|
mo_genus <- function(x, language = NULL) {
|
||||||
|
mo_property(x, "genus", language = language)
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname mo_property
|
||||||
|
#' @export
|
||||||
|
mo_family <- function(x) {
|
||||||
|
mo_property(x, "family")
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname mo_property
|
||||||
|
#' @export
|
||||||
|
mo_order <- function(x) {
|
||||||
|
mo_property(x, "order")
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname mo_property
|
||||||
|
#' @export
|
||||||
|
mo_class <- function(x) {
|
||||||
|
mo_property(x, "class")
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname mo_property
|
||||||
|
#' @export
|
||||||
|
mo_phylum <- function(x) {
|
||||||
|
mo_property(x, "phylum")
|
||||||
|
}
|
||||||
|
|
||||||
#' @rdname mo_property
|
#' @rdname mo_property
|
||||||
#' @export
|
#' @export
|
||||||
@ -204,6 +230,19 @@ mo_property <- function(x, property = 'fullname', Becker = FALSE, Lancefield = F
|
|||||||
result2
|
result2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#' @rdname mo_property
|
||||||
|
#' @export
|
||||||
|
mo_taxonomy <- function(x) {
|
||||||
|
x <- as.mo(x)
|
||||||
|
base::list(phylum = mo_phylum(x),
|
||||||
|
class = mo_class(x),
|
||||||
|
order = mo_order(x),
|
||||||
|
family = mo_family(x),
|
||||||
|
genus = mo_genus(x),
|
||||||
|
species = mo_species(x),
|
||||||
|
subspecies = mo_subspecies(x))
|
||||||
|
}
|
||||||
|
|
||||||
#' @importFrom dplyr %>% case_when
|
#' @importFrom dplyr %>% case_when
|
||||||
mo_translate <- function(x, language) {
|
mo_translate <- function(x, language) {
|
||||||
if (is.null(language)) {
|
if (is.null(language)) {
|
||||||
|
@ -55,8 +55,8 @@ This `AMR` package basically does four important things:
|
|||||||
* Use `first_isolate` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
|
* Use `first_isolate` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
|
||||||
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
|
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
|
||||||
* Use `MDRO` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.
|
* Use `MDRO` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.
|
||||||
* The data set `microorganisms` contains the family, genus, species, subspecies, colloquial name and Gram stain of almost 3,000 potential human pathogenic microorganisms (bacteria, fungi/yeasts and parasites). This enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus`, `mo_family` or `mo_gramstain`. As they use `as.mo` internally, they also use artificial intelligence. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. They also come with support for German, Dutch, French, Italian, Spanish and Portuguese. These functions can be used to add new variables to your data.
|
* The data set `microorganisms` contains the taxonomic properties of almost 3,000 potential human pathogenic microorganisms (bacteria, fungi/yeasts and parasites). Taxonomic names were downloaded from ITIS (Integrated Taxonomic Information System, http://www.itis.gov). Furhermore, the colloquial name and Gram stain are available, which enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus`, `mo_family`, `mo_gramstain` or even `mo_phylum`. As they use `as.mo` internally, they also use artificial intelligence. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. They also come with support for German, Dutch, French, Italian, Spanish and Portuguese. These functions can be used to add new variables to your data.
|
||||||
* The data set `antibiotics` contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like `ab_name` and `ab_tradenames` to look up values. As the `mo_*` functions use `as.mo` internally, the `ab_*` functions use `as.atc` internally so it uses AI to guess your expected result. For example, `ab_name("Fluclox")`, `ab_name("Floxapen")` and `ab_name("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
|
* The data set `antibiotics` contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like `ab_name` and `ab_tradenames` to look up values. The `ab_*` functions use `as.atc` internally so they support AI to guess your expected result. For example, `ab_name("Fluclox")`, `ab_name("Floxapen")` and `ab_name("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
|
||||||
|
|
||||||
3. It **analyses the data** with convenient functions that use well-known methods.
|
3. It **analyses the data** with convenient functions that use well-known methods.
|
||||||
|
|
||||||
@ -390,7 +390,7 @@ antibiotics # A tibble: 423 x 18
|
|||||||
|
|
||||||
# Dataset with bacteria codes and properties like gram stain and
|
# Dataset with bacteria codes and properties like gram stain and
|
||||||
# aerobic/anaerobic
|
# aerobic/anaerobic
|
||||||
microorganisms # A tibble: 2,642 x 11
|
microorganisms # A tibble: 2,642 x 14
|
||||||
```
|
```
|
||||||
|
|
||||||
## Copyright
|
## Copyright
|
||||||
|
Binary file not shown.
@ -62,15 +62,15 @@ Use these functions to create bar plots for antimicrobial resistance analysis. A
|
|||||||
At default, the names of antibiotics will be shown on the plots using \code{\link{abname}}. This can be set with the option \code{get_antibiotic_names} (a logical value), so change it e.g. to \code{FALSE} with \code{options(get_antibiotic_names = FALSE)}.
|
At default, the names of antibiotics will be shown on the plots using \code{\link{abname}}. This can be set with the option \code{get_antibiotic_names} (a logical value), so change it e.g. to \code{FALSE} with \code{options(get_antibiotic_names = FALSE)}.
|
||||||
|
|
||||||
\strong{The functions}\cr
|
\strong{The functions}\cr
|
||||||
\code{geom_rsi} will take any variable from the data that has an \code{rsi} class (created with \code{\link{as.rsi}}) using \code{fun} (\code{\link{portion_df}} at default, could also be \code{\link{count_df}}) and will plot bars with the percentage R, I and S. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.
|
\code{geom_rsi} will take any variable from the data that has an \code{rsi} class (created with \code{\link{as.rsi}}) using \code{fun} (\code{\link{count_df}} at default, can also be \code{\link{portion_df}}) and will plot bars with the percentage R, I and S. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.
|
||||||
|
|
||||||
\code{facet_rsi} creates 2d plots (at default based on S/I/R) using \code{\link[ggplot2]{facet_wrap}}.
|
\code{facet_rsi} creates 2d plots (at default based on S/I/R) using \code{\link[ggplot2]{facet_wrap}}.
|
||||||
|
|
||||||
\code{scale_y_percent} transforms the y axis to a 0 to 100\% range using \code{\link[ggplot2]{scale_y_continuous}}.
|
\code{scale_y_percent} transforms the y axis to a 0 to 100\% range using \code{\link[ggplot2]{scale_continuous}}.
|
||||||
|
|
||||||
\code{scale_rsi_colours} sets colours to the bars: green for S, yellow for I and red for R, using \code{\link[ggplot2]{scale_fill_brewer}}.
|
\code{scale_rsi_colours} sets colours to the bars: green for S, yellow for I and red for R, using \code{\link[ggplot2]{scale_colour_brewer}}.
|
||||||
|
|
||||||
\code{theme_rsi} is a \code{\link[ggplot2]{theme}} with minimal distraction.
|
\code{theme_rsi} is a \code{ggplot \link[ggplot2]{theme}} with minimal distraction.
|
||||||
|
|
||||||
\code{labels_rsi_count} print datalabels on the bars with percentage and amount of isolates using \code{\link[ggplot2]{geom_text}}
|
\code{labels_rsi_count} print datalabels on the bars with percentage and amount of isolates using \code{\link[ggplot2]{geom_text}}
|
||||||
|
|
||||||
@ -98,10 +98,10 @@ septic_patients \%>\%
|
|||||||
select(amox, nitr, fosf, trim, cipr) \%>\%
|
select(amox, nitr, fosf, trim, cipr) \%>\%
|
||||||
ggplot_rsi()
|
ggplot_rsi()
|
||||||
|
|
||||||
# get counts instead of percentages:
|
# get only portions and no counts:
|
||||||
septic_patients \%>\%
|
septic_patients \%>\%
|
||||||
select(amox, nitr, fosf, trim, cipr) \%>\%
|
select(amox, nitr, fosf, trim, cipr) \%>\%
|
||||||
ggplot_rsi(fun = count_df)
|
ggplot_rsi(fun = portion_df)
|
||||||
|
|
||||||
# add other ggplot2 parameters as you like:
|
# add other ggplot2 parameters as you like:
|
||||||
septic_patients \%>\%
|
septic_patients \%>\%
|
||||||
|
@ -4,20 +4,26 @@
|
|||||||
\name{microorganisms}
|
\name{microorganisms}
|
||||||
\alias{microorganisms}
|
\alias{microorganisms}
|
||||||
\title{Data set with human pathogenic microorganisms}
|
\title{Data set with human pathogenic microorganisms}
|
||||||
\format{A \code{\link{tibble}} with 2,642 observations and 11 variables:
|
\format{A \code{\link{tibble}} with 2,642 observations and 14 variables:
|
||||||
\describe{
|
\describe{
|
||||||
\item{\code{mo}}{ID of microorganism}
|
\item{\code{mo}}{ID of microorganism}
|
||||||
\item{\code{bactsys}}{Bactsyscode of microorganism}
|
\item{\code{bactsys}}{Bactsyscode of microorganism}
|
||||||
\item{\code{family}}{Family name of microorganism}
|
|
||||||
\item{\code{genus}}{Genus name of microorganism, like \code{"Echerichia"}}
|
\item{\code{genus}}{Genus name of microorganism, like \code{"Echerichia"}}
|
||||||
\item{\code{species}}{Species name of microorganism, like \code{"coli"}}
|
\item{\code{species}}{Species name of microorganism, like \code{"coli"}}
|
||||||
\item{\code{subspecies}}{Subspecies name of bio-/serovar of microorganism, like \code{"EHEC"}}
|
\item{\code{subspecies}}{Subspecies name of bio-/serovar of microorganism, like \code{"EHEC"}}
|
||||||
\item{\code{fullname}}{Full name, like \code{"Echerichia coli (EHEC)"}}
|
\item{\code{fullname}}{Full name, like \code{"Echerichia coli (EHEC)"}}
|
||||||
\item{\code{aerobic}}{Logical whether bacteria is aerobic}
|
|
||||||
\item{\code{type}}{Type of microorganism, like \code{"Bacteria"} and \code{"Fungus/yeast"}}
|
|
||||||
\item{\code{gramstain}}{Gram of microorganism, like \code{"Negative rods"}}
|
\item{\code{gramstain}}{Gram of microorganism, like \code{"Negative rods"}}
|
||||||
|
\item{\code{aerobic}}{Logical whether bacteria is aerobic}
|
||||||
|
\item{\code{family}}{Taxonomic family of the microorganism as found in ITIS, see Source}
|
||||||
|
\item{\code{order}}{Taxonomic order of the microorganism as found in ITIS, see Source}
|
||||||
|
\item{\code{class}}{Taxonomic class of the microorganism as found in ITIS, see Source}
|
||||||
|
\item{\code{phylum}}{Taxonomic phylum of the microorganism as found in ITIS, see Source}
|
||||||
|
\item{\code{type}}{Type of microorganism, like \code{"Bacteria"} and \code{"Fungus/yeast"}}
|
||||||
\item{\code{prevalence}}{A rounded integer based on prevalence of the microorganism. Used internally by \code{\link{as.mo}}, otherwise quite meaningless.}
|
\item{\code{prevalence}}{A rounded integer based on prevalence of the microorganism. Used internally by \code{\link{as.mo}}, otherwise quite meaningless.}
|
||||||
}}
|
}}
|
||||||
|
\source{
|
||||||
|
Integrated Taxonomic Information System (ITIS) on-line database, \url{https://www.itis.gov}.
|
||||||
|
}
|
||||||
\usage{
|
\usage{
|
||||||
microorganisms
|
microorganisms
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\docType{data}
|
\docType{data}
|
||||||
\name{microorganisms.umcg}
|
\name{microorganisms.umcg}
|
||||||
\alias{microorganisms.umcg}
|
\alias{microorganisms.umcg}
|
||||||
\title{Translation table for UMCG with ~1,100 microorganisms}
|
\title{Translation table for UMCG}
|
||||||
\format{A \code{\link{tibble}} with 1,095 observations and 2 variables:
|
\format{A \code{\link{tibble}} with 1,095 observations and 2 variables:
|
||||||
\describe{
|
\describe{
|
||||||
\item{\code{umcg}}{Code of microorganism according to UMCG MMB}
|
\item{\code{umcg}}{Code of microorganism according to UMCG MMB}
|
||||||
|
@ -2,34 +2,46 @@
|
|||||||
% Please edit documentation in R/mo_property.R
|
% Please edit documentation in R/mo_property.R
|
||||||
\name{mo_property}
|
\name{mo_property}
|
||||||
\alias{mo_property}
|
\alias{mo_property}
|
||||||
\alias{mo_family}
|
|
||||||
\alias{mo_genus}
|
|
||||||
\alias{mo_species}
|
|
||||||
\alias{mo_subspecies}
|
|
||||||
\alias{mo_fullname}
|
\alias{mo_fullname}
|
||||||
\alias{mo_shortname}
|
\alias{mo_shortname}
|
||||||
|
\alias{mo_subspecies}
|
||||||
|
\alias{mo_species}
|
||||||
|
\alias{mo_genus}
|
||||||
|
\alias{mo_family}
|
||||||
|
\alias{mo_order}
|
||||||
|
\alias{mo_class}
|
||||||
|
\alias{mo_phylum}
|
||||||
\alias{mo_type}
|
\alias{mo_type}
|
||||||
\alias{mo_gramstain}
|
\alias{mo_gramstain}
|
||||||
\alias{mo_aerobic}
|
\alias{mo_aerobic}
|
||||||
|
\alias{mo_taxonomy}
|
||||||
\title{Property of a microorganism}
|
\title{Property of a microorganism}
|
||||||
\source{
|
\source{
|
||||||
[1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870–926. \url{https://dx.doi.org/10.1128/CMR.00109-13}
|
[1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870–926. \url{https://dx.doi.org/10.1128/CMR.00109-13}
|
||||||
|
|
||||||
[2] Lancefield RC \strong{A serological differentiation of human and other groups of hemolytic streptococci}. 1933. J Exp Med. 57(4): 571–95. \url{https://dx.doi.org/10.1084/jem.57.4.571}
|
[2] Lancefield RC \strong{A serological differentiation of human and other groups of hemolytic streptococci}. 1933. J Exp Med. 57(4): 571–95. \url{https://dx.doi.org/10.1084/jem.57.4.571}
|
||||||
|
|
||||||
|
[3] Integrated Taxonomic Information System (ITIS) on-line database, \url{https://www.itis.gov}.
|
||||||
}
|
}
|
||||||
\usage{
|
\usage{
|
||||||
mo_family(x)
|
|
||||||
|
|
||||||
mo_genus(x, language = NULL)
|
|
||||||
|
|
||||||
mo_species(x, Becker = FALSE, Lancefield = FALSE, language = NULL)
|
|
||||||
|
|
||||||
mo_subspecies(x, Becker = FALSE, Lancefield = FALSE, language = NULL)
|
|
||||||
|
|
||||||
mo_fullname(x, Becker = FALSE, Lancefield = FALSE, language = NULL)
|
mo_fullname(x, Becker = FALSE, Lancefield = FALSE, language = NULL)
|
||||||
|
|
||||||
mo_shortname(x, Becker = FALSE, Lancefield = FALSE, language = NULL)
|
mo_shortname(x, Becker = FALSE, Lancefield = FALSE, language = NULL)
|
||||||
|
|
||||||
|
mo_subspecies(x, Becker = FALSE, Lancefield = FALSE, language = NULL)
|
||||||
|
|
||||||
|
mo_species(x, Becker = FALSE, Lancefield = FALSE, language = NULL)
|
||||||
|
|
||||||
|
mo_genus(x, language = NULL)
|
||||||
|
|
||||||
|
mo_family(x)
|
||||||
|
|
||||||
|
mo_order(x)
|
||||||
|
|
||||||
|
mo_class(x)
|
||||||
|
|
||||||
|
mo_phylum(x)
|
||||||
|
|
||||||
mo_type(x, language = NULL)
|
mo_type(x, language = NULL)
|
||||||
|
|
||||||
mo_gramstain(x, language = NULL)
|
mo_gramstain(x, language = NULL)
|
||||||
@ -38,12 +50,12 @@ mo_aerobic(x)
|
|||||||
|
|
||||||
mo_property(x, property = "fullname", Becker = FALSE,
|
mo_property(x, property = "fullname", Becker = FALSE,
|
||||||
Lancefield = FALSE, language = NULL)
|
Lancefield = FALSE, language = NULL)
|
||||||
|
|
||||||
|
mo_taxonomy(x)
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{x}{any (vector of) text that can be coerced to a valid microorganism code with \code{\link{as.mo}}}
|
\item{x}{any (vector of) text that can be coerced to a valid microorganism code with \code{\link{as.mo}}}
|
||||||
|
|
||||||
\item{language}{language of the returned text, defaults to the systems language. Either one of \code{"en"} (English), \code{"de"} (German), \code{"nl"} (Dutch), \code{"es"} (Spanish) or \code{"pt"} (Portuguese).}
|
|
||||||
|
|
||||||
\item{Becker}{a logical to indicate whether \emph{Staphylococci} should be categorised into Coagulase Negative \emph{Staphylococci} ("CoNS") and Coagulase Positive \emph{Staphylococci} ("CoPS") instead of their own species, according to Karsten Becker \emph{et al.} [1].
|
\item{Becker}{a logical to indicate whether \emph{Staphylococci} should be categorised into Coagulase Negative \emph{Staphylococci} ("CoNS") and Coagulase Positive \emph{Staphylococci} ("CoPS") instead of their own species, according to Karsten Becker \emph{et al.} [1].
|
||||||
|
|
||||||
This excludes \emph{Staphylococcus aureus} at default, use \code{Becker = "all"} to also categorise \emph{S. aureus} as "CoPS".}
|
This excludes \emph{Staphylococcus aureus} at default, use \code{Becker = "all"} to also categorise \emph{S. aureus} as "CoPS".}
|
||||||
@ -52,16 +64,21 @@ mo_property(x, property = "fullname", Becker = FALSE,
|
|||||||
|
|
||||||
This excludes \emph{Enterococci} at default (who are in group D), use \code{Lancefield = "all"} to also categorise all \emph{Enterococci} as group D.}
|
This excludes \emph{Enterococci} at default (who are in group D), use \code{Lancefield = "all"} to also categorise all \emph{Enterococci} as group D.}
|
||||||
|
|
||||||
|
\item{language}{language of the returned text, defaults to the systems language. Either one of \code{"en"} (English), \code{"de"} (German), \code{"nl"} (Dutch), \code{"es"} (Spanish) or \code{"pt"} (Portuguese).}
|
||||||
|
|
||||||
\item{property}{one of the column names of one of the \code{\link{microorganisms}} data set, like \code{"mo"}, \code{"bactsys"}, \code{"family"}, \code{"genus"}, \code{"species"}, \code{"fullname"}, \code{"gramstain"} and \code{"aerobic"}}
|
\item{property}{one of the column names of one of the \code{\link{microorganisms}} data set, like \code{"mo"}, \code{"bactsys"}, \code{"family"}, \code{"genus"}, \code{"species"}, \code{"fullname"}, \code{"gramstain"} and \code{"aerobic"}}
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
Character or logical (only \code{mo_aerobic})
|
A logical (in case of \code{mo_aerobic}), a list (in case of \code{mo_taxonomy}), a character otherwise
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
Use these functions to return a specific property of a microorganism from the \code{\link{microorganisms}} data set. All input values will be evaluated internally with \code{\link{as.mo}}.
|
Use these functions to return a specific property of a microorganism from the \code{\link{microorganisms}} data set. All input values will be evaluated internally with \code{\link{as.mo}}.
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
# All properties
|
# All properties
|
||||||
|
mo_phylum("E. coli") # "Proteobacteria"
|
||||||
|
mo_class("E. coli") # "Gammaproteobacteria"
|
||||||
|
mo_order("E. coli") # "Enterobacteriales"
|
||||||
mo_family("E. coli") # "Enterobacteriaceae"
|
mo_family("E. coli") # "Enterobacteriaceae"
|
||||||
mo_genus("E. coli") # "Escherichia"
|
mo_genus("E. coli") # "Escherichia"
|
||||||
mo_species("E. coli") # "coli"
|
mo_species("E. coli") # "coli"
|
||||||
@ -132,6 +149,10 @@ mo_fullname("S. pyogenes",
|
|||||||
mo_fullname("S. pyogenes",
|
mo_fullname("S. pyogenes",
|
||||||
Lancefield = TRUE,
|
Lancefield = TRUE,
|
||||||
language = "nl") # "Streptococcus groep A"
|
language = "nl") # "Streptococcus groep A"
|
||||||
|
|
||||||
|
|
||||||
|
# Complete taxonomy up to Phylum, returns a list
|
||||||
|
mo_taxonomy("E. coli")
|
||||||
}
|
}
|
||||||
\seealso{
|
\seealso{
|
||||||
\code{\link{microorganisms}}
|
\code{\link{microorganisms}}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
context("mo_property.R")
|
context("mo_property.R")
|
||||||
|
|
||||||
test_that("mo_property works", {
|
test_that("mo_property works", {
|
||||||
|
expect_equal(mo_phylum("E. coli"), "Proteobacteria")
|
||||||
|
expect_equal(mo_class("E. coli"), "Gammaproteobacteria")
|
||||||
|
expect_equal(mo_order("E. coli"), "Enterobacteriales")
|
||||||
expect_equal(mo_family("E. coli"), "Enterobacteriaceae")
|
expect_equal(mo_family("E. coli"), "Enterobacteriaceae")
|
||||||
expect_equal(mo_genus("E. coli"), "Escherichia")
|
expect_equal(mo_genus("E. coli"), "Escherichia")
|
||||||
expect_equal(mo_species("E. coli"), "coli")
|
expect_equal(mo_species("E. coli"), "coli")
|
||||||
|
@ -34,8 +34,8 @@ This `AMR` package basically does four important things:
|
|||||||
* Use `first_isolate` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
|
* Use `first_isolate` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
|
||||||
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
|
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
|
||||||
* Use `MDRO` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.
|
* Use `MDRO` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.
|
||||||
* The data set `microorganisms` contains the family, genus, species, subspecies, colloquial name and Gram stain of almost 3,000 potential human pathogenic microorganisms (bacteria, fungi/yeasts and parasites). This enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus`, `mo_family` or `mo_gramstain`. As they use `as.mo` internally, they also use artificial intelligence. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. They also come with support for German, Dutch, French, Italian, Spanish and Portuguese. These functions can be used to add new variables to your data.
|
* The data set `microorganisms` contains the taxonomic properties of almost 3,000 potential human pathogenic microorganisms (bacteria, fungi/yeasts and parasites). Taxonomic names were downloaded from ITIS (Integrated Taxonomic Information System, http://www.itis.gov). Furhermore, the colloquial name and Gram stain are available, which enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus`, `mo_family`, `mo_gramstain` or even `mo_phylum`. As they use `as.mo` internally, they also use artificial intelligence. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. They also come with support for German, Dutch, French, Italian, Spanish and Portuguese. These functions can be used to add new variables to your data.
|
||||||
* The data set `antibiotics` contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like `ab_official` and `ab_tradenames` to look up values. As the `mo_*` functions use `as.mo` internally, the `ab_*` functions use `as.atc` internally so it uses AI to guess your expected result. For example, `ab_official("Fluclox")`, `ab_official("Floxapen")` and `ab_official("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
|
* The data set `antibiotics` contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like `ab_name` and `ab_tradenames` to look up values. The `ab_*` functions use `as.atc` internally so they support AI to guess your expected result. For example, `ab_name("Fluclox")`, `ab_name("Floxapen")` and `ab_name("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
|
||||||
|
|
||||||
3. It **analyses the data** with convenient functions that use well-known methods.
|
3. It **analyses the data** with convenient functions that use well-known methods.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user