Skip to content
Snippets Groups Projects
Commit d670c9c3 authored by aakan96's avatar aakan96
Browse files

Update file GO_enrichment.R

parent 8992f22b
No related branches found
No related tags found
No related merge requests found
library(clusterProfiler)
library(org.Hs.eg.db)
library(AnnotationDbi)
library(clusterProfiler) # For functional enrichment analysis
library(org.Hs.eg.db) # Annotation database for human genes
library(AnnotationDbi) # Annotation utilities
# Read data from a CSV file named "go.csv" and store it in the "data" variable.
data <- read.csv("C:/Users/Emre/Desktop/go.csv", sep = ";", header = TRUE)
# Extract the ENSEMBL gene IDs from the "data" variable and store them in "genes_to_test".
genes_to_test <- data$ensembl_gene_id
# Perform Gene Ontology (GO) enrichment analysis for Biological Process (BP) terms using "enrichGO" function.
GO_results <- enrichGO(gene = genes_to_test, OrgDb = "org.Hs.eg.db", keyType = "ENSEMBL", ont = "BP")
as.data.frame(GO_results)
# Create a barplot visualizing the top 15 enriched GO terms for Biological Process.
fit <- plot(barplot(GO_results, showCategory = 15))
fit
# Perform GO enrichment analysis for Molecular Function (MF) terms using "enrichGO" function.
GO_results2 <- enrichGO(gene = genes_to_test, OrgDb = "org.Hs.eg.db", keyType = "ENSEMBL", ont = "MF")
as.data.frame(GO_results2)
# Create a barplot visualizing the top 15 enriched GO terms for Molecular Function.
fit2 <- plot(barplot(GO_results2, showCategory = 15))
fit2
# Perform GO enrichment analysis for Cellular Component (CC) terms using "enrichGO" function.
GO_results3 <- enrichGO(gene = genes_to_test, OrgDb = "org.Hs.eg.db", keyType = "ENSEMBL", ont = "CC")
as.data.frame(GO_results3)
# Create a barplot visualizing the top 15 enriched GO terms for Cellular Component.
fit3 <- plot(barplot(GO_results3, showCategory = 15))
fit3
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment