Plotting gene ontology categories in R
3
0
Entering edit mode
17 months ago
Saili • 0

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.1k views
ADD COMMENT
0
Entering edit mode
17 months ago
Leite ★ 1.3k

Dear

Maybe this can help:

Dotplot for filtered pathways result

Best, Leite

ADD COMMENT
0
Entering edit mode
17 months ago
Jeremy ▴ 880

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.

ADD COMMENT
0
Entering edit mode
17 months ago

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...

ADD COMMENT

Login before adding your answer.

Traffic: 3314 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6