From d670c9c36f0a38a5fd7816fdd24b46f5ae1ec5d7 Mon Sep 17 00:00:00 2001
From: aakan96 <aakan96@mi.fu-berlin.de>
Date: Fri, 21 Jul 2023 11:55:26 +0000
Subject: [PATCH] Update file GO_enrichment.R

---
 05_Data_Annotation/GO_enrichment.R | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/05_Data_Annotation/GO_enrichment.R b/05_Data_Annotation/GO_enrichment.R
index e6a9f5a..a866fa1 100644
--- a/05_Data_Annotation/GO_enrichment.R
+++ b/05_Data_Annotation/GO_enrichment.R
@@ -1,28 +1,34 @@
-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
 
-- 
GitLab