Body: <p>I am new to Gene Ontology (GO) analysis and would like to classify and visualize the annotations. Here is the background and the steps I have taken so far:</p>
  <ol>
  <li><p>I annotated the bacterial whole genome using Prokka. I performed</p>
  </li>
  <li><p>Interproscan on the annotated genome using the Galaxy server.</p>
  </li>
  <li><p>The Interproscan results are in a tabular format, and column 14
  contains the GO IDs.</p>
  </li>
  </ol>
  <p>Example GO IDs from column 14:</p>
  <pre><code>column 14
  GO:0003677
  GO:0003677
  GO:0005524|GO:0016887
  GO:0005524|GO:0016020|GO:0055085
  GO:0003723|GO:0046872
  GO:0004521|GO:0004534|GO:0006396|GO:0008270|GO:0090501
  etc 
  </code></pre>
  <p>I would like to classify these annotations into the Cellular Component, Biological Process, and Molecular Function categories, and then plot a graph similar to the provided image.</p>
  <p><a href="https://i.sstatic.net/PgIqk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PgIqk.png" alt="enter image description here" /></a></p>
  <p>I am comfortable using either R or Python for this analysis. Could you please provide guidance on how to achieve this using the preferred language?</p>
  <p>Thank you in advance for your help!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-04T20:37:15.147Z
Comments.Text: `library(clusterProfiler)
  library(org.Hs.eg.db)
  
  data <- read.delim("A3_InterProScan.tabular", header = TRUE, sep = "\t")
  
  go_ids <- data[,14]
  
  gene_symbols <- mapIds(org.Hs.eg.db, keys = go_ids, keytype = "GO", column = "SYMBOL")
  
  gene_symbols <- gene_symbols[!is.na(gene_symbols)]
  
  enrich_result <- enrichGO(gene = gene_symbols, OrgDb = org.Hs.eg.db)`
Comments.UserDisplayName: Umar
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-04T21:31:29.963Z
Comments.Text: Hmmm... well I know how I'd solve this and its a lot of code. I'd download the GO database (I assume it's downloadable) and screen the names from there. Then there's a pandas based solution to obtain frequencies and plot it. That strategy isn't a single question. Again, its possible there's something published.
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-05T06:30:34.137Z
Comments.Text: @M__, Thank you, If other easy way is ther thats fine too, Kindly provide me a code, I would be grateful to you, Thanks in advance
Comments.UserDisplayName: Umar
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-05T13:43:15.280Z
Comments.Text: The site is not a coding service. As the question stands published solutions are good answers. There's one possible solution, but I've never really used it especially in this context of the question, so can't recommend it.
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-05T16:02:37.927Z
Comments.Text: A python version of this question has been posted here: https://stackoverflow.com/questions/76614627/
Comments.UserDisplayName: Ram RS
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-08T07:44:54.600Z
Comments.Text: Thanks @RamRS provision of code is always good. In my opinion this is four separate questions in terms of code 1) getting the gene function from GO; 2) obtain a frequency of each gene function; 3) arranging gene function into groups; 4) plotting the resulting frequency.
Comments.UserDisplayName: M__
Tags: <r><python><gene-ontology>
Title: Gene Ontology (GO) analysis and classification of bacterial whole genome annotations
ThreadText: # Gene Ontology (GO) analysis and classification of bacterial whole genome annotations
  
  (Asked by: username_0 on 2023-07-04)
  
  I am new to Gene Ontology (GO) analysis and would like to classify and visualize the annotations. Here is the background and the steps I have taken so far:
  
  1. I annotated the bacterial whole genome using Prokka. I performed
  2. Interproscan on the annotated genome using the Galaxy server.
  3. The Interproscan results are in a tabular format, and column 14
     contains the GO IDs.
  
  Example GO IDs from column 14:
  
  ```
  column 14
  GO:0003677
  GO:0003677
  GO:0005524|GO:0016887
  GO:0005524|GO:0016020|GO:0055085
  GO:0003723|GO:0046872
  GO:0004521|GO:0004534|GO:0006396|GO:0008270|GO:0090501
  etc 
  
  ```
  
  I would like to classify these annotations into the Cellular Component, Biological Process, and Molecular Function categories, and then plot a graph similar to the provided image.
  
  [![enter image description here](https://i.sstatic.net/PgIqk.png)](https://i.sstatic.net/PgIqk.png)
  
  I am comfortable using either R or Python for this analysis. Could you please provide guidance on how to achieve this using the preferred language?
  
  Thank you in advance for your help!
  
  **Tags:** r, python, gene-ontology
  
  > **Comments:**
  > **username_0**: `library(clusterProfiler) library(org.Hs.eg.db)  data <- read.delim("A3_InterProScan.tabular", header = TRUE, sep = "\t")  go_ids <- data[,14]  gene_symbols <- mapIds(org.Hs.eg.db, keys = go_ids, keytype = "GO", column = "SYMBOL")  gene_symbols <- gene_symbols[!is.na(gene_symbols)]  enrich_result <- enrichGO(gene = gene_symbols, OrgDb = org.Hs.eg.db)`  
  > **username_1**: Hmmm... well I know how I'd solve this and its a lot of code. I'd download the GO database (I assume it's downloadable) and screen the names from there. Then there's a pandas based solution to obtain frequencies and plot it. That strategy isn't a single question. Again, its possible there's something published.  
  > **username_0**: @username_1, Thank you, If other easy way is ther thats fine too, Kindly provide me a code, I would be grateful to you, Thanks in advance  
  > **username_1**: The site is not a coding service. As the question stands published solutions are good answers. There's one possible solution, but I've never really used it especially in this context of the question, so can't recommend it.  
  > **username_2**: A python version of this question has been posted here: https://stackoverflow.com/questions/76614627/  
  > **username_1**: Thanks @username_2 provision of code is always good. In my opinion this is four separate questions in terms of code 1) getting the gene function from GO; 2) obtain a frequency of each gene function; 3) arranging gene function into groups; 4) plotting the resulting frequency.  
  
  ---
  
  ## 0 answers
  
  