ww22an
ww22an

Reputation: 51

Volcano Plot Error......... "Error in FUN(X[[i]], ...) : object 'Qval' not found"

I'm getting quite confused when I'm doing my using the ggplot function.

When I input the following code with ggplot: I actually get the volcano plot and don't receive an error

##--> Add the pval and the qval
average_data$Pval <- sig_limma_cont[match(row.names(average_data),
                                         row.names(sig_limma_cont)),6]
average_data$Qval <- sig_limma_cont[match(row.names(average_data),
                                         row.names(sig_limma_cont)),7]
ggplot(data = volcano_data, aes(y = -log10(Qval), x = Max_LFC)) +
  geom_point(aes(color = Change)) +
  geom_text_repel(data = subset(volcano_data, Change == "DOWN")[c(1:20),],
                  aes(label = Gene_Symbol),
                  segment.color = "black", size = 3,  force = 1, nudge_x = -0.25) +
  geom_text_repel(data = subset(volcano_data, Change == "UP")[c(1:20),],
                  aes(label = Gene_Symbol),
                  segment.color = "black", size = 3,  force = 1, nudge_x = 0.25) +
  geom_hline(yintercept = -log10(.005)) +
  geom_vline(xintercept = c(-0.48,0.48)) +
  scale_x_continuous(limits = c(-7, 7), name = "Max Abs Log2 FC") +
  scale_y_continuous(name = "-log10 Qval", limits = c(0,10)) +
  geom_point(data = volcano_data[which(volcano_data$Change == "STABLE"),],
             aes(y = -log10(Qval), x = Max_LFC), color = "grey50") +
  scale_color_manual(values=c("cyan", "black", "gold")) + ggtitle("LFC 1 DE Genes in relative to Naive all comparisons") +
  theme_classic() + theme(legend.position="none")

However, after I add my second code with the ggplot, I get an error message. Here's both the code and the error message :

ggplot(data = volcano_data_CM, aes(y = -log10(Qval), x = Max_LFC_CM)) +
  geom_point(aes(color = Change)) +
  geom_text_repel(data = subset(volcano_data_CM, Change == "DOWN")[c(1:500),],
                  aes(label = Gene_Symbol),
                  segment.color = "black", size = 3,  force = 2, nudge_x = -0.35) +
  geom_text_repel(data = subset(volcano_data_CM, Change == "UP")[c(1:400),],
                  aes(label = Gene_Symbol),
                  segment.color = "black", size = 3,  force = 2, nudge_x = 0.35) +
  geom_hline(yintercept = -log10(.005)) +
  geom_vline(xintercept = c(-0.48,0.48)) +
  scale_x_continuous(limits = c(-7, 7), name = "Max Abs Log2 FC") +
  scale_y_continuous(name = "-log10 Qval", limits = c(0,10)) +
  geom_point(data = volcano_data_CM[which(volcano_data_CM$Change == "STABLE"),],
             aes(y = -log10(Qval), x = Max_LFC_CM), color = "grey50") +
  scale_color_manual(values=c("darkblue", "black", "gold")) + ggtitle("LFC 1 DE CM") +
  theme_classic() + theme(legend.position="none")

To fix the previous error of Qval not found, I tried this code:

> geom_path(data = path, aes(x = x,y = y), inherit.aes = FALSE )

Now I'm getting: Error Message output from Console:

Error in FUN(X[[i]], ...) : object 'Gene_Symbol' not found

Does anyone know how to solve this? I'm confused as to why the it is recognized in the first ggplot function, but not in the others?

Let me know

Upvotes: 0

Views: 164

Answers (0)

Related Questions