Use this function to determine a valid microorganism ID (mo). Determination is done using intelligent rules and the complete taxonomic kingdoms Bacteria, Chromista, Protozoa, Archaea and most microbial species from the kingdom Fungi (see Source). The input can be almost anything: a full name (like "Staphylococcus aureus"), an abbreviated name (like "S. aureus"), an abbreviation known in the field (like "MRSA"), or just a genus. Please see Examples.

as.mo(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE,
  reference_df = get_mo_source(), ...)

is.mo(x)

mo_failures()

mo_uncertainties()

mo_renamed()

clear_mo_history(...)

Arguments

x

a character vector or a data.frame with one or two columns

Becker

a logical to indicate whether Staphylococci should be categorised into coagulase-negative Staphylococci ("CoNS") and coagulase-positive Staphylococci ("CoPS") instead of their own species, according to Karsten Becker et al. [1,2]. Note that this does not include species that were newly named after these publications, like S. caeli.

This excludes Staphylococcus aureus at default, use Becker = "all" to also categorise S. aureus as "CoPS".

Lancefield

a logical to indicate whether beta-haemolytic Streptococci should be categorised into Lancefield groups instead of their own species, according to Rebecca C. Lancefield [3]. These Streptococci will be categorised in their first group, e.g. Streptococcus dysgalactiae will be group C, although officially it was also categorised into groups G and L.

This excludes Enterococci at default (who are in group D), use Lancefield = "all" to also categorise all Enterococci as group D.

allow_uncertain

a number between 0 (or "none") and 3 (or "all"), or TRUE (= 2) or FALSE (= 0) to indicate whether the input should be checked for less probable results, see Details

reference_df

a data.frame to use for extra reference when translating x to a valid mo. See set_mo_source and get_mo_source to automate the usage of your own codes (e.g. used in your analysis or organisation).

...

other parameters passed on to functions

Value

Character (vector) with class "mo"

Details

General info
A microorganism ID from this package (class: mo) typically looks like these examples:

  Code               Full name
  ---------------    --------------------------------------
  B_KLBSL            Klebsiella
  B_KLBSL_PNMN       Klebsiella pneumoniae
  B_KLBSL_PNMN_RHNS  Klebsiella pneumoniae rhinoscleromatis
  |   |    |    |
  |   |    |    |
  |   |    |     ---> subspecies, a 4-5 letter acronym
  |   |     ----> species, a 4-5 letter acronym
  |    ----> genus, a 5-7 letter acronym
   ----> taxonomic kingdom: A (Archaea), AN (Animalia), B (Bacteria),
                            C (Chromista), F (Fungi), P (Protozoa)

Values that cannot be coered will be considered 'unknown' and will get the MO code UNKNOWN.

Use the mo_property_* functions to get properties based on the returned code, see Examples.

The algorithm uses data from the Catalogue of Life (see below) and from one other source (see microorganisms).

Self-learning algoritm
The as.mo() function gains experience from previously determined microorganism IDs and learns from it. This drastically improves both speed and reliability. Use clear_mo_history() to reset the algorithms. Only experience from your current AMR package version is used. This is done because in the future the taxonomic tree (which is included in this package) may change for any organism and it consequently has to rebuild its knowledge.

Usually, any guess after the first try runs 80-95% faster than the first try.

Intelligent rules
This function uses intelligent rules to help getting fast and logical results. It tries to find matches in this order:

  • Valid MO codes and full names: it first searches in already valid MO code and known genus/species combinations

  • Human pathogenic prevalence: it first searches in more prevalent microorganisms, then less prevalent ones (see Microbial prevalence of pathogens in humans below)

  • Taxonomic kingdom: it first searches in Bacteria/Chromista, then Fungi, then Protozoa

  • Breakdown of input values: from here it starts to breakdown input values to find possible matches

A couple of effects because of these rules:

  • "E. coli" will return the ID of Escherichia coli and not Entamoeba coli, although the latter would alphabetically come first

  • "H. influenzae" will return the ID of Haemophilus influenzae and not Haematobacter influenzae for the same reason

  • Something like "stau" or "S aur" will return the ID of Staphylococcus aureus and not Staphylococcus auricularis

This means that looking up human pathogenic microorganisms takes less time than looking up human non-pathogenic microorganisms.

Uncertain results
The algorithm can additionally use three different levels of uncertainty to guess valid results. The default is allow_uncertain = TRUE, which is equal to uncertainty level 2. Using allow_uncertain = FALSE will skip all of these additional rules:

  • (uncertainty level 1): It tries to look for only matching genera, previously accepted (but now invalid) taxonomic names and misspelled input

  • (uncertainty level 2): It removed parts between brackets, strips off words from the end one by one and re-evaluates the input with all previous rules

  • (uncertainty level 3): It strips off words from the start one by one and tries any part of the name

You can also use e.g. as.mo(..., allow_uncertain = 1) to only allow up to level 1 uncertainty.

Examples:

  • "Streptococcus group B (known as S. agalactiae)". The text between brackets will be removed and a warning will be thrown that the result Streptococcus group B (B_STRPT_GRPB) needs review.

  • "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 Staphylococcus aureus (B_STPHY_AUR) needs review.

  • "Fluoroquinolone-resistant Neisseria gonorrhoeae". The first word will be stripped, after which the function will try to find a match. A warning will be thrown that the result Neisseria gonorrhoeae (B_NESSR_GON) needs review.

Use mo_failures() to get a vector with all values that could not be coerced to a valid value.

Use mo_uncertainties() to get a data.frame with all values that were coerced to a valid value, but with uncertainty.

Use mo_renamed() to get a data.frame with all values that could be coerced based on an old, previously accepted taxonomic name.

Microbial prevalence of pathogens in humans
The intelligent rules take into account microbial prevalence of pathogens in humans. It uses three groups and all (sub)species are in only one group. These groups are:

  • 1 (most prevalent): class is Gammaproteobacteria or genus is one of: Enterococcus, Staphylococcus, Streptococcus.

  • 2: phylum is one of: Proteobacteria, Firmicutes, Actinobacteria, Sarcomastigophora or genus is one of: Aspergillus, Bacteroides, Candida, Capnocytophaga, Chryseobacterium, Cryptococcus, Elisabethkingia, Flavobacterium, Fusobacterium, Giardia, Leptotrichia, Mycoplasma, Prevotella, Rhodotorula, Treponema, Trichophyton, Ureaplasma.

  • 3 (least prevalent): all others.

Group 1 contains all common Gram positives and Gram negatives, like all Enterobacteriaceae and e.g. Pseudomonas and Legionella.

Group 2 contains probably less pathogenic microorganisms; all other members of phyla that were found in humans in the Northern Netherlands between 2001 and 2018.

Source

[1] Becker K et al. Coagulase-Negative Staphylococci. 2014. Clin Microbiol Rev. 27(4): 870–926. https://dx.doi.org/10.1128/CMR.00109-13

[2] Becker K et al. Implications of identifying the recently defined members of the S. aureus complex, S. argenteus and S. schweitzeri: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS). 2019. Clin Microbiol Infect. https://doi.org/10.1016/j.cmi.2019.02.028

[3] Lancefield RC A serological differentiation of human and other groups of hemolytic streptococci. 1933. J Exp Med. 57(4): 571–95. https://dx.doi.org/10.1084/jem.57.4.571

[4] Catalogue of Life: Annual Checklist (public online taxonomic database), http://www.catalogueoflife.org (check included annual version with catalogue_of_life_version()).

Catalogue of Life


This package contains the complete taxonomic tree of almost all microorganisms (~70,000 species) from the authoritative and comprehensive Catalogue of Life (http://www.catalogueoflife.org). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.

Click here for more information about the included taxa. Check which version of the Catalogue of Life was included in this package with catalogue_of_life_version().

Read more on our website!

On our website https://msberends.gitlab.io/AMR you can find a tutorial about how to conduct AMR analysis, the complete documentation of all functions (which reads a lot easier than here in R) and an example analysis using WHONET data.

See also

microorganisms for the data.frame that is being used to determine ID's.
The mo_property functions (like mo_genus, mo_gramstain) to get properties based on the returned code.

Examples

# NOT RUN {
# These examples all return "B_STPHY_AURS", the ID of S. aureus:
as.mo("sau") # WHONET code
as.mo("stau")
as.mo("STAU")
as.mo("staaur")
as.mo("S. aureus")
as.mo("S aureus")
as.mo("Staphylococcus aureus")
as.mo("Staphylococcus aureus (MRSA)")
as.mo("Sthafilokkockus aaureuz") # handles incorrect spelling
as.mo("MRSA")   # Methicillin Resistant S. aureus
as.mo("VISA")   # Vancomycin Intermediate S. aureus
as.mo("VRSA")   # Vancomycin Resistant S. aureus
as.mo(22242419) # Catalogue of Life ID

# Dyslexia is no problem - these all work:
as.mo("Ureaplasma urealyticum")
as.mo("Ureaplasma urealyticus")
as.mo("Ureaplasmium urealytica")
as.mo("Ureaplazma urealitycium")

as.mo("Streptococcus group A")
as.mo("GAS") # Group A Streptococci
as.mo("GBS") # Group B Streptococci

as.mo("S. epidermidis")                 # will remain species: B_STPHY_EPDR
as.mo("S. epidermidis", Becker = TRUE)  # will not remain species: B_STPHY_CONS

as.mo("S. pyogenes")                    # will remain species: B_STRPT_PYGN
as.mo("S. pyogenes", Lancefield = TRUE) # will not remain species: B_STRPT_GRPA

# All mo_* functions use as.mo() internally too (see ?mo_property):
mo_genus("E. coli")           # returns "Escherichia"
mo_gramstain("E. coli")       # returns "Gram negative"

# }# NOT RUN {
df$mo <- as.mo(df$microorganism_name)

# the select function of tidyverse is also supported:
library(dplyr)
df$mo <- df %>%
  select(microorganism_name) %>%
  as.mo()

# and can even contain 2 columns, which is convenient for genus/species combinations:
df$mo <- df %>%
  select(genus, species) %>%
  as.mo()
# although this works easier and does the same:
df <- df %>%
  mutate(mo = as.mo(paste(genus, species)))
# }