mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 07:51:57 +02:00
(v0.8.0.9004) added MDR guideline by Magiorakos et al.
This commit is contained in:
@ -166,26 +166,31 @@ get_column_abx <- function(x,
|
||||
|
||||
# sort on name
|
||||
x <- x[order(names(x), x)]
|
||||
duplicates <- x[base::duplicated(x)]
|
||||
x <- x[!names(x) %in% names(duplicates)]
|
||||
duplicates <- c(x[base::duplicated(x)], x[base::duplicated(names(x))])
|
||||
duplicates <- duplicates[unique(names(duplicates))]
|
||||
x <- c(x[!names(x) %in% names(duplicates)], duplicates)
|
||||
x <- x[order(names(x), x)]
|
||||
|
||||
# succeeded with aut-guessing
|
||||
message(blue("OK."))
|
||||
|
||||
if (verbose == TRUE) {
|
||||
for (i in seq_len(length(x))) {
|
||||
|
||||
for (i in seq_len(length(x))) {
|
||||
if (verbose == TRUE & !names(x[i]) %in% names(duplicates)) {
|
||||
message(blue(paste0("NOTE: Using column `", bold(x[i]), "` as input for `", names(x)[i],
|
||||
"` (", ab_name(names(x)[i], tolower = TRUE), ").")))
|
||||
}
|
||||
} else if (length(duplicates) > 0) {
|
||||
for (i in seq_len(length(duplicates))) {
|
||||
warning(red(paste0("Using column `", bold(duplicates[i]), "` as input for `", names(x[which(x == duplicates[i])]),
|
||||
"` (", ab_name(names(x[names(which(x == duplicates))[i]]), tolower = TRUE),
|
||||
"), although it was matched for multiple antibiotics or columns.")), call. = FALSE)
|
||||
if (names(x[i]) %in% names(duplicates)) {
|
||||
warning(red(paste0("Using column `", bold(x[i]), "` as input for `", names(x)[i],
|
||||
"` (", ab_name(names(x)[i], tolower = TRUE),
|
||||
"), although it was matched for multiple antibiotics or columns.")),
|
||||
call. = FALSE,
|
||||
immediate. = verbose)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!is.null(hard_dependencies)) {
|
||||
hard_dependencies <- unique(hard_dependencies)
|
||||
if (!all(hard_dependencies %in% names(x))) {
|
||||
# missing a hard dependency will return NA and consequently the data will not be analysed
|
||||
missing <- hard_dependencies[!hard_dependencies %in% names(x)]
|
||||
@ -194,6 +199,7 @@ get_column_abx <- function(x,
|
||||
}
|
||||
}
|
||||
if (!is.null(soft_dependencies)) {
|
||||
soft_dependencies <- unique(soft_dependencies)
|
||||
if (!all(soft_dependencies %in% names(x))) {
|
||||
# missing a soft dependency may lower the reliability
|
||||
missing <- soft_dependencies[!soft_dependencies %in% names(x)]
|
||||
@ -203,7 +209,7 @@ get_column_abx <- function(x,
|
||||
mutate(txt = paste0(bold(missing), " (", missing_names, ")")) %>%
|
||||
arrange(missing_names) %>%
|
||||
pull(txt)
|
||||
message(blue("NOTE: Reliability might be improved if these antimicrobial results would be available too:",
|
||||
message(blue("NOTE: Reliability will be improved if these antimicrobial results would be available too:",
|
||||
paste(missing_txt, collapse = ", ")))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user