mirror of
https://github.com/msberends/AMR.git
synced 2025-07-12 09:41:49 +02:00
added taxonomic data from ITIS
This commit is contained in:
@ -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)}.
|
||||
|
||||
\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{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}}
|
||||
|
||||
@ -98,10 +98,10 @@ septic_patients \%>\%
|
||||
select(amox, nitr, fosf, trim, cipr) \%>\%
|
||||
ggplot_rsi()
|
||||
|
||||
# get counts instead of percentages:
|
||||
# get only portions and no counts:
|
||||
septic_patients \%>\%
|
||||
select(amox, nitr, fosf, trim, cipr) \%>\%
|
||||
ggplot_rsi(fun = count_df)
|
||||
ggplot_rsi(fun = portion_df)
|
||||
|
||||
# add other ggplot2 parameters as you like:
|
||||
septic_patients \%>\%
|
||||
|
@ -4,20 +4,26 @@
|
||||
\name{microorganisms}
|
||||
\alias{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{
|
||||
\item{\code{mo}}{ID 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{species}}{Species name of microorganism, like \code{"coli"}}
|
||||
\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{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{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.}
|
||||
}}
|
||||
\source{
|
||||
Integrated Taxonomic Information System (ITIS) on-line database, \url{https://www.itis.gov}.
|
||||
}
|
||||
\usage{
|
||||
microorganisms
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
\docType{data}
|
||||
\name{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:
|
||||
\describe{
|
||||
\item{\code{umcg}}{Code of microorganism according to UMCG MMB}
|
||||
|
@ -2,34 +2,46 @@
|
||||
% Please edit documentation in R/mo_property.R
|
||||
\name{mo_property}
|
||||
\alias{mo_property}
|
||||
\alias{mo_family}
|
||||
\alias{mo_genus}
|
||||
\alias{mo_species}
|
||||
\alias{mo_subspecies}
|
||||
\alias{mo_fullname}
|
||||
\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_gramstain}
|
||||
\alias{mo_aerobic}
|
||||
\alias{mo_taxonomy}
|
||||
\title{Property of a microorganism}
|
||||
\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) on-line database, \url{https://www.itis.gov}.
|
||||
}
|
||||
\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_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_gramstain(x, language = NULL)
|
||||
@ -38,12 +50,12 @@ mo_aerobic(x)
|
||||
|
||||
mo_property(x, property = "fullname", Becker = FALSE,
|
||||
Lancefield = FALSE, language = NULL)
|
||||
|
||||
mo_taxonomy(x)
|
||||
}
|
||||
\arguments{
|
||||
\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].
|
||||
|
||||
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.}
|
||||
|
||||
\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"}}
|
||||
}
|
||||
\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{
|
||||
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{
|
||||
# All properties
|
||||
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"
|
||||
@ -132,6 +149,10 @@ mo_fullname("S. pyogenes",
|
||||
mo_fullname("S. pyogenes",
|
||||
Lancefield = TRUE,
|
||||
language = "nl") # "Streptococcus groep A"
|
||||
|
||||
|
||||
# Complete taxonomy up to Phylum, returns a list
|
||||
mo_taxonomy("E. coli")
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{microorganisms}}
|
||||
|
Reference in New Issue
Block a user