diff --git a/DESCRIPTION b/DESCRIPTION index 89fc22f1..9aa19876 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.8.0 -Date: 2019-10-15 +Version: 0.8.0.9000 +Date: 2019-10-16 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index cd122d95..172eae0d 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,12 @@ -# AMR 0.8.0 +# AMR 0.8.0.9000 +Last updated: 16-Oct-2019 +### New + +### Changes + + +# AMR 0.8.0 ### Breaking * Determination of first isolates now **excludes** all 'unknown' microorganisms at default, i.e. microbial code `"UNKNOWN"`. They can be included with the new parameter `include_unknown`: diff --git a/docs/404.html b/docs/404.html index ddedb2ac..5d5331de 100644 --- a/docs/404.html +++ b/docs/404.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9107 + 0.8.0.9000 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 768a238d..2cef744e 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9107 + 0.8.0.9000 diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index 59dfd80e..dce1f69e 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -187,7 +187,7 @@

How to conduct AMR analysis

Matthijs S. Berends

-

13 October 2019

+

16 October 2019

@@ -196,7 +196,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 13 October 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 16 October 2019.

Introduction

@@ -212,21 +212,21 @@ -2019-10-13 +2019-10-16 abcd Escherichia coli S S -2019-10-13 +2019-10-16 abcd Escherichia coli S R -2019-10-13 +2019-10-16 efgh Escherichia coli R @@ -321,20 +321,42 @@ -2011-07-28 -N6 -Hospital C +2012-05-14 +G6 +Hospital B Escherichia coli R -R -R S -F +R +R +M -2012-08-16 -Q6 -Hospital C +2012-03-26 +F8 +Hospital B +Staphylococcus aureus +S +S +S +S +M + + +2010-04-06 +F7 +Hospital B +Escherichia coli +I +S +R +R +M + + +2016-05-08 +O1 +Hospital B Escherichia coli S S @@ -343,48 +365,26 @@ F -2017-05-07 -G5 +2017-05-22 +T6 Hospital A Staphylococcus aureus -S -S -S R -M +S +S +S +F -2015-10-29 -V10 +2012-06-06 +X7 Hospital D -Escherichia coli -S -S -S -S -F - - -2013-08-21 -U1 -Hospital A -Escherichia coli -R -S -R -S -F - - -2017-06-24 -K6 -Hospital A Staphylococcus aureus R S S S -M +F @@ -407,8 +407,8 @@ # # Item Count Percent Cum. Count Cum. Percent # --- ----- ------- -------- ----------- ------------- -# 1 M 10,399 52.00% 10,399 52.00% -# 2 F 9,601 48.01% 20,000 100.00% +# 1 M 10,380 51.9% 10,380 51.9% +# 2 F 9,620 48.1% 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 %>%
@@ -438,14 +438,14 @@
 # Pasteurella multocida (no changes)
 # Staphylococcus (no changes)
 # Streptococcus groups A, B, C, G (no changes)
-# Streptococcus pneumoniae (1,461 values changed)
+# Streptococcus pneumoniae (1,483 values changed)
 # Viridans group streptococci (no changes)
 # 
 # EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)
-# Table 01: Intrinsic resistance in Enterobacteriaceae (1,290 values changed)
+# Table 01: Intrinsic resistance in Enterobacteriaceae (1,268 values changed)
 # Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)
 # Table 03: Intrinsic resistance in other Gram-negative bacteria (no changes)
-# Table 04: Intrinsic resistance in Gram-positive bacteria (2,724 values changed)
+# Table 04: Intrinsic resistance in Gram-positive bacteria (2,755 values changed)
 # Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)
 # Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no changes)
 # Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no changes)
@@ -453,24 +453,24 @@
 # Table 13: Interpretive rules for quinolones (no changes)
 # 
 # Other rules
-# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2,293 values changed)
-# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (126 values changed)
+# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2,282 values changed)
+# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (122 values changed)
 # Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no changes)
 # Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no changes)
 # Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no changes)
 # Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no changes)
 # 
 # --------------------------------------------------------------------------
-# EUCAST rules affected 6,534 out of 20,000 rows, making a total of 7,894 edits
+# EUCAST rules affected 6,530 out of 20,000 rows, making a total of 7,910 edits
 # => added 0 test results
 # 
-# => changed 7,894 test results
-#    - 126 test results changed from S to I
-#    - 4,707 test results changed from S to R
-#    - 1,073 test results changed from I to S
-#    - 317 test results changed from I to R
-#    - 1,653 test results changed from R to S
-#    - 18 test results changed from R to I
+# => changed 7,910 test results
+#    - 109 test results changed from S to I
+#    - 4,678 test results changed from S to R
+#    - 1,098 test results changed from I to S
+#    - 322 test results changed from I to R
+#    - 1,676 test results changed from R to S
+#    - 27 test results changed from R to I
 # --------------------------------------------------------------------------
 # 
 # Use eucast_rules(..., verbose = TRUE) (on your original data) to get a data.frame with all specified edits instead.
@@ -498,8 +498,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,663 first isolates (28.3% of total)
-

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

+# => Found 5,688 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:

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

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

@@ -509,7 +509,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 X9, 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 I4, sorted on date:

@@ -525,8 +525,8 @@ - - + + @@ -536,10 +536,10 @@ - - + + - + @@ -547,8 +547,8 @@ - - + + @@ -558,10 +558,10 @@ - - + + - + @@ -569,8 +569,8 @@ - - + + @@ -580,30 +580,30 @@ - - + + - - - - - - - - - - - - + + + + + + + + + + + + - - + + @@ -613,21 +613,21 @@ - - + + - + - - + + - + @@ -635,7 +635,7 @@
isolate
12010-01-31X92010-02-10I4 B_ESCHR_COLI R S
22010-04-03X92010-02-19I4 B_ESCHR_COLIIS S S S
32010-05-12X92010-03-09I4 B_ESCHR_COLI S S
42010-08-29X92010-04-06I4 B_ESCHR_COLIRI S R S
52011-01-07X92010-07-14I4 B_ESCHR_COLI S S
62011-04-20X92010-08-03I4 B_ESCHR_COLISSSSTRUE
72011-06-24X9B_ESCHR_COLIRI S R R FALSE
72010-09-19I4B_ESCHR_COLISSSSFALSE
82011-07-10X92010-09-19I4 B_ESCHR_COLI S S
92011-11-07X92010-10-05I4 B_ESCHR_COLI S S SRS FALSE
102011-12-20X92010-12-30I4 B_ESCHR_COLIRS S S S
-

Only 2 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The key_antibiotics() function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.

+

Only 1 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The key_antibiotics() function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.

If a column exists with a name like ‘key(…)ab’ the first_isolate() function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:

data <- data %>% 
   mutate(keyab = key_antibiotics(.)) %>% 
@@ -646,7 +646,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,141 first weighted isolates (75.7% of total)
+# => Found 15,143 first weighted isolates (75.7% of total)
@@ -663,8 +663,8 @@ - - + + @@ -675,20 +675,20 @@ - - + + - + - + - - + + @@ -699,10 +699,10 @@ - - + + - + @@ -711,8 +711,8 @@ - - + + @@ -723,71 +723,71 @@ - - + + + - - - - + + + - - + + - - - + + + - - + + - + - - + + - + + - - - + + - + - +
isolate
12010-01-31X92010-02-10I4 B_ESCHR_COLI R S
22010-04-03X92010-02-19I4 B_ESCHR_COLIIS S S S FALSEFALSETRUE
32010-05-12X92010-03-09I4 B_ESCHR_COLI S S
42010-08-29X92010-04-06I4 B_ESCHR_COLIRI S R S
52011-01-07X92010-07-14I4 B_ESCHR_COLI S S
62011-04-20X92010-08-03I4 B_ESCHR_COLII SSSSTRUERRFALSE TRUE
72011-06-24X92010-09-19I4 B_ESCHR_COLIR SRRSSS FALSE TRUE
82011-07-10X92010-09-19I4 B_ESCHR_COLI S S S S FALSETRUEFALSE
92011-11-07X92010-10-05I4 B_ESCHR_COLI S S SRSFALSE FALSETRUE
102011-12-20X92010-12-30I4 B_ESCHR_COLIRS S S S FALSETRUEFALSE
-

Instead of 2, now 8 isolates are flagged. In total, 75.7% of all isolates are marked ‘first weighted’ - 47.4% 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 6 isolates are flagged. In total, 75.7% of all isolates are marked ‘first weighted’ - 47.3% 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,141 isolates for analysis.

+

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

We can remove unneeded columns:

data_1st <- data_1st %>% 
   select(-c(first, keyab))
@@ -795,6 +795,7 @@
head(data_1st)
+ @@ -811,95 +812,101 @@ - - - + + + + - - - + + + - - - + + + + + - - - - + + + - - + + + - - - - + + + + - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
date patient_id hospital
2011-07-28N6Hospital C12012-05-14G6Hospital B B_ESCHR_COLI RRR SFRRM Gram-negative Escherichia coli TRUE
2012-08-16Q6Hospital C32010-04-06F7Hospital B B_ESCHR_COLII SSSSFRRM Gram-negative Escherichia coli TRUE
2017-05-07G552017-05-22T6 Hospital A B_STPHY_AURSSSS RMSSSF Gram-positive Staphylococcus aureus TRUE
2015-10-29V1062012-06-06X7 Hospital DB_ESCHR_COLISSSSFGram-negativeEscherichiacoliTRUE
2013-08-21U1Hospital AB_ESCHR_COLIRSRSFGram-negativeEscherichiacoliTRUE
2017-06-24K6Hospital A B_STPHY_AURS R S S SMF Gram-positive Staphylococcus aureus TRUE
72010-02-15O1Hospital AB_STPHY_AURSSSRSFGram-positiveStaphylococcusaureusTRUE
92016-11-25C6Hospital BB_ESCHR_COLISSSSMGram-negativeEscherichiacoliTRUE

Time for the analysis!

@@ -919,7 +926,7 @@
data_1st %>% freq(genus, species)

Frequency table

Class: character
-Length: 15,141 (of which NA: 0 = 0%)
+Length: 15,143 (of which NA: 0 = 0%)
Unique: 4

Shortest: 16
Longest: 24

@@ -936,33 +943,33 @@ Longest: 24

1 Escherichia coli -7,470 -49.34% -7,470 -49.34% +7,512 +49.61% +7,512 +49.61% 2 Staphylococcus aureus -3,803 -25.12% -11,273 -74.45% +3,819 +25.22% +11,331 +74.83% 3 Streptococcus pneumoniae -2,290 -15.12% -13,563 -89.58% +2,243 +14.81% +13,574 +89.64% 4 Klebsiella pneumoniae -1,578 -10.42% -15,141 +1,569 +10.36% +15,143 100.00% @@ -973,7 +980,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.4656231
+# [1] 0.4667503

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

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

Hospital A -0.4748959 +0.4672547 Hospital B -0.4543224 +0.4670225 Hospital C -0.4659041 +0.4648625 Hospital D -0.4712529 +0.4669489 @@ -1016,23 +1023,23 @@ Longest: 24

Hospital A -0.4748959 -4561 +0.4672547 +4535 Hospital B -0.4543224 -5298 +0.4670225 +5246 Hospital C -0.4659041 -2273 +0.4648625 +2291 Hospital D -0.4712529 -3009 +0.4669489 +3071 @@ -1052,27 +1059,27 @@ Longest: 24

Escherichia -0.9285141 -0.8966533 -0.9929050 +0.9247870 +0.8880458 +0.9928115 Klebsiella -0.8225602 -0.9017744 -0.9866920 +0.8132569 +0.8986616 +0.9859783 Staphylococcus -0.9250592 -0.9261110 -0.9968446 +0.9138518 +0.9185651 +0.9934538 Streptococcus -0.6200873 +0.6290682 0.0000000 -0.6200873 +0.6290682 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 fca887cd..a144724e 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 b8ebcdbd..20422eb8 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 1324b492..a48b12f0 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 9283f3d8..a83c0cd7 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 6dc6f418..f526acd5 100644 --- a/docs/articles/EUCAST.html +++ b/docs/articles/EUCAST.html @@ -187,7 +187,7 @@

How to apply EUCAST rules

Matthijs S. Berends

-

13 October 2019

+

16 October 2019

diff --git a/docs/articles/MDR.html b/docs/articles/MDR.html index 5c47c259..358937dc 100644 --- a/docs/articles/MDR.html +++ b/docs/articles/MDR.html @@ -187,7 +187,7 @@

How to determine multi-drug resistance (MDR)

Matthijs S. Berends

-

13 October 2019

+

16 October 2019

@@ -230,18 +230,18 @@

The data set looks like this now:

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

my_TB_data$mdr <- mdr_tb(my_TB_data)
@@ -275,40 +275,40 @@ Unique: 5

1 Mono-resistant -3246 -64.92% -3246 -64.92% +3276 +65.52% +3276 +65.52% 2 Negative -681 -13.62% -3927 -78.54% +658 +13.16% +3934 +78.68% 3 Multi-drug-resistant -593 -11.86% -4520 -90.40% +616 +12.32% +4550 +91.00% 4 Poly-resistant -276 -5.52% -4796 -95.92% +256 +5.12% +4806 +96.12% 5 Extensive drug-resistant -204 -4.08% +194 +3.88% 5000 100.00% diff --git a/docs/articles/SPSS.html b/docs/articles/SPSS.html index 6d83ebb3..fc505d82 100644 --- a/docs/articles/SPSS.html +++ b/docs/articles/SPSS.html @@ -187,7 +187,7 @@

How to import data from SPSS / SAS / Stata

Matthijs S. Berends

-

13 October 2019

+

16 October 2019

diff --git a/docs/articles/WHONET.html b/docs/articles/WHONET.html index 21c490ca..37e1556e 100644 --- a/docs/articles/WHONET.html +++ b/docs/articles/WHONET.html @@ -187,7 +187,7 @@

How to work with WHONET data

Matthijs S. Berends

-

13 October 2019

+

16 October 2019

diff --git a/docs/articles/benchmarks.html b/docs/articles/benchmarks.html index db624434..8016368f 100644 --- a/docs/articles/benchmarks.html +++ b/docs/articles/benchmarks.html @@ -187,7 +187,7 @@

Benchmarks

Matthijs S. Berends

-

13 October 2019

+

16 October 2019

@@ -221,36 +221,21 @@ times = 10) print(S.aureus, unit = "ms", signif = 2) # Unit: milliseconds -# expr min lq mean median uq max -# as.mo("sau") 9.5 9.7 15 10 11 34 -# as.mo("stau") 31.0 32.0 38 33 34 62 -# as.mo("STAU") 31.0 32.0 39 35 39 56 -# as.mo("staaur") 9.6 10.0 17 11 31 31 -# as.mo("STAAUR") 9.6 9.8 13 10 10 34 -# as.mo("S. aureus") 24.0 25.0 27 25 28 33 -# as.mo("S aureus") 24.0 25.0 31 25 43 51 -# as.mo("Staphylococcus aureus") 29.0 30.0 32 31 34 39 -# as.mo("Staphylococcus aureus (MRSA)") 550.0 580.0 610 600 620 680 -# as.mo("Sthafilokkockus aaureuz") 290.0 310.0 360 340 380 530 -# as.mo("MRSA") 9.6 10.0 16 10 30 32 -# as.mo("VISA") 19.0 20.0 21 20 21 22 -# as.mo("VRSA") 20.0 20.0 26 21 24 46 -# as.mo(22242419) 18.0 18.0 19 19 19 22 -# neval -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10 -# 10
+# expr min lq mean median uq max neval +# as.mo("sau") 9.9 10 14 11 12 35 10 +# as.mo("stau") 33.0 33 39 38 39 52 10 +# as.mo("STAU") 32.0 36 44 38 56 68 10 +# as.mo("staaur") 10.0 10 13 11 11 34 10 +# as.mo("STAAUR") 10.0 11 19 12 33 42 10 +# as.mo("S. aureus") 25.0 26 32 28 32 53 10 +# as.mo("S aureus") 24.0 25 31 27 30 52 10 +# as.mo("Staphylococcus aureus") 31.0 32 39 34 38 84 10 +# as.mo("Staphylococcus aureus (MRSA)") 610.0 640 680 680 710 770 10 +# as.mo("Sthafilokkockus aaureuz") 330.0 340 350 350 360 370 10 +# as.mo("MRSA") 9.8 10 13 11 12 34 10 +# as.mo("VISA") 20.0 22 29 24 31 57 10 +# as.mo("VRSA") 20.0 20 29 23 42 47 10 +# as.mo(22242419) 21.0 23 30 25 43 47 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 Methanosarcina semesiae (B_MTHNSR_SEMS), a bug probably never found before in humans:

@@ -262,19 +247,19 @@ times = 10) print(M.semesiae, unit = "ms", signif = 4) # Unit: milliseconds -# expr min lq mean median uq -# as.mo("metsem") 1293.00 1304.00 1394.00 1316.00 1395.00 -# as.mo("METSEM") 1232.00 1278.00 1510.00 1309.00 1518.00 -# as.mo("M. semesiae") 1874.00 1928.00 2063.00 1961.00 2167.00 -# as.mo("M. semesiae") 1883.00 1926.00 2091.00 1978.00 2060.00 -# as.mo("Methanosarcina semesiae") 30.23 31.64 35.26 31.82 38.29 +# expr min lq mean median uq +# as.mo("metsem") 1343.00 1385.00 1398.00 1403.00 1418.0 +# as.mo("METSEM") 1299.00 1356.00 1397.00 1396.00 1442.0 +# as.mo("M. semesiae") 1892.00 2028.00 2052.00 2041.00 2084.0 +# as.mo("M. semesiae") 1990.00 2017.00 2062.00 2032.00 2094.0 +# as.mo("Methanosarcina semesiae") 32.63 33.24 38.58 35.82 40.2 # max neval -# 1929.00 10 -# 2721.00 10 -# 2676.00 10 -# 2974.00 10 -# 52.65 10 -

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

+# 1437.00 10 +# 1488.00 10 +# 2169.00 10 +# 2245.00 10 +# 57.04 10 +

That takes 14.3 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 Methanosarcina semesiae) 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 Methanosarcina semesiae (which is uncommon):

In reality, the as.mo() functions learns from its own output to speed up determinations for next times. In above figure, this effect was disabled to show the difference with the boxplot below - when you would use as.mo() yourself:

@@ -311,8 +296,8 @@ print(run_it, unit = "ms", signif = 3) # Unit: milliseconds # expr min lq mean median uq max neval -# mo_name(x) 596 604 651 641 663 813 10 -

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

+# mo_name(x) 645 661 683 672 686 771 10 +

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

@@ -324,10 +309,10 @@ times = 10) print(run_it, unit = "ms", signif = 3) # Unit: milliseconds -# expr min lq mean median uq max neval -# A 6.300 6.460 6.79 6.500 6.810 8.32 10 -# B 24.600 24.700 28.70 25.600 26.600 51.30 10 -# C 0.778 0.828 0.93 0.854 0.872 1.63 10

+# expr min lq mean median uq max neval +# A 6.380 6.530 7.750 7.180 8.21 11.30 10 +# B 24.300 25.500 30.400 26.900 31.60 54.80 10 +# C 0.803 0.827 0.926 0.869 0.95 1.22 10

So going from mo_name("Staphylococcus aureus") to "Staphylococcus aureus" takes 0.0009 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"),
@@ -341,14 +326,14 @@
 print(run_it, unit = "ms", signif = 3)
 # Unit: milliseconds
 #  expr   min    lq  mean median    uq   max neval
-#     A 0.457 0.463 0.477  0.476 0.483 0.511    10
-#     B 0.486 0.496 0.508  0.499 0.512 0.569    10
-#     C 0.781 0.803 0.825  0.829 0.847 0.854    10
-#     D 0.479 0.495 0.528  0.510 0.517 0.749    10
-#     E 0.457 0.464 0.484  0.475 0.498 0.547    10
-#     F 0.458 0.464 0.472  0.468 0.477 0.496    10
-#     G 0.446 0.453 0.462  0.459 0.467 0.499    10
-#     H 0.426 0.458 0.467  0.467 0.472 0.507    10
+# A 0.509 0.530 0.681 0.565 0.661 1.630 10 +# B 0.518 0.526 0.598 0.553 0.564 0.875 10 +# C 0.848 0.882 1.100 0.990 1.180 1.920 10 +# D 0.566 0.592 0.734 0.714 0.765 1.120 10 +# E 0.486 0.522 0.555 0.542 0.551 0.681 10 +# F 0.466 0.493 0.598 0.553 0.586 1.110 10 +# G 0.462 0.498 0.598 0.525 0.671 0.921 10 +# H 0.480 0.489 0.566 0.508 0.628 0.756 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.

@@ -374,14 +359,14 @@ times = 10) print(run_it, unit = "ms", signif = 4) # Unit: milliseconds -# expr min lq mean median uq max neval -# en 19.99 20.17 25.15 20.21 22.19 43.86 10 -# de 21.17 21.47 26.00 21.51 21.85 44.12 10 -# nl 26.69 26.71 27.24 27.10 27.80 28.04 10 -# es 21.20 21.36 24.26 21.51 21.85 43.76 10 -# it 21.09 21.24 26.27 21.59 22.46 46.14 10 -# fr 21.16 21.35 23.98 21.51 22.11 44.93 10 -# pt 21.10 21.13 21.35 21.28 21.37 22.24 10
+# expr min lq mean median uq max neval +# en 20.01 20.76 28.07 22.47 29.04 54.04 10 +# de 21.95 22.28 26.91 22.72 24.24 58.36 10 +# nl 27.57 27.96 47.86 31.50 54.01 149.80 10 +# es 22.08 22.13 28.59 24.11 26.45 58.61 10 +# it 21.73 22.33 25.39 25.30 26.90 29.57 10 +# fr 22.23 22.98 24.95 23.45 23.70 34.08 10 +# pt 22.02 23.03 24.80 24.37 27.14 28.33 10

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

diff --git a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-11-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-11-1.png index 0a8e05ae..b1ec4b1d 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-11-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-11-1.png differ 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 573a5c9a..3bc10897 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/benchmarks_files/figure-html/unnamed-chunk-9-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-9-1.png index 99e3e3cd..e85fcf12 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-9-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-9-1.png differ diff --git a/docs/articles/index.html b/docs/articles/index.html index b6858dc1..676662c1 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9107 + 0.8.0.9000 diff --git a/docs/articles/resistance_predict.html b/docs/articles/resistance_predict.html index 3c84e184..3ad919fe 100644 --- a/docs/articles/resistance_predict.html +++ b/docs/articles/resistance_predict.html @@ -187,7 +187,7 @@

How to predict antimicrobial resistance

Matthijs S. Berends

-

13 October 2019

+

16 October 2019

diff --git a/docs/authors.html b/docs/authors.html index 1f5f1a2c..177d3ba1 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9107 + 0.8.0.9000 diff --git a/docs/index.html b/docs/index.html index cb38fd10..c3c2d404 100644 --- a/docs/index.html +++ b/docs/index.html @@ -45,7 +45,7 @@ AMR (for R) - 0.7.1.9107 + 0.8.0.9000 @@ -196,7 +196,7 @@

What is AMR (for R)?

-

AMR is a free and open-source R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. Since its first public release in early 2018, this package has been downloaded over 20,000 times from more than 40 countries (source: CRAN logs, 2019).

+

AMR is a free and open-source R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. Since its first public release in early 2018, this package has been downloaded over 25,000 times from more than 60 countries (source: CRAN logs, 2019).

After installing this package, R knows ~70,000 microorganisms (distinct microbial species) and ~450 antibiotics by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data.

We created this package for both routine analysis and academic research (as part of our PhD theses) at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology & Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is actively maintained and is free software (see Copyright).

Used to SPSS? Read our tutorial on how to import data from SPSS, SAS or Stata.

diff --git a/docs/news/index.html b/docs/news/index.html index 2230a9ef..fa69d25f 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9107 + 0.8.0.9000
@@ -231,11 +231,24 @@ -
+

-AMR 0.7.1.9107 Unreleased +AMR 0.8.0.9000 Unreleased +

+

Last updated: 16-Oct-2019

+
+

+New

+
+
+

+Changes

+
+
+
+

+AMR 0.8.0 2019-10-15

-

Last updated: 15-Oct-2019

Breaking

@@ -262,9 +275,9 @@ This is important, because a value like "testvalue" could never be
  • Renamed data set septic_patients to example_isolates

  • -
    +

    -New

    +New
    • Function bug_drug_combinations() to quickly get a data.frame with the results of all bug-drug combinations in a data set. The column containing microorganism codes is guessed automatically and its input is transformed with mo_shortname() at default:

      @@ -387,9 +400,9 @@ Since this is a major change, usage of the old also_single_tested w

      AMR 0.7.1 2019-06-23

      -
      +

      -New

      +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:

        @@ -468,9 +481,9 @@ Since this is a major change, usage of the old also_single_tested w

        AMR 0.7.0 2019-06-03

        -
        +

        -New

        +New
        • Support for translation of disk diffusion and MIC values to RSI values (i.e. antimicrobial interpretations). Supported guidelines are EUCAST (2011 to 2019) and CLSI (2011 to 2019). Use as.rsi() on an MIC value (created with as.mic()), a disk diffusion value (created with the new as.disk()) or on a complete date set containing columns with MIC or disk diffusion values.
        • Function mo_name() as alias of mo_fullname() @@ -585,9 +598,9 @@ Please +

          -New

          +New
          • BREAKING: removed deprecated functions, parameters and references to ‘bactid’. Use as.mo() to identify an MO code.
          • @@ -812,9 +825,9 @@ Using as.mo(..., allow_uncertain = 3) AMR 0.5.0 2018-11-30 -
            +

            -New

            +New
            • Repository moved to GitLab: https://gitlab.com/msberends/AMR
            • @@ -939,9 +952,9 @@ Using as.mo(..., allow_uncertain = 3) AMR 0.4.0 2018-10-01 -
              +

              -New

              +New
              • The data set microorganisms now contains all microbial taxonomic data from ITIS (kingdoms Bacteria, Fungi and Protozoa), the Integrated Taxonomy Information System, available via https://itis.gov. The data set now contains more than 18,000 microorganisms with all known bacteria, fungi and protozoa according ITIS with genus, species, subspecies, family, order, class, phylum and subkingdom. The new data set microorganisms.old contains all previously known taxonomic names from those kingdoms.
              • New functions based on the existing function mo_property: @@ -1074,9 +1087,9 @@ Using as.mo(..., allow_uncertain = 3) AMR 0.3.0 2018-08-14 -
                +

                -New

                +New
                • BREAKING: rsi_df was removed in favour of new functions portion_R, portion_IR, portion_I, portion_SI and portion_S to selectively calculate resistance or susceptibility. These functions are 20 to 30 times faster than the old rsi function. The old function still works, but is deprecated. @@ -1211,9 +1224,9 @@ Using as.mo(..., allow_uncertain = 3) AMR 0.2.0 2018-05-03 -
                  +

                  -New

                  +New
                  • Full support for Windows, Linux and macOS
                  • Full support for old R versions, only R-3.0.0 (April 2013) or later is needed (needed packages may have other dependencies)
                  • @@ -1292,7 +1305,8 @@ Using as.mo(..., allow_uncertain = 3)

                    Contents

                  diff --git a/index.md b/index.md index 0f0f5448..082371c7 100644 --- a/index.md +++ b/index.md @@ -6,7 +6,7 @@ ### What is `AMR` (for R)? -`AMR` is a free and open-source [R package](https://www.r-project.org) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. Since its first public release in early 2018, this package has been downloaded over 20,000 times from more than 40 countries (source: [CRAN logs, 2019](https://cran-logs.rstudio.com)). +`AMR` is a free and open-source [R package](https://www.r-project.org) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. Since its first public release in early 2018, this package has been downloaded over 25,000 times from more than 60 countries (source: [CRAN logs, 2019](https://cran-logs.rstudio.com)). After installing this package, R knows [**~70,000 microorganisms**](./reference/microorganisms.html) (distinct microbial species) and [**~450 antibiotics**](./reference/antibiotics.html) by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data.