Browse Source

Catalogue of life

new-mo-algorithm
parent
commit
fb1fc3686c
  1. 1
      .Rbuildignore
  2. 3
      DESCRIPTION
  3. 3
      NAMESPACE
  4. 12
      NEWS.md
  5. 73
      R/catalogue_of_life.R
  6. 61
      R/data.R
  7. 5
      R/globals.R
  8. 63
      R/itis.R
  9. 26
      R/mo.R
  10. 26
      R/mo_property.R
  11. 192
      R/zzz.R
  12. 4
      _pkgdown.yml
  13. BIN
      data/microorganisms.old.rda
  14. BIN
      data/microorganisms.rda
  15. 406
      docs/articles/AMR.html
  16. BIN
      docs/articles/AMR_files/figure-html/plot 1-1.png
  17. BIN
      docs/articles/AMR_files/figure-html/plot 3-1.png
  18. BIN
      docs/articles/AMR_files/figure-html/plot 4-1.png
  19. BIN
      docs/articles/AMR_files/figure-html/plot 5-1.png
  20. 2
      docs/articles/EUCAST.html
  21. 2
      docs/articles/G_test.html
  22. 2
      docs/articles/WHONET.html
  23. 2
      docs/articles/atc_property.html
  24. 298
      docs/articles/benchmarks.html
  25. BIN
      docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png
  26. BIN
      docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-2.png
  27. 10
      docs/articles/freq.html
  28. 2
      docs/articles/mo_property.html
  29. 2
      docs/articles/resistance_predict.html
  30. 15
      docs/index.html
  31. 12
      docs/news/index.html
  32. 25
      docs/reference/as.mo.html
  33. 345
      docs/reference/catalogue_of_life.html
  34. 311
      docs/reference/catalogue_of_life_version.html
  35. BIN
      docs/reference/figures/logo_col.png
  36. 12
      docs/reference/index.html
  37. 19
      docs/reference/microorganisms.codes.html
  38. 50
      docs/reference/microorganisms.html
  39. 29
      docs/reference/microorganisms.old.html
  40. 32
      docs/reference/mo_property.html
  41. 9
      docs/sitemap.xml
  42. 15
      index.md
  43. 53
      man/ITIS.Rd
  44. 25
      man/as.mo.Rd
  45. 63
      man/catalogue_of_life.Rd
  46. 33
      man/catalogue_of_life_version.Rd
  47. BIN
      man/figures/logo_col.png
  48. BIN
      man/figures/logo_itis.jpg
  49. BIN
      man/figures/plus.png
  50. 50
      man/microorganisms.Rd
  51. 19
      man/microorganisms.codes.Rd
  52. 27
      man/microorganisms.old.Rd
  53. 36
      man/mo_property.Rd
  54. 256
      reproduction_of_microorganisms.R
  55. 181
      vignettes/benchmarks.Rmd

1
.Rbuildignore

@ -21,3 +21,4 @@ @@ -21,3 +21,4 @@
^Meta$
^pkgdown$
^public$
^reproduction.*R$

3
DESCRIPTION

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
Package: AMR
Version: 0.5.0.9018
Date: 2019-02-18
Date: 2019-02-20
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(
@ -56,6 +56,7 @@ Suggests: @@ -56,6 +56,7 @@ Suggests:
covr (>= 3.0.1),
curl,
ggplot2,
microbenchmark,
readxl,
rmarkdown,
rstudioapi,

3
NAMESPACE

@ -68,6 +68,7 @@ export(atc_trivial_nl) @@ -68,6 +68,7 @@ export(atc_trivial_nl)
export(atc_umcg)
export(availability)
export(brmo)
export(catalogue_of_life_version)
export(count_I)
export(count_IR)
export(count_R)
@ -123,11 +124,11 @@ export(mo_ref) @@ -123,11 +124,11 @@ export(mo_ref)
export(mo_renamed)
export(mo_shortname)
export(mo_species)
export(mo_subkingdom)
export(mo_subspecies)
export(mo_taxonomy)
export(mo_type)
export(mo_uncertainties)
export(mo_url)
export(mo_year)
export(mrgn)
export(n_rsi)

12
NEWS.md

@ -10,12 +10,12 @@ We've got a new website: [https://msberends.gitlab.io/AMR](https://msberends.git @@ -10,12 +10,12 @@ We've got a new website: [https://msberends.gitlab.io/AMR](https://msberends.git
#### New
* **BREAKING**: removed deprecated functions, parameters and references to 'bactid'. Use `as.mo()` to identify an MO code.
* Catalogue of Life (CoL) inclusion for data about microorganisms, which also contains all ITIS data we used previously. The `microorganisms` data set now contains:
* Almost 60,000 species from six different kingdoms
* Almost 15,000 previously accepted names which are now taxonomic 'synonyms'
* All (sub)species from the kingdoms Archaea, Bacteria, Chromista, Protozoa and Viruses
* All (sub)species from the orders Eurotiales, Saccharomycetales and Onygenales of the kingdom Fungi. The complete taxonomy of this kingdom has more than 130,000 species. The orders we included contains at least all memebers of the families *Candida*, *Aspergillus* and *Trichophyton*.
* Due to this change, the ID of *Streptococcus* was changed from `B_STRPTC` to `B_STRPT`.
* Catalogue of Life as a new taxonomic source for data about microorganisms, which also contains all ITIS data we used previously. The `microorganisms` data set now contains:
* All ~55,000 species from the kingdoms of Archaea, Bacteria, Protozoa and Viruses
* 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 species, of which most are not microbial. Including everything tremendously slows down our algortihms, and not all fungi fit the scope of this package. By only including the aforementioned taxonomic orders, the most relevant species are covered (like genera *Aspergillus*, *Candida*, *Pneumocystis*, *Saccharomyces* and *Trichophyton*).
* All ~15,000 previously accepted names of species that have been taxonomically renamed
* The responsible author(s) and year of scientific publication
* Due to this change, some `mo` codes changed (e.g. *Streptococcus* changed from `B_STRPTC` to `B_STRPT`). A translation table is used internally to support older microorganism IDs, so users will not notice this difference.
* Support for data from [WHONET](https://whonet.org/) and [EARS-Net](https://ecdc.europa.eu/en/about-us/partnerships-and-networks/disease-and-laboratory-networks/ears-net) (European Antimicrobial Resistance Surveillance Network):
* Exported files from WHONET can be read and used in this package. For functions like `first_isolate()` and `eucast_rules()`, all parameters will be filled in automatically.
* This package now knows all antibiotic abbrevations by EARS-Net (which are also being used by WHONET) - the `antibiotics` data set now contains a column `ears_net`.

73
R/catalogue_of_life.R

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
# ==================================================================== #
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' The Catalogue of Life
#'
#' This package contains the complete taxonomic tree of almost all microorganisms from the authoritative and comprehensive Catalogue of Life.
#' @section Catalogue of Life:
#' \if{html}{\figure{logo_col.png}{options: height=60px style=margin-bottom:5px} \cr}
#' This package contains the complete taxonomic tree of almost all microorganisms from the authoritative and comprehensive Catalogue of Life (\url{http://www.catalogueoflife.org}). This data is updated annually - check the included version with \code{\link{catalogue_of_life_version}}.
#'
#' 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 species, of which most are not microbial. Including everything tremendously slows down our algortihms, and not all fungi fit the scope of this package. By only including the aforementioned taxonomic orders, the most relevant species are covered (like genera \emph{Aspergillus}, \emph{Candida}, \emph{Pneumocystis}, \emph{Saccharomyces} and \emph{Trichophyton}).}
#' \item{All ~15,000 previously accepted names of (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}
#' }
#'
#' The Catalogue of Life (\url{http://www.catalogueoflife.org}) is the most comprehensive and authoritative global index of species currently available. It holds essential information on the names, relationships and distributions of over 1.6 million species. The Catalogue of Life is used to support the major biodiversity and conservation information services such as the Global Biodiversity Information Facility (GBIF), Encyclopedia of Life (EoL) and the International Union for Conservation of Nature Red List. It is recognised by the Convention on Biological Diversity as a significant component of the Global Taxonomy Initiative and a contribution to Target 1 of the Global Strategy for Plant Conservation.
#'
#' The syntax used to transform the original data to a cleansed R format, can be found here: \url{https://gitlab.com/msberends/AMR/blob/master/reproduction_of_microorganisms.R}.
#' @inheritSection AMR Read more on our website!
#' @name catalogue_of_life
#' @rdname catalogue_of_life
#' @examples
#' # Get version info of included data set
#' catalogue_of_life_version()
#'
#'
#' # Get a note when a species was renamed
#' mo_shortname("Chlamydia psittaci")
#' # Note: 'Chlamydia psittaci' (Page, 1968) was renamed
#' # 'Chlamydophila psittaci' (Everett et al., 1999)
#' # [1] "C. psittaci"
#'
#' # Get any property from the entire taxonomic tree for all included species
#' mo_class("E. coli")
#' # [1] "Gammaproteobacteria"
#'
#' mo_family("E. coli")
#' # [1] "Enterobacteriaceae"
#'
#' mo_gramstain("E. coli") # based on kingdom and phylum, see ?mo_gramstain
#' # [1] "Gram negative"
#'
#' mo_ref("E. coli")
#' # [1] "Castellani et al., 1919"
#'
#' # Do not get mistaken - the package only includes microorganisms
#' mo_phylum("C. elegans")
#' # [1] "Cyanobacteria" # Bacteria?!
#' mo_fullname("C. elegans")
#' # [1] "Chroococcus limneticus elegans" # Because a microorganism was found
NULL

61
R/data.R

@ -133,26 +133,25 @@ @@ -133,26 +133,25 @@
#' Data set with ~60,000 microorganisms
#'
#' 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 ITIS ITIS
#' @format A \code{\link{data.frame}} with 56,659 observations and 15 variables:
#' @inheritSection catalogue_of_life Catalogue of Life
#' @format A \code{\link{data.frame}} with 56,672 observations and 14 variables:
#' \describe{
#' \item{\code{mo}}{ID of microorganism}
#' \item{\code{mo}}{ID of microorganism as used by this package}
#' \item{\code{col_id}}{Catalogue of Life ID}
#' \item{\code{genus}}{Taxonomic genus of the microorganism as found in ITIS, see Source}
#' \item{\code{species}}{Taxonomic species of the microorganism as found in ITIS, see Source}
#' \item{\code{subspecies}}{Taxonomic subspecies of the microorganism as found in ITIS, see Source}
#' \item{\code{fullname}}{Full name, like \code{"Echerichia coli"}}
#' \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{subkingdom}}{Taxonomic subkingdom of the microorganism as found in ITIS, see Source}
#' \item{\code{kingdom}}{Taxonomic kingdom of the microorganism as found in ITIS, see Source}
#' \item{\code{gramstain}}{Gram of microorganism, like \code{"Gram negative"}}
#' \item{\code{prevalence}}{An integer based on estimated prevalence of the microorganism in humans. Used internally by \code{\link{as.mo}}, otherwise quite meaningless. It has a value of 25 for manually added items and a value of 1000 for all unprevalent microorganisms whose genus was somewhere in the top 250 (with another species).}
#' \item{\code{ref}}{Author(s) and year of concerning publication as found in ITIS, see Source}
#' \item{\code{kingdom}}{Taxonomic kingdom of the microorganism}
#' \item{\code{phylum}}{Taxonomic phylum of the microorganism}
#' \item{\code{class}}{Taxonomic class of the microorganism}
#' \item{\code{order}}{Taxonomic order of the microorganism}
#' \item{\code{family}}{Taxonomic family of the microorganism}
#' \item{\code{genus}}{Taxonomic genus of the microorganism}
#' \item{\code{species}}{Taxonomic species of the microorganism}
#' \item{\code{subspecies}}{Taxonomic subspecies of the microorganism}
#' \item{\code{rank}}{Taxonomic rank of the microorganism, like \code{"species"} or \code{"genus"}}
#' \item{\code{ref}}{Author(s) and year of concerning scientific publication}
#' \item{\code{species_id}}{ID of the species as used by the Catalogue of Life}
#' }
#' @source Integrated Taxonomic Information System (ITIS) public online database, \url{https://www.itis.gov}.
#' @source Catalogue of Life: Annual Checklist (public online database), \url{www.catalogueoflife.org}.
#' @details Manually added were:
#' \itemize{
#' \item{9 species of \emph{Streptococcus} (beta haemolytic groups A, B, C, D, F, G, H, K and unspecified)}
@ -160,21 +159,37 @@ @@ -160,21 +159,37 @@
#' \item{2 other undefined (unknown Gram negatives and unknown Gram positives)}
#' }
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{as.mo}} \code{\link{mo_property}} \code{\link{microorganisms.codes}}
#' @seealso \code{\link{as.mo}}, \code{\link{mo_property}}, \code{\link{microorganisms.codes}}
"microorganisms"
catalogue_of_life <- list(
version = "Catalogue of Life: 2018 Annual Checklist",
url = "http://www.catalogueoflife.org/annual-checklist/2018"
)
#' Version info of included Catalogue of Life
#' @seealso \code{\link{microorganisms}}
#' @inheritSection catalogue_of_life Catalogue of Life
#' @export
catalogue_of_life_version <- function() {
list(version = catalogue_of_life$version,
url = catalogue_of_life$url,
no_of_species = nrow(AMR::microorganisms),
no_of_synonyms = nrow(AMR::microorganisms.old))
}
#' Data set with previously accepted taxonomic names
#'
#' A data set containing old (previously valid or accepted) taxonomic names according to ITIS. This data set is used internally by \code{\link{as.mo}}.
#' @inheritSection as.mo ITIS
#' 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:
#' \describe{
#' \item{\code{col_id}}{Catalogue of Life ID}
#' \item{\code{tsn_new}}{New Catalogue of Life ID}
#' \item{\code{fullname}}{Old taxonomic name of the microorganism as found in the CoL, see Source}
#' \item{\code{ref}}{Author(s) and year of concerning publication as found in the CoL, see Source}
#' \item{\code{fullname}}{Old taxonomic name of the microorganism}
#' \item{\code{ref}}{Author(s) and year of concerning scientific publication}
#' }
#' @source [3] Integrated Taxonomic Information System (ITIS) on-line database, \url{https://www.itis.gov}.
#' @source [3] Catalogue of Life: Annual Checklist (public online database), \url{www.catalogueoflife.org}.
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{as.mo}} \code{\link{mo_property}} \code{\link{microorganisms}}
"microorganisms.old"
@ -187,7 +202,7 @@ @@ -187,7 +202,7 @@
#' \item{\code{certe}}{Commonly used code of a microorganism}
#' \item{\code{mo}}{ID of the microorganism in the \code{\link{microorganisms}} data set}
#' }
#' @inheritSection ITIS ITIS
#' @inheritSection catalogue_of_life Catalogue of Life
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{as.mo}} \code{\link{microorganisms}}
"microorganisms.codes"

5
R/globals.R

@ -29,6 +29,7 @@ globalVariables(c(".", @@ -29,6 +29,7 @@ globalVariables(c(".",
"Becker",
"certe",
"cnt",
"col_id",
"count",
"count.x",
"count.y",
@ -49,6 +50,7 @@ globalVariables(c(".", @@ -49,6 +50,7 @@ globalVariables(c(".",
"key_ab",
"key_ab_lag",
"key_ab_other",
"kingdom",
"labs",
"Lancefield",
"Last name",
@ -73,7 +75,9 @@ globalVariables(c(".", @@ -73,7 +75,9 @@ globalVariables(c(".",
"other_pat_or_mo",
"Pasted",
"patient_id",
"phylum",
"prevalence",
"prevalent",
"psae",
"R",
"real_first_isolate",
@ -85,6 +89,7 @@ globalVariables(c(".", @@ -85,6 +89,7 @@ globalVariables(c(".",
"Sex",
"shortname",
"species",
"superprevalent",
"trade_name",
"transmute",
"tsn",

63
R/itis.R

@ -1,63 +0,0 @@ @@ -1,63 +0,0 @@
# ==================================================================== #
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' ITIS: Integrated Taxonomic Information System
#'
#' All taxonomic names of all microorganisms are included in this package, using the authoritative Integrated Taxonomic Information System (ITIS).
#' @section ITIS:
#' \if{html}{\figure{logo_itis.jpg}{options: height=60px style=margin-bottom:5px} \cr}
#' This package contains the \strong{complete microbial taxonomic data} (with all nine taxonomic ranks - from kingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, \url{https://www.itis.gov}).
#'
#' All ~20,000 (sub)species from \strong{the taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all their ~2,500 previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since ITIS honours the taxonomic branching order of bacterial phyla according to Cavalier-Smith (2002), which defines that all bacteria are classified into either subkingdom Negibacteria or subkingdom Posibacteria.
#'
#' ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists [3].
#' @inheritSection AMR Read more on our website!
#' @name ITIS
#' @rdname ITIS
#' @examples
#' # Get a note when a species was renamed
#' mo_shortname("Chlamydia psittaci")
#' # Note: 'Chlamydia psittaci' (Page, 1968) was renamed
#' # 'Chlamydophila psittaci' (Everett et al., 1999)
#' # [1] "C. psittaci"
#'
#' # Get any property from the entire taxonomic tree for all included species
#' mo_class("E. coli")
#' # [1] "Gammaproteobacteria"
#'
#' mo_family("E. coli")
#' # [1] "Enterobacteriaceae"
#'
#' mo_subkingdom("E. coli")
#' # [1] "Negibacteria"
#'
#' mo_gramstain("E. coli") # based on subkingdom
#' # [1] "Gram negative"
#'
#' mo_ref("E. coli")
#' # [1] "Castellani and Chalmers, 1919"
#'
#' # Do not get mistaken - the package only includes microorganisms
#' mo_phylum("C. elegans")
#' # [1] "Cyanobacteria" # Bacteria?!
#' mo_fullname("C. elegans")
#' # [1] "Chroococcus limneticus elegans" # Because a microorganism was found
NULL

26
R/mo.R

@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
#' \item{It strips off values between brackets and the brackets itself, and re-evaluates the input with all previous rules}
#' \item{It strips off words from the end one by one and re-evaluates the input with all previous rules}
#' \item{It strips off words from the start one by one and re-evaluates the input with all previous rules}
#' \item{It tries to look for some manual changes which are not yet published to the ITIS database (like \emph{Propionibacterium} not yet being \emph{Cutibacterium})}
#' \item{It tries to look for some manual changes which are not yet published to the Catalogue of Life (like \emph{Propionibacterium} not yet being \emph{Cutibacterium})}
#' }
#'
#' Examples:
@ -94,17 +94,17 @@ @@ -94,17 +94,17 @@
#'
#' Use \code{mo_renamed()} to get a vector with all values that could be coerced based on an old, previously accepted taxonomic name.
#'
#' @inheritSection ITIS ITIS
#' @inheritSection catalogue_of_life Catalogue of Life
# (source as a section, so it can be inherited by other man pages)
#' @section 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}
#'
#' [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). Retrieved September 2018. \url{http://www.itis.gov}
#' [3] Catalogue of Life: Annual Checklist (public online database), \url{www.catalogueoflife.org}.
#' @export
#' @return Character (vector) with class \code{"mo"}. Unknown values will return \code{NA}.
#' @seealso \code{\link{microorganisms}} for the \code{data.frame} with ITIS content that is being used to determine ID's. \cr
#' @seealso \code{\link{microorganisms}} for the \code{data.frame} that is being used to determine ID's. \cr
#' The \code{\link{mo_property}} functions (like \code{\link{mo_genus}}, \code{\link{mo_gramstain}}) to get properties based on the returned code.
#' @inheritSection AMR Read more on our website!
#' @examples
@ -216,15 +216,15 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, @@ -216,15 +216,15 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE,
x <- x[!is.na(x) & !is.null(x) & !identical(x, "")]
# conversion v0.5.0 to v0.6.0, remove for v0.7.0
x <- gsub("B_STRPTC", "B_STRPT", x)
x <- gsub("B_STRPT_EQUI", "B_STRPT_EQU", x)
x <- gsub("B_PDMNS", "B_PSDMN", x)
x <- gsub("B_CTRDM", "B_CLSTR", x)
x <- gsub("F_CANDD_GLB", "F_CANDD_GLA", x)
x <- gsub("F_CANDD_LUS", "F_CANDD", x)
x <- gsub("B_FCTRM", "B_FSBCT", x)
# conversion of old MO codes from v0.5.0 (ITIS) to later versions (Catalogue of Life)
if (any(x %like% "^[BFP]_[A-Z]{3,7}")) {
leftpart <- gsub("^([BFP]_[A-Z]{3,7}).*", "\\1", x)
if (any(leftpart %in% names(mo_codes_v0.5.0))) {
rightpart <- gsub("^[BFP]_[A-Z]{3,7}(.*)", "\\1", x)
leftpart <- mo_codes_v0.5.0[leftpart]
x[!is.na(leftpart)] <- paste0(leftpart[!is.na(leftpart)], rightpart[!is.na(leftpart)])
}
}
# defined df to check for
if (!is.null(reference_df)) {

26
R/mo_property.R

@ -26,14 +26,18 @@ @@ -26,14 +26,18 @@
#' @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}}
#' @details All functions will return the most recently known taxonomic property according to ITIS, except for \code{mo_ref}, \code{mo_authors} and \code{mo_year}. This leads to the following results:
#' @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)}
#' \item{\code{mo_ref("Chlamydia psittaci")} will return \code{"Page, 1968"} (with a warning about the renaming)}
#' \item{\code{mo_ref("Chlamydophila psittaci")} will return \code{"Everett et al., 1999"} (without a warning)}
#' }
#'
#' The Gram stain - \code{mo_gramstain()} - will be determined on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002) who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes (ref: \url{https://itis.gov/servlet/SingleRpt/SingleRpt?search_topic=TSN&search_value=956097}). These bacteria are considered Gram positive - all other bacteria are considered Gram negative. Species outside the kingdom of Bacteria will return a value \code{NA}.
#'
#' The function \code{mo_url()} will return the direct URL to the species in the Catalogue of Life.
#' @inheritSection get_locale Supported languages
#' @inheritSection ITIS ITIS
#' @inheritSection catalogue_of_life Catalogue of Life
#' @inheritSection as.mo Source
#' @rdname mo_property
#' @name mo_property
@ -49,14 +53,13 @@ @@ -49,14 +53,13 @@
#' # All properties of Escherichia coli
#' ## taxonomic properties
#' mo_kingdom("E. coli") # "Bacteria"
#' mo_subkingdom("E. coli") # "Negibacteria"
#' mo_phylum("E. coli") # "Proteobacteria"
#' mo_class("E. coli") # "Gammaproteobacteria"
#' mo_order("E. coli") # "Enterobacteriales"
#' mo_family("E. coli") # "Enterobacteriaceae"
#' mo_genus("E. coli") # "Escherichia"
#' mo_species("E. coli") # "coli"
#' mo_subspecies("E. coli") # NA
#' mo_subspecies("E. coli") # ""
#'
#' ## colloquial properties
#' mo_fullname("E. coli") # "Escherichia coli"
@ -220,12 +223,6 @@ mo_phylum <- function(x, ...) { @@ -220,12 +223,6 @@ mo_phylum <- function(x, ...) {
mo_validate(x = x, property = "phylum", ...)
}
#' @rdname mo_property
#' @export
mo_subkingdom <- function(x, ...) {
mo_validate(x = x, property = "subkingdom", ...)
}
#' @rdname mo_property
#' @export
mo_kingdom <- function(x, ...) {
@ -290,6 +287,15 @@ mo_taxonomy <- function(x, ...) { @@ -290,6 +287,15 @@ mo_taxonomy <- function(x, ...) {
subspecies = mo_subspecies(x))
}
#' @rdname mo_property
#' @export
mo_url <- function(x, ...) {
u <- mo_validate(x = x, property = "species_id", ...)
u[u != ""] <- paste0(catalogue_of_life$url, "/details/species/id/", u)
u
}
#' @rdname mo_property
#' @importFrom data.table data.table as.data.table setkey
#' @export

192
R/zzz.R

@ -128,6 +128,198 @@ NULL @@ -128,6 +128,198 @@ NULL
value = microorganisms.oldDT,
envir = asNamespace("AMR"))
# conversion of old MO codes from v0.5.0 (ITIS) to later versions (Catalogue of Life)
mo_codes_v0.5.0 <- c(B_ACHRMB = "B_ACHRM", B_ANNMA = "B_ACTNS", B_ACLLS = "B_ALCYC",
B_AHNGM = "B_ARCHN", B_ARMTM = "B_ARMTMN", B_ARTHRS = "B_ARTHR",
B_APHLS = "B_AZRHZP", B_BRCHA = "B_BRCHY", B_BCTRM = "B_BRVBCT",
B_CLRBCT = "B_CLRBC", B_CTRDM = "B_CLSTR", B_CPRMM = "B_CYLND",
B_DLCLN = "B_DPLCL", B_DMCLM = "B_DSLFT", B_DSLFVB = "B_DSLFV",
B_FCTRM = "B_FSBCT", B_GNRLA = "B_GRDNR", B_HNRBM = "B_HLNRB",
B_HPHGA = "B_HNPHGA", B_HCCCS = "B_HYDRC", B_MCRCLS = "B_MCRCL",
B_MTHYLS = "B_MLSMA", B_MARCLS = "B_MRCLS", B_MGCLS = "B_MSTGC",
B_MCLLA = "B_MTHYLC", B_MYCPLS = "B_MYCPL", B_NBCTR = "B_NTRBC",
B_OCLLS = "B_OCNBC", B_PTHRX = "B_PLNKT", B_PCCCS = "B_PRCHL",
B_PSPHN = "B_PRPHY", B_PDMNS = "B_PSDMN", B_SCCHRP = "B_SCCHR",
B_SRBCTR = "B_SHRBCTR", B_STRPTC = "B_STRPT", B_SHMNS = "B_SYNTR",
B_TRBCTR = "B_THRMN", P_ALBMN = "C_ABMNA", F_ACHLY = "C_ACHLY",
P_ACINT = "C_ACINT", P_ARTCL = "C_ACLNA", P_ACRVL = "C_ACRVL",
P_ADRCT = "C_ADRCT", P_AMPHS = "C_AHSRS", F_ALBUG = "C_ALBUG",
P_ALCNT = "C_ALCNT", P_ALFRD = "C_ALFRD", P_ALLGR = "C_ALLGR",
P_AMPHL = "C_ALPTS", F_ALTHR = "C_ALTHR", P_AMLLA = "C_AMLLA",
P_ANMLN = "C_AMLNA", P_AMMBC = "C_AMMBC", P_AMMDS = "C_AMMDS",
P_AMMLG = "C_AMMLG", P_AMMMR = "C_AMMMR", P_AMMMS = "C_AMMMS",
P_AMMON = "C_AMMON", P_AMMSC = "C_AMMSC", P_AMMSP = "C_AMMSP",
P_AMMST = "C_AMMST", P_AMMTM = "C_AMMTM", F_AMYCS = "C_AMYCS",
P_ANARM = "C_ANARM", P_ANGLD = "C_ANGLD", P_ANGLG = "C_ANGLG",
P_ANNLC = "C_ANNLC", F_ANSLP = "C_ANSLP", F_APDCH = "C_APDCH",
F_APHND = "C_APHND", F_APLNC = "C_APLNC", F_AQLND = "C_AQLND",
P_ARCHS = "C_ARCHAS", P_ASTRN = "C_ARNNN", P_ARNPR = "C_ARNPR",
F_ARSPR = "C_ARSPR", P_ARTST = "C_ARTSTR", P_AMPHC = "C_ARYNA",
P_ASCHM = "C_ASCHM", P_ASPDS = "C_ASPDS", P_ASTCL = "C_ASTCL",
P_ASTRG = "C_ASTRGR", P_ASTRM = "C_ASTRMM", P_ASTRR = "C_ASTRR",
P_ASTRT = "C_ASTRTR", F_ATKNS = "C_ATKNS", F_AYLLA = "C_AYLLA",
P_BAGGN = "C_BAGGN", P_BCCLL = "C_BCCLL", P_BDLLD = "C_BDLLD",
P_BGNRN = "C_BGNRN", P_BLCLN = "C_BLCLN", P_BLMND = "C_BLMND",
P_BLMNL = "C_BLMNL", P_BLPHR = "C_BLPHR", P_BLVNT = "C_BLVNT",
P_BOLVN = "C_BOLVN", P_BORLS = "C_BORLS", P_BRNNM = "C_BRNNM",
P_BRSLN = "C_BRSLN", P_BRSRD = "C_BRSRD", F_BRVLG = "C_BRVLG",
F_BNLLA = "C_BRVLGN", P_BSCCM = "C_BSCCM", F_BSDPH = "C_BSDPH",
P_BTHYS = "C_BTHYS", P_BTLLN = "C_BTLLN", P_BULMN = "C_BULMN",
P_CCLDM = "C_CCLDM", P_CDNLL = "C_CDNLL", P_CLPSS = "C_CDNLLP",
P_CHLDN = "C_CHLDNL", P_CHLST = "C_CHLST", P_CHNLM = "C_CHNLM",
P_CHRYS = "C_CHRYSL", P_CHTSP = "C_CHTSP", P_CBCDS = "C_CIBCDS",
P_CLCRN = "C_CLCRN", P_CLMNA = "C_CLMNA", P_CLPDM = "C_CLPDM",
P_CLPHR = "C_CLPHRY", P_CLVLN = "C_CLVLN", P_CMPNL = "C_CMPNL",
P_CNCRS = "C_CNCRS", P_CNTCH = "C_CNTCH", F_CNTRM = "C_CNTRMY",
P_COLPD = "C_COLPD", P_COLPS = "C_COLPS", P_CPRDS = "C_CPRDS",
P_CRNSP = "C_CPRMA", P_CRBNL = "C_CRBNL", P_CRBRB = "C_CRBRB",
P_CRBRG = "C_CRBRG", P_CRBRS = "C_CRBRS", P_CRCHS = "C_CRCHS",
P_CRCLC = "C_CRCLC", P_CRNLC = "C_CRNLC", P_CRNTH = "C_CRNTH",
P_CRPNT = "C_CRPNT", P_CRSTG = "C_CRSTG", P_CRTHN = "C_CRTHN",
P_CRTRN = "C_CRTRN", P_CYMBL = "C_CRTTA", P_CRYPT = "C_CRYPT",
P_CSHMN = "C_CSHMNL", P_CSSDL = "C_CSSDL", P_CLNDS = "C_CSSDLN",
P_CHRNA = "C_CTHRN", P_CTPSS = "C_CTPSS", P_CUNLN = "C_CUNLN",
P_CYLND = "C_CVLNA", P_CYCLC = "C_CYCLCB", P_CDNTA = "C_CYCLD",
P_CYCLG = "C_CYCLG", P_CYCLM = "C_CYCLM", P_CYRTL = "C_CYRTL",
P_CYSTM = "C_CYSTM", P_DCHLM = "C_DCHLM", P_DCRBS = "C_DCRBS",
P_DCTYC = "C_DCTYC", P_DIDNM = "C_DIDNM", P_DLPTS = "C_DLPTS",
P_DNTLN = "C_DNTLN", P_DNTST = "C_DNTST", P_DORTH = "C_DORTH",
P_DCTYP = "C_DPHMS", F_DPLCY = "C_DPLCY", P_DNDRT = "C_DRTNA",
P_DSCMM = "C_DSCMM", P_DSCRB = "C_DSCRB", P_DSCRN = "C_DSCRN",
P_DSCSP = "C_DSCSP", P_DSNBR = "C_DSNBR", P_DYCBC = "C_DYCBC",
F_DCTYC = "C_DYCHS", F_ECTRG = "C_ECTRG", B_EDWRD = "C_EDWRD",
P_EGGRL = "C_EGGRL", P_EHLYS = "C_EHLYS", P_EHRNB = "C_EHRNB",
P_ELPHD = "C_ELPHD", P_ENCHL = "C_ELYDM", P_EPHDM = "C_EPHDM",
P_EPLTS = "C_EPLTS", P_EPLXL = "C_EPLXL", P_EPNDL = "C_EPNDL",
P_EPNDS = "C_EPNDS", P_ENLLA = "C_EPSTM", P_EPSTY = "C_EPSTY",
F_ERYCH = "C_ERYCH", F_ESMDM = "C_ESMDM", P_ESSYR = "C_ESSYR",
P_FSCHR = "C_FHRNA", P_FLRLS = "C_FLRLS", P_FLNTN = "C_FNTNA",
P_FRNDC = "C_FRNDC", P_FRNTN = "C_FRNTN", P_FRSNK = "C_FRSNK",
P_FNLLA = "C_FSCHRN", P_FSSRN = "C_FSSRN", P_FVCSS = "C_FVCSS",
P_GDRYN = "C_GDRYN", F_GELGN = "C_GELGN", P_GERDA = "C_GERDA",
P_GLACM = "C_GLACM", P_GLBBL = "C_GLBBL", P_GLBGR = "C_GLBGR",
P_GLBLN = "C_GLBLN", P_GRTLA = "C_GLBRT", P_GLBTX = "C_GLBTX",
P_GLLNA = "C_GLLNA", P_GLMSP = "C_GLMSP", P_GLNDL = "C_GLNDL",
F_GNMCH = "C_GNMCH", P_GOSLL = "C_GOSLL", P_GRNDS = "C_GRNDS",
P_GRNTA = "C_GRNTA", P_GLBRT = "C_GTLLA", P_GTTLN = "C_GTTLN",
P_GVLNP = "C_GVLNP", P_GYPSN = "C_GYPSN", P_GYRDN = "C_GYRDN",
P_HALTR = "C_HALTR", P_HANZW = "C_HANZW", P_HAURN = "C_HAURN",
P_HELNN = "C_HELNN", P_HLPHR = "C_HHRYA", P_HLNTA = "C_HLNTA",
F_HLPHT = "C_HLPHT", P_HLSTC = "C_HLSTC", P_HMSPH = "C_HMSPH",
P_HMTRM = "C_HMTRM", P_HPKNS = "C_HPKNS", P_HPLPH = "C_HPLPH",
P_HPPCR = "C_HPPCR", P_HNLLA = "C_HPPCRP", P_HRMSN = "C_HRMSN",
P_HRNLL = "C_HRNLL", F_HRPCH = "C_HRPCH", P_HSTGR = "C_HSTGR",
P_HSTTL = "C_HSTTL", P_HTRST = "C_HTGNA", P_HTRLL = "C_HTRLL",
P_HTRPH = "C_HTRPH", F_HYPHC = "C_HYPHC", P_HYPRM = "C_HYPRM",
P_INTRN = "C_INTRN", P_IRIDI = "C_IRIDI", P_ISLND = "C_ISLND",
P_JCLLL = "C_JCLLL", P_KHLLL = "C_KHLLL", P_KRNPS = "C_KRNPS",
P_KRRRL = "C_KRRRL", P_LABOE = "C_LABOE", P_LAGEN = "C_LAGEN",
P_LBSLL = "C_LBSLL", F_LTHLA = "C_LBYRN", P_LCRYM = "C_LCRYM",
P_LEMBS = "C_LEMBS", F_LGNDM = "C_LGNDM", P_LGNMM = "C_LGNMM",
P_LGNPH = "C_LGNPHR", F_LGNSM = "C_LGNSM", P_LGYNP = "C_LGYNP",
P_LITTB = "C_LITTB", P_LITUL = "C_LITUL", P_LMBDN = "C_LMBDN",
P_LMRCK = "C_LMRCK", F_LBYRN = "C_LMYXA", P_LNGLN = "C_LNGLN",
P_LNTCL = "C_LNTCL", P_LOXDS = "C_LOXDS", F_LPTLG = "C_LPTLG",
F_LNLLA = "C_LPTLGN", F_LPTMT = "C_LPTMT", P_LRYNG = "C_LRYNG",
P_LTCRN = "C_LTCRN", P_LTHPL = "C_LTHPL", P_LTNTS = "C_LTNTS",
F_LTRST = "C_LTRST", P_LXPHY = "C_LXPHY", P_MCRTH = "C_MCRTH",
P_MELNS = "C_MELNS", P_MSDNM = "C_MESDNM", P_METPS = "C_METPS",
P_MIMSN = "C_MIMSN", P_MINCN = "C_MINCN", P_MLLNL = "C_MLLNL",
P_MLMMN = "C_MLMMN", F_MNDNL = "C_MNDNL", P_MNLYS = "C_MNLYS",
P_MNPSS = "C_MNPSS", P_MRGNL = "C_MRGNL", P_MRGNP = "C_MRGNP",
P_MRSPL = "C_MRSPL", P_MRTNT = "C_MRTNT", P_MSSLN = "C_MSSLN",
P_MSSSS = "C_MSSSS", P_MTCNT = "C_MTCNT", P_MYCHS = "C_MYCHS",
P_MYSCH = "C_MYSCH", F_MYZCY = "C_MYZCY", P_NASSL = "C_NASSL",
P_NBCLN = "C_NBCLN", P_NBCLR = "C_NBCLR", P_NCNRB = "C_NCNRB",
P_NDBCL = "C_NDBCL", P_NRLLA = "C_NDBCLR", P_NMMLC = "C_NMMLC",
F_NMTPH = "C_NMTPH", P_NNNLL = "C_NNNLL", P_NODSR = "C_NODSR",
P_NONIN = "C_NONIN", P_NOURI = "C_NOURI", P_OCLNA = "C_OCLNA",
P_OGLNA = "C_OGLNA", P_OPHTH = "C_OLMDM", F_OLPDP = "C_OLPDP",
P_ONYCH = "C_OMPSS", P_OOLIN = "C_OOLIN", P_OPRCL = "C_OPRCL",
P_ORBLN = "C_ORBLN", F_ORCAD = "C_ORCAD", P_ORDRS = "C_ORDRS",
P_OPHRY = "C_ORYDM", P_OSNGL = "C_OSNGL", P_OXYTR = "C_OXYTR",
P_PARRN = "C_PARRN", P_PATRS = "C_PATRS", P_PAVNN = "C_PAVNN",
P_PTYCH = "C_PCYLS", P_PDPHR = "C_PDPHR", P_PELSN = "C_PELSN",
F_PHGMY = "C_PHGMY", F_PSDSP = "C_PHRTA", P_PHRYG = "C_PHRYG",
P_PHYSL = "C_PHYSL", F_PHYTP = "C_PHYTP", P_PLACS = "C_PLACS",
P_PLCPS = "C_PLCPS", P_PLCPSL = "C_PLCPSL", P_PLCTN = "C_PLCTN",
P_PLGPH = "C_PLGPH", B_PLGTH = "C_PLGTH", P_PLMRN = "C_PLMRN",
P_PLNCT = "C_PLNCT", P_PLNDSC = "C_PLNDSC", P_PLNGY = "C_PLNGY",
P_PLNRBL = "C_PLNLLA", P_PLNLN = "C_PLNLN", P_PLNLR = "C_PLNLR",
P_PLNRB = "C_PLNRB", P_PLNSP = "C_PLNSPR", P_PLRNM = "C_PLRNM",
P_PLRST = "C_PLRST", P_PLRTR = "C_PLRTR", F_PLSMD = "C_PLSMD",
P_PLTYC = "C_PLTYC", P_PSDBL = "C_PLVNA", P_PLYMR = "C_PLYMR",
P_PLTYN = "C_PNMTM", P_PNRPL = "C_PNRPL", F_PNTSM = "C_PNTSM",
P_PRCNT = "C_PRCNT", P_PRFSS = "C_PRFSS", P_PRMCM = "C_PRMCUM",
F_PRNSP = "C_PRNSP", P_PRPND = "C_PRPND", P_PRPYX = "C_PRPYX",
P_PRRDN = "C_PRRDN", P_PSDDF = "C_PSDDF", P_PSDMC = "C_PSDMC",
P_PSDND = "C_PSDND", P_PSDNN = "C_PSDNN", P_PSDPL = "C_PSDPLY",
P_PSMMS = "C_PSMMS", P_PTLLN = "C_PTLLN", P_PTLLND = "C_PTLLND",
F_PTRSN = "C_PTRSN", P_PULLN = "C_PULLN", P_PUTLN = "C_PUTLN",
P_PRTTR = "C_PYMNA", P_PYRGL = "C_PYRGL", P_PYRGO = "C_PYRGO",
P_PYRLN = "C_PYRLN", F_PYTHM = "C_PYTHIM", F_PYTHL = "C_PYTHL",
P_PYXCL = "C_PYXCL", P_QNQLC = "C_QNQLC", P_RAMLN = "C_RAMLN",
P_RBRTN = "C_RBRTN", P_RCRVD = "C_RCRVD", P_RCTBL = "C_RCTBL",
P_RCTCB = "C_RCTCB", P_RCTGL = "C_RCTGL", P_RCTVG = "C_RCTVG",
P_RDGDR = "C_RDGDR", P_REMNC = "C_REMNC", P_REPHX = "C_REPHX",
P_RHBDM = "C_RHBDMM", F_RHBDS = "C_RHBDSP", P_RHPDD = "C_RHPDD",
F_RHPDM = "C_RHPDM", F_RHZDMY = "C_RHZDM", P_RHZMM = "C_RHZMM",
P_RIVRN = "C_RIVRN", P_ROSLN = "C_ROSLN", P_ROTAL = "C_ROTAL",
P_RPHDP = "C_RPHDP", P_RPRTN = "C_RPRTN", P_RSSLL = "C_RSSLL",
P_RTLMM = "C_RTLMM", P_RTYLA = "C_RTYLA", P_RUGID = "C_RUGID",
F_RZLLP = "C_RZLLP", P_SAGRN = "C_SAGRN", P_SCCMM = "C_SCCMM",
P_SCCRH = "C_SCCRH", P_SCHLM = "C_SCHLM", F_SCLRS = "C_SCLRS",
P_SCTLR = "C_SCTLR", P_SEBRK = "C_SEBRK", P_SGMLN = "C_SGMLN",
P_SGMLP = "C_SGMLP", P_SGMMR = "C_SGMMR", P_SGMVR = "C_SGMVR",
F_SMMRS = "C_SMMRS", P_SNNDS = "C_SNNDS", P_SORTS = "C_SORTS",
P_SPHGN = "C_SPHGN", P_SPHNN = "C_SPHNN", P_SNLLA = "C_SPHNNL",
P_SPHTR = "C_SPHTR", P_SPHTX = "C_SPHTX", P_SPHVG = "C_SPHVG",
P_SPRDT = "C_SPRDT", P_SPRLC = "C_SPRLC", F_SPRLG = "C_SPRLG",
P_SPRLL = "C_SPRLL", F_SPRMY = "C_SPRMY", P_SPRPL = "C_SPRPL",
P_SPRSG = "C_SPRSG", P_SPRST = "C_SPRST", P_SPHNP = "C_SPRTA",
P_SPRZN = "C_SPRZN", P_SPHRG = "C_SPSNA", P_STHDM = "C_SPTHD",
P_SRCNR = "C_SRCNR", F_SRLPD = "C_SRLPD", F_SPNGS = "C_SSPRA",
F_STEIN = "C_STEIN", P_SPTHD = "C_STHDDS", P_STHRP = "C_STHRP",
P_STNFR = "C_STNFR", P_STNSM = "C_STNSM", P_STNTR = "C_STNTR",
P_STRBL = "C_STRBL", P_STRMB = "C_STRMB", P_STTSN = "C_STTSN",
P_STYLN = "C_SYCHA", F_SCHZC = "C_SYTRM", P_TBNLL = "C_TBNLL",
P_TRCHL = "C_TCHLS", P_TCHNT = "C_TCHNT", P_THRCL = "C_THRCL",
P_THRMM = "C_THRMM", P_TIARN = "C_TIARN", P_TKPHR = "C_TKPHR",
P_TLNMA = "C_TLNMA", P_TLYPM = "C_TLYPM", P_TMNDS = "C_TMNDS",
P_TMNTA = "C_TMNTA", P_TNTNN = "C_TNNDM", P_TTNNS = "C_TNTNN",
P_TNPSS = "C_TNTNNP", P_TONTN = "C_TONTN", P_TOSAI = "C_TOSAI",
P_TPHTR = "C_TPHTR", P_TRCHH = "C_TRCHH", P_TRPHS = "C_TRCHLR",
P_TMMNA = "C_TRCHM", P_TRCHS = "C_TRCHSP", P_TRFRN = "C_TRFRN",
P_TRLCL = "C_TRLCL", P_TRTXL = "C_TRTXL", P_TRTXS = "C_TRTXS",
P_TTRHY = "C_TTRHY", F_TTRMY = "C_TTRMY", P_TXTLR = "C_TXTLR",
F_THRST = "C_TYTRM", P_URLPT = "C_ULPTS", P_UNGLT = "C_UNGLT",
P_URCNT = "C_URCNT", P_URONM = "C_URONM", P_UROSM = "C_UROSM",
P_URTRC = "C_URTRC", P_URSTY = "C_UTYLA", P_UVGRN = "C_UVGRN",
P_VLVLN = "C_VALVLN", P_VGNLN = "C_VGNLN", P_VGNLNP = "C_VGNLNP",
P_VLNRA = "C_VLVLN", P_VGNCL = "C_VNCLA", P_VRGLN = "C_VRGLN",
P_VRGLNP = "C_VRGLNP", P_VRTCL = "C_VRTCL", P_WBBNL = "C_WBBNL",
P_WEBBN = "C_WEBBN", P_WSNRL = "C_WSNRL", P_ZTHMN = "C_ZHMNM",
B_ZOOGL = "C_ZOOGL", F_DDSCS = "F_DPDSC", F_SCCHR = "F_SMYCS",
P_AMTRN = "P_ACNTH", F_AMBDM = "P_AMBDM", F_ARCYR = "P_ARCYR",
F_BADHM = "P_BADHM", F_BDHMP = "P_BDHMP", F_BRBYL = "P_BRBYL",
F_BRFLD = "P_BRFLD", F_CLMYX = "P_CLMYX", F_CLSTD = "P_CLSTD",
F_CMTRC = "P_CMTRC", F_CRBRR = "P_CRBRR", F_CRTMY = "P_CRTMY",
F_CRTRM = "P_CRTRM", F_DCTYD = "P_DCTYD", F_DDYMM = "P_DDYMM",
F_DIACH = "P_DIACH", F_DIANM = "P_DIANM", F_DIDRM = "P_DIDRM",
F_ELMYX = "P_ELMYX", F_ESTLM = "P_ESTLM", F_FULIG = "P_FULIG",
F_HMTRC = "P_HMTRC", F_LCRPS = "P_LCRPS", F_LICEA = "P_LICEA",
F_LMPRD = "P_LMPRD", F_LPTDR = "P_LPTDR", F_LSTRL = "P_LSTRL",
F_LYCGL = "P_LYCGL", F_MCBRD = "P_MCBRD", F_MNKTL = "P_MNKTL",
F_MTTRC = "P_MTTRC", F_MUCLG = "P_MUCLG", F_PHYSR = "P_PHYSR",
F_PRCHN = "P_PRCHN", F_PRMBD = "P_PRMBD", F_PRTPH = "P_PRTPH",
F_PSRNA = "P_PSRNA", F_PYSRM = "P_PYSRM", F_RTCLR = "P_RTCLR",
F_STMNT = "P_STMNT", F_SYMPH = "P_SYMPH", F_TRBRK = "P_TRBRK",
F_TRICH = "P_TRICH", F_TUBFR = "P_TUBFR")
assign(x = "mo_codes_v0.5.0",
value = mo_codes_v0.5.0,
envir = asNamespace("AMR"))
# packageStartupMessage("OK.", appendLF = TRUE)
}
}

4
_pkgdown.yml

@ -88,7 +88,8 @@ reference: @@ -88,7 +88,8 @@ reference:
for more information about how to work with functions in this package.
contents:
- '`AMR`'
- '`ITIS`'
- '`catalogue_of_life`'
- '`catalogue_of_life_version`'
- '`WHOCC`'
- title: 'Cleaning your data'
desc: >
@ -145,7 +146,6 @@ reference: @@ -145,7 +146,6 @@ reference:
- '`WHONET`'
- '`microorganisms.codes`'
- '`microorganisms.old`'
- '`supplementary_data`'
- title: Other
desc: >
These functions are mostly for internal use, but some of

BIN
data/microorganisms.old.rda

Binary file not shown.

BIN
data/microorganisms.rda

Binary file not shown.

406
docs/articles/AMR.html

<
@ -192,7 +192,7 @@ @@ -192,7 +192,7 @@
<h1>How to conduct AMR analysis</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">18 February 2019</h4>
<h4 class="date">20 February 2019</h4>
<div class="hidden name"><code>AMR.Rmd</code></div>
@ -201,7 +201,7 @@ @@ -201,7 +201,7 @@
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">RMarkdown</a>. However, the methodology remains unchanged. This page was generated on 18 February 2019.</p>
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">RMarkdown</a>. However, the methodology remains unchanged. This page was generated on 20 February 2019.</p>
<div id="introduction" class="section level1">
<h1 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h1>
@ -217,21 +217,21 @@ @@ -217,21 +217,21 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2019-02-18</td>
<td align="center">2019-02-20</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
</tr>
<tr class="even">
<td align="center">2019-02-18</td>
<td align="center">2019-02-20</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
</tr>
<tr class="odd">
<td align="center">2019-02-18</td>
<td align="center">2019-02-20</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -327,70 +327,70 @@ @@ -327,70 +327,70 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2011-01-25</td>
<td align="center">V6</td>
<td align="center">Hospital A</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">I</td>
<td align="center">2012-08-24</td>
<td align="center">V3</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2013-07-31</td>
<td align="center">A8</td>
<td align="center">Hospital D</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">2013-04-28</td>
<td align="center">S3</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2016-10-12</td>
<td align="center">Y3</td>
<td align="center">2013-05-13</td>
<td align="center">F2</td>
<td align="center">Hospital D</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2013-12-31</td>
<td align="center">B4</td>
<td align="center">Hospital B</td>
<td align="center">2017-04-04</td>
<td align="center">I9</td>
<td align="center">Hospital C</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2014-08-10</td>
<td align="center">F9</td>
<td align="center">Hospital A</td>
<td align="center">2015-12-23</td>
<td align="center">G9</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2017-12-05</td>
<td align="center">H7</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">2011-12-19</td>
<td align="center">T2</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">F</td>
</tr>
</tbody>
</table>
@ -411,8 +411,8 @@ @@ -411,8 +411,8 @@
#&gt;
#&gt; Item Count Percent Cum. Count Cum. Percent
#&gt; --- ----- ------- -------- ----------- -------------
#&gt; 1 M 10,283 51.4% 10,283 51.4%
#&gt; 2 F 9,717 48.6% 20,000 100.0%</code></pre>
#&gt; 1 M 10,471 52.4% 10,471 52.4%
#&gt; 2 F 9,529 47.6% 20,000 100.0%</code></pre>
<p>So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values <code>M</code> and <code>F</code>. From a researcher perspective: there are slightly more men. Nothing we didn’t already know.</p>
<p>The data is already quite clean, but we still need to transform some variables. The <code>bacteria</code> column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The <code><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate()</a></code> function of the <code>dplyr</code> package makes this really easy:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" title="1">data &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span></a>
@ -443,10 +443,10 @@ @@ -443,10 +443,10 @@
<a class="sourceLine" id="cb14-19" title="19"><span class="co">#&gt; Kingella kingae (no changes)</span></a>
<a class="sourceLine" id="cb14-20" title="20"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-21" title="21"><span class="co">#&gt; EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
<a class="sourceLine" id="cb14-22" title="22"><span class="co">#&gt; Table 1: Intrinsic resistance in Enterobacteriaceae (1294 changes)</span></a>
<a class="sourceLine" id="cb14-22" title="22"><span class="co">#&gt; Table 1: Intrinsic resistance in Enterobacteriaceae (1288 changes)</span></a>
<a class="sourceLine" id="cb14-23" title="23"><span class="co">#&gt; Table 2: Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)</span></a>
<a class="sourceLine" id="cb14-24" title="24"><span class="co">#&gt; Table 3: Intrinsic resistance in other Gram-negative bacteria (no changes)</span></a>
<a class="sourceLine" id="cb14-25" title="25"><span class="co">#&gt; Table 4: Intrinsic resistance in Gram-positive bacteria (2822 changes)</span></a>
<a class="sourceLine" id="cb14-25" title="25"><span class="co">#&gt; Table 4: Intrinsic resistance in Gram-positive bacteria (2757 changes)</span></a>
<a class="sourceLine" id="cb14-26" title="26"><span class="co">#&gt; Table 8: Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)</span></a>
<a class="sourceLine" id="cb14-27" title="27"><span class="co">#&gt; Table 9: Interpretive rules for B-lactam agents and Gram-negative rods (no changes)</span></a>
<a class="sourceLine" id="cb14-28" title="28"><span class="co">#&gt; Table 10: Interpretive rules for B-lactam agents and other Gram-negative bacteria (no changes)</span></a>
@ -462,9 +462,9 @@ @@ -462,9 +462,9 @@
<a class="sourceLine" id="cb14-38" title="38"><span class="co">#&gt; Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no changes)</span></a>
<a class="sourceLine" id="cb14-39" title="39"><span class="co">#&gt; Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no changes)</span></a>
<a class="sourceLine" id="cb14-40" title="40"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-41" title="41"><span class="co">#&gt; =&gt; EUCAST rules affected 7,463 out of 20,000 rows</span></a>
<a class="sourceLine" id="cb14-41" title="41"><span class="co">#&gt; =&gt; EUCAST rules affected 7,243 out of 20,000 rows</span></a>
<a class="sourceLine" id="cb14-42" title="42"><span class="co">#&gt; -&gt; added 0 test results</span></a>
<a class="sourceLine" id="cb14-43" title="43"><span class="co">#&gt; -&gt; changed 4,116 test results (0 to S; 0 to I; 4,116 to R)</span></a></code></pre></div>
<a class="sourceLine" id="cb14-43" title="43"><span class="co">#&gt; -&gt; changed 4,045 test results (0 to S; 0 to I; 4,045 to R)</span></a></code></pre></div>
</div>
<div id="adding-new-variables" class="section level1">
<h1 class="hasAnchor">
@ -489,8 +489,8 @@ @@ -489,8 +489,8 @@
<a class="sourceLine" id="cb16-3" title="3"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></a>
<a class="sourceLine" id="cb16-4" title="4"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a>
<a class="sourceLine" id="cb16-5" title="5"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb16-6" title="6"><span class="co">#&gt; =&gt; Found 5,654 first isolates (28.3% of total)</span></a></code></pre></div>
<p>So only 28.3% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<a class="sourceLine" id="cb16-6" title="6"><span class="co">#&gt; =&gt; Found 5,692 first isolates (28.5% of total)</span></a></code></pre></div>
<p>So only 28.5% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" title="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb17-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(first <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>)</a></code></pre></div>
<p>For future use, the above two syntaxes can be shortened with the <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> function:</p>
@ -516,8 +516,8 @@ @@ -516,8 +516,8 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-04-05</td>
<td align="center">Q7</td>
<td align="center">2010-01-31</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
@ -527,30 +527,30 @@ @@ -527,30 +527,30 @@
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-05-10</td>
<td align="center">Q7</td>
<td align="center">2010-03-09</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-06-22</td>
<td align="center">Q7</td>
<td align="center">2010-05-30</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-06-25</td>
<td align="center">Q7</td>
<td align="center">2010-06-22</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -560,41 +560,41 @@ @@ -560,41 +560,41 @@
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-10-03</td>
<td align="center">Q7</td>
<td align="center">2011-01-10</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-10-08</td>
<td align="center">Q7</td>
<td align="center">2011-02-19</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2011-03-24</td>
<td align="center">Q7</td>
<td align="center">2011-02-21</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2011-03-27</td>
<td align="center">Q7</td>
<td align="center">2011-05-11</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -604,21 +604,21 @@ @@ -604,21 +604,21 @@
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-05-11</td>
<td align="center">Q7</td>
<td align="center">2011-07-06</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">TRUE</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-07-22</td>
<td align="center">Q7</td>
<td align="center">2011-08-11</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -637,7 +637,7 @@ @@ -637,7 +637,7 @@
<a class="sourceLine" id="cb19-7" title="7"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb19-8" title="8"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.</span></a>
<a class="sourceLine" id="cb19-9" title="9"><span class="co">#&gt; [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
<a class="sourceLine" id="cb19-10" title="10"><span class="co">#&gt; =&gt; Found 15,805 first weighted isolates (79.0% of total)</span></a></code></pre></div>
<a class="sourceLine" id="cb19-10" title="10"><span class="co">#&gt; =&gt; Found 15,864 first weighted isolates (79.3% of total)</span></a></code></pre></div>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -654,8 +654,8 @@ @@ -654,8 +654,8 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-04-05</td>
<td align="center">Q7</td>
<td align="center">2010-01-31</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
@ -666,11 +666,11 @@ @@ -666,11 +666,11 @@
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-05-10</td>
<td align="center">Q7</td>
<td align="center">2010-03-09</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
@ -678,11 +678,11 @@ @@ -678,11 +678,11 @@
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-06-22</td>
<td align="center">Q7</td>
<td align="center">2010-05-30</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
@ -690,8 +690,8 @@ @@ -690,8 +690,8 @@
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-06-25</td>
<td align="center">Q7</td>
<td align="center">2010-06-22</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -702,83 +702,83 @@ @@ -702,83 +702,83 @@
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-10-03</td>
<td align="center">Q7</td>
<td align="center">2011-01-10</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-10-08</td>
<td align="center">Q7</td>
<td align="center">2011-02-19</td>
<td align="center">C6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">TRUE</td>
</tr>