mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 15:41:56 +02:00
mo_rank mo_url, added Tremellales
This commit is contained in:
@ -29,7 +29,7 @@
|
||||
#' Included are:
|
||||
#' \itemize{
|
||||
#' \item{All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria, Protozoa and Viruses}
|
||||
#' \item{All ~3,000 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Onygenales, Pneumocystales, Saccharomycetales and Schizosaccharomycetales. 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 and including everything would tremendously slow down our algorithms too. By only including the aforementioned taxonomic orders, the most relevant (sub)species are covered (like all species of \emph{Aspergillus}, \emph{Candida}, \emph{Pneumocystis}, \emph{Saccharomyces} and \emph{Trichophyton}).}
|
||||
#' \item{All ~3,500 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Onygenales, Pneumocystales, Saccharomycetales, Schizosaccharomycetales and Tremellales. 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 and including everything would tremendously slow down our algorithms too. By only including the aforementioned taxonomic orders, the most relevant fungi are covered (like all species of \emph{Aspergillus}, \emph{Candida}, \emph{Cryptococcus}, \emph{Histplasma}, \emph{Pneumocystis}, \emph{Saccharomyces} and \emph{Trichophyton}).}
|
||||
#' \item{All ~15,000 previously accepted names of included (sub)species that have been taxonomically renamed}
|
||||
#' \item{The complete taxonomic tree of all included (sub)species: from kingdom to subspecies}
|
||||
#' \item{The responsible author(s) and year of scientific publication}
|
||||
|
7
R/data.R
7
R/data.R
@ -134,7 +134,7 @@
|
||||
#'
|
||||
#' A data set containing the microbial taxonomy of six kingdoms from the Catalogue of Life. MO codes can be looked up using \code{\link{as.mo}}.
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' @format A \code{\link{data.frame}} with 56,672 observations and 14 variables:
|
||||
#' @format A \code{\link{data.frame}} with 57,158 observations and 14 variables:
|
||||
#' \describe{
|
||||
#' \item{\code{mo}}{ID of microorganism as used by this package}
|
||||
#' \item{\code{col_id}}{Catalogue of Life ID}
|
||||
@ -163,6 +163,7 @@
|
||||
"microorganisms"
|
||||
|
||||
catalogue_of_life <- list(
|
||||
year = 2018,
|
||||
version = "Catalogue of Life: 2018 Annual Checklist",
|
||||
url = "http://www.catalogueoflife.org/annual-checklist/2018"
|
||||
)
|
||||
@ -175,6 +176,8 @@ catalogue_of_life <- list(
|
||||
catalogue_of_life_version <- function() {
|
||||
list(version = catalogue_of_life$version,
|
||||
url = catalogue_of_life$url,
|
||||
# annual release always somewhere in March
|
||||
is_latest_annual_release = Sys.Date() < as.Date(paste0(catalogue_of_life$year + 1, "-04-01")),
|
||||
no_of_species = nrow(AMR::microorganisms),
|
||||
no_of_synonyms = nrow(AMR::microorganisms.old))
|
||||
}
|
||||
@ -183,7 +186,7 @@ catalogue_of_life_version <- function() {
|
||||
#'
|
||||
#' A data set containing old (previously valid or accepted) taxonomic names according to the Catalogue of Life. This data set is used internally by \code{\link{as.mo}}.
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' @format A \code{\link{data.frame}} with 14,506 observations and 4 variables:
|
||||
#' @format A \code{\link{data.frame}} with 14,487 observations and 4 variables:
|
||||
#' \describe{
|
||||
#' \item{\code{col_id}}{Catalogue of Life ID}
|
||||
#' \item{\code{tsn_new}}{New Catalogue of Life ID}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#' @param property one of the column names of one of the \code{\link{microorganisms}} data set or \code{"shortname"}
|
||||
#' @param language language of the returned text, defaults to system language (see \code{\link{get_locale}}) and can also be set with \code{\link{getOption}("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.
|
||||
#' @param ... other parameters passed on to \code{\link{as.mo}}
|
||||
#' @param open browse the URL using \code{\link[utils]{browseURL}}
|
||||
#' @details All functions will return the most recently known taxonomic property according to the Catalogue of Life, except for \code{mo_ref}, \code{mo_authors} and \code{mo_year}. This leads to the following results:
|
||||
#' \itemize{
|
||||
#' \item{\code{mo_fullname("Chlamydia psittaci")} will return \code{"Chlamydophila psittaci"} (with a warning about the renaming)}
|
||||
@ -44,14 +45,14 @@
|
||||
#' @return \itemize{
|
||||
#' \item{An \code{integer} in case of \code{mo_year}}
|
||||
#' \item{A \code{list} in case of \code{mo_taxonomy}}
|
||||
#' \item{A named \code{character} in case of \code{mo_url}}
|
||||
#' \item{A \code{character} in all other cases}
|
||||
#' }
|
||||
#' @export
|
||||
#' @seealso \code{\link{microorganisms}}
|
||||
#' @inheritSection AMR Read more on our website!
|
||||
#' @examples
|
||||
#' # All properties of Escherichia coli
|
||||
#' ## taxonomic properties
|
||||
#' ## taxonomic tree
|
||||
#' mo_kingdom("E. coli") # "Bacteria"
|
||||
#' mo_phylum("E. coli") # "Proteobacteria"
|
||||
#' mo_class("E. coli") # "Gammaproteobacteria"
|
||||
@ -68,10 +69,12 @@
|
||||
#' ## other properties
|
||||
#' mo_gramstain("E. coli") # "Gram negative"
|
||||
#' mo_type("E. coli") # "Bacteria" (equal to kingdom)
|
||||
#' mo_rank("E. coli") # "species"
|
||||
#' mo_url("E. coli") # get the direct url to the Catalogue of Life
|
||||
#'
|
||||
#' ## scientific reference
|
||||
#' mo_ref("E. coli") # "Castellani and Chalmers, 1919"
|
||||
#' mo_authors("E. coli") # "Castellani and Chalmers"
|
||||
#' mo_ref("E. coli") # "Castellani et al., 1919"
|
||||
#' mo_authors("E. coli") # "Castellani et al."
|
||||
#' mo_year("E. coli") # 1919
|
||||
#'
|
||||
#'
|
||||
@ -107,7 +110,7 @@
|
||||
#' mo_shortname("S. pyo", Lancefield = TRUE) # "GAS" ('Group A streptococci')
|
||||
#'
|
||||
#'
|
||||
#' # Language support for German, Dutch, Spanish, Portuguese, Italian and French
|
||||
#' # language support for German, Dutch, Spanish, Portuguese, Italian and French
|
||||
#' mo_gramstain("E. coli", language = "de") # "Gramnegativ"
|
||||
#' mo_gramstain("E. coli", language = "nl") # "Gram-negatief"
|
||||
#' mo_gramstain("E. coli", language = "es") # "Gram negativo"
|
||||
@ -125,7 +128,7 @@
|
||||
#' language = "nl") # "Streptococcus groep A"
|
||||
#'
|
||||
#'
|
||||
#' # Get a list with the complete taxonomy (kingdom to subspecies)
|
||||
#' # get a list with the complete taxonomy (kingdom to subspecies)
|
||||
#' mo_taxonomy("E. coli")
|
||||
mo_fullname <- function(x, language = get_locale(), ...) {
|
||||
x <- mo_validate(x = x, property = "fullname", ...)
|
||||
@ -259,9 +262,9 @@ mo_ref <- function(x, ...) {
|
||||
#' @export
|
||||
mo_authors <- function(x, ...) {
|
||||
x <- mo_validate(x = x, property = "ref", ...)
|
||||
# remove last 4 digits and presumably the comma and space that preceed them
|
||||
# remove last 4 digits and presumably the comma and space that preceeds them
|
||||
x[!is.na(x)] <- gsub(",? ?[0-9]{4}", "", x[!is.na(x)])
|
||||
x
|
||||
suppressWarnings(x)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@ -270,7 +273,13 @@ mo_year <- function(x, ...) {
|
||||
x <- mo_validate(x = x, property = "ref", ...)
|
||||
# get last 4 digits
|
||||
x[!is.na(x)] <- gsub(".*([0-9]{4})$", "\\1", x[!is.na(x)])
|
||||
as.integer(x)
|
||||
suppressWarnings(as.integer(x))
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_rank <- function(x, ...) {
|
||||
mo_validate(x = x, property = "rank", ...)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@ -288,10 +297,18 @@ mo_taxonomy <- function(x, ...) {
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @importFrom utils browseURL
|
||||
#' @export
|
||||
mo_url <- function(x, ...) {
|
||||
mo_url <- function(x, open = FALSE, ...) {
|
||||
u <- mo_validate(x = x, property = "species_id", ...)
|
||||
u[u != ""] <- paste0(catalogue_of_life$url, "/details/species/id/", u)
|
||||
names(u) <- mo_fullname(x = x, ... = ...)
|
||||
if (open == TRUE) {
|
||||
if (length(u) > 1) {
|
||||
warning("only the first URL will be opened, as `browseURL` only suports one string.")
|
||||
}
|
||||
browseURL(u[1L])
|
||||
}
|
||||
u
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user