mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 15:21:58 +02:00
new antibiotics
This commit is contained in:
@ -40,7 +40,7 @@
|
||||
</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="Released version">0.6.1.9002</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -105,7 +105,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../reference/atc_property.html">
|
||||
<a href="../reference/ab_property.html">
|
||||
<span class="fa fa-capsules"></span>
|
||||
|
||||
Get properties of an antibiotic
|
||||
@ -192,7 +192,7 @@
|
||||
<h1>Benchmarks</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">09 April 2019</h4>
|
||||
<h4 class="date">10 May 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>benchmarks.Rmd</code></div>
|
||||
@ -217,14 +217,14 @@
|
||||
<a class="sourceLine" id="cb2-8" title="8"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
|
||||
<a class="sourceLine" id="cb2-9" title="9"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(S.aureus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
|
||||
<a class="sourceLine" id="cb2-10" title="10"><span class="co">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb2-11" title="11"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb2-12" title="12"><span class="co">#> as.mo("sau") 18 18.0 27 18.0 18.0 65 10</span></a>
|
||||
<a class="sourceLine" id="cb2-13" title="13"><span class="co">#> as.mo("stau") 48 48.0 56 48.0 48.0 130 10</span></a>
|
||||
<a class="sourceLine" id="cb2-14" title="14"><span class="co">#> as.mo("staaur") 18 18.0 24 18.0 18.0 76 10</span></a>
|
||||
<a class="sourceLine" id="cb2-15" title="15"><span class="co">#> as.mo("STAAUR") 18 18.0 27 18.0 19.0 63 10</span></a>
|
||||
<a class="sourceLine" id="cb2-16" title="16"><span class="co">#> as.mo("S. aureus") 28 28.0 33 28.0 29.0 72 10</span></a>
|
||||
<a class="sourceLine" id="cb2-17" title="17"><span class="co">#> as.mo("S. aureus") 28 29.0 38 29.0 31.0 76 10</span></a>
|
||||
<a class="sourceLine" id="cb2-18" title="18"><span class="co">#> as.mo("Staphylococcus aureus") 8 8.1 12 8.1 8.2 52 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb2-11" title="11"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb2-12" title="12"><span class="co">#> as.mo("sau") 18.0 18 23.0 18 18.0 65 10</span></a>
|
||||
<a class="sourceLine" id="cb2-13" title="13"><span class="co">#> as.mo("stau") 47.0 48 48.0 48 48.0 50 10</span></a>
|
||||
<a class="sourceLine" id="cb2-14" title="14"><span class="co">#> as.mo("staaur") 18.0 18 22.0 18 18.0 62 10</span></a>
|
||||
<a class="sourceLine" id="cb2-15" title="15"><span class="co">#> as.mo("STAAUR") 18.0 18 32.0 19 62.0 62 10</span></a>
|
||||
<a class="sourceLine" id="cb2-16" title="16"><span class="co">#> as.mo("S. aureus") 28.0 28 42.0 28 28.0 120 10</span></a>
|
||||
<a class="sourceLine" id="cb2-17" title="17"><span class="co">#> as.mo("S. aureus") 28.0 28 40.0 28 29.0 98 10</span></a>
|
||||
<a class="sourceLine" id="cb2-18" title="18"><span class="co">#> as.mo("Staphylococcus aureus") 7.9 8 9.2 8 8.1 20 10</span></a></code></pre></div>
|
||||
<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 100 milliseconds, this is only 10 input values per second. The second input is the only one that has to be looked up thoroughly. All the others are known codes (the first one is a WHONET code) or common laboratory codes, or common full organism names like the last one. Full organism names are always preferred.</p>
|
||||
<p>To achieve this speed, the <code>as.mo</code> function also takes into account the prevalence of human pathogenic microorganisms. The downside is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of <em>Thermus islandicus</em> (<code>B_THERMS_ISL</code>), a bug probably never found before in humans:</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1">T.islandicus <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"theisl"</span>),</a>
|
||||
@ -236,12 +236,12 @@
|
||||
<a class="sourceLine" id="cb3-7" title="7"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(T.islandicus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
|
||||
<a class="sourceLine" id="cb3-8" title="8"><span class="co">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb3-9" title="9"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb3-10" title="10"><span class="co">#> as.mo("theisl") 460 480 490 500 510 510 10</span></a>
|
||||
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#> as.mo("THEISL") 460 460 490 470 510 520 10</span></a>
|
||||
<a class="sourceLine" id="cb3-12" title="12"><span class="co">#> as.mo("T. islandicus") 72 73 88 75 110 120 10</span></a>
|
||||
<a class="sourceLine" id="cb3-13" title="13"><span class="co">#> as.mo("T. islandicus") 73 73 87 74 100 140 10</span></a>
|
||||
<a class="sourceLine" id="cb3-14" title="14"><span class="co">#> as.mo("Thermus islandicus") 72 73 90 75 120 130 10</span></a></code></pre></div>
|
||||
<p>That takes 8 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
|
||||
<a class="sourceLine" id="cb3-10" title="10"><span class="co">#> as.mo("theisl") 470 470 490 470 520 520 10</span></a>
|
||||
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#> as.mo("THEISL") 470 470 500 510 520 520 10</span></a>
|
||||
<a class="sourceLine" id="cb3-12" title="12"><span class="co">#> as.mo("T. islandicus") 76 76 81 76 77 120 10</span></a>
|
||||
<a class="sourceLine" id="cb3-13" title="13"><span class="co">#> as.mo("T. islandicus") 76 76 94 78 120 120 10</span></a>
|
||||
<a class="sourceLine" id="cb3-14" title="14"><span class="co">#> as.mo("Thermus islandicus") 74 74 96 77 120 150 10</span></a></code></pre></div>
|
||||
<p>That takes 8.2 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
|
||||
<p>In the figure below, we compare <em>Escherichia coli</em> (which is very common) with <em>Prevotella brevis</em> (which is moderately common) and with <em>Thermus islandicus</em> (which is very uncommon):</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/par">par</a></span>(<span class="dt">mar =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">5</span>, <span class="dv">16</span>, <span class="dv">4</span>, <span class="dv">2</span>)) <span class="co"># set more space for left margin text (16)</span></a>
|
||||
<a class="sourceLine" id="cb4-2" title="2"></a>
|
||||
@ -253,7 +253,7 @@
|
||||
<a class="sourceLine" id="cb4-8" title="8"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>),</a>
|
||||
<a class="sourceLine" id="cb4-9" title="9"> <span class="dt">times =</span> <span class="dv">10</span>),</a>
|
||||
<a class="sourceLine" id="cb4-10" title="10"> <span class="dt">horizontal =</span> <span class="ot">TRUE</span>, <span class="dt">las =</span> <span class="dv">1</span>, <span class="dt">unit =</span> <span class="st">"s"</span>, <span class="dt">log =</span> <span class="ot">FALSE</span>,</a>
|
||||
<a class="sourceLine" id="cb4-11" title="11"> <span class="dt">xlab =</span> <span class="st">""</span>, <span class="dt">ylab =</span> <span class="st">"Time in seconds"</span>, <span class="dt">ylim =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">0</span>, <span class="fl">0.5</span>),</a>
|
||||
<a class="sourceLine" id="cb4-11" title="11"> <span class="dt">xlab =</span> <span class="st">""</span>, <span class="dt">ylab =</span> <span class="st">"Time in seconds"</span>,</a>
|
||||
<a class="sourceLine" id="cb4-12" title="12"> <span class="dt">main =</span> <span class="st">"Benchmarks per prevalence"</span>)</a></code></pre></div>
|
||||
<p><img src="benchmarks_files/figure-html/unnamed-chunk-5-1.png" width="720"></p>
|
||||
<p>Uncommon microorganisms take a lot more time than common microorganisms. To relieve this pitfall and further improve performance, two important calculations take almost no time at all: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p>
|
||||
@ -286,9 +286,9 @@
|
||||
<a class="sourceLine" id="cb5-23" title="23"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
|
||||
<a class="sourceLine" id="cb5-24" title="24"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
|
||||
<a class="sourceLine" id="cb5-25" title="25"><span class="co">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb5-26" title="26"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb5-27" title="27"><span class="co">#> mo_fullname(x) 774 777 811 783 829 947 10</span></a></code></pre></div>
|
||||
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.78 seconds (783 ms). You only lose time on your unique input values.</p>
|
||||
<a class="sourceLine" id="cb5-26" title="26"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb5-27" title="27"><span class="co">#> mo_fullname(x) 777 780 859 864 870 1080 10</span></a></code></pre></div>
|
||||
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.86 seconds (864 ms). You only lose time on your unique input values.</p>
|
||||
</div>
|
||||
<div id="precalculated-results" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
@ -300,11 +300,11 @@
|
||||
<a class="sourceLine" id="cb6-4" title="4"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
|
||||
<a class="sourceLine" id="cb6-5" title="5"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
|
||||
<a class="sourceLine" id="cb6-6" title="6"><span class="co">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb6-7" title="7"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb6-8" title="8"><span class="co">#> A 12.000 12.100 12.500 12.400 12.800 13.20 10</span></a>
|
||||
<a class="sourceLine" id="cb6-9" title="9"><span class="co">#> B 25.800 26.200 26.900 26.600 27.800 28.00 10</span></a>
|
||||
<a class="sourceLine" id="cb6-10" title="10"><span class="co">#> C 0.476 0.691 0.758 0.812 0.848 1.03 10</span></a></code></pre></div>
|
||||
<p>So going from <code><a href="../reference/mo_property.html">mo_fullname("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0008 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>
|
||||
<a class="sourceLine" id="cb6-7" title="7"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb6-8" title="8"><span class="co">#> A 13.30 14.0 14.3 14.1 14.30 17.30 10</span></a>
|
||||
<a class="sourceLine" id="cb6-9" title="9"><span class="co">#> B 25.20 25.5 36.5 26.5 39.60 71.30 10</span></a>
|
||||
<a class="sourceLine" id="cb6-10" title="10"><span class="co">#> C 1.68 1.7 1.9 1.8 1.94 2.81 10</span></a></code></pre></div>
|
||||
<p>So going from <code><a href="../reference/mo_property.html">mo_fullname("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0018 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="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="1">run_it <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_species</a></span>(<span class="st">"aureus"</span>),</a>
|
||||
<a class="sourceLine" id="cb7-2" title="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"Staphylococcus"</span>),</a>
|
||||
<a class="sourceLine" id="cb7-3" title="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a>
|
||||
@ -317,14 +317,14 @@
|
||||
<a class="sourceLine" id="cb7-10" title="10"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
|
||||
<a class="sourceLine" id="cb7-11" title="11"><span class="co">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb7-12" title="12"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb7-13" title="13"><span class="co">#> A 0.364 0.403 0.452 0.455 0.496 0.575 10</span></a>
|
||||
<a class="sourceLine" id="cb7-14" title="14"><span class="co">#> B 0.478 0.533 0.566 0.565 0.594 0.645 10</span></a>
|
||||
<a class="sourceLine" id="cb7-15" title="15"><span class="co">#> C 0.512 0.726 0.851 0.893 1.010 1.150 10</span></a>
|
||||
<a class="sourceLine" id="cb7-16" title="16"><span class="co">#> D 0.409 0.460 0.490 0.507 0.530 0.544 10</span></a>
|
||||
<a class="sourceLine" id="cb7-17" title="17"><span class="co">#> E 0.375 0.380 0.454 0.476 0.488 0.524 10</span></a>
|
||||
<a class="sourceLine" id="cb7-18" title="18"><span class="co">#> F 0.395 0.411 0.463 0.442 0.522 0.587 10</span></a>
|
||||
<a class="sourceLine" id="cb7-19" title="19"><span class="co">#> G 0.381 0.404 0.454 0.451 0.495 0.546 10</span></a>
|
||||
<a class="sourceLine" id="cb7-20" title="20"><span class="co">#> H 0.232 0.268 0.304 0.297 0.336 0.391 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb7-13" title="13"><span class="co">#> A 0.417 0.456 0.511 0.494 0.558 0.612 10</span></a>
|
||||
<a class="sourceLine" id="cb7-14" title="14"><span class="co">#> B 0.416 0.555 0.620 0.614 0.658 0.837 10</span></a>
|
||||
<a class="sourceLine" id="cb7-15" title="15"><span class="co">#> C 1.360 1.630 1.970 1.880 1.970 3.220 10</span></a>
|
||||
<a class="sourceLine" id="cb7-16" title="16"><span class="co">#> D 0.435 0.519 0.671 0.665 0.734 1.120 10</span></a>
|
||||
<a class="sourceLine" id="cb7-17" title="17"><span class="co">#> E 0.356 0.429 0.491 0.452 0.486 0.916 10</span></a>
|
||||
<a class="sourceLine" id="cb7-18" title="18"><span class="co">#> F 0.384 0.450 0.559 0.502 0.543 1.180 10</span></a>
|
||||
<a class="sourceLine" id="cb7-19" title="19"><span class="co">#> G 0.407 0.450 0.591 0.527 0.663 1.080 10</span></a>
|
||||
<a class="sourceLine" id="cb7-20" title="20"><span class="co">#> H 0.219 0.272 0.295 0.276 0.311 0.420 10</span></a></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> too, there is no point in calculating the result. And because this package ‘knows’ all phyla of all known bacteria (according to the Catalogue of Life), it can just return the initial value immediately.</p>
|
||||
</div>
|
||||
<div id="results-in-other-languages" class="section level3">
|
||||
@ -350,14 +350,14 @@
|
||||
<a class="sourceLine" id="cb8-17" title="17"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
|
||||
<a class="sourceLine" id="cb8-18" title="18"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">4</span>)</a>
|
||||
<a class="sourceLine" id="cb8-19" title="19"><span class="co">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb8-20" title="20"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb8-21" title="21"><span class="co">#> en 18.37 19.07 19.98 19.22 19.41 27.24 10</span></a>
|
||||
<a class="sourceLine" id="cb8-22" title="22"><span class="co">#> de 30.58 31.06 35.93 31.42 31.54 77.27 10</span></a>
|
||||
<a class="sourceLine" id="cb8-23" title="23"><span class="co">#> nl 31.01 31.33 37.73 31.41 31.59 93.52 10</span></a>
|
||||
<a class="sourceLine" id="cb8-24" title="24"><span class="co">#> es 31.38 31.45 36.30 31.81 32.53 76.12 10</span></a>
|
||||
<a class="sourceLine" id="cb8-25" title="25"><span class="co">#> it 30.98 31.40 36.99 31.58 32.30 84.46 10</span></a>
|
||||
<a class="sourceLine" id="cb8-26" title="26"><span class="co">#> fr 31.19 31.21 35.82 31.45 31.62 75.52 10</span></a>
|
||||
<a class="sourceLine" id="cb8-27" title="27"><span class="co">#> pt 31.02 31.36 40.85 32.22 33.84 76.22 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb8-20" title="20"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb8-21" title="21"><span class="co">#> en 18.34 18.37 23.22 18.54 19.53 63.17 10</span></a>
|
||||
<a class="sourceLine" id="cb8-22" title="22"><span class="co">#> de 23.46 23.50 23.76 23.57 23.76 25.10 10</span></a>
|
||||
<a class="sourceLine" id="cb8-23" title="23"><span class="co">#> nl 50.78 52.48 62.59 53.54 57.07 100.20 10</span></a>
|
||||
<a class="sourceLine" id="cb8-24" title="24"><span class="co">#> es 23.53 23.59 28.70 23.76 24.17 68.55 10</span></a>
|
||||
<a class="sourceLine" id="cb8-25" title="25"><span class="co">#> it 23.31 23.40 23.69 23.51 23.79 24.73 10</span></a>
|
||||
<a class="sourceLine" id="cb8-26" title="26"><span class="co">#> fr 23.45 23.52 24.21 24.06 24.88 25.21 10</span></a>
|
||||
<a class="sourceLine" id="cb8-27" title="27"><span class="co">#> pt 23.54 23.72 24.37 24.39 24.90 25.58 10</span></a></code></pre></div>
|
||||
<p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user