mirror of
https://github.com/msberends/AMR.git
synced 2026-11-29 06:46:14 +01:00
Built site for AMR@3.1.0.9011: 944078c
This commit is contained in:
1 parent
578406c4c9
commit
268d60edec
121 files changed
+537
-528
No files matched your search
@@ -85,31 +85,30 @@ suspicious.
|
||||
sir <- random_sir(10)
|
||||
sir
|
||||
#> Class <sir>
|
||||
#> [1] I I S I R I S S S R
|
||||
#> [1] I R R I R I I R I I
|
||||
mean_amr_distance(sir)
|
||||
#> [1] -0.4743416 -0.4743416 -0.4743416 -0.4743416 1.8973666 -0.4743416
|
||||
#> [7] -0.4743416 -0.4743416 -0.4743416 1.8973666
|
||||
#> [1] -0.7745967 1.1618950 1.1618950 -0.7745967 1.1618950 -0.7745967
|
||||
#> [7] -0.7745967 1.1618950 -0.7745967 -0.7745967
|
||||
|
||||
mic <- random_mic(10)
|
||||
mic
|
||||
#> Class <mic>
|
||||
#> [1] <=0.0001 64 0.001 64 0.0002 <=0.0001 0.008 0.064
|
||||
#> [9] 0.0002 0.125
|
||||
#> [1] 0.0005 0.064 0.0005 0.064 0.0005 0.032 0.016 0.064 0.001 32
|
||||
mean_amr_distance(mic)
|
||||
#> [1] -0.9348351 1.6473085 -0.4901118 1.6473085 -0.8009600 -0.9348351
|
||||
#> [7] -0.0884866 0.3131386 -0.8009600 0.4424330
|
||||
#> [1] -0.98118944 0.42148922 -0.98118944 0.42148922 -0.98118944 0.22110656
|
||||
#> [7] 0.02072389 0.42148922 -0.78080678 2.21807699
|
||||
# equal to the Z-score of their log2:
|
||||
(log2(mic) - mean(log2(mic))) / sd(log2(mic))
|
||||
#> [1] -0.9348351 1.6473085 -0.4901118 1.6473085 -0.8009600 -0.9348351
|
||||
#> [7] -0.0884866 0.3131386 -0.8009600 0.4424330
|
||||
#> [1] -0.98118944 0.42148922 -0.98118944 0.42148922 -0.98118944 0.22110656
|
||||
#> [7] 0.02072389 0.42148922 -0.78080678 2.21807699
|
||||
|
||||
disk <- random_disk(10)
|
||||
disk
|
||||
#> Class <disk>
|
||||
#> [1] 43 46 40 43 47 47 50 20 46 31
|
||||
#> [1] 50 24 48 45 42 45 39 47 39 18
|
||||
mean_amr_distance(disk)
|
||||
#> [1] 0.1859655 0.5141399 -0.1422089 0.1859655 0.6235314 0.6235314
|
||||
#> [7] 0.9517058 -2.3300383 0.5141399 -1.1267321
|
||||
#> [1] 0.9732102 -1.4834370 0.7842374 0.5007781 0.2173188 0.5007781
|
||||
#> [7] -0.0661405 0.6897510 -0.0661405 -2.0503556
|
||||
|
||||
y <- data.frame(
|
||||
id = LETTERS[1:10],
|
||||
@@ -119,36 +118,36 @@ y <- data.frame(
|
||||
tobr = random_mic(10, ab = "tobr", mo = "Escherichia coli")
|
||||
)
|
||||
y
|
||||
#> id amox cipr gent tobr
|
||||
#> 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
|
||||
#> id amox cipr gent tobr
|
||||
#> 1 A S 24 <=0.25 8
|
||||
#> 2 B I 26 <=0.25 8
|
||||
#> 3 C S 21 <=0.25 8
|
||||
#> 4 D R 24 <=0.25 8
|
||||
#> 5 E I 26 <=0.25 8
|
||||
#> 6 F I 27 0.5 8
|
||||
#> 7 G S 21 0.5 16
|
||||
#> 8 H R 29 <=0.25 16
|
||||
#> 9 I R 26 <=0.25 8
|
||||
#> 10 J S 20 <=0.25 8
|
||||
mean_amr_distance(y)
|
||||
#> ℹ Calculating mean AMR distance based on columns "amox", "cipr", "gent", and
|
||||
#> "tobr"
|
||||
#> [1] 0.87190417 -0.29007013 -0.44456433 -0.18707400 0.07298484 0.33047517
|
||||
#> [7] 0.02148677 1.33795527 -0.85654887 -0.85654887
|
||||
#> [1] -0.42631712 -0.25690939 -0.68042872 0.09123205 -0.25690939 0.42072154
|
||||
#> [7] 0.50542540 1.10767844 0.26063978 -0.76513259
|
||||
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
|
||||
#> 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
|
||||
#> id amox cipr gent tobr amr_distance
|
||||
#> 1 A S 24 <=0.25 8 -0.4743416
|
||||
#> 2 B I 26 <=0.25 8 -0.4743416
|
||||
#> 3 C S 21 <=0.25 8 -0.4743416
|
||||
#> 4 D R 24 <=0.25 8 -0.4743416
|
||||
#> 5 E I 26 <=0.25 8 -0.4743416
|
||||
#> 9 I R 26 <=0.25 8 -0.4743416
|
||||
#> 10 J S 20 <=0.25 8 -0.4743416
|
||||
#> 6 F I 27 0.5 8 0.7115125
|
||||
#> 8 H R 29 <=0.25 16 0.7115125
|
||||
#> 7 G S 21 0.5 16 1.8973666
|
||||
|
||||
if (require("dplyr")) {
|
||||
y %>%
|
||||
@@ -160,17 +159,17 @@ 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 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
|
||||
#> id amox cipr gent tobr amr_distance check_id_C
|
||||
#> 1 C S 21 <=0.25 8 -0.68042872 0.00000000
|
||||
#> 2 J S 20 <=0.25 8 -0.76513259 0.08470387
|
||||
#> 3 A S 24 <=0.25 8 -0.42631712 0.25411160
|
||||
#> 4 B I 26 <=0.25 8 -0.25690939 0.42351933
|
||||
#> 5 E I 26 <=0.25 8 -0.25690939 0.42351933
|
||||
#> 6 D R 24 <=0.25 8 0.09123205 0.77166077
|
||||
#> 7 I R 26 <=0.25 8 0.26063978 0.94106850
|
||||
#> 8 F I 27 0.5 8 0.42072154 1.10115026
|
||||
#> 9 G S 21 0.5 16 0.50542540 1.18585412
|
||||
#> 10 H R 29 <=0.25 16 1.10767844 1.78810716
|
||||
if (require("dplyr")) {
|
||||
# support for groups
|
||||
example_isolates %>%
|
||||
|
||||
Reference in new issue
Block a user