I'm new to R and I'm trying to make a MA plot from my DESeq2 results using ggplot2.
I have figured out how to make a MA plot using the following code:
plot_poly <- all_counts.poly.results %>% as.data.frame() %>% ggplot(aes(log2(baseMean), log2FoldChange) + geom_point(aes(color = pvalue < 0.05), cex = 0.1) + labs(title = "Poly Torin Treated vs Untreated")
Inside the all_counts.poly.results are EnsGeneIDs I'm interested in labeling on the graph, but there are too many to plot, so want to filter this against an excel file with specific EnsGeneIDs.
For example, I was thinking about setting it up like this with dplyr, but I'm not sure if this is correct.
# contains EnsGeneIDs I want to be plotted EnsGeneIDs <- read_excel("/Users/kylestangline/Desktop/geneIDs.xls") filtered_all_counts.poly.results <- all_counts.poly.results %>% filter(all_counts.poly.results$EnsGeneIDs %in% EnsGeneIDs) # filter only specific EnsGeneIDs
Then use these filtered EnsGeneIDs as labels on the MA plot I made above?