diff --git a/DESCRIPTION b/DESCRIPTION index 690916ac..89f14c3a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 0.7.1.9002 +Version: 0.7.1.9003 Date: 2019-06-23 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/NEWS.md b/NEWS.md index 9403b9ea..8492fcf7 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,8 @@ -# AMR 0.7.1.9002 +# AMR 0.7.1.9003 + +(no code changes yet) + +# AMR 0.7.1 #### New * Function `rsi_df()` to transform a `data.frame` to a data set containing only the microbial interpretation (S, I, R), the antibiotic, the percentage of S/I/R and the number of available isolates. This is a convenient combination of the existing functions `count_df()` and `portion_df()` to immediately show resistance percentages and number of available isolates: diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 7b7f78cc..0c7b7107 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9002 + 0.7.1.9003 diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index 9ec1ab02..6496de6a 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -40,7 +40,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 @@ -192,7 +192,7 @@

How to conduct AMR analysis

Matthijs S. Berends

-

22 June 2019

+

23 June 2019

@@ -201,7 +201,7 @@ -

Note: values on this page will change with every website update since they are based on randomly created values and the page was written in R Markdown. However, the methodology remains unchanged. This page was generated on 22 June 2019.

+

Note: values on this page will change with every website update since they are based on randomly created values and the page was written in R Markdown. However, the methodology remains unchanged. This page was generated on 23 June 2019.

Introduction

@@ -217,21 +217,21 @@ -2019-06-22 +2019-06-23 abcd Escherichia coli S S -2019-06-22 +2019-06-23 abcd Escherichia coli S R -2019-06-22 +2019-06-23 efgh Escherichia coli R @@ -327,63 +327,30 @@ -2014-05-06 -Y6 -Hospital D -Streptococcus pneumoniae +2017-10-01 +O3 +Hospital B +Escherichia coli +R R -S S S F -2010-10-04 -M1 -Hospital D -Escherichia coli -S -S -S -R -M - - -2015-04-19 -L8 -Hospital D -Escherichia coli -R -R -R -S -M - - -2013-08-28 -O2 -Hospital C -Streptococcus pneumoniae -R -S -S -R -F - - -2010-04-25 -T1 -Hospital C -Escherichia coli +2011-03-09 +U5 +Hospital B +Staphylococcus aureus S S S S F - -2010-05-31 -B3 + +2011-03-26 +N5 Hospital A Escherichia coli S @@ -392,6 +359,39 @@ S M + +2013-03-11 +O1 +Hospital A +Escherichia coli +R +S +R +R +F + + +2016-05-24 +V5 +Hospital D +Staphylococcus aureus +S +S +S +S +F + + +2016-09-21 +Z8 +Hospital A +Klebsiella pneumoniae +S +S +R +S +F +

Now, let’s start the cleaning and the analysis!

@@ -411,8 +411,8 @@ # # Item Count Percent Cum. Count Cum. Percent # --- ----- ------- -------- ----------- ------------- -# 1 M 10,382 51.9% 10,382 51.9% -# 2 F 9,618 48.1% 20,000 100.0% +# 1 M 10,366 51.8% 10,366 51.8% +# 2 F 9,634 48.2% 20,000 100.0%

So, we can draw at least two conclusions immediately. From a data scientists perspective, the data looks clean: only values M and F. From a researchers perspective: there are slightly more men. Nothing we didn’t already know.

The data is already quite clean, but we still need to transform some variables. The bacteria column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The mutate() function of the dplyr package makes this really easy:

data <- data %>%
@@ -442,14 +442,14 @@
 # Pasteurella multocida (no new changes)
 # Staphylococcus (no new changes)
 # Streptococcus groups A, B, C, G (no new changes)
-# Streptococcus pneumoniae (1,472 new changes)
+# Streptococcus pneumoniae (1,453 new changes)
 # Viridans group streptococci (no new changes)
 # 
 # EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)
-# Table 01: Intrinsic resistance in Enterobacteriaceae (1,278 new changes)
+# Table 01: Intrinsic resistance in Enterobacteriaceae (1,298 new changes)
 # Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no new changes)
 # Table 03: Intrinsic resistance in other Gram-negative bacteria (no new changes)
-# Table 04: Intrinsic resistance in Gram-positive bacteria (2,802 new changes)
+# Table 04: Intrinsic resistance in Gram-positive bacteria (2,747 new changes)
 # Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no new changes)
 # Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no new changes)
 # Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no new changes)
@@ -457,24 +457,24 @@
 # Table 13: Interpretive rules for quinolones (no new changes)
 # 
 # Other rules
-# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2,239 new changes)
-# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (112 new changes)
+# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2,176 new changes)
+# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (121 new changes)
 # Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no new changes)
 # Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no new changes)
 # Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no new changes)
 # Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no new changes)
 # 
 # --------------------------------------------------------------------------
-# EUCAST rules affected 6,529 out of 20,000 rows, making a total of 7,903 edits
+# EUCAST rules affected 6,468 out of 20,000 rows, making a total of 7,795 edits
 # => added 0 test results
 # 
-# => changed 7,903 test results
-#    - 117 test results changed from S to I
-#    - 4,760 test results changed from S to R
-#    - 1,044 test results changed from I to S
-#    - 324 test results changed from I to R
-#    - 1,642 test results changed from R to S
-#    - 16 test results changed from R to I
+# => changed 7,795 test results
+#    - 107 test results changed from S to I
+#    - 4,725 test results changed from S to R
+#    - 1,040 test results changed from I to S
+#    - 329 test results changed from I to R
+#    - 1,579 test results changed from R to S
+#    - 15 test results changed from R to I
 # --------------------------------------------------------------------------
 # 
 # Use verbose = TRUE to get a data.frame with all specified edits instead.
@@ -502,8 +502,8 @@ # NOTE: Using column `bacteria` as input for `col_mo`. # NOTE: Using column `date` as input for `col_date`. # NOTE: Using column `patient_id` as input for `col_patient_id`. -# => Found 5,683 first isolates (28.4% of total)
-

So only 28.4% is suitable for resistance analysis! We can now filter on it with the filter() function, also from the dplyr package:

+# => Found 5,644 first isolates (28.2% of total) +

So only 28.2% is suitable for resistance analysis! We can now filter on it with the filter() function, also from the dplyr package:

data_1st <- data %>% 
   filter(first == TRUE)

For future use, the above two syntaxes can be shortened with the filter_first_isolate() function:

@@ -513,7 +513,7 @@

First weighted isolates

-

We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient L1, sorted on date:

+

We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient M3, sorted on date:

@@ -529,19 +529,19 @@ - - + + - + - - + + @@ -551,10 +551,10 @@ - - + + - + @@ -562,63 +562,63 @@ - - + + - - + + - - + + + + - - - - + + - - + + - - + + - - + + - - + + + + - - - - + + @@ -628,10 +628,10 @@ - - + + - + @@ -650,7 +650,7 @@ # NOTE: Using column `patient_id` as input for `col_patient_id`.# NOTE: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.# [Criterion] Inclusion based on key antibiotics, ignoring I. -# => Found 15,191 first weighted isolates (76.0% of total) +# => Found 15,080 first weighted isolates (75.4% of total)
isolate
12010-06-13L12010-01-24M3 B_ESCHR_COL S SSR S TRUE
22010-08-25L12010-03-17M3 B_ESCHR_COL S S
32010-09-09L12010-04-12M3 B_ESCHR_COLRS S R S
42010-09-14L12010-05-20M3 B_ESCHR_COLRIS S RS FALSE
52010-10-01L12010-06-08M3 B_ESCHR_COLSS R SSS FALSE
62010-11-15L12010-06-20M3 B_ESCHR_COLSSRI S S FALSE
72010-12-31L12010-09-18M3 B_ESCHR_COLRISS S S FALSE
82011-01-14L12010-10-08M3 B_ESCHR_COLSS R SSS FALSE
92011-01-31L12010-11-05M3 B_ESCHR_COL S S
102011-03-23L12010-12-23M3 B_ESCHR_COLRS S S S
@@ -667,34 +667,34 @@ - - + + - + - - + + - + - - + + - + @@ -703,35 +703,35 @@ - - + + - - + + + - - - + + + + - - - + - - + + - - + + @@ -739,11 +739,11 @@ - - + + - - + + @@ -751,20 +751,20 @@ - - + + + + - - - + - - + + @@ -775,23 +775,23 @@ - - + + - + - +
isolate
12010-06-13L12010-01-24M3 B_ESCHR_COL S SSR S TRUE TRUE
22010-08-25L12010-03-17M3 B_ESCHR_COL S S S S FALSEFALSETRUE
32010-09-09L12010-04-12M3 B_ESCHR_COLRS S R S
42010-09-14L12010-05-20M3 B_ESCHR_COLRIS S RSFALSE FALSETRUE
52010-10-01L12010-06-08M3 B_ESCHR_COLSS R SSS FALSETRUEFALSE
62010-11-15L12010-06-20M3 B_ESCHR_COLSSRI S S FALSE
72010-12-31L12010-09-18M3 B_ESCHR_COLRISS S S FALSE
82011-01-14L12010-10-08M3 B_ESCHR_COLSS R SSSFALSE FALSETRUE
92011-01-31L12010-11-05M3 B_ESCHR_COL S S
102011-03-23L12010-12-23M3 B_ESCHR_COLRS S S S FALSETRUEFALSE
-

Instead of 1, now 8 isolates are flagged. In total, 76% of all isolates are marked ‘first weighted’ - 47.5% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.

+

Instead of 1, now 7 isolates are flagged. In total, 75.4% of all isolates are marked ‘first weighted’ - 47.2% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.

As with filter_first_isolate(), there’s a shortcut for this new algorithm too:

data_1st <- data %>% 
   filter_first_weighted_isolate()
-

So we end up with 15,191 isolates for analysis.

+

So we end up with 15,080 isolates for analysis.

We can remove unneeded columns:

data_1st <- data_1st %>% 
   select(-c(first, keyab))
@@ -817,47 +817,15 @@ 1 -2014-05-06 -Y6 -Hospital D -B_STRPT_PNE +2017-10-01 +O3 +Hospital B +B_ESCHR_COL R R S -R +S F -Gram-positive -Streptococcus -pneumoniae -TRUE - - -2 -2010-10-04 -M1 -Hospital D -B_ESCHR_COL -S -S -S -R -M -Gram-negative -Escherichia -coli -TRUE - - -3 -2015-04-19 -L8 -Hospital D -B_ESCHR_COL -R -R -R -S -M Gram-negative Escherichia coli @@ -865,29 +833,61 @@ 4 -2013-08-28 -O2 -Hospital C -B_STRPT_PNE -R +2013-03-11 +O1 +Hospital A +B_ESCHR_COL R S R +R +F +Gram-negative +Escherichia +coli +TRUE + + +5 +2016-05-24 +V5 +Hospital D +B_STPHY_AUR +S +S +S +S F Gram-positive -Streptococcus +Staphylococcus +aureus +TRUE + + +6 +2016-09-21 +Z8 +Hospital A +B_KLBSL_PNE +R +S +R +S +F +Gram-negative +Klebsiella pneumoniae TRUE 7 -2012-05-09 -B2 -Hospital A +2010-09-19 +H3 +Hospital C B_ESCHR_COL +R S -S -S +R S M Gram-negative @@ -897,18 +897,18 @@ 8 -2016-11-07 -J4 -Hospital D -B_STPHY_AUR -R +2015-04-27 +C9 +Hospital C +B_ESCHR_COL +S S S S M -Gram-positive -Staphylococcus -aureus +Gram-negative +Escherichia +coli TRUE @@ -928,9 +928,9 @@
freq(paste(data_1st$genus, data_1st$species))

Or can be used like the dplyr way, which is easier readable:

data_1st %>% freq(genus, species)
-

Frequency table of genus and species from data_1st (15,191 x 13)

+

Frequency table of genus and species from data_1st (15,080 x 13)

Columns: 2
-Length: 15,191 (of which NA: 0 = 0.00%)
+Length: 15,080 (of which NA: 0 = 0.00%)
Unique: 4

Shortest: 16
Longest: 24

@@ -947,33 +947,33 @@ Longest: 24

1 Escherichia coli -7,443 -49.0% -7,443 -49.0% +7,414 +49.2% +7,414 +49.2% 2 Staphylococcus aureus -3,827 -25.2% -11,270 -74.2% +3,787 +25.1% +11,201 +74.3% 3 Streptococcus pneumoniae -2,353 -15.5% -13,623 +2,319 +15.4% +13,520 89.7% 4 Klebsiella pneumoniae -1,568 +1,560 10.3% -15,191 +15,080 100.0% @@ -984,7 +984,7 @@ Longest: 24

Resistance percentages

The functions portion_S(), portion_SI(), portion_I(), portion_IR() and portion_R() can be used to determine the portion of a specific antimicrobial outcome. As per the EUCAST guideline of 2019, we calculate resistance as the portion of R (portion_R()) and susceptibility as the portion of S and I (portion_SI()). These functions can be used on their own:

data_1st %>% portion_R(AMX)
-# [1] 0.4710684
+# [1] 0.4661804

Or can be used in conjuction with group_by() and summarise(), both from the dplyr package:

data_1st %>% 
   group_by(hospital) %>% 
@@ -997,19 +997,19 @@ Longest: 24

Hospital A -0.4769129 +0.4658016 Hospital B -0.4643125 +0.4614653 Hospital C -0.4723793 +0.4744526 Hospital D -0.4731788 +0.4686334 @@ -1027,23 +1027,23 @@ Longest: 24

Hospital A -0.4769129 -4548 +0.4658016 +4547 Hospital B -0.4643125 -5324 +0.4614653 +5255 Hospital C -0.4723793 -2299 +0.4744526 +2329 Hospital D -0.4731788 -3020 +0.4686334 +2949 @@ -1063,27 +1063,27 @@ Longest: 24

Escherichia -0.9226119 -0.8988311 -0.9943571 +0.9219045 +0.8950634 +0.9950094 Klebsiella -0.8010204 -0.8903061 -0.9795918 +0.8153846 +0.8935897 +0.9865385 Staphylococcus -0.9263130 -0.9140319 -0.9934675 +0.9176129 +0.9144442 +0.9949828 Streptococcus -0.6162346 +0.6196636 0.0000000 -0.6162346 +0.6196636 diff --git a/docs/articles/AMR_files/figure-html/plot 1-1.png b/docs/articles/AMR_files/figure-html/plot 1-1.png index 18868765..33eec1ad 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 1-1.png and b/docs/articles/AMR_files/figure-html/plot 1-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 3-1.png b/docs/articles/AMR_files/figure-html/plot 3-1.png index 03445ff7..205cf20b 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 3-1.png and b/docs/articles/AMR_files/figure-html/plot 3-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 4-1.png b/docs/articles/AMR_files/figure-html/plot 4-1.png index a37757e6..053f0125 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 4-1.png and b/docs/articles/AMR_files/figure-html/plot 4-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 5-1.png b/docs/articles/AMR_files/figure-html/plot 5-1.png index b39e4d32..1030ab8e 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 5-1.png and b/docs/articles/AMR_files/figure-html/plot 5-1.png differ diff --git a/docs/articles/EUCAST.html b/docs/articles/EUCAST.html index 1389cac4..3300a7ef 100644 --- a/docs/articles/EUCAST.html +++ b/docs/articles/EUCAST.html @@ -40,7 +40,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003
@@ -192,7 +192,7 @@

How to apply EUCAST rules

Matthijs S. Berends

-

22 June 2019

+

23 June 2019

diff --git a/docs/articles/MDR.html b/docs/articles/MDR.html index 1fd50a0a..2db12903 100644 --- a/docs/articles/MDR.html +++ b/docs/articles/MDR.html @@ -40,7 +40,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 @@ -192,7 +192,7 @@

How to determine multi-drug resistance (MDR)

Matthijs S. Berends

-

22 June 2019

+

23 June 2019

@@ -235,19 +235,19 @@

The data set looks like this now:

head(my_TB_data)
 #   rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin
-# 1          S         S            R          S            R            I
-# 2          S         S            R          S            R            S
-# 3          R         R            S          S            S            S
-# 4          S         I            S          I            S            S
-# 5          S         S            I          I            R            R
-# 6          R         R            R          R            R            R
+# 1          R         S            R          S            S            S
+# 2          I         R            S          S            I            S
+# 3          S         R            R          R            S            R
+# 4          R         S            R          R            I            S
+# 5          I         R            R          S            R            S
+# 6          S         S            S          S            R            R
 #   kanamycin
-# 1         R
+# 1         S
 # 2         I
-# 3         R
-# 4         I
-# 5         R
-# 6         I
+# 3 S +# 4 S +# 5 S +# 6 S

We can now add the interpretation of MDR-TB to our data set:

my_TB_data$mdr <- mdr_tb(my_TB_data)
 # NOTE: No column found as input for `col_mo`, assuming all records contain Mycobacterium tuberculosis.
@@ -277,40 +277,40 @@ Unique: 5

1 Mono-resistance -3,284 -65.7% -3,284 -65.7% +3,206 +64.1% +3,206 +64.1% 2 Negative -675 -13.5% -3,959 -79.2% +689 +13.8% +3,895 +77.9% 3 Multidrug resistance -570 -11.4% -4,529 -90.6% +578 +11.6% +4,473 +89.5% 4 Poly-resistance -263 -5.3% -4,792 -95.8% +299 +6.0% +4,772 +95.4% 5 Extensive drug resistance -208 -4.2% +228 +4.6% 5,000 100.0% diff --git a/docs/articles/SPSS.html b/docs/articles/SPSS.html index a169c1cb..bbbf6767 100644 --- a/docs/articles/SPSS.html +++ b/docs/articles/SPSS.html @@ -40,7 +40,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003
@@ -192,7 +192,7 @@

How to import data from SPSS / SAS / Stata

Matthijs S. Berends

-

22 June 2019

+

23 June 2019

diff --git a/docs/articles/WHONET.html b/docs/articles/WHONET.html index 1f2802d0..94c2e162 100644 --- a/docs/articles/WHONET.html +++ b/docs/articles/WHONET.html @@ -40,7 +40,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 @@ -192,7 +192,7 @@

How to work with WHONET data

Matthijs S. Berends

-

22 June 2019

+

23 June 2019

diff --git a/docs/articles/benchmarks.html b/docs/articles/benchmarks.html index 75515ea9..37b86f5a 100644 --- a/docs/articles/benchmarks.html +++ b/docs/articles/benchmarks.html @@ -40,7 +40,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 @@ -192,7 +192,7 @@

Benchmarks

Matthijs S. Berends

-

22 June 2019

+

23 June 2019

@@ -217,14 +217,14 @@ times = 10) print(S.aureus, unit = "ms", signif = 2) # Unit: milliseconds -# expr min lq mean median uq max neval -# as.mo("sau") 18.0 18.0 22 18.0 18.0 63 10 -# as.mo("stau") 66.0 66.0 71 66.0 66.0 110 10 -# as.mo("staaur") 18.0 18.0 18 18.0 18.0 18 10 -# as.mo("STAAUR") 18.0 18.0 18 18.0 18.0 20 10 -# as.mo("S. aureus") 53.0 53.0 70 53.0 55.0 180 10 -# as.mo("S. aureus") 52.0 53.0 73 54.0 97.0 110 10 -# as.mo("Staphylococcus aureus") 8.2 8.2 17 8.3 8.4 53 10
+# expr min lq mean median uq max neval +# as.mo("sau") 17.0 18.0 22.0 18.0 18.0 61.0 10 +# as.mo("stau") 66.0 66.0 75.0 66.0 68.0 110.0 10 +# as.mo("staaur") 17.0 18.0 18.0 18.0 18.0 18.0 10 +# as.mo("STAAUR") 18.0 18.0 32.0 18.0 54.0 80.0 10 +# as.mo("S. aureus") 52.0 53.0 57.0 53.0 53.0 96.0 10 +# as.mo("S. aureus") 52.0 53.0 78.0 53.0 110.0 150.0 10 +# as.mo("Staphylococcus aureus") 8.1 8.1 8.2 8.2 8.2 8.3 10

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.

To achieve this speed, the as.mo 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 Thermus islandicus (B_THERMS_ISL), a bug probably never found before in humans:

T.islandicus <- microbenchmark(as.mo("theisl"),
@@ -236,12 +236,12 @@
 print(T.islandicus, unit = "ms", signif = 2)
 # Unit: milliseconds
 #                         expr min  lq mean median  uq max neval
-#              as.mo("theisl") 400 400  430    430 450 450    10
-#              as.mo("THEISL") 390 400  420    420 450 460    10
-#       as.mo("T. islandicus") 210 210  260    240 270 430    10
-#      as.mo("T.  islandicus") 210 210  250    260 260 270    10
-#  as.mo("Thermus islandicus")  74  75   94     76 120 120    10
-

That takes 7 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 Thermus islandicus) are almost fast - these are the most probable input from most data sets.

+# as.mo("theisl") 390 390 420 440 440 440 10 +# as.mo("THEISL") 390 390 420 440 440 450 10 +# as.mo("T. islandicus") 210 250 250 250 260 270 10 +# as.mo("T. islandicus") 210 210 240 220 250 410 10 +# as.mo("Thermus islandicus") 72 72 82 72 73 120 10 +

That takes 6.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 Thermus islandicus) are almost fast - these are the most probable input from most data sets.

In the figure below, we compare Escherichia coli (which is very common) with Prevotella brevis (which is moderately common) and with Thermus islandicus (which is very uncommon):

par(mar = c(5, 16, 4, 2)) # set more space for left margin text (16)
 
@@ -287,8 +287,8 @@
 print(run_it, unit = "ms", signif = 3)
 # Unit: milliseconds
 #            expr  min   lq mean median   uq  max neval
-#  mo_fullname(x) 1090 1130 1190   1170 1230 1320    10
-

So transforming 500,000 values (!!) of 50 unique values only takes 1.17 seconds (1167 ms). You only lose time on your unique input values.

+# mo_fullname(x) 1120 1140 1190 1180 1210 1260 10 +

So transforming 500,000 values (!!) of 50 unique values only takes 1.18 seconds (1182 ms). You only lose time on your unique input values.

@@ -300,11 +300,11 @@ times = 10) print(run_it, unit = "ms", signif = 3) # Unit: milliseconds -# expr min lq mean median uq max neval -# A 13.00 13.20 13.70 13.60 14.10 14.70 10 -# B 50.40 50.90 57.80 51.80 52.80 104.00 10 -# C 1.72 1.77 1.86 1.83 1.98 2.02 10

-

So going from mo_fullname("Staphylococcus aureus") to "Staphylococcus aureus" takes 0.0018 seconds - it doesn’t even start calculating if the result would be the same as the expected resulting value. That goes for all helper functions:

+# expr min lq mean median uq max neval +# A 12.90 13.1 18.50 13.60 13.90 63.60 10 +# B 49.90 50.1 52.20 51.10 52.20 62.60 10 +# C 1.49 1.7 1.76 1.73 1.96 1.98 10 +

So going from mo_fullname("Staphylococcus aureus") to "Staphylococcus aureus" takes 0.0017 seconds - it doesn’t even start calculating if the result would be the same as the expected resulting value. That goes for all helper functions:

run_it <- microbenchmark(A = mo_species("aureus"),
                          B = mo_genus("Staphylococcus"),
                          C = mo_fullname("Staphylococcus aureus"),
@@ -317,14 +317,14 @@
 print(run_it, unit = "ms", signif = 3)
 # Unit: milliseconds
 #  expr   min    lq  mean median    uq   max neval
-#     A 0.591 0.635 0.719  0.681 0.808 0.968    10
-#     B 0.575 0.643 0.702  0.688 0.738 0.893    10
-#     C 1.550 1.660 1.780  1.730 1.920 2.170    10
-#     D 0.594 0.685 0.725  0.732 0.760 0.928    10
-#     E 0.584 0.614 0.667  0.650 0.730 0.782    10
-#     F 0.473 0.479 0.617  0.629 0.712 0.810    10
-#     G 0.495 0.526 0.576  0.559 0.602 0.756    10
-#     H 0.489 0.519 0.565  0.575 0.607 0.647    10
+# A 0.518 0.544 0.630 0.620 0.683 0.752 10 +# B 0.548 0.650 0.695 0.703 0.728 0.855 10 +# C 1.530 1.600 1.750 1.780 1.880 1.950 10 +# D 0.541 0.640 0.690 0.665 0.728 0.857 10 +# E 0.496 0.545 0.610 0.612 0.680 0.754 10 +# F 0.523 0.547 0.613 0.580 0.701 0.756 10 +# G 0.528 0.547 0.586 0.568 0.600 0.743 10 +# H 0.547 0.553 0.634 0.609 0.670 0.864 10

Of course, when running mo_phylum("Firmicutes") the function has zero knowledge about the actual microorganism, namely S. aureus. But since the result would be "Firmicutes" 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.

@@ -351,13 +351,13 @@ print(run_it, unit = "ms", signif = 4) # Unit: milliseconds # expr min lq mean median uq max neval -# en 43.75 43.82 44.07 43.93 44.28 44.90 10 -# de 45.96 46.09 47.68 46.20 46.65 59.40 10 -# nl 59.57 59.72 64.49 59.88 60.34 104.30 10 -# es 45.82 45.89 50.72 46.30 46.60 90.94 10 -# it 45.77 45.94 55.86 46.46 48.05 96.85 10 -# fr 45.67 45.99 55.17 46.39 46.78 92.03 10 -# pt 45.84 45.92 46.27 46.04 46.36 47.24 10
+# en 43.34 43.72 43.76 43.82 43.93 43.98 10 +# de 45.77 45.82 46.40 45.90 46.21 50.16 10 +# nl 59.12 59.39 60.61 59.81 60.97 65.36 10 +# es 45.35 45.70 55.58 46.30 50.91 90.30 10 +# it 45.54 45.72 47.36 46.02 46.23 57.97 10 +# fr 45.44 45.68 55.49 45.91 46.30 97.86 10 +# pt 45.60 45.68 52.57 45.79 46.17 110.10 10

Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.

diff --git a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png index bf33e9bf..b92bce59 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png differ diff --git a/docs/articles/freq.html b/docs/articles/freq.html index ca20393e..76f11103 100644 --- a/docs/articles/freq.html +++ b/docs/articles/freq.html @@ -40,7 +40,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 @@ -192,7 +192,7 @@

How to create frequency tables

Matthijs S. Berends

-

22 June 2019

+

23 June 2019

diff --git a/docs/articles/index.html b/docs/articles/index.html index fcd5c643..85228423 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9002 + 0.7.1.9003 diff --git a/docs/articles/resistance_predict.html b/docs/articles/resistance_predict.html index d6144d0b..9046de87 100644 --- a/docs/articles/resistance_predict.html +++ b/docs/articles/resistance_predict.html @@ -40,7 +40,7 @@ AMR (for R) - 0.7.1.9002 + 0.7.1.9003 diff --git a/docs/authors.html b/docs/authors.html index bd0ef913..5ff48dac 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9002 + 0.7.1.9003 diff --git a/docs/index.html b/docs/index.html index 1ef7ff79..fa6e8812 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 0.7.1.9002 + 0.7.1.9003 diff --git a/docs/news/index.html b/docs/news/index.html index 85785280..5dbe1e7a 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9002 + 0.7.1.9003 @@ -232,9 +232,15 @@ -
+

-AMR 0.7.1.9002 Unreleased +AMR 0.7.1.9003 Unreleased +

+

(no code changes yet)

+
+
+

+AMR 0.7.1 2019-06-23

@@ -1141,7 +1147,8 @@ Using as.mo(..., allow_uncertain = 3)

Contents

diff --git a/docs/reference/AMR.html b/docs/reference/AMR.html index 05714ec0..579fb8ce 100644 --- a/docs/reference/AMR.html +++ b/docs/reference/AMR.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003
diff --git a/docs/reference/WHOCC.html b/docs/reference/WHOCC.html index 8454fb4b..0b0cceb6 100644 --- a/docs/reference/WHOCC.html +++ b/docs/reference/WHOCC.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003
diff --git a/docs/reference/WHONET.html b/docs/reference/WHONET.html index 9e008a6f..b0daef68 100644 --- a/docs/reference/WHONET.html +++ b/docs/reference/WHONET.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/ab_property.html b/docs/reference/ab_property.html index d8f706cb..2ebc5904 100644 --- a/docs/reference/ab_property.html +++ b/docs/reference/ab_property.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/age.html b/docs/reference/age.html index 77af99da..d598ffe7 100644 --- a/docs/reference/age.html +++ b/docs/reference/age.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/age_groups.html b/docs/reference/age_groups.html index 456531d6..ed164084 100644 --- a/docs/reference/age_groups.html +++ b/docs/reference/age_groups.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/antibiotics.html b/docs/reference/antibiotics.html index dee4f360..71a5ac87 100644 --- a/docs/reference/antibiotics.html +++ b/docs/reference/antibiotics.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/as.ab.html b/docs/reference/as.ab.html index 2db50e4d..0f35c0e8 100644 --- a/docs/reference/as.ab.html +++ b/docs/reference/as.ab.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/as.atc.html b/docs/reference/as.atc.html index dd776413..03d2912a 100644 --- a/docs/reference/as.atc.html +++ b/docs/reference/as.atc.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/as.disk.html b/docs/reference/as.disk.html index bb4b05e0..d9698d72 100644 --- a/docs/reference/as.disk.html +++ b/docs/reference/as.disk.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/as.mic.html b/docs/reference/as.mic.html index f8e985d4..0d1524b3 100644 --- a/docs/reference/as.mic.html +++ b/docs/reference/as.mic.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/as.mo.html b/docs/reference/as.mo.html index 2245273f..9a42e6ac 100644 --- a/docs/reference/as.mo.html +++ b/docs/reference/as.mo.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.1.9002 + 0.7.1.9003 diff --git a/docs/reference/as.rsi.html b/docs/reference/as.rsi.html index 05f0b17a..2fc17921 100644 --- a/docs/reference/as.rsi.html +++ b/docs/reference/as.rsi.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/atc_online.html b/docs/reference/atc_online.html index 7c3285f1..52dea325 100644 --- a/docs/reference/atc_online.html +++ b/docs/reference/atc_online.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/availability.html b/docs/reference/availability.html index f866ab4a..a6a22783 100644 --- a/docs/reference/availability.html +++ b/docs/reference/availability.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/catalogue_of_life.html b/docs/reference/catalogue_of_life.html index 312988b9..a507f2b6 100644 --- a/docs/reference/catalogue_of_life.html +++ b/docs/reference/catalogue_of_life.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/catalogue_of_life_version.html b/docs/reference/catalogue_of_life_version.html index a71d7d5f..b74e7d98 100644 --- a/docs/reference/catalogue_of_life_version.html +++ b/docs/reference/catalogue_of_life_version.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/count.html b/docs/reference/count.html index 5e7b4107..6b507f81 100644 --- a/docs/reference/count.html +++ b/docs/reference/count.html @@ -81,7 +81,7 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/eucast_rules.html b/docs/reference/eucast_rules.html index a5c14893..594f83c2 100644 --- a/docs/reference/eucast_rules.html +++ b/docs/reference/eucast_rules.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/extended-functions.html b/docs/reference/extended-functions.html index 4e94d910..3d8dc804 100644 --- a/docs/reference/extended-functions.html +++ b/docs/reference/extended-functions.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/filter_ab_class.html b/docs/reference/filter_ab_class.html index dd0d78ca..9064b021 100644 --- a/docs/reference/filter_ab_class.html +++ b/docs/reference/filter_ab_class.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/first_isolate.html b/docs/reference/first_isolate.html index 7e573a49..b056313e 100644 --- a/docs/reference/first_isolate.html +++ b/docs/reference/first_isolate.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/freq.html b/docs/reference/freq.html index 6a945861..f1c60e1d 100644 --- a/docs/reference/freq.html +++ b/docs/reference/freq.html @@ -81,7 +81,7 @@ top_freq can be used to get the top/bottom n items of a frequency table, with co AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/g.test.html b/docs/reference/g.test.html index d3f53320..0e0525d6 100644 --- a/docs/reference/g.test.html +++ b/docs/reference/g.test.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/ggplot_rsi.html b/docs/reference/ggplot_rsi.html index abe526b4..b0d45e51 100644 --- a/docs/reference/ggplot_rsi.html +++ b/docs/reference/ggplot_rsi.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/guess_ab_col.html b/docs/reference/guess_ab_col.html index 5a95b56d..6922e3f4 100644 --- a/docs/reference/guess_ab_col.html +++ b/docs/reference/guess_ab_col.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/index.html b/docs/reference/index.html index d8db6860..39ea7893 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9002 + 0.7.1.9003 diff --git a/docs/reference/join.html b/docs/reference/join.html index abe6592f..caaa5c1b 100644 --- a/docs/reference/join.html +++ b/docs/reference/join.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/key_antibiotics.html b/docs/reference/key_antibiotics.html index e9e0ca6c..5002897c 100644 --- a/docs/reference/key_antibiotics.html +++ b/docs/reference/key_antibiotics.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/kurtosis.html b/docs/reference/kurtosis.html index cd67255f..5e1791ce 100644 --- a/docs/reference/kurtosis.html +++ b/docs/reference/kurtosis.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/like.html b/docs/reference/like.html index 608d5ea0..17a7ac50 100644 --- a/docs/reference/like.html +++ b/docs/reference/like.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/mdro.html b/docs/reference/mdro.html index 0c0f2a21..3e92d9f9 100644 --- a/docs/reference/mdro.html +++ b/docs/reference/mdro.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/microorganisms.codes.html b/docs/reference/microorganisms.codes.html index b33f5886..0139b878 100644 --- a/docs/reference/microorganisms.codes.html +++ b/docs/reference/microorganisms.codes.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/microorganisms.html b/docs/reference/microorganisms.html index f8cc6619..1b22753b 100644 --- a/docs/reference/microorganisms.html +++ b/docs/reference/microorganisms.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/microorganisms.old.html b/docs/reference/microorganisms.old.html index fa8e694b..a2ce3acd 100644 --- a/docs/reference/microorganisms.old.html +++ b/docs/reference/microorganisms.old.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/mo_property.html b/docs/reference/mo_property.html index 6d28affc..9ef2c60b 100644 --- a/docs/reference/mo_property.html +++ b/docs/reference/mo_property.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/mo_source.html b/docs/reference/mo_source.html index d0ebf72d..eb3961b4 100644 --- a/docs/reference/mo_source.html +++ b/docs/reference/mo_source.html @@ -81,7 +81,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/p.symbol.html b/docs/reference/p.symbol.html index 7fb8f943..079db613 100644 --- a/docs/reference/p.symbol.html +++ b/docs/reference/p.symbol.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/portion.html b/docs/reference/portion.html index 08601c85..9ee65afa 100644 --- a/docs/reference/portion.html +++ b/docs/reference/portion.html @@ -81,7 +81,7 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/read.4D.html b/docs/reference/read.4D.html index fd5bb3a4..f93a3edf 100644 --- a/docs/reference/read.4D.html +++ b/docs/reference/read.4D.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/resistance_predict.html b/docs/reference/resistance_predict.html index 7abd7cd0..6b9f0e5e 100644 --- a/docs/reference/resistance_predict.html +++ b/docs/reference/resistance_predict.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/rsi_translation.html b/docs/reference/rsi_translation.html index 04680413..862b3ad0 100644 --- a/docs/reference/rsi_translation.html +++ b/docs/reference/rsi_translation.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/septic_patients.html b/docs/reference/septic_patients.html index 08aaed3c..324e72e2 100644 --- a/docs/reference/septic_patients.html +++ b/docs/reference/septic_patients.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/skewness.html b/docs/reference/skewness.html index 92d75cbf..54aaf7bd 100644 --- a/docs/reference/skewness.html +++ b/docs/reference/skewness.html @@ -81,7 +81,7 @@ When negative: the left tail is longer; the mass of the distribution is concentr AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/docs/reference/translate.html b/docs/reference/translate.html index 4e7cce64..676219de 100644 --- a/docs/reference/translate.html +++ b/docs/reference/translate.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9013 + 0.7.1.9003 diff --git a/git_siteonly.sh b/git_siteonly.sh index 7e6470ae..c50b7e51 100755 --- a/git_siteonly.sh +++ b/git_siteonly.sh @@ -6,32 +6,12 @@ # bash git_merge.sh # ####################################################################### -echo "•••••••••••••••••••••" -echo "• Reloading package •" -echo "•••••••••••••••••••••" -Rscript -e "devtools::load_all()" -Rscript -e "devtools::document()" -Rscript -e "devtools::install(quiet = TRUE, dependencies = FALSE)" -echo -echo "•••••••••••••••••" -echo "• Building site •" -echo "•••••••••••••••••" -Rscript -e "suppressMessages(pkgdown::build_site(lazy = TRUE, examples = FALSE))" +bash git_premaster.sh "website update" FALSE echo -read -p "Continue (Y/n)? " choice -case "$choice" in - n|N ) exit 1;; - * ) ;; -esac - -echo -echo "•••••••••••••••••••••••••••" -echo "• Uploading to repository •" -echo "•••••••••••••••••••••••••••" -git add . -git commit -a -m "website update" --quiet -# git push --quiet +echo "••••••••••••••••••••••••••••••" +echo "• Uploading to master branch •" +echo "••••••••••••••••••••••••••••••" git checkout master git merge premaster git push --quiet