AMR/man/as.mo.Rd

170 lines
9.4 KiB
Plaintext
Raw Normal View History

2018-07-23 14:14:03 +02:00
% Generated by roxygen2: do not edit by hand
2018-08-31 13:36:19 +02:00
% Please edit documentation in R/mo.R
\name{as.mo}
\alias{as.mo}
\alias{mo}
\alias{is.mo}
\alias{guess_mo}
\title{Transform to microorganism ID}
2018-07-23 14:14:03 +02:00
\usage{
2018-12-07 12:04:55 +01:00
as.mo(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE,
2018-10-01 11:39:43 +02:00
reference_df = NULL)
2018-07-23 14:14:03 +02:00
2018-08-31 13:36:19 +02:00
is.mo(x)
2018-07-23 14:14:03 +02:00
2018-09-24 23:33:29 +02:00
guess_mo(x, Becker = FALSE, Lancefield = FALSE,
2018-12-07 12:04:55 +01:00
allow_uncertain = TRUE, reference_df = NULL)
2018-07-23 14:14:03 +02:00
}
\arguments{
\item{x}{a character vector or a \code{data.frame} with one or two columns}
\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".}
2018-09-24 23:33:29 +02:00
\item{Lancefield}{a logical to indicate whether beta-haemolytic \emph{Streptococci} should be categorised into Lancefield groups instead of their own species, according to Rebecca C. Lancefield [2]. These \emph{Streptococci} will be categorised in their first group, e.g. \emph{Streptococcus dysgalactiae} will be group C, although officially it was also categorised into groups G and L.
This excludes \emph{Enterococci} at default (who are in group D), use \code{Lancefield = "all"} to also categorise all \emph{Enterococci} as group D.}
2018-09-24 23:33:29 +02:00
2018-12-07 12:04:55 +01:00
\item{allow_uncertain}{a logical to indicate whether the input should be checked for less possible results, see Details}
2018-10-01 11:39:43 +02:00
\item{reference_df}{a \code{data.frame} to use for extra reference when translating \code{x} to a valid \code{mo}. The first column can be any microbial name, code or ID (used in your analysis or organisation), the second column must be a valid \code{mo} as found in the \code{\link{microorganisms}} data set.}
2018-07-23 14:14:03 +02:00
}
\value{
2018-08-31 13:36:19 +02:00
Character (vector) with class \code{"mo"}. Unknown values will return \code{NA}.
2018-07-23 14:14:03 +02:00
}
\description{
2018-09-24 23:33:29 +02:00
Use this function to determine a valid microorganism ID (\code{mo}). Determination is done using Artificial Intelligence (AI) and the complete taxonomic kingdoms \emph{Bacteria}, \emph{Fungi} and \emph{Protozoa} (see Source), so the input can be almost anything: a full name (like \code{"Staphylococcus aureus"}), an abbreviated name (like \code{"S. aureus"}), an abbreviation known in the field (like \code{"MRSA"}), or just a genus. You could also \code{\link{select}} a genus and species column, zie Examples.
2018-07-23 14:14:03 +02:00
}
\details{
2018-10-01 11:39:43 +02:00
A microbial ID from this package (class: \code{mo}) typically looks like these examples:\cr
2018-09-24 23:33:29 +02:00
\preformatted{
2018-12-07 12:04:55 +01:00
Code Full name
--------------- --------------------------------------
B_KLBSL Klebsiella
B_KLBSL_PNE Klebsiella pneumoniae
B_KLBSL_PNE_RHI Klebsiella pneumoniae rhinoscleromatis
2018-09-24 23:33:29 +02:00
| | | |
| | | |
| | | ----> subspecies, a 3-4 letter acronym
| | ----> species, a 3-4 letter acronym
| ----> genus, a 5-7 letter acronym, mostly without vowels
2018-10-29 17:26:17 +01:00
----> taxonomic kingdom, either B (Bacteria), F (Fungi) or P (Protozoa)
2018-09-24 23:33:29 +02:00
}
2018-08-01 08:03:31 +02:00
Use the \code{\link{mo_property}} functions to get properties based on the returned code, see Examples.
2018-10-31 12:10:49 +01:00
This function uses Artificial Intelligence (AI) to help getting fast and logical results. It tries to find matches in this order:
\itemize{
\item{Taxonomic kingdom: it first searches in bacteria, then fungi, then protozoa}
\item{Human pathogenic prevalence: it first searches in more prevalent microorganisms, then less prevalent ones}
2018-11-24 20:25:09 +01:00
\item{Valid MO codes and full names: it first searches in already valid MO code and known genus/species combinations}
2018-10-31 12:10:49 +01:00
\item{Breakdown of input values: from here it starts to breakdown input values to find possible matches}
}
2018-12-07 12:04:55 +01:00
A couple of effects because of these rules:
2018-07-23 14:14:03 +02:00
\itemize{
\item{\code{"E. coli"} will return the ID of \emph{Escherichia coli} and not \emph{Entamoeba coli}, although the latter would alphabetically come first}
\item{\code{"H. influenzae"} will return the ID of \emph{Haemophilus influenzae} and not \emph{Haematobacter influenzae} for the same reason}
2018-07-23 14:14:03 +02:00
\item{Something like \code{"p aer"} will return the ID of \emph{Pseudomonas aeruginosa} and not \emph{Pasteurella aerogenes}}
\item{Something like \code{"stau"} or \code{"S aur"} will return the ID of \emph{Staphylococcus aureus} and not \emph{Staphylococcus auricularis}}
2018-07-23 14:14:03 +02:00
}
2018-10-01 11:39:43 +02:00
This means that looking up human pathogenic microorganisms takes less time than looking up human \strong{non}-pathogenic microorganisms.
2018-09-24 23:33:29 +02:00
2018-12-07 12:04:55 +01:00
When using \code{allow_uncertain = TRUE} (which is the default setting), it will use additional rules if all previous AI rules failed to get valid results. Examples:
\itemize{
\item{\code{"Streptococcus group B (known as S. agalactiae)"}. The text between brackets will be removed and a warning will be thrown that the result \emph{Streptococcus group B} (\code{B_STRPTC_GRB}) needs review.}
\item{\code{"S. aureus - please mind: MRSA"}. The last word will be stripped, after which the function will try to find a match. If it does not, the second last word will be stripped, etc. Again, a warning will be thrown that the result \emph{Staphylococcus aureus} (\code{B_STPHY_AUR}) needs review.}
\item{\code{"D. spartina"}. This is the abbreviation of an old taxonomic name: \emph{Didymosphaeria spartinae} (the last "e" was missing from the input). This fungus was renamed to \emph{Leptosphaeria obiones}, so a warning will be thrown that this result (\code{F_LPTSP_OBI}) needs review.}
}
2018-09-24 23:33:29 +02:00
\code{guess_mo} is an alias of \code{as.mo}.
}
2019-01-02 23:24:07 +01:00
\section{Source}{
[1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870926. \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): 57195. \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}
}
2018-09-24 23:33:29 +02:00
\section{ITIS}{
\if{html}{\figure{itis_logo.jpg}{options: height=60px style=margin-bottom:5px} \cr}
2018-12-10 21:47:25 +01:00
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}).
2018-10-01 11:39:43 +02:00
2018-11-09 13:11:54 +01:00
All (sub)species from \strong{the taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all 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 all bacteria are classified into subkingdom Negibacteria or Posibacteria.
2018-10-01 11:39:43 +02:00
ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists [3].
2018-09-24 23:33:29 +02:00
}
2019-01-02 23:24:07 +01:00
\section{Read more on our website!}{
2018-09-24 23:33:29 +02:00
2019-01-02 23:24:07 +01:00
\if{html}{\figure{logo.png}{options: height=40px style=margin-bottom:5px} \cr}
On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{a omprehensive tutorial} about how to conduct AMR analysis and find \href{https://msberends.gitlab.io/AMR/reference}{the complete documentation of all functions}, which reads a lot easier than in R.
2018-07-23 14:14:03 +02:00
}
2018-09-24 23:33:29 +02:00
2018-07-23 14:14:03 +02:00
\examples{
2018-10-01 11:39:43 +02:00
# These examples all return "B_STPHY_AUR", the ID of S. aureus:
2018-08-31 13:36:19 +02:00
as.mo("stau")
as.mo("STAU")
as.mo("staaur")
as.mo("S. aureus")
as.mo("S aureus")
as.mo("Staphylococcus aureus")
2018-12-07 12:04:55 +01:00
as.mo("Staphylococcus aureus (MRSA)")
2018-08-31 13:36:19 +02:00
as.mo("MRSA") # Methicillin Resistant S. aureus
as.mo("VISA") # Vancomycin Intermediate S. aureus
as.mo("VRSA") # Vancomycin Resistant S. aureus
2018-09-24 23:33:29 +02:00
as.mo(369) # Search on TSN (Taxonomic Serial Number), a unique identifier
# for the Integrated Taxonomic Information System (ITIS)
2018-07-23 14:14:03 +02:00
2018-09-05 10:51:46 +02:00
as.mo("Streptococcus group A")
as.mo("GAS") # Group A Streptococci
as.mo("GBS") # Group B Streptococci
2018-08-31 13:36:19 +02:00
# guess_mo is an alias of as.mo and works the same
2018-09-24 23:33:29 +02:00
guess_mo("S. epidermidis") # will remain species: B_STPHY_EPI
guess_mo("S. epidermidis", Becker = TRUE) # will not remain species: B_STPHY_CNS
2018-09-24 23:33:29 +02:00
guess_mo("S. pyogenes") # will remain species: B_STRPTC_PYO
guess_mo("S. pyogenes", Lancefield = TRUE) # will not remain species: B_STRPTC_GRA
2018-08-31 13:36:19 +02:00
# Use mo_* functions to get a specific property based on `mo`
2018-09-24 23:33:29 +02:00
Ecoli <- as.mo("E. coli") # returns `B_ESCHR_COL`
mo_genus(Ecoli) # returns "Escherichia"
2018-09-24 23:33:29 +02:00
mo_gramstain(Ecoli) # returns "Gram negative"
# but it uses as.mo internally too, so you could also just use:
mo_genus("E. coli") # returns "Escherichia"
2018-07-23 14:14:03 +02:00
\dontrun{
2018-08-31 13:36:19 +02:00
df$mo <- as.mo(df$microorganism_name)
2018-07-23 14:14:03 +02:00
# the select function of tidyverse is also supported:
library(dplyr)
2018-08-31 13:36:19 +02:00
df$mo <- df \%>\%
2018-07-23 14:14:03 +02:00
select(microorganism_name) \%>\%
2018-11-24 20:25:09 +01:00
as.mo()
2018-07-23 14:14:03 +02:00
# and can even contain 2 columns, which is convenient for genus/species combinations:
2018-08-31 13:36:19 +02:00
df$mo <- df \%>\%
2018-07-23 14:14:03 +02:00
select(genus, species) \%>\%
2018-11-24 20:25:09 +01:00
as.mo()
# although this works easier and does the same:
2018-07-23 14:14:03 +02:00
df <- df \%>\%
2018-11-24 20:25:09 +01:00
mutate(mo = as.mo(paste(genus, species)))
2018-07-23 14:14:03 +02:00
}
}
\seealso{
2018-09-24 23:33:29 +02:00
\code{\link{microorganisms}} for the \code{data.frame} with ITIS content 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.
2018-07-23 14:14:03 +02:00
}
2018-08-03 14:49:29 +02:00
\keyword{Becker}
\keyword{Lancefield}
\keyword{becker}
\keyword{guess}
\keyword{lancefield}
2018-08-31 13:36:19 +02:00
\keyword{mo}