1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 08:06:12 +01:00

(v1.5.0.9035) quick test

This commit is contained in:
dr. M.S. (Matthijs) Berends 2021-03-07 22:15:25 +01:00
parent 450bbe5fb7
commit 2f0fc3cab7
3 changed files with 19 additions and 7 deletions

View File

@ -1,5 +1,5 @@
Package: AMR Package: AMR
Version: 1.5.0.9034 Version: 1.5.0.9035
Date: 2021-03-07 Date: 2021-03-07
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Authors@R: c( Authors@R: c(

1
R/ab.R
View File

@ -105,7 +105,6 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
already_regex <- isTRUE(list(...)$already_regex) already_regex <- isTRUE(list(...)$already_regex)
fast_mode <- isTRUE(list(...)$fast_mode) fast_mode <- isTRUE(list(...)$fast_mode)
x_bak <- x x_bak <- x
x <- toupper(x) x <- toupper(x)
x_nonNA <- x[!is.na(x)] x_nonNA <- x[!is.na(x)]

23
R/rsi.R
View File

@ -774,6 +774,11 @@ exec_as.rsi <- function(method,
for (i in seq_len(length(x))) { for (i in seq_len(length(x))) {
is_intrinsic_r <- paste(mo[i], ab) %in% INTRINSIC_R is_intrinsic_r <- paste(mo[i], ab) %in% INTRINSIC_R
if (is_intrinsic_r == TRUE) {
print("====")
print(paste(mo[i], ab))
print("====")
}
any_is_intrinsic_resistant <- any_is_intrinsic_resistant | is_intrinsic_r any_is_intrinsic_resistant <- any_is_intrinsic_resistant | is_intrinsic_r
if (isTRUE(add_intrinsic_resistance) & is_intrinsic_r) { if (isTRUE(add_intrinsic_resistance) & is_intrinsic_r) {
@ -814,14 +819,22 @@ exec_as.rsi <- function(method,
if (is.na(x[i])) { if (is.na(x[i])) {
new_rsi[i] <- NA_character_ new_rsi[i] <- NA_character_
} else if (method == "mic") { } else if (method == "mic") {
print("----")
print(str(get_record))
print(x[i])
print(x[i] <= get_record$breakpoint_S)
print(x[i] > get_record$breakpoint_R)
print(x[i] >= get_record$breakpoint_R)
print(guideline_coerced %like% "EUCAST" & x[i] > get_record$breakpoint_R)
print(guideline_coerced %like% "EUCAST" && x[i] > get_record$breakpoint_R)
print(guideline_coerced %like% "EUCAST" & (x[i] > get_record$breakpoint_R))
print("----")
new_rsi[i] <- quick_case_when(isTRUE(conserve_capped_values) & x[i] %like% "^<[0-9]" ~ "S", new_rsi[i] <- quick_case_when(isTRUE(conserve_capped_values) & x[i] %like% "^<[0-9]" ~ "S",
isTRUE(conserve_capped_values) & x[i] %like% "^>[0-9]" ~ "R", isTRUE(conserve_capped_values) & x[i] %like% "^>[0-9]" ~ "R",
# start interpreting: EUCAST uses <= S and > R, CLSI uses <=S and >= R # start interpreting: EUCAST uses <= S and > R, CLSI uses <=S and >= R
isTRUE(x[i] <= get_record$breakpoint_S) ~ "S", x[i] <= get_record$breakpoint_S ~ "S",
guideline_coerced %like% "EUCAST" & guideline_coerced %like% "EUCAST" & x[i] > get_record$breakpoint_R ~ "R",
isTRUE(x[i] > get_record$breakpoint_R) ~ "R", guideline_coerced %like% "CLSI" & x[i] >= get_record$breakpoint_R ~ "R",
guideline_coerced %like% "CLSI" &
isTRUE(x[i] >= get_record$breakpoint_R) ~ "R",
# return "I" when not match the bottom or top # return "I" when not match the bottom or top
!is.na(get_record$breakpoint_S) & !is.na(get_record$breakpoint_R) ~ "I", !is.na(get_record$breakpoint_S) & !is.na(get_record$breakpoint_R) ~ "I",
# and NA otherwise # and NA otherwise