<!-- Generated by pkgdown: do not edit by hand --><htmllang="en"><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"><metacharset="utf-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Transform Arbitrary Input to Valid Microbial Taxonomy — as.mo • AMR (for R)</title><!-- favicons --><linkrel="icon"type="image/png"sizes="16x16"href="../favicon-16x16.png"><linkrel="icon"type="image/png"sizes="32x32"href="../favicon-32x32.png"><linkrel="apple-touch-icon"type="image/png"sizes="180x180"href="../apple-touch-icon.png"><linkrel="apple-touch-icon"type="image/png"sizes="120x120"href="../apple-touch-icon-120x120.png"><linkrel="apple-touch-icon"type="image/png"sizes="76x76"href="../apple-touch-icon-76x76.png"><linkrel="apple-touch-icon"type="image/png"sizes="60x60"href="../apple-touch-icon-60x60.png"><scriptsrc="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><metaname="viewport"content="width=device-width, initial-scale=1, shrink-to-fit=no"><linkhref="../deps/bootstrap-5.3.1/bootstrap.min.css"rel="stylesheet"><scriptsrc="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><linkhref="../deps/Lato-0.4.9/font.css"rel="stylesheet"><linkhref="../deps/Fira_Code-0.4.9/font.css"rel="stylesheet"><linkhref="../deps/font-awesome-6.5.2/css/all.min.css"rel="stylesheet"><linkhref="../deps/font-awesome-6.5.2/css/v4-shims.min.css"rel="stylesheet"><scriptsrc="../deps/headroom-0.11.0/headroom.min.js"></script><scriptsrc="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><scriptsrc="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><scriptsrc="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><scriptsrc="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><scriptsrc="../deps/search-1.0.0/fuse.min.js"></script><scriptsrc="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><scriptsrc="../pkgdown.js"></script><linkhref="../extra.css"rel="stylesheet"><scriptsrc="../extra.js"></script><metaproperty="og:title"content="Transform Arbitrary Input to Valid Microbial Taxonomy — as.mo"><metaname="description"content='Use this function to get a valid microorganism code (mo) based on arbitrary user input. Determination is done using intelligent rules and the complete taxonomic tree of the kingdoms Animalia, Archaea, Bacteria, Chromista, and Protozoa, 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 (such as "S. aureus"), an abbreviation known in the field (such as "MRSA"), or just a genus. See Examples.'><metaproperty="og:description"content='Use this function to get a valid microorganism code (mo) based on arbitrary user input. Determination is done using intelligent rules and the complete taxonomic tree of the kingdoms Animalia, Archaea, Bacteria, Chromista, and Protozoa, 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 (such as "S. aureus"), an abbreviation known in the field (such as "MRSA"), or just a genus. See Examples.'><metaproperty="og:image"content="https://msberends.github.io/AMR/logo.svg"></head><body>
<buttonclass="nav-link dropdown-toggle"type="button"id="dropdown-how-to"data-bs-toggle="dropdown"aria-expanded="false"aria-haspopup="true"><spanclass="fa fa-question-circle"></span> How to</button>
<ulclass="dropdown-menu"aria-labelledby="dropdown-how-to"><li><aclass="dropdown-item"href="../articles/AMR.html"><spanclass="fa fa-directions"></span> Conduct AMR Analysis</a></li>
<p>Use this function to get a valid microorganism code (<code>mo</code>) based on arbitrary user input. Determination is done using intelligent rules and the complete taxonomic tree of the kingdoms Animalia, Archaea, Bacteria, Chromista, and Protozoa, and most microbial species from the kingdom Fungi (see <em>Source</em>). The input can be almost anything: a full name (like <code>"Staphylococcus aureus"</code>), an abbreviated name (such as <code>"S. aureus"</code>), an abbreviation known in the field (such as <code>"MRSA"</code>), or just a genus. See <em>Examples</em>.</p>
<span> language <spanclass="op">=</span><spanclass="fu"><ahref="translate.html">get_AMR_locale</a></span><spanclass="op">(</span><spanclass="op">)</span>,</span>
<span> info <spanclass="op">=</span><spanclass="fu"><ahref="https://rdrr.io/r/base/interactive.html"class="external-link">interactive</a></span><spanclass="op">(</span><spanclass="op">)</span>,</span>
<dd><p>a <ahref="https://rdrr.io/r/base/character.html"class="external-link">character</a> vector or a <ahref="https://rdrr.io/r/base/data.frame.html"class="external-link">data.frame</a> with one or two columns</p></dd>
<dd><p>a <ahref="https://rdrr.io/r/base/logical.html"class="external-link">logical</a> 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 <em>et al.</em> (see <em>Source</em>). Please see <em>Details</em> for a full list of staphylococcal species that will be converted.</p>
<dd><p>a <ahref="https://rdrr.io/r/base/logical.html"class="external-link">logical</a> to indicate whether a beta-haemolytic <em>Streptococcus</em> should be categorised into Lancefield groups instead of their own species, according to Rebecca C. Lancefield (see <em>Source</em>). These streptococci will be categorised in their first group, e.g. <em>Streptococcus dysgalactiae</em> will be group C, although officially it was also categorised into groups G and L. . Please see <em>Details</em> for a full list of streptococcal species that will be converted.</p>
<p>This excludes enterococci at default (who are in group D), use <code>Lancefield = "all"</code> to also categorise all enterococci as group D.</p></dd>
<dd><p>a numeric value to set as the lower limit for the <ahref="mo_matching_score.html">MO matching score</a>. When left blank, this will be determined automatically based on the character length of <code>x</code>, its <ahref="microorganisms.html">taxonomic kingdom</a> and <ahref="mo_matching_score.html">human pathogenicity</a>.</p></dd>
<dd><p>a <ahref="https://rdrr.io/r/base/logical.html"class="external-link">logical</a> to indicate if old, previously valid taxonomic names must be preserved and not be corrected to currently accepted names. The default is <code>FALSE</code>, which will return a note if old taxonomic names were processed. The default can be set with the package option <code><ahref="AMR-options.html">AMR_keep_synonyms</a></code>, i.e. <code>options(AMR_keep_synonyms = TRUE)</code> or <code>options(AMR_keep_synonyms = FALSE)</code>.</p></dd>
<dd><p>a <ahref="https://rdrr.io/r/base/data.frame.html"class="external-link">data.frame</a> to be used for extra reference when translating <code>x</code> to a valid <code>mo</code>. See <code><ahref="mo_source.html">set_mo_source()</a></code> and <code><ahref="mo_source.html">get_mo_source()</a></code> to automate the usage of your own codes (e.g. used in your analysis or organisation).</p></dd>
<dd><p>a Perl-compatible <ahref="https://rdrr.io/r/base/regex.html"class="external-link">regular expression</a> (case-insensitive) of which all matches in <code>x</code> must return <code>NA</code>. This can be convenient to exclude known non-relevant input and can also be set with the package option <code><ahref="AMR-options.html">AMR_ignore_pattern</a></code>, e.g. <code>options(AMR_ignore_pattern = "(not reported|contaminated flora)")</code>.</p></dd>
<dd><p>a Perl-compatible <ahref="https://rdrr.io/r/base/regex.html"class="external-link">regular expression</a> (case-insensitive) to clean the input of <code>x</code>. Every matched part in <code>x</code> will be removed. At default, this is the outcome of <code>mo_cleaning_regex()</code>, which removes texts between brackets and texts such as "species" and "serovar". The default can be set with the package option <code><ahref="AMR-options.html">AMR_cleaning_regex</a></code>.</p></dd>
<dd><p>a <ahref="https://rdrr.io/r/base/logical.html"class="external-link">logical</a> to indicate if only fungi must be found, making sure that e.g. misspellings always return records from the kingdom of Fungi. This can be set globally for <ahref="mo_property.html">all microorganism functions</a> with the package option <code><ahref="AMR-options.html">AMR_only_fungi</a></code>, i.e. <code>options(AMR_only_fungi = TRUE)</code>.</p></dd>
<dd><p>language to translate text like "no growth", which defaults to the system language (see <code><ahref="translate.html">get_AMR_locale()</a></code>)</p></dd>
<dd><p>a <ahref="https://rdrr.io/r/base/logical.html"class="external-link">logical</a> to indicate that info must be printed, e.g. a progress bar when more than 25 items are to be coerced, or a list with old taxonomic names. The default is <code>TRUE</code> only in interactive mode.</p></dd>
<p>A <ahref="https://rdrr.io/r/base/character.html"class="external-link">character</a><ahref="https://rdrr.io/r/base/vector.html"class="external-link">vector</a> with additional class <code>mo</code></p>
<spanid="cb1-8"><ahref="#cb1-8"tabindex="-1"></a><spanclass="er">|</span><spanclass="er">|</span><spanclass="er">|</span> \<spanclass="sc">--</span><spanclass="ot">-></span> subspecies, a <spanclass="dv">3-5</span> letter acronym</span>
<spanid="cb1-9"><ahref="#cb1-9"tabindex="-1"></a><spanclass="sc">|</span><spanclass="er">|</span> \<spanclass="sc">---</span><spanclass="ot">-></span> species, a <spanclass="dv">3-6</span> letter acronym</span>
<spanid="cb1-10"><ahref="#cb1-10"tabindex="-1"></a><spanclass="sc">|</span> \<spanclass="sc">---</span><spanclass="ot">-></span> genus, a <spanclass="dv">4-8</span> letter acronym</span>
<p>The <code>as.mo()</code> function uses a novel and scientifically validated (<ahref="https://doi.org/10.18637/jss.v104.i03"class="external-link">doi:10.18637/jss.v104.i03</a>
) matching score algorithm (see <em>Matching Score for Microorganisms</em> below) to match input against the <ahref="microorganisms.html">available microbial taxonomy</a> in this package. This implicates that e.g. <code>"E. coli"</code> (a microorganism highly prevalent in humans) will return the microbial ID of <em>Escherichia coli</em> and not <em>Entamoeba coli</em> (a microorganism less prevalent in humans), although the latter would alphabetically come first.</p><divclass="section">
<p>Results of non-exact taxonomic input are based on their <ahref="mo_matching_score.html">matching score</a>. The lowest allowed score can be set with the <code>minimum_matching_score</code> argument. At default this will be determined based on the character length of the input, the <ahref="microorganisms.html">taxonomic kingdom</a>, and the <ahref="mo_matching_score.html">human pathogenicity</a> of the taxonomic outcome. If values are matched with uncertainty, a message will be shown to suggest the user to inspect the results with <code>mo_uncertainties()</code>, which returns a <ahref="https://rdrr.io/r/base/data.frame.html"class="external-link">data.frame</a> with all specifications.</p>
<p>To increase the quality of matching, the <code>cleaning_regex</code> argument is used to clean the input. This must be a <ahref="https://rdrr.io/r/base/regex.html"class="external-link">regular expression</a> that matches parts of the input that should be removed before the input is matched against the <ahref="microorganisms.html">available microbial taxonomy</a>. It will be matched Perl-compatible and case-insensitive. The default value of <code>cleaning_regex</code> is the outcome of the helper function <code>mo_cleaning_regex()</code>.</p>
<p>There are three helper functions that can be run after using the <code>as.mo()</code> function:</p><ul><li><p>Use <code>mo_uncertainties()</code> to get a <ahref="https://rdrr.io/r/base/data.frame.html"class="external-link">data.frame</a> that prints in a pretty format with all taxonomic names that were guessed. The output contains the matching score for all matches (see <em>Matching Score for Microorganisms</em> below).</p></li>
<li><p>Use <code>mo_failures()</code> to get a <ahref="https://rdrr.io/r/base/character.html"class="external-link">character</a><ahref="https://rdrr.io/r/base/vector.html"class="external-link">vector</a> with all values that could not be coerced to a valid value.</p></li>
<li><p>Use <code>mo_renamed()</code> to get a <ahref="https://rdrr.io/r/base/data.frame.html"class="external-link">data.frame</a> with all values that could be coerced based on old, previously accepted taxonomic names.</p></li>
<p>The <ahref="mo_matching_score.html">matching score algorithm</a> gives precedence to bacteria over fungi. If you are only analysing fungi, be sure to use <code>only_fungi = TRUE</code>, or better yet, add this to your code and run it once every session:</p>
<p>This will make sure that no bacteria or other 'non-fungi' will be returned by <code>as.mo()</code>, or any of the <code><ahref="mo_property.html">mo_*</a></code> functions.</p>
<h3id="coagulase-negative-and-coagulase-positive-staphylococci">Coagulase-negative and Coagulase-positive Staphylococci<aclass="anchor"aria-label="anchor"href="#coagulase-negative-and-coagulase-positive-staphylococci"></a></h3>
</ul><p>This is based on:</p><ul><li><p>Becker K <em>et al.</em> (2014). <strong>Coagulase-Negative Staphylococci.</strong><em>Clin Microbiol Rev.</em> 27(4): 870-926; <ahref="https://doi.org/10.1128/CMR.00109-13"class="external-link">doi:10.1128/CMR.00109-13</a></p></li>
<li><p>Becker K <em>et al.</em> (2019). <strong>Implications of identifying the recently defined members of the <em>S. aureus</em> complex, <em>S. argenteus</em> and <em>S. schweitzeri</em>: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS).</strong><em>Clin Microbiol Infect</em>; <ahref="https://doi.org/10.1016/j.cmi.2019.02.028"class="external-link">doi:10.1016/j.cmi.2019.02.028</a></p></li>
<li><p>Becker K <em>et al.</em> (2020). <strong>Emergence of coagulase-negative staphylococci.</strong><em>Expert Rev Anti Infect Ther.</em> 18(4):349-366; <ahref="https://doi.org/10.1080/14787210.2020.1730813"class="external-link">doi:10.1080/14787210.2020.1730813</a></p></li>
</ul><p>For newly named staphylococcal species, such as <em>S. brunensis</em> (2024) and <em>S. shinii</em> (2023), we looked up the scientific reference to make sure the species are considered for the correct coagulase group.</p>
</div>
<divclass="section">
<h3id="lancefield-groups-in-streptococci">Lancefield Groups in Streptococci<aclass="anchor"aria-label="anchor"href="#lancefield-groups-in-streptococci"></a></h3>
<p>With <code>Lancefield = TRUE</code>, the following streptococci will be converted to their corresponding Lancefield group:</p><ul><li><p>Streptococcus Group A: <em>S. pyogenes</em></p></li>
<li><p>Streptococcus Group B: <em>S. agalactiae</em></p></li>
<li><p>Streptococcus Group G: <em>S. canis</em>, <em>S. dysgalactiae</em>, <em>S. dysgalactiae dysgalactiae</em>, and <em>S. dysgalactiae equisimilis</em></p></li>
<li><p>Streptococcus Group H: <em>S. sanguinis</em></p></li>
<li><p>Streptococcus Group K: <em>S. salivarius</em>, <em>S. salivarius salivarius</em>, and <em>S. salivarius thermophilus</em></p></li>
<li><p>Streptococcus Group L: <em>S. dysgalactiae</em>, <em>S. dysgalactiae dysgalactiae</em>, and <em>S. dysgalactiae equisimilis</em></p></li>
</ul><p>This is based on:</p><ul><li><p>Lancefield RC (1933). <strong>A serological differentiation of human and other groups of hemolytic streptococci.</strong><em>J Exp Med.</em> 57(4): 571-95; <ahref="https://doi.org/10.1084/jem.57.4.571"class="external-link">doi:10.1084/jem.57.4.571</a></p></li>
<ul><li><p>Berends MS <em>et al.</em> (2022). <strong>AMR: An R Package for Working with Antimicrobial Resistance Data</strong>. <em>Journal of Statistical Software</em>, 104(3), 1-31; <ahref="https://doi.org/10.18637/jss.v104.i03"class="external-link">doi:10.18637/jss.v104.i03</a></p></li>
<li><p>Parte, AC <em>et al.</em> (2020). <strong>List of Prokaryotic names with Standing in Nomenclature (LPSN) moves to the DSMZ.</strong> International Journal of Systematic and Evolutionary Microbiology, 70, 5607-5612; <ahref="https://doi.org/10.1099/ijsem.0.004332"class="external-link">doi:10.1099/ijsem.0.004332</a>
<li><p>Vincent, R <em>et al</em> (2013). <strong>MycoBank gearing up for new horizons.</strong> IMA Fungus, 4(2), 371-9; <ahref="https://doi.org/10.5598/imafungus.2013.04.02.16"class="external-link">doi:10.5598/imafungus.2013.04.02.16</a>
. Accessed from <ahref="https://www.mycobank.org"class="external-link">https://www.mycobank.org</a> on June 24th, 2024.</p></li>
<li><p>Reimer, LC <em>et al.</em> (2022). <strong><em>BacDive</em> in 2022: the knowledge base for standardized bacterial and archaeal data.</strong> Nucleic Acids Res., 50(D1):D741-D74; <ahref="https://doi.org/10.1093/nar/gkab961"class="external-link">doi:10.1093/nar/gkab961</a>
<li><p>Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microorganism', OID 2.16.840.1.114222.4.11.1009 (v12). URL: <ahref="https://phinvads.cdc.gov"class="external-link">https://phinvads.cdc.gov</a></p></li>
<li><p>Bartlett A <em>et al.</em> (2022). <strong>A comprehensive list of bacterial pathogens infecting humans</strong><em>Microbiology</em> 168:001269; <ahref="https://doi.org/10.1099/mic.0.001269"class="external-link">doi:10.1099/mic.0.001269</a></p></li>
<h2id="matching-score-for-microorganisms">Matching Score for Microorganisms<aclass="anchor"aria-label="anchor"href="#matching-score-for-microorganisms"></a></h2>
<p>With ambiguous user input in <code>as.mo()</code> and all the <code><ahref="mo_property.html">mo_*</a></code> functions, the returned results are chosen based on their matching score using <code><ahref="mo_matching_score.html">mo_matching_score()</a></code>. This matching score \(m\), is calculated as:</p>
<li><p>\(n\) is a taxonomic name (genus, species, and subspecies);</p></li>
<li><p>\(l_n\) is the length of \(n\);</p></li>
<li><p>\(lev\) is the <ahref="https://en.wikipedia.org/wiki/Levenshtein_distance"class="external-link">Levenshtein distance function</a> (counting any insertion as 1, and any deletion or substitution as 2) that is needed to change \(x\) into \(n\);</p></li>
</ul><p>The grouping into human pathogenic prevalence \(p\) is based on recent work from Bartlett <em>et al.</em> (2022, <ahref="https://doi.org/10.1099/mic.0.001269"class="external-link">doi:10.1099/mic.0.001269</a>
) who extensively studied medical-scientific literature to categorise all bacterial species into these groups:</p><ul><li><p><strong>Established</strong>, if a taxonomic species has infected at least three persons in three or more references. These records have <code>prevalence = 1.15</code> in the <ahref="microorganisms.html">microorganisms</a> data set;</p></li>
<li><p><strong>Putative</strong>, if a taxonomic species has fewer than three known cases. These records have <code>prevalence = 1.25</code> in the <ahref="microorganisms.html">microorganisms</a> data set.</p></li>
</ul><p>Furthermore,</p><ul><li><p>Genera from the World Health Organization's (WHO) Priority Pathogen List have <code>prevalence = 1.0</code> in the <ahref="microorganisms.html">microorganisms</a> data set;</p></li>
<li><p>Any genus present in the <strong>established</strong> list also has <code>prevalence = 1.15</code> in the <ahref="microorganisms.html">microorganisms</a> data set;</p></li>
<li><p>Any other genus present in the <strong>putative</strong> list has <code>prevalence = 1.25</code> in the <ahref="microorganisms.html">microorganisms</a> data set;</p></li>
<li><p>Any other species or subspecies of which the genus is present in the two aforementioned groups, has <code>prevalence = 1.5</code> in the <ahref="microorganisms.html">microorganisms</a> data set;</p></li>
</ul><p>When calculating the matching score, all characters in \(x\) and \(n\) are ignored that are other than A-Z, a-z, 0-9, spaces and parentheses.</p>
<p>All matches are sorted descending on their matching score and for all user input values, the top match will be returned. This will lead to the effect that e.g., <code>"E. coli"</code> will return the microbial ID of <em>Escherichia coli</em> (\(m = 0.688\), a highly prevalent microorganism found in humans) and not <em>Entamoeba coli</em> (\(m = 0.381\), a less prevalent microorganism in humans), although the latter would alphabetically come first.</p>
<h2id="reference-data-publicly-available">Reference Data Publicly Available<aclass="anchor"aria-label="anchor"href="#reference-data-publicly-available"></a></h2>
<p>All data sets in this <code>AMR</code> package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit <ahref="https://msberends.github.io/AMR/articles/datasets.html">our website for the download links</a>. The actual files are of course available on <ahref="https://github.com/msberends/AMR/tree/main/data-raw"class="external-link">our GitHub repository</a>.</p>
<divclass="dont-index"><p><ahref="microorganisms.html">microorganisms</a> for the <ahref="https://rdrr.io/r/base/data.frame.html"class="external-link">data.frame</a> that is being used to determine ID's.</p>
<p>The <code><ahref="mo_property.html">mo_*</a></code> functions (such as <code><ahref="mo_property.html">mo_genus()</a></code>, <code><ahref="mo_property.html">mo_gramstain()</a></code>) to get properties based on the returned code.</p></div>
<spanclass="r-in"><span><spanclass="fu">as.mo</span><spanclass="op">(</span><spanclass="st">"Streptococcus group A"</span><spanclass="op">)</span></span></span>
<spanclass="r-in"><span><spanclass="fu">as.mo</span><spanclass="op">(</span><spanclass="st">"S. epidermidis"</span>, Becker <spanclass="op">=</span><spanclass="cn">TRUE</span><spanclass="op">)</span><spanclass="co"># will not remain species: B_STPHY_CONS</span></span></span>
<spanclass="r-in"><span><spanclass="fu">as.mo</span><spanclass="op">(</span><spanclass="st">"S. pyogenes"</span>, Lancefield <spanclass="op">=</span><spanclass="cn">TRUE</span><spanclass="op">)</span><spanclass="co"># will not remain species: B_STRPT_GRPA</span></span></span>
<spanclass="r-in"><span><spanclass="fu"><ahref="mo_property.html">mo_is_intrinsic_resistant</a></span><spanclass="op">(</span><spanclass="st">"ESCCOL"</span>, ab <spanclass="op">=</span><spanclass="st">"vanco"</span><spanclass="op">)</span></span></span>
<p><code>AMR</code> (for R). Free and open-source, licenced under the <atarget="_blank"href="https://github.com/msberends/AMR/blob/main/LICENSE"class="external-link">GNU General Public License version 2.0 (GPL-2)</a>.<br>Developed at the <atarget="_blank"href="https://www.rug.nl"class="external-link">University of Groningen</a> and <atarget="_blank"href="https://www.umcg.nl"class="external-link">University Medical Center Groningen</a> in The Netherlands.</p>