gravatar for 3kixintehead

3 hours ago by

I have a volcano plot with genes of log2FC > 1 and -log10(padj) > 0.5 highlighted. However, I would also like to label and color differently the top 25 genes in variability. I have a table of ENS ids and their hgnc symbols. However with my code below I get the error: Aesthetics must be either length 1 or the same as the data (7030): label

I think the reason for this is that my list is only 25 rows. I need to get it to the full length, but still only label the genes I have selected. I would also like to color these a different color to highlight them further. I am relatively new to R, but I have been stuck on this problem for a while. Is there a fairly simple fix or do I need to rebuild my gene table with all genes?

ggplot(filter_df, aes(x=log2FoldChange, y=-log10(padj))) +
geom_point(aes(color=test), size=1.5, alpha=0.4) +
scale_color_manual(values=c('gray', 'red')) +
geom_text_repel(aes(x = log2FoldChange, y = -log10(padj),label=Gene_list$hgnc_symbol)) +    
ggtitle('Volcano Plot') +
labs(y=expression('-Log'[10]*' P'[adj]), x=expression('Log'[2]*' fold change')) +
theme_minimal() +
theme(legend.position="none", plot.title = element_text(size = rel(1.5), hjust = 0.5))

Source link