<!-- 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>Add Custom Microorganisms — add_custom_microorganisms • 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.4.2/css/all.min.css"rel="stylesheet"><linkhref="../deps/font-awesome-6.4.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="Add Custom Microorganisms — add_custom_microorganisms"><metaname="description"content="With add_custom_microorganisms() you can add your own custom microorganisms, such the non-taxonomic outcome of laboratory analysis."><metaproperty="og:description"content="With add_custom_microorganisms() you can add your own custom microorganisms, such the non-taxonomic outcome of laboratory analysis."><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>
<buttonclass="nav-link dropdown-toggle"type="button"id="dropdown-with-other-pkgs"data-bs-toggle="dropdown"aria-expanded="false"aria-haspopup="true"><spanclass="fa fa-layer-group"></span> With other pkgs</button>
<ulclass="dropdown-menu"aria-labelledby="dropdown-with-other-pkgs"><li><aclass="dropdown-item"href="../articles/other_pkg.html"><spanclass="fa fa-layer-group"></span> AMR & dplyr/tidyverse</a></li>
<li><aclass="dropdown-item"href="../articles/other_pkg.html"><spanclass="fa fa-layer-group"></span> AMR & data.table</a></li>
<li><aclass="dropdown-item"href="../articles/other_pkg.html"><spanclass="fa fa-layer-group"></span> AMR & tidymodels</a></li>
<li><aclass="dropdown-item"href="../articles/other_pkg.html"><spanclass="fa fa-layer-group"></span> AMR & base R</a></li>
<p>With <code>add_custom_microorganisms()</code> you can add your own custom microorganisms, such the non-taxonomic outcome of laboratory analysis.</p>
<dd><p>a <ahref="https://rdrr.io/r/base/data.frame.html"class="external-link">data.frame</a> resembling the <ahref="microorganisms.html">microorganisms</a> data set, at least containing column "genus" (case-insensitive)</p></dd>
<p>This function will fill in missing taxonomy for you, if specific taxonomic columns are missing, see <em>Examples</em>.</p>
<p><strong>Important:</strong> Due to how <spanstyle="R">R</span> works, the <code>add_custom_microorganisms()</code> function has to be run in every <spanstyle="R">R</span> session - added microorganisms are not stored between sessions and are thus lost when <spanstyle="R">R</span> is exited.</p>
<p><strong>Method 1:</strong> Using the package option <code><ahref="AMR-options.html">AMR_custom_mo</a></code>, which is the preferred method. To use this method:</p><ol><li><p>Create a data set in the structure of the <ahref="microorganisms.html">microorganisms</a> data set (containing at the very least column "genus") and save it with <code><ahref="https://rdrr.io/r/base/readRDS.html"class="external-link">saveRDS()</a></code> to a location of choice, e.g. <code>"~/my_custom_mo.rds"</code>, or any remote location.</p></li>
<li><p>Set the file location to the package option <code><ahref="AMR-options.html">AMR_custom_mo</a></code>: <code>options(AMR_custom_mo = "~/my_custom_mo.rds")</code>. This can even be a remote file location, such as an https URL. Since options are not saved between <spanstyle="R">R</span> sessions, it is best to save this option to the <code>.Rprofile</code> file so that it will be loaded on start-up of <spanstyle="R">R</span>. To do this, open the <code>.Rprofile</code> file using e.g. <code>utils::file.edit("~/.Rprofile")</code>, add this text and save the file:</p>
</ol><p><strong>Method 2:</strong> Loading the microorganism directly from your <code>.Rprofile</code> file. Note that the definitions will be stored in a user-specific <spanstyle="R">R</span> file, which is a suboptimal workflow. To use this method:</p><ol><li><p>Edit the <code>.Rprofile</code> file using e.g. <code>utils::file.edit("~/.Rprofile")</code>.</p></li>
<spanclass="r-wrn co"><spanclass="r-pr">#></span><spanclass="warning">Warning: </span>No hits found for "Enterobacter asburiae/cloacae" with</span>
<spanclass="r-wrn co"><spanclass="r-pr">#></span> minimum_matching_score = NULL (=0.538). Try setting this value lower or</span>
<spanclass="r-wrn co"><spanclass="r-pr">#></span> even to 0.</span>
<spanclass="r-wrn co"><spanclass="r-pr">#></span><spanclass="warning">Warning: </span>The following input could not be coerced and was returned as "UNKNOWN":</span>
<spanclass="r-in"><span> genus <spanclass="op">=</span><spanclass="st">"Citrobacter"</span>,</span></span>
<spanclass="r-in"><span> species <spanclass="op">=</span><spanclass="fu"><ahref="https://rdrr.io/r/base/c.html"class="external-link">c</a></span><spanclass="op">(</span><spanclass="st">"freundii"</span>, <spanclass="st">"braakii complex"</span><spanclass="op">)</span>,</span></span>
<spanclass="r-wrn co"><spanclass="r-pr">#></span><spanclass="warning">Warning: </span>No hits found for "C. freundii complex" with minimum_matching_score = NULL</span>
<spanclass="r-wrn co"><spanclass="r-pr">#></span> (=0.16). Try setting this value lower or even to 0.</span>
<spanclass="r-wrn co"><spanclass="r-pr">#></span><spanclass="warning">Warning: </span>The following input could not be coerced and was returned as "UNKNOWN": "C.</span>
<spanclass="r-wrn co"><spanclass="r-pr">#></span><spanclass="warning">Warning: </span>No hits found for "C. freundii complex" with minimum_matching_score = NULL</span>
<spanclass="r-wrn co"><spanclass="r-pr">#></span> (=0.16). Try setting this value lower or even to 0.</span>
<spanclass="r-wrn co"><spanclass="r-pr">#></span><spanclass="warning">Warning: </span>The following input could not be coerced and was returned as "UNKNOWN": "C.</span>
<spanclass="r-wrn co"><spanclass="r-pr">#></span><spanclass="warning">Warning: </span>No hits found for "C. freundii complex" with minimum_matching_score = NULL</span>
<spanclass="r-wrn co"><spanclass="r-pr">#></span> (=0.16). Try setting this value lower or even to 0.</span>
<spanclass="r-wrn co"><spanclass="r-pr">#></span><spanclass="warning">Warning: </span>The following input could not be coerced and was returned as "UNKNOWN": "C.</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>