diff --git a/NAMESPACE b/NAMESPACE index c6ec41018..9b3d17367 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -300,6 +300,7 @@ export(mo_is_yeast) export(mo_kingdom) export(mo_lpsn) export(mo_matching_score) +export(mo_morphology) export(mo_mycobank) export(mo_name) export(mo_order) diff --git a/R/mo_property.R b/R/mo_property.R index 0bde26c90..f5405c180 100755 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -102,8 +102,10 @@ #' #' # other properties --------------------------------------------------------- #' -#' mo_pathogenicity("Klebsiella pneumoniae") +#' mo_morphology("Klebsiella pneumoniae") #' mo_gramstain("Klebsiella pneumoniae") +#' mo_gramstain("Klebsiella pneumoniae", add_morphology = TRUE) +#' mo_pathogenicity("Klebsiella pneumoniae") #' mo_snomed("Klebsiella pneumoniae") #' mo_type("Klebsiella pneumoniae") #' mo_rank("Klebsiella pneumoniae") @@ -472,6 +474,7 @@ mo_gramstain <- function(x, language = get_AMR_locale(), keep_synonyms = getOpti meet_criteria(x, allow_NA = TRUE) language <- validate_language(language) meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1) + meet_criteria(add_morphology, allow_class = "logical", has_length = 1) x.mo <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...) metadata <- get_mo_uncertainties() @@ -497,6 +500,12 @@ mo_gramstain <- function(x, language = get_AMR_locale(), keep_synonyms = getOpti # and of course our own ID for Gram-positives | x.mo %in% c("B_GRAMP", "B_ANAER-POS")] <- "Gram-positive" + if (isTRUE(add_morphology)) { + morphs <- mo_morphology(x.mo, language = NULL) + morphs[is.na(x)] <- "" + x[!is.na(x)] <- paste(x[!is.na(x)], tolower(morphs[!is.na(x)])) + } + load_mo_uncertainties(metadata) translate_into_language(x, language = language, only_unknown = FALSE) } diff --git a/man/microorganisms.Rd b/man/microorganisms.Rd index 43854c9e9..35cb6cba1 100644 --- a/man/microorganisms.Rd +++ b/man/microorganisms.Rd @@ -14,6 +14,7 @@ A \link[tibble:tibble]{tibble} with 78 679 observations and 26 variables: \item \code{rank}\cr Text of the taxonomic rank of the microorganism, such as \code{"species"} or \code{"genus"} \item \code{ref}\cr Abbreviated authority citation for the nomenclatural act that established the current name combination, following ICNP conventions. For species described in their current genus (\emph{sp. nov.}), this is the original description author(s) and year. For species transferred to a different genus (\emph{comb. nov.}), this is the reclassification author(s) and year. Emendations are excluded. For synonyms, this is the authority under which the synonym was originally published. This field is directly retrieved from the source specified in the column \code{source}. Diacritics were removed to comply with CRAN, that only allows ASCII characters. \item \code{oxygen_tolerance} \cr Oxygen tolerance, either \code{"aerobe"}, \code{"anaerobe"}, \code{"anaerobe/microaerophile"}, \code{"facultative anaerobe"}, \code{"likely facultative anaerobe"}, \code{"microaerophile"}, or NA. 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 68.3\% of all ~39 000 bacteria in the data set contain an oxygen tolerance. +\item \code{morphology} \cr Morphology (cell shape), either \code{""}. These data were retrieved from BacDive (see \emph{Source}). Genera that are clinically established as coccobacilli (the HACEK group and beyond, such as \emph{Haemophilus} and \emph{Acinetobacter}) are classified as such regardless of BacDive majority vote. Items that contain "likely" are missing from BacDive and were extrapolated from other species within the same genus. Currently 0\% of all ~39 000 bacteria in the data set contain a morphology. \item \code{source}\cr Either \code{"GBIF"}, \code{"LPSN"}, \code{"Manually added"}, \code{"MycoBank"}, or \code{"manually added"} (see \emph{Source}) \item \code{lpsn}\cr Identifier ('Record number') of 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. \emph{\strong{This is a unique identifier}}, though available for only ~33 000 records. \item \code{lpsn_parent}\cr LPSN identifier of the parent taxon diff --git a/man/mo_property.Rd b/man/mo_property.Rd index e1d6a5700..e59bf6963 100644 --- a/man/mo_property.Rd +++ b/man/mo_property.Rd @@ -24,6 +24,7 @@ \alias{mo_is_intrinsic_resistant} \alias{mo_oxygen_tolerance} \alias{mo_is_anaerobic} +\alias{mo_morphology} \alias{mo_snomed} \alias{mo_ref} \alias{mo_authors} @@ -86,7 +87,8 @@ mo_pathogenicity(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) mo_gramstain(x, language = get_AMR_locale(), - keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) + keep_synonyms = getOption("AMR_keep_synonyms", FALSE), + add_morphology = FALSE, ...) mo_is_gram_negative(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) @@ -106,6 +108,9 @@ mo_oxygen_tolerance(x, language = get_AMR_locale(), mo_is_anaerobic(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) +mo_morphology(x, language = get_AMR_locale(), + keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) + mo_snomed(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) @@ -161,6 +166,8 @@ The default is \code{FALSE}, which will return a note if outdated taxonomic name \item{...}{Other arguments passed on to \code{\link[=as.mo]{as.mo()}}, such as 'minimum_matching_score', 'ignore_pattern', and 'remove_from_input'.} +\item{add_morphology}{a \link{logical} to indicate whether the morphology (from \code{\link[=mo_morphology]{mo_morphology()}}) should be added to the Gram stain result, e.g. \code{"Gram-negative rods"} instead of \code{"Gram-negative"}. The default is \code{FALSE}.} + \item{ab}{Any (vector of) text that can be coerced to a valid antibiotic drug code with \code{\link[=as.ab]{as.ab()}}.} \item{open}{Browse the URL using \code{\link[utils:browseURL]{browseURL()}}.} @@ -203,7 +210,7 @@ Determination of yeasts (\code{\link[=mo_is_yeast]{mo_is_yeast()}}) is based on Determination of intrinsic resistance (\code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}}) is based on the \link{intrinsic_resistant} data set, which is based on \href{https://www.eucast.org/bacteria/important-additional-information/expert-rules/}{'EUCAST Expected Resistant Phenotypes' v1.2} (2023). 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 antimicrobials). -Determination of bacterial oxygen tolerance (\code{\link[=mo_oxygen_tolerance]{mo_oxygen_tolerance()}}) is 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. +Determination of both bacterial oxygen tolerance (\code{\link[=mo_oxygen_tolerance]{mo_oxygen_tolerance()}}) and morphology (\code{\link[=mo_morphology]{mo_morphology()}}) are 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"}, indicating 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. \href{https://www.mycobank.org}{This MycoBank URL} is used for fungi wherever available , \href{https://www.mycobank.org}{this LPSN URL} for bacteria wherever available, and \href{https://www.gbif.org}{this GBIF link} otherwise. @@ -262,8 +269,10 @@ mo_shortname("Klebsiella pneumoniae") # other properties --------------------------------------------------------- -mo_pathogenicity("Klebsiella pneumoniae") +mo_morphology("Klebsiella pneumoniae") mo_gramstain("Klebsiella pneumoniae") +mo_gramstain("Klebsiella pneumoniae", add_morphology = TRUE) +mo_pathogenicity("Klebsiella pneumoniae") mo_snomed("Klebsiella pneumoniae") mo_type("Klebsiella pneumoniae") mo_rank("Klebsiella pneumoniae")