mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 02:03:04 +02:00
(v1.7.1.9002) ab class selectors update
This commit is contained in:
Binary file not shown.
28
data-raw/exploratory_data_analysis_test.R
Normal file
28
data-raw/exploratory_data_analysis_test.R
Normal file
@ -0,0 +1,28 @@
|
||||
library(dplyr)
|
||||
example_isolates %>%
|
||||
select(mo, where(is.rsi)) %>%
|
||||
tidyr::pivot_longer(cols = where(is.rsi)) %>%
|
||||
# remove intrisic R
|
||||
filter(!paste(mo, name) %in% AMR:::INTRINSIC_R) %>%
|
||||
mutate(name = as.ab(name),
|
||||
value = ifelse(value == "R", 1, 0),
|
||||
class = ab_group(name)) %>%
|
||||
group_by(mo, class) %>%
|
||||
summarise(n = n(),
|
||||
res = mean(value, na.rm = TRUE)) %>%
|
||||
filter(n > 30, !is.na(res))
|
||||
|
||||
|
||||
|
||||
df <- example_isolates
|
||||
search_mo <- "B_ESCHR_COLI"
|
||||
intrinsic_res <- INTRINSIC_R[INTRINSIC_R %like% search_mo]
|
||||
intrinsic_res <- gsub(".* (.*)", "\\1", intrinsic_res)
|
||||
|
||||
x <- df %>%
|
||||
select(mo, where(is.rsi)) %>%
|
||||
filter(mo == search_mo) %>%
|
||||
# at least 30 results available
|
||||
select(function(x) sum(!is.na(x)) >= 30) %>%
|
||||
# remove intrisic R
|
||||
select(!matches(paste(intrinsic_res, collapse = "|")))
|
Reference in New Issue
Block a user