mirror of
https://github.com/msberends/AMR.git
synced 2026-11-29 07:26:10 +01:00
Built site for AMR@3.1.0.9010: fdfdada
This commit is contained in:
1 parent
f4e4a814d8
commit
578406c4c9
124 files changed
+575
-446
No files matched your search
@@ -85,31 +85,31 @@ suspicious.
|
||||
sir <- random_sir(10)
|
||||
sir
|
||||
#> Class <sir>
|
||||
#> [1] R S I R R I S R I R
|
||||
#> [1] I I S I R I S S S R
|
||||
mean_amr_distance(sir)
|
||||
#> [1] 0.9486833 -0.9486833 -0.9486833 0.9486833 0.9486833 -0.9486833
|
||||
#> [7] -0.9486833 0.9486833 -0.9486833 0.9486833
|
||||
#> [1] -0.4743416 -0.4743416 -0.4743416 -0.4743416 1.8973666 -0.4743416
|
||||
#> [7] -0.4743416 -0.4743416 -0.4743416 1.8973666
|
||||
|
||||
mic <- random_mic(10)
|
||||
mic
|
||||
#> Class <mic>
|
||||
#> [1] 0.0002 0.032 0.002 8 <=0.0001 0.001 0.5 <=0.0001
|
||||
#> [9] 0.002 0.002
|
||||
#> [1] <=0.0001 64 0.001 64 0.0002 <=0.0001 0.008 0.064
|
||||
#> [9] 0.0002 0.125
|
||||
mean_amr_distance(mic)
|
||||
#> [1] -0.8220689 0.5401854 -0.2040199 2.0222300 -1.0081203 -0.3900712
|
||||
#> [7] 1.2780248 -1.0081203 -0.2040199 -0.2040199
|
||||
#> [1] -0.9348351 1.6473085 -0.4901118 1.6473085 -0.8009600 -0.9348351
|
||||
#> [7] -0.0884866 0.3131386 -0.8009600 0.4424330
|
||||
# equal to the Z-score of their log2:
|
||||
(log2(mic) - mean(log2(mic))) / sd(log2(mic))
|
||||
#> [1] -0.8220689 0.5401854 -0.2040199 2.0222300 -1.0081203 -0.3900712
|
||||
#> [7] 1.2780248 -1.0081203 -0.2040199 -0.2040199
|
||||
#> [1] -0.9348351 1.6473085 -0.4901118 1.6473085 -0.8009600 -0.9348351
|
||||
#> [7] -0.0884866 0.3131386 -0.8009600 0.4424330
|
||||
|
||||
disk <- random_disk(10)
|
||||
disk
|
||||
#> Class <disk>
|
||||
#> [1] 49 26 48 42 31 50 13 43 50 35
|
||||
#> [1] 43 46 40 43 47 47 50 20 46 31
|
||||
mean_amr_distance(disk)
|
||||
#> [1] 0.8341912 -1.0285658 0.7532018 0.2672651 -0.6236187 0.9151806
|
||||
#> [7] -2.0814285 0.3482546 0.9151806 -0.2996609
|
||||
#> [1] 0.1859655 0.5141399 -0.1422089 0.1859655 0.6235314 0.6235314
|
||||
#> [7] 0.9517058 -2.3300383 0.5141399 -1.1267321
|
||||
|
||||
y <- data.frame(
|
||||
id = LETTERS[1:10],
|
||||
@@ -120,35 +120,35 @@ y <- data.frame(
|
||||
)
|
||||
y
|
||||
#> id amox cipr gent tobr
|
||||
#> 1 A S 24 4 2
|
||||
#> 2 B I 27 4 2
|
||||
#> 3 C S 18 4 2
|
||||
#> 4 D S 30 4 <=1
|
||||
#> 5 E I 23 4 2
|
||||
#> 6 F I 19 4 2
|
||||
#> 7 G R 23 4 <=1
|
||||
#> 8 H I 28 4 <=1
|
||||
#> 9 I R 28 4 <=1
|
||||
#> 10 J I 26 4 <=1
|
||||
#> 1 A I 31 16 4
|
||||
#> 2 B S 30 <=8 <=2
|
||||
#> 3 C S 27 <=8 <=2
|
||||
#> 4 D S 32 <=8 <=2
|
||||
#> 5 E R 27 <=8 <=2
|
||||
#> 6 F I 32 <=8 4
|
||||
#> 7 G R 26 <=8 <=2
|
||||
#> 8 H R 30 16 4
|
||||
#> 9 I I 19 <=8 <=2
|
||||
#> 10 J S 19 <=8 <=2
|
||||
mean_amr_distance(y)
|
||||
#> ℹ Calculating mean AMR distance based on columns "amox", "cipr", "gent", and
|
||||
#> "tobr"
|
||||
#> [1] 0.10747691 0.36066176 -0.39889277 -0.01860893 0.02308197 -0.31449782
|
||||
#> [7] 0.18119585 -0.18739883 0.60317059 -0.35618872
|
||||
#> [1] 0.87190417 -0.29007013 -0.44456433 -0.18707400 0.07298484 0.33047517
|
||||
#> [7] 0.02148677 1.33795527 -0.85654887 -0.85654887
|
||||
y$amr_distance <- mean_amr_distance(y, is.mic(y))
|
||||
#> ℹ Calculating mean AMR distance based on columns "gent" and "tobr"
|
||||
y[order(y$amr_distance), ]
|
||||
#> id amox cipr gent tobr amr_distance
|
||||
#> 4 D S 30 4 <=1 -0.9486833
|
||||
#> 7 G R 23 4 <=1 -0.9486833
|
||||
#> 8 H I 28 4 <=1 -0.9486833
|
||||
#> 9 I R 28 4 <=1 -0.9486833
|
||||
#> 10 J I 26 4 <=1 -0.9486833
|
||||
#> 1 A S 24 4 2 0.9486833
|
||||
#> 2 B I 27 4 2 0.9486833
|
||||
#> 3 C S 18 4 2 0.9486833
|
||||
#> 5 E I 23 4 2 0.9486833
|
||||
#> 6 F I 19 4 2 0.9486833
|
||||
#> 2 B S 30 <=8 <=2 -0.5477003
|
||||
#> 3 C S 27 <=8 <=2 -0.5477003
|
||||
#> 4 D S 32 <=8 <=2 -0.5477003
|
||||
#> 5 E R 27 <=8 <=2 -0.5477003
|
||||
#> 7 G R 26 <=8 <=2 -0.5477003
|
||||
#> 9 I I 19 <=8 <=2 -0.5477003
|
||||
#> 10 J S 19 <=8 <=2 -0.5477003
|
||||
#> 6 F I 32 <=8 4 0.4873980
|
||||
#> 1 A I 31 16 4 1.6732521
|
||||
#> 8 H R 30 16 4 1.6732521
|
||||
|
||||
if (require("dplyr")) {
|
||||
y %>%
|
||||
@@ -161,16 +161,16 @@ if (require("dplyr")) {
|
||||
#> ℹ Calculating mean AMR distance based on columns "amox", "cipr", "gent", and
|
||||
#> "tobr"
|
||||
#> id amox cipr gent tobr amr_distance check_id_C
|
||||
#> 1 C S 18 4 2 -0.39889277 0.00000000
|
||||
#> 2 J I 26 4 <=1 -0.35618872 0.04270405
|
||||
#> 3 F I 19 4 2 -0.31449782 0.08439495
|
||||
#> 4 H I 28 4 <=1 -0.18739883 0.21149394
|
||||
#> 5 D S 30 4 <=1 -0.01860893 0.38028384
|
||||
#> 6 E I 23 4 2 0.02308197 0.42197474
|
||||
#> 7 A S 24 4 2 0.10747691 0.50636968
|
||||
#> 8 G R 23 4 <=1 0.18119585 0.58008862
|
||||
#> 9 B I 27 4 2 0.36066176 0.75955453
|
||||
#> 10 I R 28 4 <=1 0.60317059 1.00206336
|
||||
#> 1 C S 27 <=8 <=2 -0.44456433 0.0000000
|
||||
#> 2 B S 30 <=8 <=2 -0.29007013 0.1544942
|
||||
#> 3 D S 32 <=8 <=2 -0.18707400 0.2574903
|
||||
#> 4 I I 19 <=8 <=2 -0.85654887 0.4119845
|
||||
#> 5 J S 19 <=8 <=2 -0.85654887 0.4119845
|
||||
#> 6 G R 26 <=8 <=2 0.02148677 0.4660511
|
||||
#> 7 E R 27 <=8 <=2 0.07298484 0.5175492
|
||||
#> 8 F I 32 <=8 4 0.33047517 0.7750395
|
||||
#> 9 A I 31 16 4 0.87190417 1.3164685
|
||||
#> 10 H R 30 16 4 1.33795527 1.7825196
|
||||
if (require("dplyr")) {
|
||||
# support for groups
|
||||
example_isolates %>%
|
||||
|
||||
Reference in new issue
Block a user