diff --git a/05_Data_Annotation/GO_enrichment.R b/05_Data_Annotation/GO_enrichment.R index e6a9f5a640e9c110358fa5f6182ef476c27cd6f2..a866fa187c2f23d9970b507f1dcf24d9e5817494 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