diff --git a/f-generate_mean_sd_plot.R b/f-generate_mean_sd_plot.R index 5aafcd33..b674a9c6 100644 --- a/f-generate_mean_sd_plot.R +++ b/f-generate_mean_sd_plot.R @@ -20,13 +20,14 @@ trial <- c("Gallocatechin Gallate", "Genistein", "Imatinib", key <- c("Gemcitabine", "Trametinib", "Withaferin A", "Saracatinib", "Selumetinib", "Auranofin") + + data <- read_csv("results/ace2-summarized-dataset.csv", col_types = col_spec) %>% mutate( class = if_else((avg >= 0.47 & sdev <= 0.08), "novel", "filtered"), class = if_else(compound %in% antiviral, "antiviral", class), - class = if_else(compound %in% trial, "trial", class), - class = if_else(compound %in% key, "key", class), + class = if_else(compound %in% trial, "trial", class) ) %>% select(compound, avg, sdev, class) %>% filter( @@ -42,6 +43,20 @@ data <- str_detect(compound, "^Tyrphostin", negate = T) ) +annotations <- data %>% + filter(compound %in% key) %>% + mutate(x = c(0.46, 0.56, 0.52, 0.6), + y = c(0.085, 0.05, 0.065, 0.04), + xend = avg + 0.00125, + yend = sdev + 0.0005, + label = compound) + +curve_annotations <- pmap(annotations, ~ annotate(geom = "curve", x = ..5, y = ..6, xend = ..7, yend = ..8, curvature = .3, arrow = arrow(length = unit(2, "mm")))) + +label_annotations <- pmap(annotations, ~ annotate(geom = "label", x = ..5, y = ..6, label = ..9, hjust = "center")) + +all_annotations <- c(curve_annotations, label_annotations) + g <- ggplot(data, aes(x = avg, y = sdev, group = class, color = class, shape = class)) p <- g + geom_point(size = 5) + @@ -49,23 +64,23 @@ p <- g + geom_point(size = 5) + scale_y_reverse(breaks = seq(0, 0.15, 0.01), limits = c(0.10, 0)) + geom_vline(xintercept = 0.47, color = "darkred", lwd = 1.5) + geom_hline(yintercept = 0.08, color = "darkred", lwd = 1.5) + - scale_color_manual(breaks = c("key", "antiviral", "trial", "novel", "filtered"), - labels = c("Key Recommendations", + scale_color_manual(breaks = c("antiviral", "trial", "novel", "filtered"), + labels = c( "Known Anti-viral Properties", "Currently in trial", "Novel identified", "Did not pass Threshold"), name = "Drug Status", - values = c("darkred", "darkgreen", "maroon", + values = c("darkgreen", "maroon", "darkblue", "lightgrey")) + - scale_shape_manual(breaks = c("key", "antiviral", "trial", "novel", "filtered"), - labels = c("Key Recommendations", + scale_shape_manual(breaks = c("antiviral", "trial", "novel", "filtered"), + labels = c( "Known Anti-viral Properties", "Currently in trial", "Novel identified", "Did not pass Threshold"), name = "Drug Status", - values = c(25, 17, 18, 15, 16)) + + values = c(17, 18, 15, 16)) + xlab("Mean Concordance") + ylab("Standard Deviation of Concordance") + theme_minimal() + @@ -77,9 +92,12 @@ p <- g + geom_point(size = 5) + legend.title = element_text(size = 24, family = "ArialMT"), legend.key = element_rect(color = NA, fill = NA), legend.key.size = unit(1.5, "cm") - ) + ) + + ggtitle("Concordance Plot of Identified Drugs") + +full <- reduce(all_annotations, `+`, .init = p) + -full <- p + ggtitle("Concordance Plot of Identified Drugs") ggsave("figures/SARS2-Mean-SD-Plot.png", plot = full, device = "png", width = 11.69 * 2, height = 8.27 * 2, units = "in") diff --git a/figures/SARS2-Mean-SD-Plot.jpg b/figures/SARS2-Mean-SD-Plot.jpg index b175cd12..7f308e09 100644 Binary files a/figures/SARS2-Mean-SD-Plot.jpg and b/figures/SARS2-Mean-SD-Plot.jpg differ diff --git a/figures/SARS2-Mean-SD-Plot.pdf b/figures/SARS2-Mean-SD-Plot.pdf index 9b68dfa6..9e2c4daa 100644 Binary files a/figures/SARS2-Mean-SD-Plot.pdf and b/figures/SARS2-Mean-SD-Plot.pdf differ diff --git a/figures/SARS2-Mean-SD-Plot.png b/figures/SARS2-Mean-SD-Plot.png index 3fc86bdd..52f030d9 100644 Binary files a/figures/SARS2-Mean-SD-Plot.png and b/figures/SARS2-Mean-SD-Plot.png differ