mirror of https://github.com/msberends/AMR.git
404 lines
31 KiB
HTML
404 lines
31 KiB
HTML
<!DOCTYPE html>
|
||
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Benchmarks • AMR (for R)</title>
|
||
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
|
||
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png">
|
||
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png">
|
||
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png">
|
||
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
|
||
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
|
||
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.4.0/flatly/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css">
|
||
<script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
|
||
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
|
||
<script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
|
||
<script src="../extra.js"></script><meta property="og:title" content="Benchmarks">
|
||
<meta property="og:description" content="AMR">
|
||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.png">
|
||
<meta name="twitter:card" content="summary_large_image">
|
||
<meta name="twitter:creator" content="@msberends">
|
||
<meta name="twitter:site" content="@univgroningen">
|
||
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
|
||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||
<![endif]-->
|
||
</head>
|
||
<body data-spy="scroll" data-target="#toc">
|
||
|
||
|
||
<div class="container template-article">
|
||
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||
<div class="container">
|
||
<div class="navbar-header">
|
||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
|
||
<span class="sr-only">Toggle navigation</span>
|
||
<span class="icon-bar"></span>
|
||
<span class="icon-bar"></span>
|
||
<span class="icon-bar"></span>
|
||
</button>
|
||
<span class="navbar-brand">
|
||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9024</span>
|
||
</span>
|
||
</div>
|
||
|
||
<div id="navbar" class="navbar-collapse collapse">
|
||
<ul class="nav navbar-nav">
|
||
<li>
|
||
<a href="../index.html">
|
||
<span class="fa fa-home"></span>
|
||
|
||
Home
|
||
</a>
|
||
</li>
|
||
<li class="dropdown">
|
||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||
<span class="fa fa-question-circle"></span>
|
||
|
||
How to
|
||
|
||
<span class="caret"></span>
|
||
</a>
|
||
<ul class="dropdown-menu" role="menu">
|
||
<li>
|
||
<a href="../articles/AMR.html">
|
||
<span class="fa fa-directions"></span>
|
||
|
||
Conduct AMR analysis
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="../articles/resistance_predict.html">
|
||
<span class="fa fa-dice"></span>
|
||
|
||
Predict antimicrobial resistance
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="../articles/datasets.html">
|
||
<span class="fa fa-database"></span>
|
||
|
||
Data sets for download / own use
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="../articles/PCA.html">
|
||
<span class="fa fa-compress"></span>
|
||
|
||
Conduct principal component analysis for AMR
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="../articles/MDR.html">
|
||
<span class="fa fa-skull-crossbones"></span>
|
||
|
||
Determine multi-drug resistance (MDR)
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="../articles/WHONET.html">
|
||
<span class="fa fa-globe-americas"></span>
|
||
|
||
Work with WHONET data
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="../articles/SPSS.html">
|
||
<span class="fa fa-file-upload"></span>
|
||
|
||
Import data from SPSS/SAS/Stata
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="../articles/EUCAST.html">
|
||
<span class="fa fa-exchange-alt"></span>
|
||
|
||
Apply EUCAST rules
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="../reference/mo_property.html">
|
||
<span class="fa fa-bug"></span>
|
||
|
||
Get properties of a microorganism
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="../reference/ab_property.html">
|
||
<span class="fa fa-capsules"></span>
|
||
|
||
Get properties of an antibiotic
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="../articles/benchmarks.html">
|
||
<span class="fa fa-shipping-fast"></span>
|
||
|
||
Other: benchmarks
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li>
|
||
<a href="../reference/index.html">
|
||
<span class="fa fa-book-open"></span>
|
||
|
||
Manual
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="../authors.html">
|
||
<span class="fa fa-users"></span>
|
||
|
||
Authors
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="../news/index.html">
|
||
<span class="far fa-newspaper"></span>
|
||
|
||
Changelog
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
<ul class="nav navbar-nav navbar-right">
|
||
<li>
|
||
<a href="https://github.com/msberends/AMR" class="external-link">
|
||
<span class="fab fa-github"></span>
|
||
|
||
Source Code
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="../survey.html">
|
||
<span class="fa fa-clipboard-list"></span>
|
||
|
||
Survey
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<!--/.nav-collapse -->
|
||
</div>
|
||
<!--/.container -->
|
||
</div>
|
||
<!--/.navbar -->
|
||
|
||
|
||
|
||
</header><script src="benchmarks_files/header-attrs-2.9/header-attrs.js"></script><div class="row">
|
||
<div class="col-md-9 contents">
|
||
<div class="page-header toc-ignore">
|
||
<h1 data-toc-skip>Benchmarks</h1>
|
||
|
||
|
||
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/benchmarks.Rmd" class="external-link"><code>vignettes/benchmarks.Rmd</code></a></small>
|
||
<div class="hidden name"><code>benchmarks.Rmd</code></div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<p>One of the most important features of this package is the complete microbial taxonomic database, supplied by the <a href="http://www.catalogueoflife.org" class="external-link">Catalogue of Life</a> (CoL) and the <a href="https://lpsn.dsmz.de" class="external-link">List of Prokaryotic names with Standing in Nomenclature</a> (LPSN). We created a function <code><a href="../reference/as.mo.html">as.mo()</a></code> that transforms any user input value to a valid microbial ID by using intelligent rules combined with the microbial taxonomy.</p>
|
||
<p>Using the <code>microbenchmark</code> package, we can review the calculation performance of this function. Its function <code><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html" class="external-link">microbenchmark()</a></code> runs different input expressions independently of each other and measures their time-to-result.</p>
|
||
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/joshuaulrich/microbenchmark/" class="external-link">microbenchmark</a></span><span class="op">)</span>
|
||
<span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/msberends/AMR" class="external-link">AMR</a></span><span class="op">)</span>
|
||
<span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org" class="external-link">dplyr</a></span><span class="op">)</span></code></pre></div>
|
||
<p>In the next test, we try to ‘coerce’ different input values into the microbial code of <em>Staphylococcus aureus</em>. Coercion is a computational process of forcing output based on an input. For microorganism names, coercing user input to taxonomically valid microorganism names is crucial to ensure correct interpretation and to enable grouping based on taxonomic properties.</p>
|
||
<p>The actual result is the same every time: it returns its microorganism code <code>B_STPHY_AURS</code> (<em>B</em> stands for <em>Bacteria</em>, its taxonomic kingdom).</p>
|
||
<p>But the calculation time differs a lot:</p>
|
||
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span class="va">S.aureus</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html" class="external-link">microbenchmark</a></span><span class="op">(</span>
|
||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"sau"</span><span class="op">)</span>, <span class="co"># WHONET code</span>
|
||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"stau"</span><span class="op">)</span>,
|
||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"STAU"</span><span class="op">)</span>,
|
||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"staaur"</span><span class="op">)</span>,
|
||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"STAAUR"</span><span class="op">)</span>,
|
||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"S. aureus"</span><span class="op">)</span>,
|
||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"S aureus"</span><span class="op">)</span>,
|
||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"Staphylococcus aureus"</span><span class="op">)</span>, <span class="co"># official taxonomic name</span>
|
||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"Staphylococcus aureus (MRSA)"</span><span class="op">)</span>, <span class="co"># additional text</span>
|
||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"Sthafilokkockus aaureuz"</span><span class="op">)</span>, <span class="co"># incorrect spelling</span>
|
||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"MRSA"</span><span class="op">)</span>, <span class="co"># Methicillin Resistant S. aureus</span>
|
||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"VISA"</span><span class="op">)</span>, <span class="co"># Vancomycin Intermediate S. aureus</span>
|
||
times <span class="op">=</span> <span class="fl">25</span><span class="op">)</span>
|
||
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html" class="external-link">print</a></span><span class="op">(</span><span class="va">S.aureus</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">2</span><span class="op">)</span>
|
||
<span class="co"># Unit: milliseconds</span>
|
||
<span class="co"># expr min lq mean median uq max</span>
|
||
<span class="co"># as.mo("sau") 12.0 13.0 14 13.0 13.0 45.0</span>
|
||
<span class="co"># as.mo("stau") 55.0 58.0 72 60.0 92.0 100.0</span>
|
||
<span class="co"># as.mo("STAU") 54.0 59.0 85 91.0 94.0 200.0</span>
|
||
<span class="co"># as.mo("staaur") 11.0 12.0 19 13.0 15.0 58.0</span>
|
||
<span class="co"># as.mo("STAAUR") 12.0 13.0 21 14.0 16.0 63.0</span>
|
||
<span class="co"># as.mo("S. aureus") 24.0 28.0 41 30.0 62.0 73.0</span>
|
||
<span class="co"># as.mo("S aureus") 26.0 28.0 37 30.0 33.0 75.0</span>
|
||
<span class="co"># as.mo("Staphylococcus aureus") 3.1 3.8 4 3.9 4.2 4.7</span>
|
||
<span class="co"># as.mo("Staphylococcus aureus (MRSA)") 250.0 260.0 270 260.0 290.0 300.0</span>
|
||
<span class="co"># as.mo("Sthafilokkockus aaureuz") 160.0 200.0 200 200.0 200.0 240.0</span>
|
||
<span class="co"># as.mo("MRSA") 11.0 13.0 20 13.0 15.0 55.0</span>
|
||
<span class="co"># as.mo("VISA") 21.0 22.0 31 23.0 27.0 69.0</span>
|
||
<span class="co"># neval</span>
|
||
<span class="co"># 25</span>
|
||
<span class="co"># 25</span>
|
||
<span class="co"># 25</span>
|
||
<span class="co"># 25</span>
|
||
<span class="co"># 25</span>
|
||
<span class="co"># 25</span>
|
||
<span class="co"># 25</span>
|
||
<span class="co"># 25</span>
|
||
<span class="co"># 25</span>
|
||
<span class="co"># 25</span>
|
||
<span class="co"># 25</span>
|
||
<span class="co"># 25</span></code></pre></div>
|
||
<p><img src="benchmarks_files/figure-html/unnamed-chunk-4-1.png" width="750"></p>
|
||
<p>In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 200 milliseconds, this is only 5 input values per second. It is clear that accepted taxonomic names are extremely fast, but some variations are up to 200 times slower to determine.</p>
|
||
<p>To improve performance, we implemented two important algorithms to save unnecessary calculations: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p>
|
||
<div id="repetitive-results" class="section level3">
|
||
<h3 class="hasAnchor">
|
||
<a href="#repetitive-results" class="anchor" aria-hidden="true"></a>Repetitive results</h3>
|
||
<p>Repetitive results are values that are present more than once in a vector. Unique values will only be calculated once by <code><a href="../reference/as.mo.html">as.mo()</a></code>. So running <code><a href="../reference/as.mo.html">as.mo(c("E. coli", "E. coli"))</a></code> will check the value <code>"E. coli"</code> only once.</p>
|
||
<p>To prove this, we will use <code><a href="../reference/mo_property.html">mo_name()</a></code> for testing - a helper function that returns the full microbial name (genus, species and possibly subspecies) which uses <code><a href="../reference/as.mo.html">as.mo()</a></code> internally.</p>
|
||
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span class="co"># start with the example_isolates data set</span>
|
||
<span class="va">x</span> <span class="op"><-</span> <span class="va">example_isolates</span> <span class="op">%>%</span>
|
||
<span class="co"># take all MO codes from the 'mo' column</span>
|
||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/pull.html" class="external-link">pull</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span> <span class="op">%>%</span>
|
||
<span class="co"># and copy them a thousand times</span>
|
||
<span class="fu"><a href="https://rdrr.io/r/base/rep.html" class="external-link">rep</a></span><span class="op">(</span><span class="fl">1000</span><span class="op">)</span> <span class="op">%>%</span>
|
||
<span class="co"># then scramble them</span>
|
||
<span class="fu"><a href="https://rdrr.io/r/base/sample.html" class="external-link">sample</a></span><span class="op">(</span><span class="op">)</span>
|
||
|
||
<span class="co"># what do these values look like? They are of class <mo>:</span>
|
||
<span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
|
||
<span class="co"># Class <mo></span>
|
||
<span class="co"># [1] B_STPHY_AURS B_STPHY_CONS B_ESCHR_COLI B_STRPT_PYGN B_STPHY_CONS</span>
|
||
<span class="co"># [6] B_ESCHR_COLI</span>
|
||
|
||
<span class="co"># as the example_isolates data set has 2,000 rows, we should have 2 million items</span>
|
||
<span class="fu"><a href="https://rdrr.io/r/base/length.html" class="external-link">length</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
|
||
<span class="co"># [1] 2000000</span>
|
||
|
||
<span class="co"># and how many unique values do we have?</span>
|
||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/n_distinct.html" class="external-link">n_distinct</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
|
||
<span class="co"># [1] 90</span>
|
||
|
||
<span class="co"># now let's see:</span>
|
||
<span class="va">run_it</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html" class="external-link">microbenchmark</a></span><span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>,
|
||
times <span class="op">=</span> <span class="fl">10</span><span class="op">)</span>
|
||
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html" class="external-link">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
||
<span class="co"># Unit: milliseconds</span>
|
||
<span class="co"># expr min lq mean median uq max neval</span>
|
||
<span class="co"># mo_name(x) 163 204 267 233 346 398 10</span></code></pre></div>
|
||
<p>So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.233 seconds. That is 116 nanoseconds on average. You only lose time on your unique input values.</p>
|
||
</div>
|
||
<div id="precalculated-results" class="section level3">
|
||
<h3 class="hasAnchor">
|
||
<a href="#precalculated-results" class="anchor" aria-hidden="true"></a>Precalculated results</h3>
|
||
<p>What about precalculated results? If the input is an already precalculated result of a helper function such as <code><a href="../reference/mo_property.html">mo_name()</a></code>, it almost doesn’t take any time at all. In other words, if you run <code><a href="../reference/mo_property.html">mo_name()</a></code> on a valid taxonomic name, it will return the results immediately (see ‘C’ below):</p>
|
||
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span class="va">run_it</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html" class="external-link">microbenchmark</a></span><span class="op">(</span>A <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"STAAUR"</span><span class="op">)</span>,
|
||
B <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"S. aureus"</span><span class="op">)</span>,
|
||
C <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"Staphylococcus aureus"</span><span class="op">)</span>,
|
||
times <span class="op">=</span> <span class="fl">10</span><span class="op">)</span>
|
||
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html" class="external-link">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
||
<span class="co"># Unit: milliseconds</span>
|
||
<span class="co"># expr min lq mean median uq max neval</span>
|
||
<span class="co"># A 7.93 8.08 14.50 8.35 8.46 70.00 10</span>
|
||
<span class="co"># B 22.40 22.80 24.30 24.30 24.60 27.20 10</span>
|
||
<span class="co"># C 1.89 2.00 2.19 2.15 2.30 2.76 10</span></code></pre></div>
|
||
<p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0021 seconds - it doesn’t even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
|
||
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span class="va">run_it</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html" class="external-link">microbenchmark</a></span><span class="op">(</span>A <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_species</a></span><span class="op">(</span><span class="st">"aureus"</span><span class="op">)</span>,
|
||
B <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="st">"Staphylococcus"</span><span class="op">)</span>,
|
||
C <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"Staphylococcus aureus"</span><span class="op">)</span>,
|
||
D <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_family</a></span><span class="op">(</span><span class="st">"Staphylococcaceae"</span><span class="op">)</span>,
|
||
E <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_order</a></span><span class="op">(</span><span class="st">"Bacillales"</span><span class="op">)</span>,
|
||
F <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_class</a></span><span class="op">(</span><span class="st">"Bacilli"</span><span class="op">)</span>,
|
||
G <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_phylum</a></span><span class="op">(</span><span class="st">"Firmicutes"</span><span class="op">)</span>,
|
||
H <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_kingdom</a></span><span class="op">(</span><span class="st">"Bacteria"</span><span class="op">)</span>,
|
||
times <span class="op">=</span> <span class="fl">10</span><span class="op">)</span>
|
||
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html" class="external-link">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
||
<span class="co"># Unit: milliseconds</span>
|
||
<span class="co"># expr min lq mean median uq max neval</span>
|
||
<span class="co"># A 1.73 1.78 1.83 1.81 1.90 1.90 10</span>
|
||
<span class="co"># B 1.73 1.83 1.90 1.89 1.98 2.04 10</span>
|
||
<span class="co"># C 1.72 1.79 1.88 1.85 1.95 2.08 10</span>
|
||
<span class="co"># D 1.75 1.75 1.85 1.88 1.91 1.93 10</span>
|
||
<span class="co"># E 1.70 1.78 1.82 1.80 1.83 2.02 10</span>
|
||
<span class="co"># F 1.68 1.78 1.79 1.79 1.81 1.91 10</span>
|
||
<span class="co"># G 1.69 1.75 1.79 1.79 1.81 1.89 10</span>
|
||
<span class="co"># H 1.68 1.71 1.85 1.76 1.85 2.65 10</span></code></pre></div>
|
||
<p>Of course, when running <code><a href="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> anyway, there is no point in calculating the result. And because this package contains all phyla of all known bacteria, it can just return the initial value immediately.</p>
|
||
</div>
|
||
<div id="results-in-other-languages" class="section level3">
|
||
<h3 class="hasAnchor">
|
||
<a href="#results-in-other-languages" class="anchor" aria-hidden="true"></a>Results in other languages</h3>
|
||
<p>When the system language is non-English and supported by this <code>AMR</code> package, some functions will have a translated result. This almost does’t take extra time:</p>
|
||
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"CoNS"</span>, language <span class="op">=</span> <span class="st">"en"</span><span class="op">)</span> <span class="co"># or just mo_name("CoNS") on an English system</span>
|
||
<span class="co"># [1] "Coagulase-negative Staphylococcus (CoNS)"</span>
|
||
|
||
<span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"CoNS"</span>, language <span class="op">=</span> <span class="st">"es"</span><span class="op">)</span> <span class="co"># or just mo_name("CoNS") on a Spanish system</span>
|
||
<span class="co"># [1] "Staphylococcus coagulasa negativo (SCN)"</span>
|
||
|
||
<span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"CoNS"</span>, language <span class="op">=</span> <span class="st">"nl"</span><span class="op">)</span> <span class="co"># or just mo_name("CoNS") on a Dutch system</span>
|
||
<span class="co"># [1] "Coagulase-negatieve Staphylococcus (CNS)"</span>
|
||
|
||
<span class="va">run_it</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html" class="external-link">microbenchmark</a></span><span class="op">(</span>en <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"CoNS"</span>, language <span class="op">=</span> <span class="st">"en"</span><span class="op">)</span>,
|
||
de <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"CoNS"</span>, language <span class="op">=</span> <span class="st">"de"</span><span class="op">)</span>,
|
||
nl <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"CoNS"</span>, language <span class="op">=</span> <span class="st">"nl"</span><span class="op">)</span>,
|
||
es <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"CoNS"</span>, language <span class="op">=</span> <span class="st">"es"</span><span class="op">)</span>,
|
||
it <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"CoNS"</span>, language <span class="op">=</span> <span class="st">"it"</span><span class="op">)</span>,
|
||
fr <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"CoNS"</span>, language <span class="op">=</span> <span class="st">"fr"</span><span class="op">)</span>,
|
||
pt <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="st">"CoNS"</span>, language <span class="op">=</span> <span class="st">"pt"</span><span class="op">)</span>,
|
||
times <span class="op">=</span> <span class="fl">100</span><span class="op">)</span>
|
||
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html" class="external-link">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">4</span><span class="op">)</span>
|
||
<span class="co"># Unit: milliseconds</span>
|
||
<span class="co"># expr min lq mean median uq max neval</span>
|
||
<span class="co"># en 19.47 20.23 24.54 20.72 21.85 89.57 100</span>
|
||
<span class="co"># de 30.58 31.52 41.31 32.78 34.76 86.03 100</span>
|
||
<span class="co"># nl 34.81 35.58 45.89 36.76 39.41 94.01 100</span>
|
||
<span class="co"># es 34.41 35.12 40.08 36.22 37.33 94.71 100</span>
|
||
<span class="co"># it 23.93 24.65 27.31 25.15 25.84 81.01 100</span>
|
||
<span class="co"># fr 23.59 24.40 31.40 25.01 25.62 200.30 100</span>
|
||
<span class="co"># pt 23.69 24.73 30.23 25.57 26.32 82.19 100</span></code></pre></div>
|
||
<p>Currently supported non-English languages are German, Dutch, Spanish, Italian, French and Portuguese.</p>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<footer><div class="copyright">
|
||
<p></p>
|
||
<p>Developed by <a href="https://www.rug.nl/staff/m.s.berends/" class="external-link external-link">Matthijs S. Berends</a>, <a href="https://www.rug.nl/staff/c.f.luz/" class="external-link external-link">Christian F. Luz</a>, <a href="https://www.rug.nl/staff/a.w.friedrich/" class="external-link external-link">Alexander W. Friedrich</a>, <a href="https://www.rug.nl/staff/b.sinha/" class="external-link external-link">Bhanu N. M. Sinha</a>, <a href="https://www.rug.nl/staff/c.j.albers/" class="external-link external-link">Casper J. Albers</a>, <a href="https://www.rug.nl/staff/c.glasner/" class="external-link external-link">Corinna Glasner</a>.</p>
|
||
</div>
|
||
|
||
<div class="pkgdown">
|
||
<p></p>
|
||
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link external-link">pkgdown</a> 1.6.1.9001.</p>
|
||
</div>
|
||
|
||
</footer>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</body>
|
||
</html>
|