Skip to content

Commit

Permalink
notes reminded me to add the bar plot thing
Browse files Browse the repository at this point in the history
  • Loading branch information
kweav committed Dec 19, 2024
1 parent 9b23efc commit b35b5a4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions R/plots-gi.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,26 @@ plot_volcano <- function(gimap_dataset, facet_rep = TRUE, reps_to_drop = c("Day0
} else{ return(gplot) }
}

plot_targets_bar <- function(gimap_dataset, target1, target2, reps_to_drop = c("Day05_RepA_early")){
gimap_dataset$gi_scores %>%
filter(!(rep %in% reps_to_drop)) %>%
filter((grepl(target1,pgRNA_target)) | (grepl(target2, pgRNA_target))) %>%
ggplot(aes(y = mean_observed_cs,
x = target_type,
fill = target_type)) +
geom_bar(stat = "identity") +
geom_point(pch = 21, size=3) +
theme_bw() +
ylab("CRISPR score") +
xlab("") +
ggtitle(paste0(target1, "/", target2)) +
geom_hline(yintercept = 0) +
scale_x_discrete(labels = c("ctrl_gene" = paste0(target2, " KO"), #this assumes that target2 is the ctrl_{target2} gene
"gene_ctrl" = paste0(target1, " KO"), #this assumes that target1 is the {target1}_ctrl gene
"gene_gene" = "DKO")) +
theme(legend.position = "none",
panel.background = element_blank(),
panel.grid = element_blank(),
axis.text.x = element_text(angle = 45, hjust=1))
}

0 comments on commit b35b5a4

Please sign in to comment.