---
title: "Hands-On Session 3: Functional Annotation and Analysis"
canonical: "https://help.biobam.com/space/BTP/3495657474/Hands-On%20Session%203%3A%20Functional%20Annotation%20and%20Analysis"
format: markdown
---
# Introduction

## Dataset

[https://drive.google.com/drive/folders/1TImxh7w5ZR0-gcnIwAgzl7hMza_rqwfj?usp=sharing](https://drive.google.com/drive/folders/1TImxh7w5ZR0-gcnIwAgzl7hMza_rqwfj?usp=sharing)

## Goals and Algorithms/Tools

- Obtaining functional annotations for our sequences
  - BLAST, InterProScan, eggNOG-mapper
- Refining our functional annotations
  - OmicsBox-Tools to merge and refine annotations
- Enrichment Analysis of our previous Differential Analysis Expression Results
  - GSEA, Fisher’s Exact Test
- Combined Pathway Analysis
  - KEGG database

# Task 1: BLAST

Our first task on our road to Functional Annotation will be to load our sequences. These have been provided as a .fasta file, which can be loaded into OmicsBox through “functional analysis → Load → Load Sequences → Load Fasta File (.fasta)”. This will open the given sequences as a table in OmicsBox - from here, we will work mostly through the **side panel actions**, which can be fond to the right of the table. If it is hidden, there should be a little triangle pointing to the left, which will allow you to expand the side panel.

In the side panel, under **Blast**, we can now perform a **Cloud Blast**. As shown in **Figure 1**, next we will select “UniProtKB/Swiss-Prot (swissprot v5)” as the database we want to BLAST against - this is a smaller database which will allow us to perform our BLAST more quickly. Additionally, we will limit our BLAST to the Taxonomy filter “Mammalia”, as we know we are working with Ursus Arctos data. We could be even more specific and directly select, for instance, “Ursus Arctos” in our taxonomy filter, but by using the kingdom of “Mammalia” instead, we gain the added advantage of finding orthologs from model organisms such as Homo Sapiens or Mus Musculus.

The remaining configuration options can be left to their defaults for now; although you are encouraged to look into them, e.g. through their associated :question_mark:-Icons, for our purposes right now it may be best to leave them to their default values, as they may also impact the runtime.

On the last page of the wizard, the “output folder” can simply be disabled, as we will be inspecting our results within OmicsBox.


![image-20240307-083242.png](media://022b8482-466a-446d-9bb3-6c7c5a4f22da)

Once our BLAST has started, we can already progress to **Tasks 2 and 3**, even while the BLAST is still running!

# Task 2: InterProScan

Now that our BLAST is on the way, we also want to include protein information such as protein families and domains. Additionally, IPS may include additional GO Terms not found by our BLAST.

Through the side panel action **InterProScan**, we can now start this process, choosing to perform a **Cloud InterProScan**. Once again, we can leave all of the options in the wizard as their defaults. On the last page, we can disable the XML Output, as we will simply view our results within OmicsBox.

While our BLAST and InterProScan are running, we can already move on to the eggNOG-mapper in **Task 3**.


# Task 3: EggNOG-mapper

EggNOG-mapper is a tool for fast functional annotation of novel sequences (genes or proteins) using precomputed eggNOG-based orthology assignments. The use of orthology predictions for functional annotation avoids transferring annotations from paralogs e.g. duplicate genes with a higher chance of being involved in functional divergence.

We will use the same .fasta file as previously as the main input, whereas the Target Orthologs and GO Evidence options can be left to their default. If you want to be stricter with which annotations to consider, you can adjust these options to more restrictive values, but for our purposes, with such a small toy dataset, it probably does not hurt to be as liberal as possible in selecting annotations.



# Task 4: Post-Processing our Functional Annotations

When these three algorithms have successfully finished, we can already explore their results, although what we are really interested in is combining these pieces of information that we gathered from various different sources.

## Task 4.1: GO Mapping

After using a BLAST to receive hits from selected database, we need to perform GO Mapping to actually connect these hits to their associated GO Terms. In the side panel of our sequence table which contains the BLAST and InterProScan results, we can find **GO Mapping**. We simply have to run this action, which should complete very quickly, and we have successfully received the relevant GO Terms.

## Task 4.2: GO Annotation

Next, we will apply the retrieved and mapped GO Terms to our sequences. For this, we need to decide on how strict our “annotation rule” should be. This will determine how reliable and specific our resulting functional annotations are.

For this purpose, an annotation score is calculated for each candidate GO Term, based on the sequence similarity of the related BLAST hit, the evidence code (with experimental evidence codes typically being seen as more reliable than computational analysis evidence codes). The Annotation CutOff and GO Weight are illustrated in Figure 2.

In the side panel, we can find **GO Annotation** and run it with the default settings.


![image-20240307-095443.png](media://76d6a6f3-db0f-4b52-b7e4-274774a17149)

## Task 4.3: Merging BLAST, IPS, and eggNOG GOs

After completing the GO mapping and annotation, we can merge our results from BLAST and IPS through the side panel option **Merge GOs**, which can be found under the section **InterProScan**. 

To further merge these GOs with our eggNOG results as well, we need to save our eggNOG results as a .box file, which can be achieved through the **Save** or **Save As** icons in the top right of the corresponding table. Then, after we have switched back to our table with the now-merged BLAST and IPS results, we can run **Merge EggNOG GOs**, which is found under the section **GO Annotation**, selecting the just-saved .box files which contains our eggNOG results.

## Task 4.4: Finalizing our results

Now that we have combined the annotation results from all of our different sources, we can run some further cleaning to refine our results.

The next step is to **Validate GO Annotations**, also found under the side panel section **GO Annotation** - this ensures that we are only using the most specific GO Terms for each sequence. Referring back to Figure 2, because of merging GOs from different sources, we may now have a sequence that is, for instance, annotated with both “small molecule binding”, as well as “ion binding”. However, as “ion binding” is more specific, we can safely remove the “small molecule binding” annotation.

We can also use the side panel action **Remove 1st Level Annotations**; this will remove the most basic three GO Terms - Biological Process, Molecular Function, and Cellular Component - from our annotations, as these are much too general to provide any tangible information.

Additionally, we also want to make sure that we have obtained all the relevant enzyme codes. To do this, we first remove any enzyme codes that may already be present through the side panel action **Remove EC-Codes**. Afterwards, we can obtain all enzyme codes through **EC-Code Mapping**.

After these steps, we can save our final functional annotations as a .box file using the **Save **or **Save As** icons in the top right.

# Task 5: Investigating our Functional Annotation results

OmicsBox offers a variety of different options to investigate our results in more detail.

By right-clicking on an individual sequence, we can investigate the associated GO Terms and their annotation scores by creating a **GO-Mapping Graph with Annotation Scores**. We can also investigate the results of individual steps - BLAST, IPS, Mapping - in more detail. For instance, looking at the BLAST Results in Alignment-Mode may yield interesting insights. This also demonstrates that BLAST hits do not have to match the entire sequence, but just a fraction.

We can also create various charts - for instance, specifically about our **BLAST** results (e.g. the Top-Hit Species Distribution) or **InterProScan **results (e.g. the Distribution of Protein Families or Domains). These charts can be created in the respective sections of the side panel, and then selecting **Charts**.

# Task 6: Gene Set Enrichment Analysis

Now that we have our functional annotations, we can finally go back to our quantification data. Previously, we ran edgeR to perform a differential expression analysis as part of Hands-On Session 2. We can now return to those results, and use the side panel to perform a **Gene Set Enrichment Analysis (GSEA)**. As the Reference Annotation, we will chose our sequences with functional annotations, which we saved as a .box file.

This orders our genes by the following formula: sign(logFC) * -log10(P-Value)

This way, the genes that are the most up-regulated will be at the top of the lits, while down-regulated genes will be at the bottom of the list.

Then, the functional annotations we added to our sequences is used to determine the enrichment of GO Terms at the top and bottom of the list. That way, we can find GO Terms that are significantly enriched based on our differential expression analysis, either positively or negatively.

Having run our **GSEA**, we can investigate individual enriched GO Terms through Right Click → Show Details; or we can use the side panel option **Make Enriched Graph**. This creates three graphs, one for each basic GO Category, showcasing the network of enriched GO terms.

# Task 7: Combined Pathway Analysis with KEGG

In addition to our GSEA analysis, we can also run a Combined Pathway Analysis to find out more about how the relevant GO Terms we have discovered relate to, for instance, metabolic pathways. We can achieve this by linking up our obtained enzyme codes with the KEGG (Kyoto Encyclopedia of Genes and Genomes) database, and running another GSEA and Fischer’s Exact Test.

Under the module **functional analysis**, choose the option **Combined Pathway Analysis**. Disable the **Reactome** pathway analysis - in a real use case, you would probably want to perform this as well, but for our purposes it will take too long and it is not necessary. Next, we disable the **Gramene** pathway analysis, as we are not working with plant data. On the next page, we will link up **just** our **enyzme codes** with the KEGG database. As we just obtained these enyzme codes based on our combined BLAST, InterProScan, and eggNOG analyses, there is no need to also use the KEGG Orthology entries, so we can save some time here.