I've conducted a DESeq2 analysis on a large volume of data and I'm trying to make box plots that compare the counts of specific genes, which are sorted into 2 groups, and include statistical significance.
Using the plotCounts() function works fine, but I'm struggling to add the p.adj values calculated by DESeq2. This is where I've got to so far:
#Retrieving information for specific gene
PDCD1 <- subset(results_dds, row.names(results_dds) == "PDCD1")
PDCD1_pvalue <- PDCD1$padj
#Capture count data from plotCounts
PDCD1_data <- plotCounts(dds, gene="PDCD1", intgroup=c("subtype_group"), returnData = TRUE)
#Graph
ggplot(PDCD1_data, aes(x = subtype_group, y = count)) +
geom_col() +
theme_bw() +
ggtitle("PDCD1") +
theme(plot.title = element_text(hjust = 0.5)) +
#?
I'm still pretty new to R and I'm unsure where to go from here. Using the stat_pvalue_manual function results in an error "data should contain group1 and group2 columns".
Is there a simple way to add significance from DESeq2 to count graphs?