This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Plotting gene ontology categories in R

Hi all I am very new to R and bioinformatics, I have performed gene ontology analysis using DAVID on a set of differentially expressed genes. I wanted to construct a barplot in R which shows the Log10P values on one axis with their respective go terms. I am new to R, so I am not very familiar with plotting using ggplot2. I have a dataset that has the following columns: Category - Biological Process, Cellular Component, or Molecular Function, terms - GO terms associated, Number of genes -contains the count of genes associated with the respective GO terms, Log p-value. snip shot of my data I need to make something like this

ontology gene r

3 answers

Dear

Maybe this can help:

Dotplot for filtered pathways result

Best, Leite

You can use the following code: First, load the packages that you will need.

library(ggplot2)
library(forcats)

Then load your data and make your figure.

plotting = read.csv('Plotting.csv')
graph = ggplot(data = plotting, aes(x = fct_rev(fct_reorder(Terms, LogPvalue)), y = LogPvalue, color = Category)) + geom_col() + labs(x = NULL)
graph

This graph sets x to Terms and orders the columns by descending LogPvalue and colors the columns based on Category. It also removes the x-axis label.

There are also multiple packages on Bioconductor for Gene Ontologies, some of which offer some quite nice built-in plots. For example, rrvgo features heatmaps, treemaps, scatterPlots and wordclouds. The clusterprofiler enables to plot enriched GO categories on a directed acyclic graph. There are many more packages that might be helpful...

Log in to answer this question.