<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://teaching.healthtech.dtu.dk/22140/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Krivi</id>
	<title>22140 - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://teaching.healthtech.dtu.dk/22140/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Krivi"/>
	<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php/Special:Contributions/Krivi"/>
	<updated>2026-04-06T21:09:47Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=241</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=241"/>
		<updated>2025-09-26T10:19:58Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Visualizing networks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using R to extract, analyze, interpret and visualize (sub)networks&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. This is one of many interaction networks. Note that it has a confidence score (cs-score) telling us how certain we about each interaction.&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/exercise4.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the (data via the graph_from_dataframe() function). No plotting needed now.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.2, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Use ggraph to plot the graph created by filtering with confidence score 0.2. Indicate which nodes are seed notes and which are neighbours.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora(). What background do you need to use? (you already have all the information needed to decide and use this background)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #5:&#039;&#039;&#039;&lt;br /&gt;
* Which gene is the most central (as defined by betweenness centrality) in the largest cluster? Does that gene make sense in the disease context?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=240</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=240"/>
		<updated>2025-09-26T10:19:39Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Exercise on &amp;quot;Virtual Pulldowns&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using R to extract, analyze, interpret and visualize (sub)networks&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. This is one of many interaction networks. Note that it has a confidence score (cs-score) telling us how certain we about each interaction.&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/exercise4.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the (data via the graph_from_dataframe() function). No plotting needed now.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.2, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Plot the graph created by filtering with confidence score 0.2. Indicate which nodes are seed notes and which are neighbours.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora(). What background do you need to use? (you already have all the information needed to decide and use this background)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #5:&#039;&#039;&#039;&lt;br /&gt;
* Which gene is the most central (as defined by betweenness centrality) in the largest cluster? Does that gene make sense in the disease context?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=239</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=239"/>
		<updated>2025-09-20T16:26:42Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Exercise on &amp;quot;Virtual Pulldowns&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using R to extract, analyze, interpret and visualize (sub)networks&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. This is one of many interaction networks. Note that it has a confidence score (cs-score) telling us how certain we about each interaction.&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/exercise4.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.2, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Plot the graph created by filtering with confidence score 0.2. Indicate which nodes are seed notes and which are neighbours.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora(). What background do you need to use? (you already have all the information needed to decide and use this background)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #5:&#039;&#039;&#039;&lt;br /&gt;
* Which gene is the most central (as defined by betweenness centrality) in the largest cluster? Does that gene make sense in the disease context?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=238</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=238"/>
		<updated>2025-09-19T07:12:08Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Functional classification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using R to extract, analyze, interpret and visualize (sub)networks&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. This is one of many interaction networks. Note that it has a confidence score (cs-score) telling us how certain we about each interaction.&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.2, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Plot the graph created by filtering with confidence score 0.2. Indicate which nodes are seed notes and which are neighbours.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora(). What background do you need to use? (you already have all the information needed to decide and use this background)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #5:&#039;&#039;&#039;&lt;br /&gt;
* Which gene is the most central (as defined by betweenness centrality) in the largest cluster? Does that gene make sense in the disease context?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=237</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=237"/>
		<updated>2025-09-19T07:11:33Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Functional classification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using R to extract, analyze, interpret and visualize (sub)networks&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. This is one of many interaction networks. Note that it has a confidence score (cs-score) telling us how certain we about each interaction.&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.2, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Plot the graph created by filtering with confidence score 0.2. Indicate which nodes are seed notes and which are neighbours.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora(). What background do you need to use? (you already have all information needed to descided this - no information is missing)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #5:&#039;&#039;&#039;&lt;br /&gt;
* Which gene is the most central (as defined by betweenness centrality) in the largest cluster? Does that gene make sense in the disease context?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=236</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=236"/>
		<updated>2025-09-19T07:10:11Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Human diseases / virtual pulldown exercise */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using R to extract, analyze, interpret and visualize (sub)networks&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. This is one of many interaction networks. Note that it has a confidence score (cs-score) telling us how certain we about each interaction.&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.2, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Plot the graph created by filtering with confidence score 0.2. Indicate which nodes are seed notes and which are neighbours.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #5:&#039;&#039;&#039;&lt;br /&gt;
* Which gene is the most central (as defined by betweenness centrality) in the largest cluster? Does that gene make sense in the disease context?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=235</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=235"/>
		<updated>2025-09-19T07:09:30Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Functional classification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using R to extract, analyze and visualize (sub)networks&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. This is one of many interaction networks. Note that it has a confidence score (cs-score) telling us how certain we about each interaction.&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.2, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Plot the graph created by filtering with confidence score 0.2. Indicate which nodes are seed notes and which are neighbours.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #5:&#039;&#039;&#039;&lt;br /&gt;
* Which gene is the most central (as defined by betweenness centrality) in the largest cluster? Does that gene make sense in the disease context?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=234</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=234"/>
		<updated>2025-09-19T07:09:18Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Functional classification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using R to extract, analyze and visualize (sub)networks&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. This is one of many interaction networks. Note that it has a confidence score (cs-score) telling us how certain we about each interaction.&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.2, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Plot the graph created by filtering with confidence score 0.2. Indicate which nodes are seed notes and which are neighbours.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Which gene is the most central (as defined by betweenness centrality) in the largest cluster? Does that gene make sense in the disease context?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=233</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=233"/>
		<updated>2025-09-17T11:39:53Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Exercise on &amp;quot;Virtual Pulldowns&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using R to extract, analyze and visualize (sub)networks&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. This is one of many interaction networks. Note that it has a confidence score (cs-score) telling us how certain we about each interaction.&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.2, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Plot the graph created by filtering with confidence score 0.2. Indicate which nodes are seed notes and which are neighbours.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=232</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=232"/>
		<updated>2025-09-17T11:38:19Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Human diseases / virtual pulldown exercise */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using R to extract, analyze and visualize (sub)networks&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.2, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Plot the graph created by filtering with confidence score 0.2. Indicate which nodes are seed notes and which are neighbours.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=231</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=231"/>
		<updated>2025-09-17T11:27:50Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Visualizing networks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using the DiscoNet package in R&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.2, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Plot the graph created by filtering with confidence score 0.2. Indicate which nodes are seed notes and which are neighbours.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=230</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=230"/>
		<updated>2025-09-17T11:26:42Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Heart disease proteins */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using the DiscoNet package in R&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.2, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK:&#039;&#039;&#039; Get ready to visualize the three graphs (relevance score cutoffs 0, 0.5, 1) using ggraph.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Include screenshots of the networks in your report&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=229</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=229"/>
		<updated>2025-09-17T11:25:51Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Protein complex detection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using the DiscoNet package in R&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK:&#039;&#039;&#039; Get ready to visualize the three graphs (relevance score cutoffs 0, 0.5, 1) using ggraph.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Include screenshots of the networks in your report&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=228</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=228"/>
		<updated>2025-09-17T11:25:38Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Functional classification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using the DiscoNet package in R&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK:&#039;&#039;&#039; Get ready to visualize the three graphs (relevance score cutoffs 0, 0.5, 1) using ggraph.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Include screenshots of the networks in your report&lt;br /&gt;
&lt;br /&gt;
=== Protein complex detection ===&lt;br /&gt;
Next up, we will use the MCODE algorithm to detect potential protein complexes using a 0.0 relevance filtering cutoff. The can be done with the &amp;quot;community_detection&amp;quot; function of DiscoNet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
communities &amp;lt;- community_detection(g1, algorithm = &amp;quot;mcode&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3&amp;quot;:&lt;br /&gt;
Examine the resulting communities. Which one do you think may be molecular complexes and why? Paste an example of a community you believe could be a protein complex, and one you don&#039;t believe is a protein complex.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
Use loivant clustering with resolution = 0.4 to find sub-clusters in the network. For the 2-3 largest clusters do gene-set overrepressentation analysis with fora().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Suggest the main biological function for each cluster. Do they make biological sense in the context of heart disease?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=227</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=227"/>
		<updated>2025-09-17T11:16:45Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Heart disease proteins */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using the DiscoNet package in R&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require vertex attribute &amp;quot;names&amp;quot; in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,            mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK:&#039;&#039;&#039; Get ready to visualize the three graphs (relevance score cutoffs 0, 0.5, 1) using ggraph.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Include screenshots of the networks in your report&lt;br /&gt;
&lt;br /&gt;
=== Protein complex detection ===&lt;br /&gt;
Next up, we will use the MCODE algorithm to detect potential protein complexes using a 0.0 relevance filtering cutoff. The can be done with the &amp;quot;community_detection&amp;quot; function of DiscoNet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
communities &amp;lt;- community_detection(g1, algorithm = &amp;quot;mcode&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3&amp;quot;:&lt;br /&gt;
Examine the resulting communities. Which one do you think may be molecular complexes and why? Paste an example of a community you believe could be a protein complex, and one you don&#039;t believe is a protein complex.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
For the next part, we&#039;ll try to identify the function of the proteins we have found by performing Gene Ontology over-representation analysis of sub-clusters with-in the network.&lt;br /&gt;
&lt;br /&gt;
This can be done with the fgsea package.&lt;br /&gt;
&lt;br /&gt;
Start by loading the background gene list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise9.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run fora on all potential protein complexes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(fgsea)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
BP_list = split(x = BP_df$gene_symbol, f = BP_df$gs_name)&lt;br /&gt;
&lt;br /&gt;
fora(pathways = BP_list, genes = V(communities$communities[[&#039;COMMUNITY NUMBER&#039;]])$name, universe = all_gene_ids)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Discuss the interpretation of the most significant results for each of the communities that could be protein complexes. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
=== Analysis of heart developmental disease networks ===&lt;br /&gt;
[[Image:phenotype_groups.png|500px|right|thumb|Phenotype groups]]&lt;br /&gt;
[[Image:Cogs_brain.png|50px]]&lt;br /&gt;
&#039;&#039;&#039;Final task/report question&#039;&#039;&#039;: In the final part of the Virtual Pulldown exercise, your task is to select &#039;&#039;&#039;3 different sets of heart disease genes&#039;&#039;&#039; from the Lage &#039;&#039;et al&#039;&#039; (2010) study (data in excel file below) and do the following analyses:&lt;br /&gt;
# Create and download the virtual pulldown networks&lt;br /&gt;
# IMPORTANT: Create a NEW Cytoscape session.&lt;br /&gt;
# Import the networks into Cytoscape (either start a new session, or give the networks new names - otherwise Cytoscape gets confused).&lt;br /&gt;
#* Advanced: try to import the XML version instead of the SIF version (ask the instructor for help if needed); this can save you some time.&lt;br /&gt;
# Include a screenshot of the network in your report.&lt;br /&gt;
# Try to identify sub-networks in the network (by &amp;quot;eyeballing&amp;quot; the clusters), and perform a functional analysis of the proteins contained.&lt;br /&gt;
#* Report lists of proteins in the selected sub-networks.&lt;br /&gt;
#* Report Gene Ontology over-representation analysis for both Biological Process and Molecular Function.&lt;br /&gt;
#* Discuss and compare the results from the over-repressentation analysis.&lt;br /&gt;
&lt;br /&gt;
Excel sheet with the heart disease gene lists:&lt;br /&gt;
* [https://teaching.healthtech.dtu.dk/27040/exercises/HeartDiseaseGenes.xlsx HeartDiseaseGenes.xlsx]&lt;br /&gt;
---&amp;gt;&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=226</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=226"/>
		<updated>2025-09-17T11:15:46Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Heart disease proteins */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using the DiscoNet package in R&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require matching vertex names in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,              mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the function with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment at the start of the function). You should annotate what each section of the function does. &#039;&#039;Hint&#039;&#039;: If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Run the `filter_virtual_pulldown()` with these cutoffs: 0, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK:&#039;&#039;&#039; Get ready to visualize the three graphs (relevance score cutoffs 0, 0.5, 1) using ggraph.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Include screenshots of the networks in your report&lt;br /&gt;
&lt;br /&gt;
=== Protein complex detection ===&lt;br /&gt;
Next up, we will use the MCODE algorithm to detect potential protein complexes using a 0.0 relevance filtering cutoff. The can be done with the &amp;quot;community_detection&amp;quot; function of DiscoNet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
communities &amp;lt;- community_detection(g1, algorithm = &amp;quot;mcode&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3&amp;quot;:&lt;br /&gt;
Examine the resulting communities. Which one do you think may be molecular complexes and why? Paste an example of a community you believe could be a protein complex, and one you don&#039;t believe is a protein complex.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
For the next part, we&#039;ll try to identify the function of the proteins we have found by performing Gene Ontology over-representation analysis of sub-clusters with-in the network.&lt;br /&gt;
&lt;br /&gt;
This can be done with the fgsea package.&lt;br /&gt;
&lt;br /&gt;
Start by loading the background gene list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise9.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run fora on all potential protein complexes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(fgsea)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
BP_list = split(x = BP_df$gene_symbol, f = BP_df$gs_name)&lt;br /&gt;
&lt;br /&gt;
fora(pathways = BP_list, genes = V(communities$communities[[&#039;COMMUNITY NUMBER&#039;]])$name, universe = all_gene_ids)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Discuss the interpretation of the most significant results for each of the communities that could be protein complexes. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
=== Analysis of heart developmental disease networks ===&lt;br /&gt;
[[Image:phenotype_groups.png|500px|right|thumb|Phenotype groups]]&lt;br /&gt;
[[Image:Cogs_brain.png|50px]]&lt;br /&gt;
&#039;&#039;&#039;Final task/report question&#039;&#039;&#039;: In the final part of the Virtual Pulldown exercise, your task is to select &#039;&#039;&#039;3 different sets of heart disease genes&#039;&#039;&#039; from the Lage &#039;&#039;et al&#039;&#039; (2010) study (data in excel file below) and do the following analyses:&lt;br /&gt;
# Create and download the virtual pulldown networks&lt;br /&gt;
# IMPORTANT: Create a NEW Cytoscape session.&lt;br /&gt;
# Import the networks into Cytoscape (either start a new session, or give the networks new names - otherwise Cytoscape gets confused).&lt;br /&gt;
#* Advanced: try to import the XML version instead of the SIF version (ask the instructor for help if needed); this can save you some time.&lt;br /&gt;
# Include a screenshot of the network in your report.&lt;br /&gt;
# Try to identify sub-networks in the network (by &amp;quot;eyeballing&amp;quot; the clusters), and perform a functional analysis of the proteins contained.&lt;br /&gt;
#* Report lists of proteins in the selected sub-networks.&lt;br /&gt;
#* Report Gene Ontology over-representation analysis for both Biological Process and Molecular Function.&lt;br /&gt;
#* Discuss and compare the results from the over-repressentation analysis.&lt;br /&gt;
&lt;br /&gt;
Excel sheet with the heart disease gene lists:&lt;br /&gt;
* [https://teaching.healthtech.dtu.dk/27040/exercises/HeartDiseaseGenes.xlsx HeartDiseaseGenes.xlsx]&lt;br /&gt;
---&amp;gt;&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=225</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=225"/>
		<updated>2025-09-17T11:13:56Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Heart disease proteins */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using the DiscoNet package in R&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
1: First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Libraries needed&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2: Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3: Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph (aka virtual pulldown), Step 2: Filter the virtual pulldown (as discussed in lecture). For step 1:&lt;br /&gt;
&lt;br /&gt;
* You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
** Hint: The unlist() function turns a list into a vector wile presevering all entries&lt;br /&gt;
* You can use `induced_subgraph()` to extact a subnetwork based on a set of node ids.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4: For step2 you can use this function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
filter_virtual_pulldown &amp;lt;- function(subGraph, parentGraph, cutoff) {&lt;br /&gt;
  # require matching vertex names in both graphs&lt;br /&gt;
  if (is.null(V(subGraph)$name) || is.null(V(parentGraph)$name))&lt;br /&gt;
    stop(&amp;quot;Both graphs must have vertex &#039;name&#039; attributes.&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
  mode &amp;lt;- &amp;quot;all&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  vn &amp;lt;- V(subGraph)$name&lt;br /&gt;
  &lt;br /&gt;
  deg_full     &amp;lt;- degree(parentGraph, v = vn, mode = mode)&lt;br /&gt;
  deg_internal &amp;lt;- degree(subGraph,              mode = mode)&lt;br /&gt;
  &lt;br /&gt;
  res &amp;lt;- data.frame(&lt;br /&gt;
    node          = vn,&lt;br /&gt;
    deg_internal  = deg_internal,&lt;br /&gt;
    deg_full      = deg_full,&lt;br /&gt;
    frac_internal = ifelse(deg_full &amp;gt; 0, deg_internal / deg_full, NA_real_),&lt;br /&gt;
    stringsAsFactors = FALSE&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
  nodes_to_keep &amp;lt;- res$node[!is.na(res$frac_internal) &amp;amp; res$frac_internal &amp;gt;= cutoff]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph &amp;lt;- induced_subgraph(subGraph, vids = V(subGraph)[name %in% nodes_to_keep])&lt;br /&gt;
  &lt;br /&gt;
  V(filteredSubGraph)$frac_internal &amp;lt;- res$frac_internal[match(V(filteredSubGraph)$name, res$node)]&lt;br /&gt;
  &lt;br /&gt;
  filteredSubGraph&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start by annotating the code with comments (like the &amp;quot;# require matching vertex names in both graphs&amp;quot; comment). You should annotate what each part of the code does? If needed you can run parts of the code to see what the intermediary results are.&lt;br /&gt;
&lt;br /&gt;
5: Try running with these cutoffs: 0, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
* Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
* How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK:&#039;&#039;&#039; Get ready to visualize the three graphs (relevance score cutoffs 0, 0.5, 1) using ggraph.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Include screenshots of the networks in your report&lt;br /&gt;
&lt;br /&gt;
=== Protein complex detection ===&lt;br /&gt;
Next up, we will use the MCODE algorithm to detect potential protein complexes using a 0.0 relevance filtering cutoff. The can be done with the &amp;quot;community_detection&amp;quot; function of DiscoNet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
communities &amp;lt;- community_detection(g1, algorithm = &amp;quot;mcode&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3&amp;quot;:&lt;br /&gt;
Examine the resulting communities. Which one do you think may be molecular complexes and why? Paste an example of a community you believe could be a protein complex, and one you don&#039;t believe is a protein complex.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
For the next part, we&#039;ll try to identify the function of the proteins we have found by performing Gene Ontology over-representation analysis of sub-clusters with-in the network.&lt;br /&gt;
&lt;br /&gt;
This can be done with the fgsea package.&lt;br /&gt;
&lt;br /&gt;
Start by loading the background gene list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise9.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run fora on all potential protein complexes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(fgsea)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
BP_list = split(x = BP_df$gene_symbol, f = BP_df$gs_name)&lt;br /&gt;
&lt;br /&gt;
fora(pathways = BP_list, genes = V(communities$communities[[&#039;COMMUNITY NUMBER&#039;]])$name, universe = all_gene_ids)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Discuss the interpretation of the most significant results for each of the communities that could be protein complexes. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
=== Analysis of heart developmental disease networks ===&lt;br /&gt;
[[Image:phenotype_groups.png|500px|right|thumb|Phenotype groups]]&lt;br /&gt;
[[Image:Cogs_brain.png|50px]]&lt;br /&gt;
&#039;&#039;&#039;Final task/report question&#039;&#039;&#039;: In the final part of the Virtual Pulldown exercise, your task is to select &#039;&#039;&#039;3 different sets of heart disease genes&#039;&#039;&#039; from the Lage &#039;&#039;et al&#039;&#039; (2010) study (data in excel file below) and do the following analyses:&lt;br /&gt;
# Create and download the virtual pulldown networks&lt;br /&gt;
# IMPORTANT: Create a NEW Cytoscape session.&lt;br /&gt;
# Import the networks into Cytoscape (either start a new session, or give the networks new names - otherwise Cytoscape gets confused).&lt;br /&gt;
#* Advanced: try to import the XML version instead of the SIF version (ask the instructor for help if needed); this can save you some time.&lt;br /&gt;
# Include a screenshot of the network in your report.&lt;br /&gt;
# Try to identify sub-networks in the network (by &amp;quot;eyeballing&amp;quot; the clusters), and perform a functional analysis of the proteins contained.&lt;br /&gt;
#* Report lists of proteins in the selected sub-networks.&lt;br /&gt;
#* Report Gene Ontology over-representation analysis for both Biological Process and Molecular Function.&lt;br /&gt;
#* Discuss and compare the results from the over-repressentation analysis.&lt;br /&gt;
&lt;br /&gt;
Excel sheet with the heart disease gene lists:&lt;br /&gt;
* [https://teaching.healthtech.dtu.dk/27040/exercises/HeartDiseaseGenes.xlsx HeartDiseaseGenes.xlsx]&lt;br /&gt;
---&amp;gt;&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=224</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=224"/>
		<updated>2025-09-17T10:50:11Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Heart disease proteins */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using the DiscoNet package in R&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
# First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph, Step 2: Filter subgraph. Lets start with step 1. You can use the `ego()` function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Convert network into igraph object with the following relevancescore cutoffs: 0, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g &amp;lt;- graph_from_data_frame(interactions, directed = FALSE, vertices = node_attributes)&lt;br /&gt;
g1 &amp;lt;- relevance_filtering(g, 0)&lt;br /&gt;
g2 &amp;lt;- relevance_filtering(g, 0.5)&lt;br /&gt;
g3 &amp;lt;- relevance_filtering(g, 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
# How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK:&#039;&#039;&#039; Get ready to visualize the three graphs (relevance score cutoffs 0, 0.5, 1) using ggraph.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Include screenshots of the networks in your report&lt;br /&gt;
&lt;br /&gt;
=== Protein complex detection ===&lt;br /&gt;
Next up, we will use the MCODE algorithm to detect potential protein complexes using a 0.0 relevance filtering cutoff. The can be done with the &amp;quot;community_detection&amp;quot; function of DiscoNet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
communities &amp;lt;- community_detection(g1, algorithm = &amp;quot;mcode&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3&amp;quot;:&lt;br /&gt;
Examine the resulting communities. Which one do you think may be molecular complexes and why? Paste an example of a community you believe could be a protein complex, and one you don&#039;t believe is a protein complex.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
For the next part, we&#039;ll try to identify the function of the proteins we have found by performing Gene Ontology over-representation analysis of sub-clusters with-in the network.&lt;br /&gt;
&lt;br /&gt;
This can be done with the fgsea package.&lt;br /&gt;
&lt;br /&gt;
Start by loading the background gene list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise9.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run fora on all potential protein complexes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(fgsea)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
BP_list = split(x = BP_df$gene_symbol, f = BP_df$gs_name)&lt;br /&gt;
&lt;br /&gt;
fora(pathways = BP_list, genes = V(communities$communities[[&#039;COMMUNITY NUMBER&#039;]])$name, universe = all_gene_ids)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Discuss the interpretation of the most significant results for each of the communities that could be protein complexes. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
=== Analysis of heart developmental disease networks ===&lt;br /&gt;
[[Image:phenotype_groups.png|500px|right|thumb|Phenotype groups]]&lt;br /&gt;
[[Image:Cogs_brain.png|50px]]&lt;br /&gt;
&#039;&#039;&#039;Final task/report question&#039;&#039;&#039;: In the final part of the Virtual Pulldown exercise, your task is to select &#039;&#039;&#039;3 different sets of heart disease genes&#039;&#039;&#039; from the Lage &#039;&#039;et al&#039;&#039; (2010) study (data in excel file below) and do the following analyses:&lt;br /&gt;
# Create and download the virtual pulldown networks&lt;br /&gt;
# IMPORTANT: Create a NEW Cytoscape session.&lt;br /&gt;
# Import the networks into Cytoscape (either start a new session, or give the networks new names - otherwise Cytoscape gets confused).&lt;br /&gt;
#* Advanced: try to import the XML version instead of the SIF version (ask the instructor for help if needed); this can save you some time.&lt;br /&gt;
# Include a screenshot of the network in your report.&lt;br /&gt;
# Try to identify sub-networks in the network (by &amp;quot;eyeballing&amp;quot; the clusters), and perform a functional analysis of the proteins contained.&lt;br /&gt;
#* Report lists of proteins in the selected sub-networks.&lt;br /&gt;
#* Report Gene Ontology over-representation analysis for both Biological Process and Molecular Function.&lt;br /&gt;
#* Discuss and compare the results from the over-repressentation analysis.&lt;br /&gt;
&lt;br /&gt;
Excel sheet with the heart disease gene lists:&lt;br /&gt;
* [https://teaching.healthtech.dtu.dk/27040/exercises/HeartDiseaseGenes.xlsx HeartDiseaseGenes.xlsx]&lt;br /&gt;
---&amp;gt;&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=223</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=223"/>
		<updated>2025-09-17T10:48:16Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Heart disease proteins */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using the DiscoNet package in R&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
# First you need to load the packages and data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Extract all connections with a confidence score &amp;gt;= 0.2 and use igraph to create a graph with the data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Next we will do the virtual pulldown as a two step process. Step 1: Extract sub-graph, Step 2: Filter subgraph. Lets start with step 1. You can use the &amp;lt;pre&amp;gt;ego()&amp;lt;/pre&amp;gt; function to get neighbors of all seed genes. Here you need to specify &#039;&#039;mode = &amp;quot;all&amp;quot;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Convert network into igraph object with the following relevancescore cutoffs: 0, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g &amp;lt;- graph_from_data_frame(interactions, directed = FALSE, vertices = node_attributes)&lt;br /&gt;
g1 &amp;lt;- relevance_filtering(g, 0)&lt;br /&gt;
g2 &amp;lt;- relevance_filtering(g, 0.5)&lt;br /&gt;
g3 &amp;lt;- relevance_filtering(g, 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
# How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK:&#039;&#039;&#039; Get ready to visualize the three graphs (relevance score cutoffs 0, 0.5, 1) using ggraph.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Include screenshots of the networks in your report&lt;br /&gt;
&lt;br /&gt;
=== Protein complex detection ===&lt;br /&gt;
Next up, we will use the MCODE algorithm to detect potential protein complexes using a 0.0 relevance filtering cutoff. The can be done with the &amp;quot;community_detection&amp;quot; function of DiscoNet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
communities &amp;lt;- community_detection(g1, algorithm = &amp;quot;mcode&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3&amp;quot;:&lt;br /&gt;
Examine the resulting communities. Which one do you think may be molecular complexes and why? Paste an example of a community you believe could be a protein complex, and one you don&#039;t believe is a protein complex.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
For the next part, we&#039;ll try to identify the function of the proteins we have found by performing Gene Ontology over-representation analysis of sub-clusters with-in the network.&lt;br /&gt;
&lt;br /&gt;
This can be done with the fgsea package.&lt;br /&gt;
&lt;br /&gt;
Start by loading the background gene list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise9.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run fora on all potential protein complexes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(fgsea)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
BP_list = split(x = BP_df$gene_symbol, f = BP_df$gs_name)&lt;br /&gt;
&lt;br /&gt;
fora(pathways = BP_list, genes = V(communities$communities[[&#039;COMMUNITY NUMBER&#039;]])$name, universe = all_gene_ids)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Discuss the interpretation of the most significant results for each of the communities that could be protein complexes. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
=== Analysis of heart developmental disease networks ===&lt;br /&gt;
[[Image:phenotype_groups.png|500px|right|thumb|Phenotype groups]]&lt;br /&gt;
[[Image:Cogs_brain.png|50px]]&lt;br /&gt;
&#039;&#039;&#039;Final task/report question&#039;&#039;&#039;: In the final part of the Virtual Pulldown exercise, your task is to select &#039;&#039;&#039;3 different sets of heart disease genes&#039;&#039;&#039; from the Lage &#039;&#039;et al&#039;&#039; (2010) study (data in excel file below) and do the following analyses:&lt;br /&gt;
# Create and download the virtual pulldown networks&lt;br /&gt;
# IMPORTANT: Create a NEW Cytoscape session.&lt;br /&gt;
# Import the networks into Cytoscape (either start a new session, or give the networks new names - otherwise Cytoscape gets confused).&lt;br /&gt;
#* Advanced: try to import the XML version instead of the SIF version (ask the instructor for help if needed); this can save you some time.&lt;br /&gt;
# Include a screenshot of the network in your report.&lt;br /&gt;
# Try to identify sub-networks in the network (by &amp;quot;eyeballing&amp;quot; the clusters), and perform a functional analysis of the proteins contained.&lt;br /&gt;
#* Report lists of proteins in the selected sub-networks.&lt;br /&gt;
#* Report Gene Ontology over-representation analysis for both Biological Process and Molecular Function.&lt;br /&gt;
#* Discuss and compare the results from the over-repressentation analysis.&lt;br /&gt;
&lt;br /&gt;
Excel sheet with the heart disease gene lists:&lt;br /&gt;
* [https://teaching.healthtech.dtu.dk/27040/exercises/HeartDiseaseGenes.xlsx HeartDiseaseGenes.xlsx]&lt;br /&gt;
---&amp;gt;&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=222</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=222"/>
		<updated>2025-09-17T10:29:01Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Heart disease proteins */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using the DiscoNet package in R&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
# Load the packages&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(igraph)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Run DiscoNet with this list of proteins with the following parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
network_ex2 &amp;lt;- virtual_pulldown(seed_nodes = seeds, database = db, id_type = &amp;quot;hgnc&amp;quot;, zs_confidence_score = 0.156)&lt;br /&gt;
interactions &amp;lt;- data.frame(network_ex2$network)&lt;br /&gt;
node_attributes &amp;lt;- data.frame(network_ex2$node_attributes)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Convert network into igraph object with the following relevancescore cutoffs: 0, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g &amp;lt;- graph_from_data_frame(interactions, directed = FALSE, vertices = node_attributes)&lt;br /&gt;
g1 &amp;lt;- relevance_filtering(g, 0)&lt;br /&gt;
g2 &amp;lt;- relevance_filtering(g, 0.5)&lt;br /&gt;
g3 &amp;lt;- relevance_filtering(g, 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
# How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK:&#039;&#039;&#039; Get ready to visualize the three graphs (relevance score cutoffs 0, 0.5, 1) using ggraph.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Include screenshots of the networks in your report&lt;br /&gt;
&lt;br /&gt;
=== Protein complex detection ===&lt;br /&gt;
Next up, we will use the MCODE algorithm to detect potential protein complexes using a 0.0 relevance filtering cutoff. The can be done with the &amp;quot;community_detection&amp;quot; function of DiscoNet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
communities &amp;lt;- community_detection(g1, algorithm = &amp;quot;mcode&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3&amp;quot;:&lt;br /&gt;
Examine the resulting communities. Which one do you think may be molecular complexes and why? Paste an example of a community you believe could be a protein complex, and one you don&#039;t believe is a protein complex.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
For the next part, we&#039;ll try to identify the function of the proteins we have found by performing Gene Ontology over-representation analysis of sub-clusters with-in the network.&lt;br /&gt;
&lt;br /&gt;
This can be done with the fgsea package.&lt;br /&gt;
&lt;br /&gt;
Start by loading the background gene list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise9.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run fora on all potential protein complexes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(fgsea)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
BP_list = split(x = BP_df$gene_symbol, f = BP_df$gs_name)&lt;br /&gt;
&lt;br /&gt;
fora(pathways = BP_list, genes = V(communities$communities[[&#039;COMMUNITY NUMBER&#039;]])$name, universe = all_gene_ids)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Discuss the interpretation of the most significant results for each of the communities that could be protein complexes. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
=== Analysis of heart developmental disease networks ===&lt;br /&gt;
[[Image:phenotype_groups.png|500px|right|thumb|Phenotype groups]]&lt;br /&gt;
[[Image:Cogs_brain.png|50px]]&lt;br /&gt;
&#039;&#039;&#039;Final task/report question&#039;&#039;&#039;: In the final part of the Virtual Pulldown exercise, your task is to select &#039;&#039;&#039;3 different sets of heart disease genes&#039;&#039;&#039; from the Lage &#039;&#039;et al&#039;&#039; (2010) study (data in excel file below) and do the following analyses:&lt;br /&gt;
# Create and download the virtual pulldown networks&lt;br /&gt;
# IMPORTANT: Create a NEW Cytoscape session.&lt;br /&gt;
# Import the networks into Cytoscape (either start a new session, or give the networks new names - otherwise Cytoscape gets confused).&lt;br /&gt;
#* Advanced: try to import the XML version instead of the SIF version (ask the instructor for help if needed); this can save you some time.&lt;br /&gt;
# Include a screenshot of the network in your report.&lt;br /&gt;
# Try to identify sub-networks in the network (by &amp;quot;eyeballing&amp;quot; the clusters), and perform a functional analysis of the proteins contained.&lt;br /&gt;
#* Report lists of proteins in the selected sub-networks.&lt;br /&gt;
#* Report Gene Ontology over-representation analysis for both Biological Process and Molecular Function.&lt;br /&gt;
#* Discuss and compare the results from the over-repressentation analysis.&lt;br /&gt;
&lt;br /&gt;
Excel sheet with the heart disease gene lists:&lt;br /&gt;
* [https://teaching.healthtech.dtu.dk/27040/exercises/HeartDiseaseGenes.xlsx HeartDiseaseGenes.xlsx]&lt;br /&gt;
---&amp;gt;&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=221</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=221"/>
		<updated>2025-09-17T10:27:43Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Heart disease proteins */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using the DiscoNet package in R&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
# Load the packages&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(DiscoNet)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
# The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Run DiscoNet with this list of proteins with the following parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
network_ex2 &amp;lt;- virtual_pulldown(seed_nodes = seeds, database = db, id_type = &amp;quot;hgnc&amp;quot;, zs_confidence_score = 0.156)&lt;br /&gt;
interactions &amp;lt;- data.frame(network_ex2$network)&lt;br /&gt;
node_attributes &amp;lt;- data.frame(network_ex2$node_attributes)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Convert network into igraph object with the following relevancescore cutoffs: 0, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g &amp;lt;- graph_from_data_frame(interactions, directed = FALSE, vertices = node_attributes)&lt;br /&gt;
g1 &amp;lt;- relevance_filtering(g, 0)&lt;br /&gt;
g2 &amp;lt;- relevance_filtering(g, 0.5)&lt;br /&gt;
g3 &amp;lt;- relevance_filtering(g, 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
# How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK:&#039;&#039;&#039; Get ready to visualize the three graphs (relevance score cutoffs 0, 0.5, 1) using ggraph.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Include screenshots of the networks in your report&lt;br /&gt;
&lt;br /&gt;
=== Protein complex detection ===&lt;br /&gt;
Next up, we will use the MCODE algorithm to detect potential protein complexes using a 0.0 relevance filtering cutoff. The can be done with the &amp;quot;community_detection&amp;quot; function of DiscoNet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
communities &amp;lt;- community_detection(g1, algorithm = &amp;quot;mcode&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3&amp;quot;:&lt;br /&gt;
Examine the resulting communities. Which one do you think may be molecular complexes and why? Paste an example of a community you believe could be a protein complex, and one you don&#039;t believe is a protein complex.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
For the next part, we&#039;ll try to identify the function of the proteins we have found by performing Gene Ontology over-representation analysis of sub-clusters with-in the network.&lt;br /&gt;
&lt;br /&gt;
This can be done with the fgsea package.&lt;br /&gt;
&lt;br /&gt;
Start by loading the background gene list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise9.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run fora on all potential protein complexes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(fgsea)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
BP_list = split(x = BP_df$gene_symbol, f = BP_df$gs_name)&lt;br /&gt;
&lt;br /&gt;
fora(pathways = BP_list, genes = V(communities$communities[[&#039;COMMUNITY NUMBER&#039;]])$name, universe = all_gene_ids)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Discuss the interpretation of the most significant results for each of the communities that could be protein complexes. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
=== Analysis of heart developmental disease networks ===&lt;br /&gt;
[[Image:phenotype_groups.png|500px|right|thumb|Phenotype groups]]&lt;br /&gt;
[[Image:Cogs_brain.png|50px]]&lt;br /&gt;
&#039;&#039;&#039;Final task/report question&#039;&#039;&#039;: In the final part of the Virtual Pulldown exercise, your task is to select &#039;&#039;&#039;3 different sets of heart disease genes&#039;&#039;&#039; from the Lage &#039;&#039;et al&#039;&#039; (2010) study (data in excel file below) and do the following analyses:&lt;br /&gt;
# Create and download the virtual pulldown networks&lt;br /&gt;
# IMPORTANT: Create a NEW Cytoscape session.&lt;br /&gt;
# Import the networks into Cytoscape (either start a new session, or give the networks new names - otherwise Cytoscape gets confused).&lt;br /&gt;
#* Advanced: try to import the XML version instead of the SIF version (ask the instructor for help if needed); this can save you some time.&lt;br /&gt;
# Include a screenshot of the network in your report.&lt;br /&gt;
# Try to identify sub-networks in the network (by &amp;quot;eyeballing&amp;quot; the clusters), and perform a functional analysis of the proteins contained.&lt;br /&gt;
#* Report lists of proteins in the selected sub-networks.&lt;br /&gt;
#* Report Gene Ontology over-representation analysis for both Biological Process and Molecular Function.&lt;br /&gt;
#* Discuss and compare the results from the over-repressentation analysis.&lt;br /&gt;
&lt;br /&gt;
Excel sheet with the heart disease gene lists:&lt;br /&gt;
* [https://teaching.healthtech.dtu.dk/27040/exercises/HeartDiseaseGenes.xlsx HeartDiseaseGenes.xlsx]&lt;br /&gt;
---&amp;gt;&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=220</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=220"/>
		<updated>2025-09-17T10:27:22Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Human diseases / virtual pulldown exercise */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, Rasmus Wernersson and Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using the DiscoNet package in R&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
# Load the packages&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(DiscoNet)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Run DiscoNet with this list of proteins with the following parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
network_ex2 &amp;lt;- virtual_pulldown(seed_nodes = seeds, database = db, id_type = &amp;quot;hgnc&amp;quot;, zs_confidence_score = 0.156)&lt;br /&gt;
interactions &amp;lt;- data.frame(network_ex2$network)&lt;br /&gt;
node_attributes &amp;lt;- data.frame(network_ex2$node_attributes)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Convert network into igraph object with the following relevancescore cutoffs: 0, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g &amp;lt;- graph_from_data_frame(interactions, directed = FALSE, vertices = node_attributes)&lt;br /&gt;
g1 &amp;lt;- relevance_filtering(g, 0)&lt;br /&gt;
g2 &amp;lt;- relevance_filtering(g, 0.5)&lt;br /&gt;
g3 &amp;lt;- relevance_filtering(g, 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
# How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK:&#039;&#039;&#039; Get ready to visualize the three graphs (relevance score cutoffs 0, 0.5, 1) using ggraph.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Include screenshots of the networks in your report&lt;br /&gt;
&lt;br /&gt;
=== Protein complex detection ===&lt;br /&gt;
Next up, we will use the MCODE algorithm to detect potential protein complexes using a 0.0 relevance filtering cutoff. The can be done with the &amp;quot;community_detection&amp;quot; function of DiscoNet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
communities &amp;lt;- community_detection(g1, algorithm = &amp;quot;mcode&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3&amp;quot;:&lt;br /&gt;
Examine the resulting communities. Which one do you think may be molecular complexes and why? Paste an example of a community you believe could be a protein complex, and one you don&#039;t believe is a protein complex.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
For the next part, we&#039;ll try to identify the function of the proteins we have found by performing Gene Ontology over-representation analysis of sub-clusters with-in the network.&lt;br /&gt;
&lt;br /&gt;
This can be done with the fgsea package.&lt;br /&gt;
&lt;br /&gt;
Start by loading the background gene list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise9.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run fora on all potential protein complexes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(fgsea)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
BP_list = split(x = BP_df$gene_symbol, f = BP_df$gs_name)&lt;br /&gt;
&lt;br /&gt;
fora(pathways = BP_list, genes = V(communities$communities[[&#039;COMMUNITY NUMBER&#039;]])$name, universe = all_gene_ids)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Discuss the interpretation of the most significant results for each of the communities that could be protein complexes. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
=== Analysis of heart developmental disease networks ===&lt;br /&gt;
[[Image:phenotype_groups.png|500px|right|thumb|Phenotype groups]]&lt;br /&gt;
[[Image:Cogs_brain.png|50px]]&lt;br /&gt;
&#039;&#039;&#039;Final task/report question&#039;&#039;&#039;: In the final part of the Virtual Pulldown exercise, your task is to select &#039;&#039;&#039;3 different sets of heart disease genes&#039;&#039;&#039; from the Lage &#039;&#039;et al&#039;&#039; (2010) study (data in excel file below) and do the following analyses:&lt;br /&gt;
# Create and download the virtual pulldown networks&lt;br /&gt;
# IMPORTANT: Create a NEW Cytoscape session.&lt;br /&gt;
# Import the networks into Cytoscape (either start a new session, or give the networks new names - otherwise Cytoscape gets confused).&lt;br /&gt;
#* Advanced: try to import the XML version instead of the SIF version (ask the instructor for help if needed); this can save you some time.&lt;br /&gt;
# Include a screenshot of the network in your report.&lt;br /&gt;
# Try to identify sub-networks in the network (by &amp;quot;eyeballing&amp;quot; the clusters), and perform a functional analysis of the proteins contained.&lt;br /&gt;
#* Report lists of proteins in the selected sub-networks.&lt;br /&gt;
#* Report Gene Ontology over-representation analysis for both Biological Process and Molecular Function.&lt;br /&gt;
#* Discuss and compare the results from the over-repressentation analysis.&lt;br /&gt;
&lt;br /&gt;
Excel sheet with the heart disease gene lists:&lt;br /&gt;
* [https://teaching.healthtech.dtu.dk/27040/exercises/HeartDiseaseGenes.xlsx HeartDiseaseGenes.xlsx]&lt;br /&gt;
---&amp;gt;&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=DiscoNet&amp;diff=219</id>
		<title>DiscoNet</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=DiscoNet&amp;diff=219"/>
		<updated>2025-09-17T10:26:50Z</updated>

		<summary type="html">&lt;p&gt;Krivi: Krivi moved page DiscoNet to Heart Disease and Virtual Pulldown: renaming&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Heart Disease and Virtual Pulldown]]&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=218</id>
		<title>Heart Disease and Virtual Pulldown</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=Heart_Disease_and_Virtual_Pulldown&amp;diff=218"/>
		<updated>2025-09-17T10:26:50Z</updated>

		<summary type="html">&lt;p&gt;Krivi: Krivi moved page DiscoNet to Heart Disease and Virtual Pulldown: renaming&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Human diseases / virtual pulldown exercise =&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Lars Rønn Olsen, Giorgia Moranzoni, and Rasmus Wernersson&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Learning objectives:&#039;&#039;&#039;&lt;br /&gt;
* Overall objective: learn how to extract meaningful networks from human PPI data&lt;br /&gt;
*# Virtual pulldowns: sampling 1st order networks and filtering &amp;quot;sticky proteins&amp;quot;&lt;br /&gt;
*# Finding tightly connected clusters in larger networks&lt;br /&gt;
*# Using the DiscoNet package in R&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
[[Image:Heart+networks.png|600px|right|thumb|&#039;&#039;&#039;Click to zoom&#039;&#039;&#039; - example of the type of network characterization we aim at doing in this exercise. Seed proteins are colored yellow. (From Lage &#039;&#039;et al&#039;&#039;, 2010)]]&lt;br /&gt;
&lt;br /&gt;
=== The network neighborhood as an indication of function ===&lt;br /&gt;
As we have seen before, the function of a protein can often be inferred from the function of the proteins interacting with it. Previously we have been using this to look at the function of proteins of which little is known. Today we&#039;ll take this a step further by investigating what we can learn from the interaction partner for a &#039;&#039;&#039;group&#039;&#039;&#039; of potentially associated proteins. &lt;br /&gt;
=== Disease gene/protein networks ===&lt;br /&gt;
The basic idea is to start out with a list of genes/proteins that are known (or expected) to be involved in the same disease, even if the exact molecular basis of the disease is not understood. The hypothesis is that many of the disease-associated genes are likely to be involved in networks leading to the same phenotype (here: disease).&lt;br /&gt;
&lt;br /&gt;
In the most simple case, all known disease related genes, might be part of a single network with a crystal-clear link to the disease. However, this is rarely the case.&lt;br /&gt;
&lt;br /&gt;
What is more commonly the case is the situation shown in the figure to the right: the known disease related genes/protein (&amp;quot;seed proteins&amp;quot;) are involved in several &#039;&#039;&#039;sub-networks&#039;&#039;&#039; describing different components of the disease. &lt;br /&gt;
&lt;br /&gt;
There are several benefits from this type of analysis - most importantly:&lt;br /&gt;
* Identification of novel disease-related genes/proteins&lt;br /&gt;
* Generating hypotheses about the molecular biology behind a disease&lt;br /&gt;
&lt;br /&gt;
=== Knowing where to look ===&lt;br /&gt;
The human interactome is HUGE. The theoretical maximum is all 20.000+ proteins interacting with each other (200 million interactions), but even the fraction we have experimental evidence for, is in the order of several hundreds of thousands of interactions between 12.000+ proteins.&lt;br /&gt;
&lt;br /&gt;
As we have seen before when we looked at network properties, it will be possible to connect most nodes (here: proteins) in the network with very few steps. This is also the case with the human interactome, which taken as a whole is one giant interconnected hairball. In order to learn anything about the function of the disease genes/proteins in question, it&#039;s important to restrict what we&#039;re looking at to the &#039;&#039;&#039;close neighborhood&#039;&#039;&#039; of the proteins. &lt;br /&gt;
&lt;br /&gt;
In this exercise we&#039;ll be working with two different approaches to this:&lt;br /&gt;
# Building a network &amp;quot;bottom-up&amp;quot; - sampling the 1st order interaction partners for a list of input proteins (&amp;quot;Virtual pulldowns&amp;quot;)&lt;br /&gt;
# Topology based clustering on large input networks, followed by a search for cluster enriched in disease-related proteins&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise on &amp;quot;Virtual Pulldowns&amp;quot; ==&lt;br /&gt;
For this part of the exercise, we&#039;ll be using a resource created here at DTU: the &amp;quot;InWeb&amp;quot; inferred human interactome. As we have been going through in much more details in the lecture, InWeb was build by:&lt;br /&gt;
# Transferring interactions from model organisms to human by orthology (if a pair of interacting proteins have strong orthologs in human, the interaction is transferred)&lt;br /&gt;
# &#039;&#039;&#039;Scoring&#039;&#039;&#039; the reliability of the interactions. This allows for filtering out interactions with little experimental support, thus building a high-confidence network&lt;br /&gt;
&lt;br /&gt;
For querying the InWeb we&#039;ll use the &amp;quot;DiscoNet&amp;quot; R package, which works as follows:&lt;br /&gt;
&lt;br /&gt;
# Input: a list of protein believed to be involved in a particular biology (here: different heart diseases/developmental stages)&lt;br /&gt;
# For each protein, 1st order interaction partners are found&lt;br /&gt;
# For all input proteins and all 1st order interaction partners, a combined network is built&lt;br /&gt;
# For the combined network a series of &#039;&#039;&#039;scored subnetworks&#039;&#039;&#039; are build in order to filter away &amp;quot;sticky proteins&amp;quot; (as we talked about in the lecture)&lt;br /&gt;
# An overrepresentation analysis is performed for each complex using the fgsea package&lt;br /&gt;
# Finally a visual representation of the network is presented&lt;br /&gt;
&lt;br /&gt;
=== Heart disease proteins ===&lt;br /&gt;
We&#039;ll start out with a set of proteins known to be involved in &#039;&#039;&#039;[https://en.wikipedia.org/wiki/Atrioventricular_septal_defect|Abnormal atrioventricular canal morphology]&#039;&#039;&#039; (&amp;quot;AACM&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seeds &amp;lt;- c(&amp;quot;ALDH1A2&amp;quot;, &amp;quot;BMP2&amp;quot;, &amp;quot;CXADR&amp;quot;, &amp;quot;GATA4&amp;quot;, &amp;quot;HAS2&amp;quot;, &amp;quot;NF1&amp;quot;, &amp;quot;NKX2-5&amp;quot;, &amp;quot;PITX2&amp;quot;, &amp;quot;PKD2&amp;quot;, &amp;quot;RXRA&amp;quot;, &amp;quot;TBX1&amp;quot;, &amp;quot;TBX2&amp;quot;, &amp;quot;ZFPM1&amp;quot;, &amp;quot;ZFPM2&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #1:&#039;&#039;&#039; &lt;br /&gt;
# Load the packages&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(DiscoNet)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
library(fgsea)&lt;br /&gt;
&lt;br /&gt;
The PPI database we will use is InWeb:&lt;br /&gt;
load(file=&#039;/home/projects/22140/inweb_reduced.Rdata&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Run DiscoNet with this list of proteins with the following parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
network_ex2 &amp;lt;- virtual_pulldown(seed_nodes = seeds, database = db, id_type = &amp;quot;hgnc&amp;quot;, zs_confidence_score = 0.156)&lt;br /&gt;
interactions &amp;lt;- data.frame(network_ex2$network)&lt;br /&gt;
node_attributes &amp;lt;- data.frame(network_ex2$node_attributes)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Convert network into igraph object with the following relevancescore cutoffs: 0, 0.5, 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g &amp;lt;- graph_from_data_frame(interactions, directed = FALSE, vertices = node_attributes)&lt;br /&gt;
g1 &amp;lt;- relevance_filtering(g, 0)&lt;br /&gt;
g2 &amp;lt;- relevance_filtering(g, 0.5)&lt;br /&gt;
g3 &amp;lt;- relevance_filtering(g, 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Look at the size of the filtered/scored networks to get an impression of how the network is narrowed down as the confidence score cut-off is raised&lt;br /&gt;
# How many proteins (nodes) and how many interactions (edges) are reported when a 0.2 threshold is applied? How does that compare to the full network (no cutoff)? Explain difference.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing networks ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK:&#039;&#039;&#039; Get ready to visualize the three graphs (relevance score cutoffs 0, 0.5, 1) using ggraph.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2&amp;quot;:&lt;br /&gt;
* Include screenshots of the networks in your report&lt;br /&gt;
&lt;br /&gt;
=== Protein complex detection ===&lt;br /&gt;
Next up, we will use the MCODE algorithm to detect potential protein complexes using a 0.0 relevance filtering cutoff. The can be done with the &amp;quot;community_detection&amp;quot; function of DiscoNet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
communities &amp;lt;- community_detection(g1, algorithm = &amp;quot;mcode&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3&amp;quot;:&lt;br /&gt;
Examine the resulting communities. Which one do you think may be molecular complexes and why? Paste an example of a community you believe could be a protein complex, and one you don&#039;t believe is a protein complex.&lt;br /&gt;
&lt;br /&gt;
=== Functional classification ===&lt;br /&gt;
For the next part, we&#039;ll try to identify the function of the proteins we have found by performing Gene Ontology over-representation analysis of sub-clusters with-in the network.&lt;br /&gt;
&lt;br /&gt;
This can be done with the fgsea package.&lt;br /&gt;
&lt;br /&gt;
Start by loading the background gene list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise9.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run fora on all potential protein complexes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library(fgsea)&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;human&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
BP_list = split(x = BP_df$gene_symbol, f = BP_df$gs_name)&lt;br /&gt;
&lt;br /&gt;
fora(pathways = BP_list, genes = V(communities$communities[[&#039;COMMUNITY NUMBER&#039;]])$name, universe = all_gene_ids)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #4:&#039;&#039;&#039;&lt;br /&gt;
* Discuss the interpretation of the most significant results for each of the communities that could be protein complexes. Do they make biological sense in the context of heart disease?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
=== Analysis of heart developmental disease networks ===&lt;br /&gt;
[[Image:phenotype_groups.png|500px|right|thumb|Phenotype groups]]&lt;br /&gt;
[[Image:Cogs_brain.png|50px]]&lt;br /&gt;
&#039;&#039;&#039;Final task/report question&#039;&#039;&#039;: In the final part of the Virtual Pulldown exercise, your task is to select &#039;&#039;&#039;3 different sets of heart disease genes&#039;&#039;&#039; from the Lage &#039;&#039;et al&#039;&#039; (2010) study (data in excel file below) and do the following analyses:&lt;br /&gt;
# Create and download the virtual pulldown networks&lt;br /&gt;
# IMPORTANT: Create a NEW Cytoscape session.&lt;br /&gt;
# Import the networks into Cytoscape (either start a new session, or give the networks new names - otherwise Cytoscape gets confused).&lt;br /&gt;
#* Advanced: try to import the XML version instead of the SIF version (ask the instructor for help if needed); this can save you some time.&lt;br /&gt;
# Include a screenshot of the network in your report.&lt;br /&gt;
# Try to identify sub-networks in the network (by &amp;quot;eyeballing&amp;quot; the clusters), and perform a functional analysis of the proteins contained.&lt;br /&gt;
#* Report lists of proteins in the selected sub-networks.&lt;br /&gt;
#* Report Gene Ontology over-representation analysis for both Biological Process and Molecular Function.&lt;br /&gt;
#* Discuss and compare the results from the over-repressentation analysis.&lt;br /&gt;
&lt;br /&gt;
Excel sheet with the heart disease gene lists:&lt;br /&gt;
* [https://teaching.healthtech.dtu.dk/27040/exercises/HeartDiseaseGenes.xlsx HeartDiseaseGenes.xlsx]&lt;br /&gt;
---&amp;gt;&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=217</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=217"/>
		<updated>2025-09-17T10:16:10Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Enrichment analysis - reexamining cluster #1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #6: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes that had the possiblity of ending in the final list (e.g. all genes tested for statistical significance). We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #7:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes (background for this exercise) calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
# What will happen to the P-value and odds ratio (calculated by &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt;) if the background was 500 genes,100,000 genes? Calculate the result and comment on it. What does this mean for the choice of background?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from an existing interaction network. You can find clusters 1-8 in the node attribute table. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part1.Rdata&amp;quot;) # existing network data&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part2.Rdata&amp;quot;) # background&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Hint&#039;&#039;: You can see which objects exist in your current R session through RStudio&#039;s &amp;quot;Envroment&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the other clusters in the interaction data. Randomly pick another cluster. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** What is the likely function of this cluster?**&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=216</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=216"/>
		<updated>2025-09-11T12:13:27Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Enrichment analysis - reexamining cluster #1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #6: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes that had the possiblity of ending in the final list (e.g. all genes tested for statistical significance). We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #7:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes (background for this exercise) calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
# What will happen to the P-value and odds ratio (calculated by &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt;) if the background was 500 genes,100,000 genes? What does this mean for the choice of background?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from an existing interaction network. You can find clusters 1-8 in the node attribute table. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part1.Rdata&amp;quot;) # existing network data&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part2.Rdata&amp;quot;) # background&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Hint&#039;&#039;: You can see which objects exist in your current R session through RStudio&#039;s &amp;quot;Envroment&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the other clusters in the interaction data. Randomly pick another cluster. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** What is the likely function of this cluster?**&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=215</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=215"/>
		<updated>2025-09-11T11:52:07Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Enrichment analysis - reexamining cluster #1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #6: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes that had the possiblity of ending in the final list (e.g. all genes tested for statistical significance). We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #7:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes (background for this exercise) calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
# What will happen to the P-value and odds ratio (calculated by &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt;) if the background was 1000 genes,100,000 genes?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from an existing interaction network. You can find clusters 1-8 in the node attribute table. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part1.Rdata&amp;quot;) # existing network data&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part2.Rdata&amp;quot;) # background&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Hint&#039;&#039;: You can see which objects exist in your current R session through RStudio&#039;s &amp;quot;Envroment&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the other clusters in the interaction data. Randomly pick another cluster. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** What is the likely function of this cluster?**&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=214</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=214"/>
		<updated>2025-09-11T11:50:16Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Enrichment analysis - reexamining cluster #1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #6: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes that had the possiblity of ending in the final list (e.g. all genes tested for statistical significance). We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #7:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes (background for this exercise) calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from an existing interaction network. You can find clusters 1-8 in the node attribute table. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part1.Rdata&amp;quot;) # existing network data&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part2.Rdata&amp;quot;) # background&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Hint&#039;&#039;: You can see which objects exist in your current R session through RStudio&#039;s &amp;quot;Envroment&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the other clusters in the interaction data. Randomly pick another cluster. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** What is the likely function of this cluster?**&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=213</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=213"/>
		<updated>2025-09-11T11:49:13Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Part 2: Gene Ontology overrepresentation analysis (ORA) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #6: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes that had the possiblity of ending in the final list (e.g. all genes tested for statistical significance). We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #7:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from an existing interaction network. You can find clusters 1-8 in the node attribute table. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part1.Rdata&amp;quot;) # existing network data&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part2.Rdata&amp;quot;) # background&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Hint&#039;&#039;: You can see which objects exist in your current R session through RStudio&#039;s &amp;quot;Envroment&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the other clusters in the interaction data. Randomly pick another cluster. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** What is the likely function of this cluster?**&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=212</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=212"/>
		<updated>2025-09-10T08:36:36Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Repeat analysis on selected clusters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #6: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #7:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from an existing interaction network. You can find clusters 1-8 in the node attribute table. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part1.Rdata&amp;quot;) # existing network data&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part2.Rdata&amp;quot;) # background&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Hint&#039;&#039;: You can see which objects exist in your current R session through RStudio&#039;s &amp;quot;Envroment&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the other clusters in the interaction data. Randomly pick another cluster. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** What is the likely function of this cluster?**&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=211</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=211"/>
		<updated>2025-09-10T08:36:27Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Preparing input data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #6: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #7:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from an existing interaction network. You can find clusters 1-8 in the node attribute table. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part1.Rdata&amp;quot;) # existing network data&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part2.Rdata&amp;quot;) # background&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Hint&#039;&#039;: You can see which objects exist in your current R session through RStudio&#039;s &amp;quot;Envroment&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the other clusters in the interaction data. Randomly pick another cluster. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** What is the likely function of this cluster?**&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=210</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=210"/>
		<updated>2025-09-10T08:35:52Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Enrichment analysis - reexamining cluster #1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #6: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #7:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from an existing interaction network. You can find clusters 1-8 in the node attribute table. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part1.Rdata&amp;quot;) # existing network data&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part2.Rdata&amp;quot;) # background&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Hint&#039;&#039;: You can see which objects exist in your current R session through RStudio&#039;s &amp;quot;Envroment&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the other clusters in the interaction data. Randomly pick another cluster. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** What is the likely function of this cluster?**&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=209</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=209"/>
		<updated>2025-09-10T08:35:14Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* UniProt */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #6: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from an existing interaction network. You can find clusters 1-8 in the node attribute table. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part1.Rdata&amp;quot;) # existing network data&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part2.Rdata&amp;quot;) # background&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Hint&#039;&#039;: You can see which objects exist in your current R session through RStudio&#039;s &amp;quot;Envroment&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the other clusters in the interaction data. Randomly pick another cluster. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** What is the likely function of this cluster?**&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=208</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=208"/>
		<updated>2025-09-10T08:34:37Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Repeat analysis on selected clusters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from an existing interaction network. You can find clusters 1-8 in the node attribute table. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part1.Rdata&amp;quot;) # existing network data&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part2.Rdata&amp;quot;) # background&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Hint&#039;&#039;: You can see which objects exist in your current R session through RStudio&#039;s &amp;quot;Envroment&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the other clusters in the interaction data. Randomly pick another cluster. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** What is the likely function of this cluster?**&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=207</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=207"/>
		<updated>2025-09-10T08:32:34Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Preparing input data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from an existing interaction network. You can find clusters 1-8 in the node attribute table. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part1.Rdata&amp;quot;) # existing network data&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part2.Rdata&amp;quot;) # background&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Hint&#039;&#039;: You can see which objects exist in your current R session through RStudio&#039;s &amp;quot;Envroment&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=206</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=206"/>
		<updated>2025-09-10T08:31:38Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Preparing input data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from an existing interaction network. You can find clusters 1-8 in the node attribute table. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part1.Rdata&amp;quot;) # existing network data&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise3_part2.Rdata&amp;quot;) # background&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Hint&#039;&#039;: You can see which objects exist in your current R session through RStudio&#039;s &amp;quot;Envroment&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=205</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=205"/>
		<updated>2025-09-10T08:30:22Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from an existing interaction network. You can find clusters 1-8 in the node attribute table. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;) # existing network data&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;) # background&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Hint&#039;&#039;: You can see which objects exist in your current R session through RStudio&#039;s &amp;quot;Envroment&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=204</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=204"/>
		<updated>2025-09-10T08:19:58Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Introducing over representation in R */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of all annotated genes (background list). The &amp;lt;code&amp;gt;fora()&amp;lt;/code&amp;gt; function from &#039;&#039;&#039;fgsea&#039;&#039;&#039; package can be used do an overrepressentation analysis (incl. p-values) for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from last week&#039;s exercises as example. You can find clusters 1-8 in the node attribute table from last week&#039;s exercise, and clusters 9-10 in your solutions (also included in the Rdata object for this week&#039;s exercises). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;)&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=203</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=203"/>
		<updated>2025-09-10T08:17:58Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Enrichment analysis - reexamining cluster #1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term (use &amp;lt;code&amp;gt;fisher.test()&amp;lt;/code&amp;gt; in RStudio)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of the entire yeast genome (background list). The &amp;quot;fora&amp;quot; function from &amp;quot;fgsea&amp;quot; can be used to calculate p-values for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from last week&#039;s exercises as example. You can find clusters 1-8 in the node attribute table from last week&#039;s exercise, and clusters 9-10 in your solutions (also included in the Rdata object for this week&#039;s exercises). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;)&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=202</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=202"/>
		<updated>2025-09-10T08:16:50Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Enrichment analysis - reexamining cluster #1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming a total of &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term&lt;br /&gt;
# The biological interpretation of the analysis&lt;br /&gt;
&lt;br /&gt;
The p-values can be calculated using an online calculator such as [http://graphpad.com/quickcalcs/contingency1/ this one].&lt;br /&gt;
* &#039;&#039;&#039;2021 update:&#039;&#039;&#039;: We are testing a new online calculator this year: https://www.medcalc.org/calc/fisher.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of the entire yeast genome (background list). The &amp;quot;fora&amp;quot; function from &amp;quot;fgsea&amp;quot; can be used to calculate p-values for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from last week&#039;s exercises as example. You can find clusters 1-8 in the node attribute table from last week&#039;s exercise, and clusters 9-10 in your solutions (also included in the Rdata object for this week&#039;s exercises). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;)&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=201</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=201"/>
		<updated>2025-09-10T08:15:59Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Enrichment analysis - reexamining cluster #1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins below are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire yeast genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming yeast has &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term&lt;br /&gt;
# The biological interpretation of the analysis&lt;br /&gt;
&lt;br /&gt;
The p-values can be calculated using an online calculator such as [http://graphpad.com/quickcalcs/contingency1/ this one].&lt;br /&gt;
* &#039;&#039;&#039;2021 update:&#039;&#039;&#039;: We are testing a new online calculator this year: https://www.medcalc.org/calc/fisher.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of the entire yeast genome (background list). The &amp;quot;fora&amp;quot; function from &amp;quot;fgsea&amp;quot; can be used to calculate p-values for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from last week&#039;s exercises as example. You can find clusters 1-8 in the node attribute table from last week&#039;s exercise, and clusters 9-10 in your solutions (also included in the Rdata object for this week&#039;s exercises). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;)&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=200</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=200"/>
		<updated>2025-09-10T08:14:14Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Part 2: Gene Ontology overrepresentation analysis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis (ORA)=&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a RNAseq experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins in Cluster #1 (from [[ExYeastSysBio1|last week&#039;s exercise]]) are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Systematic name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| YMR078C||CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR175W||DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR278W||DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YBL035C||POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL102W||POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL262W||POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YOR144C||ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR167C||MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| YIR008C||PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YKL045W||PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YOR217W||RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YJR068W||RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YNL290W||RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YOL094C||RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR087W||RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire yeast genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming yeast has &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term&lt;br /&gt;
# The biological interpretation of the analysis&lt;br /&gt;
&lt;br /&gt;
The p-values can be calculated using an online calculator such as [http://graphpad.com/quickcalcs/contingency1/ this one].&lt;br /&gt;
* &#039;&#039;&#039;2021 update:&#039;&#039;&#039;: We are testing a new online calculator this year: https://www.medcalc.org/calc/fisher.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of the entire yeast genome (background list). The &amp;quot;fora&amp;quot; function from &amp;quot;fgsea&amp;quot; can be used to calculate p-values for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from last week&#039;s exercises as example. You can find clusters 1-8 in the node attribute table from last week&#039;s exercise, and clusters 9-10 in your solutions (also included in the Rdata object for this week&#039;s exercises). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;)&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=199</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=199"/>
		<updated>2025-09-10T08:09:01Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* UniProt */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis =&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a microarray experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins in Cluster #1 (from [[ExYeastSysBio1|last week&#039;s exercise]]) are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Systematic name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| YMR078C||CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR175W||DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR278W||DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YBL035C||POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL102W||POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL262W||POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YOR144C||ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR167C||MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| YIR008C||PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YKL045W||PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YOR217W||RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YJR068W||RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YNL290W||RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YOL094C||RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR087W||RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire yeast genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming yeast has &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term&lt;br /&gt;
# The biological interpretation of the analysis&lt;br /&gt;
&lt;br /&gt;
The p-values can be calculated using an online calculator such as [http://graphpad.com/quickcalcs/contingency1/ this one].&lt;br /&gt;
* &#039;&#039;&#039;2021 update:&#039;&#039;&#039;: We are testing a new online calculator this year: https://www.medcalc.org/calc/fisher.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of the entire yeast genome (background list). The &amp;quot;fora&amp;quot; function from &amp;quot;fgsea&amp;quot; can be used to calculate p-values for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from last week&#039;s exercises as example. You can find clusters 1-8 in the node attribute table from last week&#039;s exercise, and clusters 9-10 in your solutions (also included in the Rdata object for this week&#039;s exercises). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;)&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=198</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=198"/>
		<updated>2025-09-10T08:08:45Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* UniProt */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039; we learned to use in course &#039;&#039;&#039;22111&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
** How does the information here compare to the information in the &#039;&#039;keywords&#039;&#039; section?&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis =&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a microarray experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins in Cluster #1 (from [[ExYeastSysBio1|last week&#039;s exercise]]) are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Systematic name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| YMR078C||CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR175W||DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR278W||DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YBL035C||POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL102W||POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL262W||POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YOR144C||ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR167C||MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| YIR008C||PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YKL045W||PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YOR217W||RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YJR068W||RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YNL290W||RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YOL094C||RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR087W||RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire yeast genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming yeast has &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term&lt;br /&gt;
# The biological interpretation of the analysis&lt;br /&gt;
&lt;br /&gt;
The p-values can be calculated using an online calculator such as [http://graphpad.com/quickcalcs/contingency1/ this one].&lt;br /&gt;
* &#039;&#039;&#039;2021 update:&#039;&#039;&#039;: We are testing a new online calculator this year: https://www.medcalc.org/calc/fisher.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of the entire yeast genome (background list). The &amp;quot;fora&amp;quot; function from &amp;quot;fgsea&amp;quot; can be used to calculate p-values for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from last week&#039;s exercises as example. You can find clusters 1-8 in the node attribute table from last week&#039;s exercise, and clusters 9-10 in your solutions (also included in the Rdata object for this week&#039;s exercises). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;)&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=197</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=197"/>
		<updated>2025-09-10T08:07:31Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Part 1b: GO annotations on Genes and Proteins */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039; we learned to use in course &#039;&#039;&#039;22111&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis =&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a microarray experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins in Cluster #1 (from [[ExYeastSysBio1|last week&#039;s exercise]]) are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Systematic name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| YMR078C||CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR175W||DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR278W||DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YBL035C||POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL102W||POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL262W||POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YOR144C||ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR167C||MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| YIR008C||PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YKL045W||PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YOR217W||RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YJR068W||RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YNL290W||RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YOL094C||RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR087W||RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire yeast genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming yeast has &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term&lt;br /&gt;
# The biological interpretation of the analysis&lt;br /&gt;
&lt;br /&gt;
The p-values can be calculated using an online calculator such as [http://graphpad.com/quickcalcs/contingency1/ this one].&lt;br /&gt;
* &#039;&#039;&#039;2021 update:&#039;&#039;&#039;: We are testing a new online calculator this year: https://www.medcalc.org/calc/fisher.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of the entire yeast genome (background list). The &amp;quot;fora&amp;quot; function from &amp;quot;fgsea&amp;quot; can be used to calculate p-values for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from last week&#039;s exercises as example. You can find clusters 1-8 in the node attribute table from last week&#039;s exercise, and clusters 9-10 in your solutions (also included in the Rdata object for this week&#039;s exercises). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;)&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=196</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=196"/>
		<updated>2025-09-10T08:05:52Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Part 1b: GO annotations on Genes and Proteins */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
= Part 1b: GO annotations on Genes and Proteins =&lt;br /&gt;
As was mentioned earlier, Gene Ontology was created to provide a &#039;&#039;&#039;standardized&#039;&#039;&#039; set of &amp;quot;keywords&amp;quot; for annotating the function of genes and proteins. We&#039;ll now have a look at how GO is actually used in large sequence databases.&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039; we learned to use in course &#039;&#039;&#039;22111&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis =&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a microarray experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins in Cluster #1 (from [[ExYeastSysBio1|last week&#039;s exercise]]) are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Systematic name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| YMR078C||CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR175W||DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR278W||DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YBL035C||POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL102W||POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL262W||POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YOR144C||ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR167C||MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| YIR008C||PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YKL045W||PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YOR217W||RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YJR068W||RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YNL290W||RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YOL094C||RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR087W||RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire yeast genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming yeast has &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term&lt;br /&gt;
# The biological interpretation of the analysis&lt;br /&gt;
&lt;br /&gt;
The p-values can be calculated using an online calculator such as [http://graphpad.com/quickcalcs/contingency1/ this one].&lt;br /&gt;
* &#039;&#039;&#039;2021 update:&#039;&#039;&#039;: We are testing a new online calculator this year: https://www.medcalc.org/calc/fisher.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of the entire yeast genome (background list). The &amp;quot;fora&amp;quot; function from &amp;quot;fgsea&amp;quot; can be used to calculate p-values for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from last week&#039;s exercises as example. You can find clusters 1-8 in the node attribute table from last week&#039;s exercise, and clusters 9-10 in your solutions (also included in the Rdata object for this week&#039;s exercises). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;)&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=195</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=195"/>
		<updated>2025-09-10T08:05:43Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Part 1b: GO annotations on Genes and Proteins */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
= Part 1b: GO annotations on Genes and Proteins =&lt;br /&gt;
As was mentioned earlier, Gene Ontology was created to provide a &#039;&#039;&#039;standardized&#039;&#039;&#039; set of &amp;quot;keywords&amp;quot; for annotating the function of genes and proteins. We&#039;ll now have a look at how GO is actually used in large sequence databases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039; we learned to use in course &#039;&#039;&#039;22111&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis =&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a microarray experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins in Cluster #1 (from [[ExYeastSysBio1|last week&#039;s exercise]]) are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Systematic name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| YMR078C||CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR175W||DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR278W||DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YBL035C||POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL102W||POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL262W||POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YOR144C||ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR167C||MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| YIR008C||PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YKL045W||PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YOR217W||RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YJR068W||RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YNL290W||RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YOL094C||RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR087W||RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire yeast genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming yeast has &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term&lt;br /&gt;
# The biological interpretation of the analysis&lt;br /&gt;
&lt;br /&gt;
The p-values can be calculated using an online calculator such as [http://graphpad.com/quickcalcs/contingency1/ this one].&lt;br /&gt;
* &#039;&#039;&#039;2021 update:&#039;&#039;&#039;: We are testing a new online calculator this year: https://www.medcalc.org/calc/fisher.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of the entire yeast genome (background list). The &amp;quot;fora&amp;quot; function from &amp;quot;fgsea&amp;quot; can be used to calculate p-values for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from last week&#039;s exercises as example. You can find clusters 1-8 in the node attribute table from last week&#039;s exercise, and clusters 9-10 in your solutions (also included in the Rdata object for this week&#039;s exercises). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;)&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=194</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=194"/>
		<updated>2025-09-10T08:03:14Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Cellular Component examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
This concept is equivivalent to species taxonomy - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
= Part 1b: GO annotations on Genes and Proteins =&lt;br /&gt;
As was mentioned earlier, Gene Ontology was created to provide a &#039;&#039;&#039;standardized&#039;&#039;&#039; set of &amp;quot;keywords&amp;quot; for annotating the function of genes and proteins. We&#039;ll now have a look at how GO is actually used in large sequence databases.&lt;br /&gt;
&lt;br /&gt;
== Saccharomyces Genome Database ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #6: Look the entry for POL1 (YNL102W) in [http://www.yeastgenome.org SGD]&#039;&#039;&#039;&lt;br /&gt;
* Notice that all Saccharomyces Genome Database (SGD) entries have an entire section on Gene Ontology annotations; click on the &amp;quot;Gene Ontology&amp;quot; tab for full details. This actually include a bit of extra information about the &#039;&#039;&#039;evidence&#039;&#039;&#039; for annotations.&lt;br /&gt;
* What is the Molecular Function for POL1?&lt;br /&gt;
* Click on the link for this term to see how SGD describes the GO term, and how the evidence is presented.&lt;br /&gt;
** How many other yeast genes are ALSO annotated to have &amp;quot;DNA-directed DNA polymerase activity&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT:&#039;&#039;&#039; SGD also offers the possibility to jump from their website to the same GO term inside AmiGO. This is very useful for investigating the hierarchy of GO terms &amp;quot;above&amp;quot; - SGD has limited functionality for this.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #7: Follow the link to AmiGO&#039;&#039;&#039;&lt;br /&gt;
* Follow the link to AmiGO for the Molecular Function term found above, and answer the following question:&lt;br /&gt;
** Does POL1 have &amp;quot;Transferase Activity&amp;quot;? (Which GO term).&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039; we learned to use in course &#039;&#039;&#039;22111&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis =&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a microarray experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins in Cluster #1 (from [[ExYeastSysBio1|last week&#039;s exercise]]) are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Systematic name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| YMR078C||CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR175W||DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR278W||DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YBL035C||POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL102W||POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL262W||POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YOR144C||ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR167C||MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| YIR008C||PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YKL045W||PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YOR217W||RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YJR068W||RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YNL290W||RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YOL094C||RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR087W||RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire yeast genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming yeast has &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term&lt;br /&gt;
# The biological interpretation of the analysis&lt;br /&gt;
&lt;br /&gt;
The p-values can be calculated using an online calculator such as [http://graphpad.com/quickcalcs/contingency1/ this one].&lt;br /&gt;
* &#039;&#039;&#039;2021 update:&#039;&#039;&#039;: We are testing a new online calculator this year: https://www.medcalc.org/calc/fisher.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of the entire yeast genome (background list). The &amp;quot;fora&amp;quot; function from &amp;quot;fgsea&amp;quot; can be used to calculate p-values for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from last week&#039;s exercises as example. You can find clusters 1-8 in the node attribute table from last week&#039;s exercise, and clusters 9-10 in your solutions (also included in the Rdata object for this week&#039;s exercises). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;)&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=193</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=193"/>
		<updated>2025-09-10T08:01:39Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Example: &amp;quot;Cell division&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
It&#039;s much the same case as we have previously seen with taxonomy in course 27611 - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
= Part 1b: GO annotations on Genes and Proteins =&lt;br /&gt;
As was mentioned earlier, Gene Ontology was created to provide a &#039;&#039;&#039;standardized&#039;&#039;&#039; set of &amp;quot;keywords&amp;quot; for annotating the function of genes and proteins. We&#039;ll now have a look at how GO is actually used in large sequence databases.&lt;br /&gt;
&lt;br /&gt;
== Saccharomyces Genome Database ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #6: Look the entry for POL1 (YNL102W) in [http://www.yeastgenome.org SGD]&#039;&#039;&#039;&lt;br /&gt;
* Notice that all Saccharomyces Genome Database (SGD) entries have an entire section on Gene Ontology annotations; click on the &amp;quot;Gene Ontology&amp;quot; tab for full details. This actually include a bit of extra information about the &#039;&#039;&#039;evidence&#039;&#039;&#039; for annotations.&lt;br /&gt;
* What is the Molecular Function for POL1?&lt;br /&gt;
* Click on the link for this term to see how SGD describes the GO term, and how the evidence is presented.&lt;br /&gt;
** How many other yeast genes are ALSO annotated to have &amp;quot;DNA-directed DNA polymerase activity&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT:&#039;&#039;&#039; SGD also offers the possibility to jump from their website to the same GO term inside AmiGO. This is very useful for investigating the hierarchy of GO terms &amp;quot;above&amp;quot; - SGD has limited functionality for this.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #7: Follow the link to AmiGO&#039;&#039;&#039;&lt;br /&gt;
* Follow the link to AmiGO for the Molecular Function term found above, and answer the following question:&lt;br /&gt;
** Does POL1 have &amp;quot;Transferase Activity&amp;quot;? (Which GO term).&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039; we learned to use in course &#039;&#039;&#039;22111&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis =&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a microarray experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins in Cluster #1 (from [[ExYeastSysBio1|last week&#039;s exercise]]) are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Systematic name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| YMR078C||CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR175W||DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR278W||DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YBL035C||POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL102W||POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL262W||POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YOR144C||ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR167C||MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| YIR008C||PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YKL045W||PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YOR217W||RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YJR068W||RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YNL290W||RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YOL094C||RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR087W||RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire yeast genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming yeast has &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term&lt;br /&gt;
# The biological interpretation of the analysis&lt;br /&gt;
&lt;br /&gt;
The p-values can be calculated using an online calculator such as [http://graphpad.com/quickcalcs/contingency1/ this one].&lt;br /&gt;
* &#039;&#039;&#039;2021 update:&#039;&#039;&#039;: We are testing a new online calculator this year: https://www.medcalc.org/calc/fisher.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of the entire yeast genome (background list). The &amp;quot;fora&amp;quot; function from &amp;quot;fgsea&amp;quot; can be used to calculate p-values for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from last week&#039;s exercises as example. You can find clusters 1-8 in the node attribute table from last week&#039;s exercise, and clusters 9-10 in your solutions (also included in the Rdata object for this week&#039;s exercises). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;)&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=192</id>
		<title>ExGeneOntology R</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22140/index.php?title=ExGeneOntology_R&amp;diff=192"/>
		<updated>2025-09-10T08:00:44Z</updated>

		<summary type="html">&lt;p&gt;Krivi: /* Example: &amp;quot;Cell division&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gene Ontology - cell cycle examples =&lt;br /&gt;
[[Image:QuickGO_Mitochondrion.png|thumb|right|250px|&#039;&#039;&#039;Cellular component&#039;&#039;&#039; example: the GO term &#039;&#039;&#039;mitochondrion&#039;&#039;&#039;]]&lt;br /&gt;
&#039;&#039;&#039;Exercise written by:&#039;&#039;&#039; Rasmus Wernersson &amp;amp; Kristoffer Vitting-Seerup&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Purpose of this exercise:&#039;&#039;&#039;&lt;br /&gt;
* Understand how Gene Ontology terms are defined and organized:&lt;br /&gt;
** The relationship between GO terms (IS A, PART OF, etc)&lt;br /&gt;
** The three main trunks of GO: BIOLOGICAL PROCESS, MOLECULAR FUNCTION and CELLULAR COMPONENT.&lt;br /&gt;
* Learn how to query the Gene Ontology database.&lt;br /&gt;
** Using the official online GO query system: AmiGO&lt;br /&gt;
** Using links from UniProt.&lt;br /&gt;
* Understand the theory behind GO over-representation analysis&lt;br /&gt;
* Learn how to perform GO over-representation analysis:&lt;br /&gt;
** Using the R package &amp;quot;fgsea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Part 1a: using the Gene Ontology terms and tools =&lt;br /&gt;
The &#039;&#039;&#039;Gene Ontology&#039;&#039;&#039; database contains a collection of &#039;&#039;&#039;strict definitions&#039;&#039;&#039; of &#039;&#039;&#039;biological terms&#039;&#039;&#039;, and information about how the terms relate to each other (for example &#039;&#039;&#039;DNA replication&#039;&#039;&#039; is a &#039;&#039;&#039;biosynthetic process&#039;&#039;&#039; which in turn is a &#039;&#039;&#039;biological process&#039;&#039;&#039;). The Gene Ontology system is divided into three main trunks:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Biological Process&#039;&#039;&#039; (e.g. DNA replication)&lt;br /&gt;
# &#039;&#039;&#039;Molecular Function&#039;&#039;&#039; (e.g. DNA binding)&lt;br /&gt;
# &#039;&#039;&#039;Cellular Component&#039;&#039;&#039; (e.g. Nucleus).&lt;br /&gt;
&lt;br /&gt;
Each term has a UNIQUE IDENTIFIER - much in the same way, as we have it with gene ids in Ensembl (e.g. ENSG00000141510) and protein identifiers in UniProt (e.g. P53_HUMAN). The Gene Ontology was created to provide a standardized way to characterize the functionality of &#039;&#039;&#039;genes&#039;&#039;&#039; (hence the name) and &#039;&#039;&#039;gene products&#039;&#039;&#039; (protein). The idea is much the same as with UniProt keywords: to have a standard set of &#039;&#039;&#039;labels&#039;&#039;&#039; that can be used to describe the gene/protein functionality: this will both 1) make it much easier to search gene/protein databases, and 2) make it much easier to perform &#039;&#039;&#039;large scale&#039;&#039;&#039; comparisons of genes/proteins. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LINKS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Database look-up:&#039;&#039;&#039;&lt;br /&gt;
** http://www.geneontology.org - the home of the Gene Ontology project&lt;br /&gt;
** http://amigo.geneontology.org - the &#039;&#039;&#039;AmiGO&#039;&#039;&#039; search system (the official search engine for the project)&lt;br /&gt;
** http://www.ebi.ac.uk/QuickGO - An alternative search system for Gene Ontology, created and maintained by the EBI. They provide a nice graphical representation of the GO trees.&lt;br /&gt;
* &#039;&#039;&#039;Overrepresentation analysis:&#039;&#039;&#039;&lt;br /&gt;
** The R package [https://bioconductor.org/packages/release/bioc/html/fgsea.html,&amp;quot;fgsea&amp;quot;] for over representation analysis, and the R package [https://cran.r-project.org/web/packages/msigdbr/index.html, &amp;quot;msigdbr&amp;quot;] for retrieving genesets. &#039;&#039;&#039;Note&#039;&#039;&#039;: These packages are already installed in the RStudio server - no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
== Example: &amp;quot;Cell division&amp;quot; ==&lt;br /&gt;
Gene Ontology provides a wealth of information, to the point where it can be a bit intimidating at first (it can be difficult to see the forest for all the trees). Before we start browsing the full online database, we will start out with a simple example, where we&#039;ll highlight some of the most important features, and for a moment hide the rest:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Term: Cell division&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Accession&#039;&#039;&#039;&lt;br /&gt;
|GO:0051301&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot; | [[Image:QuickGO_CellDivision_cropped.png]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Ontology&#039;&#039;&#039;&lt;br /&gt;
|Biological Process&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Definition&#039;&#039;&#039;&lt;br /&gt;
|The process resulting in division and partitioning of components of a cell to form more cells. &lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Comment&#039;&#039;&#039;&lt;br /&gt;
|Note that this term differs from &#039;cytokinesis ; GO:0000910&#039; in that cytokinesis does not include nuclear division.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of the definition of a GO term (&amp;quot;Cell division&amp;quot; ; GO id: 0051301) in the &#039;&#039;&#039;biological process&#039;&#039;&#039; category, and a graph showing it&#039;s relationship to other GO terms. Note that there are 7 different types of relationships defined. The most common one is the &#039;&#039;&#039;IS A&#039;&#039;&#039; relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate &amp;quot;cell division&amp;quot; using [http://amigo.geneontology.org &#039;&#039;&#039;AmiGO 2&#039;&#039;&#039;]&lt;br /&gt;
* Select Search -&amp;gt; Ontology from the top menu.&lt;br /&gt;
* Search for the term &amp;quot;cell division&amp;quot;, and click on the entry for &amp;quot;cell division&amp;quot; at the top of the results list.&lt;br /&gt;
* Spend some time getting familiar with the entry page: &lt;br /&gt;
** The top part contains the definition(s) related to this particular entry.&lt;br /&gt;
** The lower part contains information about how this entry relates to OTHER entries. Try clicking on the various tabs, such as &amp;quot;Graph Views&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #1:&#039;&#039;&#039;&lt;br /&gt;
* How many ancestor terms are defined? With how many different types of relationships?&lt;br /&gt;
* How many children terms are defined? With how many different types of relationships?&lt;br /&gt;
&lt;br /&gt;
== Cellular Component examples ==&lt;br /&gt;
[[Image:Animal_cell_structure_en.png|thumb|300px|Examples of subcellular components from an animal cell. Image Source: [http://en.wikipedia.org/wiki/File:Animal_cell_structure_en.svg Wikipedia].]]&lt;br /&gt;
The &amp;quot;Cellular Component&amp;quot; part of Gene Ontology is good for illustrating the concept of &#039;&#039;&#039;nested terms&#039;&#039;&#039; in more details, since it&#039;s easy to visualize the boxes-in-boxes concept here. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For example:&#039;&#039;&#039; The &#039;&#039;&#039;Nucleolus&#039;&#039;&#039; (the organelle for synthesis and maturation of Ribosomal RNA) is located WITHIN the &#039;&#039;&#039;nucleus&#039;&#039;&#039; which is located WITHIN the &#039;&#039;&#039;cell&#039;&#039;&#039;. While this seems trivial and evidently true, it&#039;s important to realize the concept of &#039;&#039;&#039;inherited properties&#039;&#039;&#039; within a hierarchical structure.&lt;br /&gt;
&lt;br /&gt;
It&#039;s much the same case as we have previously seen with taxonomy in course 27611 - for example, if you look up Human (&#039;&#039;Homo sapiens&#039;&#039;) and Mouse (&#039;&#039;Mus musculus&#039;&#039;) in NCBI Taxonomy, the abbreviated lineages look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Primates › Hominidae › Homo&lt;br /&gt;
Eukaryota › Metazoa › Chordata › Craniata › Vertebrata › Mammalia › Eutheria › Muroidea ›  Mus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the GO terminology these are &#039;&#039;&#039;IS A&#039;&#039;&#039; relationships: From this we can see that all humans are primates, and all primates are mammals, but all mammals are NOT (necessarily) human. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: investigate the nucleus in GO&#039;&#039;&#039;&lt;br /&gt;
* Look up &amp;quot;nucleus&amp;quot; (GO:0005634) in AmiGO.&lt;br /&gt;
**&#039;&#039;Hint: if you get a lot of hits that are not what you are looking for, try putting your query inside quotation marks (&amp;quot;&amp;quot;).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #2:&#039;&#039;&#039;&lt;br /&gt;
* Is &amp;quot;nucleus&amp;quot; a membrane-bound, or non membrane-bound organelle? On which linked GO terms do you base this conclusion?&lt;br /&gt;
* What types of relationships are found?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IS A&#039;&#039;&#039; vs. &#039;&#039;&#039;PART OF&#039;&#039;&#039;: So far we have been focusing on the &amp;quot;&#039;&#039;&#039;IS A&#039;&#039;&#039;&amp;quot; relationship (nucleus IS A organelle which in turn IS A cellular component). However, things get a bit more complicated, when we bring the &amp;quot;PART OF&amp;quot; relationship into the picture, as the next example will show.&lt;br /&gt;
&lt;br /&gt;
== Molecular Function examples ==&lt;br /&gt;
Continuing with our focus on cell cycle and DNA replication, investigate the following terms:&lt;br /&gt;
&lt;br /&gt;
# DNA Polymerase Activity&lt;br /&gt;
# Helicase Activity&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #3:&#039;&#039;&#039;&lt;br /&gt;
answer the following questions:&lt;br /&gt;
&lt;br /&gt;
* Can the activities described be directed towards both DNA and RNA? Remember add your arguments&lt;br /&gt;
* At which node does the &amp;quot;tree&amp;quot; branch out of the &amp;quot;Molecular Function&amp;quot; ontology and into a different ontology? With what type of relationship? Does this make biological sense?&lt;br /&gt;
&lt;br /&gt;
== (A few more) Biological Process examples ==&lt;br /&gt;
[[Image:QuickGO_negative_regulation_example.png|right|thumb|300px|Example of &#039;&#039;&#039;negative regulation&#039;&#039;&#039;]]&lt;br /&gt;
Next up we&#039;ll investigate how the different phases of the cell cycle have been categorized in GO. &lt;br /&gt;
&lt;br /&gt;
* Start out by looking up the entry for the G1 phase: &#039;&#039;&#039;GO:0051318&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From here you&#039;ll need to investigate the &amp;quot;neighborhood&amp;quot; of terms to answer the questions below - ask the instructor for help if you get stuck.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #4:&#039;&#039;&#039; &#039;&#039;&#039;Mitosis related questions:&#039;&#039;&#039; (ignore meiosis for now)&lt;br /&gt;
* How many (if any) &#039;&#039;&#039;cell cycle&#039;&#039;&#039; sub-phases are defined for:&lt;br /&gt;
** G1 phase&lt;br /&gt;
** S phase&lt;br /&gt;
** G2 phase&lt;br /&gt;
** M phase&lt;br /&gt;
* Which phases are grouped together into the &amp;quot;interphase&amp;quot; term?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;REPORT QUESTION #5:&#039;&#039;&#039; &#039;&#039;&#039;Meiosis related question:&#039;&#039;&#039; During meiosis the sister chromatids can exchange DNA in a process called &amp;quot;homologous chromosome pairing at meiosis&amp;quot; - you may have heard this described as &amp;quot;Chromosome Crossover&amp;quot; as well (technically crossing over is the &#039;&#039;&#039;method&#039;&#039;&#039; by with the &#039;&#039;&#039;process&#039;&#039;&#039; happens).&lt;br /&gt;
* In which meiotic cell cycle phase does &#039;&#039;&#039;homologous chromosome pairing at meiosis&#039;&#039;&#039; happen?&lt;br /&gt;
&lt;br /&gt;
= Part 1b: GO annotations on Genes and Proteins =&lt;br /&gt;
As was mentioned earlier, Gene Ontology was created to provide a &#039;&#039;&#039;standardized&#039;&#039;&#039; set of &amp;quot;keywords&amp;quot; for annotating the function of genes and proteins. We&#039;ll now have a look at how GO is actually used in large sequence databases.&lt;br /&gt;
&lt;br /&gt;
== Saccharomyces Genome Database ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #6: Look the entry for POL1 (YNL102W) in [http://www.yeastgenome.org SGD]&#039;&#039;&#039;&lt;br /&gt;
* Notice that all Saccharomyces Genome Database (SGD) entries have an entire section on Gene Ontology annotations; click on the &amp;quot;Gene Ontology&amp;quot; tab for full details. This actually include a bit of extra information about the &#039;&#039;&#039;evidence&#039;&#039;&#039; for annotations.&lt;br /&gt;
* What is the Molecular Function for POL1?&lt;br /&gt;
* Click on the link for this term to see how SGD describes the GO term, and how the evidence is presented.&lt;br /&gt;
** How many other yeast genes are ALSO annotated to have &amp;quot;DNA-directed DNA polymerase activity&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT:&#039;&#039;&#039; SGD also offers the possibility to jump from their website to the same GO term inside AmiGO. This is very useful for investigating the hierarchy of GO terms &amp;quot;above&amp;quot; - SGD has limited functionality for this.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #7: Follow the link to AmiGO&#039;&#039;&#039;&lt;br /&gt;
* Follow the link to AmiGO for the Molecular Function term found above, and answer the following question:&lt;br /&gt;
** Does POL1 have &amp;quot;Transferase Activity&amp;quot;? (Which GO term).&lt;br /&gt;
&lt;br /&gt;
== UniProt ==&lt;br /&gt;
UniProt uses a lot of its own annotation - for example the UniProt &#039;&#039;&#039;keywords&#039;&#039;&#039; we learned to use in course &#039;&#039;&#039;22111&#039;&#039;&#039;. However, the protein entries are also annotated with GO terms.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #8: look up human POLD1 in [http://www.uniprot.org UniProt]&#039;&#039;&#039;:&lt;br /&gt;
* Entry name: DPOD1_HUMAN or P28340.&lt;br /&gt;
* Locate the &amp;quot;Function&amp;quot; and &amp;quot;Subcellular Location&amp;quot; sections.&lt;br /&gt;
* Gene Ontology:&lt;br /&gt;
** Select a GO term you think looks interesting and click on it - this will take you to EBI&#039;s own interface to GO.&lt;br /&gt;
** Click through the tabs, and see what type of information is there.&lt;br /&gt;
** Notice that there is NO direct link to AmiGO, but you can always copy+paste the GO identifier into AmiGO, if you want to investigate the term using a more familiar interface.&lt;br /&gt;
* Questions (requires a bit of detective work - ask the instructor if you get stuck):&lt;br /&gt;
** How many UniProt proteins are annotated with &amp;quot;GO:0045004 DNA replication proofreading&amp;quot;?&lt;br /&gt;
** How many of these are human? (TaxID: 9606 - use the filtering function, if you don&#039;t want to count them).&lt;br /&gt;
&lt;br /&gt;
= Part 2: Gene Ontology overrepresentation analysis =&lt;br /&gt;
&lt;br /&gt;
In this part of the exercise, we focus on performing analysis for overrepresentation in GO. We are interested in knowing if a chosen subset of genes/proteins has any special characteristics, compared to what would be expected if we picked a similar sized subset &#039;&#039;&#039;randomly&#039;&#039;&#039; from the entire pool of genes/proteins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Study group:&#039;&#039;&#039;&lt;br /&gt;
* The subset (study group) could be a set of overexpressed genes from a microarray experiment, or simply a list of genes which you for other reasons expect to be involved in the same biological process. &lt;br /&gt;
&#039;&#039;&#039;Population group:&#039;&#039;&#039;&lt;br /&gt;
* The population group would then be defined as the &#039;&#039;&#039;background&#039;&#039;&#039; to compare to - e.g. the entire list of genes, or in the case of gene expression all genes represented on the microarray. We can then ask if the frequency of proteins annotation to a GO term is different for the study group compared to the overall population.&lt;br /&gt;
&lt;br /&gt;
== Enrichment analysis - reexamining cluster #1 ==&lt;br /&gt;
[[Image:Cluster1_subnetwork.png|thumb|200px|right]]&lt;br /&gt;
&lt;br /&gt;
Before we move on to the more advanced statistical methods, we&#039;ll spend a moment answering the following questions:&lt;br /&gt;
* &#039;&#039;Is the &#039;&#039;&#039;observed frequency&#039;&#039;&#039; of a given characteristic different from the &#039;&#039;&#039;expected frequency&#039;&#039;&#039; &#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
The steps to do this is simply to &lt;br /&gt;
# Calculate the frequency across the entire &#039;&#039;&#039;population group&#039;&#039;&#039; (X number of genes with the characteristic in a total population of Y: FX = X/Y).&lt;br /&gt;
# From this frequency calculate expected genes/protein with this characteristic in the &#039;&#039;&#039;study group&#039;&#039;&#039; (n = size of study group; exp = FX * n)&lt;br /&gt;
# Compare to the observed frequency&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; is then calculated as the ratio with observed/expected&lt;br /&gt;
&lt;br /&gt;
We&#039;ll go through this with an example: in this case we want to examine whether the proteins in Cluster #1 (from [[ExYeastSysBio1|last week&#039;s exercise]]) are overrepresented in any of the following three GO terms: &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;All proteins in Cluster #1 are listed in the table below with a mark if they are associated with a GO term:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Systematic name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Gene name&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA replication (GO:0006260)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;DNA repair (GO:0006281)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;Cell cycle (GO:0007049)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| YMR078C||CTF18||Chromosome transmission fidelity protein 18||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR175W||DPB2||DNA polymerase epsilon subunit B||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR278W||DPB3||DNA polymerase epsilon subunit C||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YBL035C||POL12||DNA polymerase alpha subunit B||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL102W||POL1||DNA polymerase alpha catalytic subunit A||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YNL262W||POL2||DNA polymerase epsilon catalytic subunit A||X||X||&lt;br /&gt;
|-&lt;br /&gt;
| YOR144C||ELG1||Telomere length regulation protein ELG1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YPR167C||MET16||Phosphoadenosine phosphosulfate reductase||||||&lt;br /&gt;
|-&lt;br /&gt;
| YIR008C||PRI1||DNA primase small subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YKL045W||PRI2||DNA primase large subunit||X||||&lt;br /&gt;
|-&lt;br /&gt;
| YOR217W||RFC1||Replication factor C subunit 1||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YJR068W||RFC2||Replication factor C subunit 2||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YNL290W||RFC3||Replication factor C subunit 3||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YOL094C||RFC4||Replication factor C subunit 4||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YBR087W||RFC5||Replication factor C subunit 5||X||X||X&lt;br /&gt;
|-&lt;br /&gt;
| YCL042W||YCL042W||Putative uncharacterized protein YCL042W||||||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the table below are the &#039;&#039;&#039;total number&#039;&#039;&#039; of proteins listed that are involved in the three GO categories &amp;quot;DNA replication&amp;quot;, &amp;quot;DNA repair&amp;quot; and &amp;quot;Cell cycle&amp;quot; across the &#039;&#039;&#039;entire yeast genome&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;GO term&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0a0f0;&amp;quot;|&#039;&#039;&#039;# genes (including subgroups)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| DNA replication (GO:0006260)||96&lt;br /&gt;
|-&lt;br /&gt;
| DNA repair (GO:0006281)||259&lt;br /&gt;
|-&lt;br /&gt;
| Cell cycle (GO:0007049)||313&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #9:&#039;&#039;&#039; Assuming yeast has &#039;&#039;&#039;5500&#039;&#039;&#039; annotated genes calculate/report the following values:&lt;br /&gt;
# Population group size&lt;br /&gt;
# Study group size&lt;br /&gt;
# Genome wide frequency of each GO term&lt;br /&gt;
# Expected number of genes annotated with each term in a &#039;&#039;&#039;random&#039;&#039;&#039; selection of yeast genes of the same size as cluster #1&lt;br /&gt;
# The &#039;&#039;&#039;enrichment&#039;&#039;&#039; of observed GO terms compared to expected&lt;br /&gt;
# The p-value for each GO term&lt;br /&gt;
# The biological interpretation of the analysis&lt;br /&gt;
&lt;br /&gt;
The p-values can be calculated using an online calculator such as [http://graphpad.com/quickcalcs/contingency1/ this one].&lt;br /&gt;
* &#039;&#039;&#039;2021 update:&#039;&#039;&#039;: We are testing a new online calculator this year: https://www.medcalc.org/calc/fisher.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Fisher&#039;s exact test ==&lt;br /&gt;
Fisher&#039;s exact test is a statistical significance test that can be used to determine significant overrepresentation. The test can be applied to contingency tables - 2x2 table of observed frequencies of the variables. A contingency table contains two columns for the subset and population and rows with the two mutual exclusive values: 1) Proteins annotated to the GO term in question or 2) Proteins not annotated to the GO term. The cells in the table can be represented by the letters a, b, c and d, call the totals across rows and columns, and represent the grand total by n:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term|| a || b || a + b &lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term|| c || d || c + d &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; || a + c || b + d || a + b + c + d (n) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of obtaining any such set of observations is according to Fisher then given by the hypergeometric distribution:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_test.png|left|500px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Subset&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;&#039;Population&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#a0f0a0;&amp;quot;|&#039;&#039;Row total&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Proteins annotated to GO term||3||5||8&lt;br /&gt;
|-&lt;br /&gt;
| Proteins &#039;&#039;not&#039;&#039; annotated to GO term||8||12||20&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Column total&#039;&#039; ||11||17||28 (n)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The probability of observing these frequencies is then calculation as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Fishers_example.png|left|400px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear: both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #10:&#039;&#039;&#039;&lt;br /&gt;
* Calculate the p-values for the &#039;&#039;&#039;cluster #1&#039;&#039;&#039; example above.&lt;br /&gt;
* &#039;&#039;Use the same assumptions as in question 12&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automated analysis using &amp;quot;fgsea&amp;quot; and &amp;quot;msigdbr&amp;quot; ==&lt;br /&gt;
=== Introducing over representation in R ===&lt;br /&gt;
&lt;br /&gt;
For the final part of the exercise, we&#039;ll be using an automated tool for comparison of an &#039;&#039;&#039;input gene list&#039;&#039;&#039; (target list) against a background distribution consisting of the entire yeast genome (background list). The &amp;quot;fora&amp;quot; function from &amp;quot;fgsea&amp;quot; can be used to calculate p-values for all gene sets within a list of gene sets. We can use the &amp;quot;msigbdr&amp;quot; package to download gene sets for:&lt;br /&gt;
&lt;br /&gt;
* Biological Processes&lt;br /&gt;
* Molecular Functions&lt;br /&gt;
* Cellular Components&lt;br /&gt;
&lt;br /&gt;
The results are returned as tables with p-values, gene set size, and the size of the overlap between the gene set and the target list. Finally it&#039;s worth mentioning, that the &amp;quot;fora&amp;quot; function also takes care of &#039;&#039;&#039;multiple testing correction&#039;&#039;&#039;, an important problem for large scale data analysis, which we will re-visit in greater details in a later exercise.&lt;br /&gt;
&lt;br /&gt;
=== Preparing input data ===&lt;br /&gt;
First we need to prepare our input data. An over representation analysis, we need &#039;&#039;&#039;three inputs&#039;&#039;&#039; 1) a target gene list of interest, 2) a background gene list, and 3) the gene sets we wish to examine for over representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Target gene list&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
we&#039;ll use &#039;&#039;&#039;Cluster #1&#039;&#039;&#039; from last week&#039;s exercises as example. You can find clusters 1-8 in the node attribute table from last week&#039;s exercise, and clusters 9-10 in your solutions (also included in the Rdata object for this week&#039;s exercises). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Background list&#039;&#039;&#039; (&amp;quot;population group&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The background here will be the entire yeast genome - a list containing ALL yeast gene names. We have prepared such a list, and included it in the exercise5.Rdata object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise4.Rdata&amp;quot;)&lt;br /&gt;
load(&amp;quot;/home/projects/22140/exercise5.Rdata&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gene ontology gene sets&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gene ontology gene sets can be downloaded from the &amp;quot;molecular signatures database&amp;quot; (msigdb) using the R package &amp;quot;msigdbr&amp;quot; using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
library(msigdbr)&lt;br /&gt;
BP_df = msigdbr(species = &amp;quot;S. cerevisiae&amp;quot;, category = &amp;quot;C5&amp;quot;, subcategory = &amp;quot;BP&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command retrieves biological process gene sets for yeast. The &amp;quot;C5&amp;quot; category is the msigdb annotation for the three gene ontologies. The subcategory is either &amp;quot;BP&amp;quot; (biological process), &amp;quot;MF&amp;quot; (molecular function), or &amp;quot;CC&amp;quot; (cellular component).&lt;br /&gt;
&lt;br /&gt;
Before we proceed, take a moment to explore the functions &amp;quot;fora&amp;quot; and &amp;quot;msigdbr&amp;quot;. In particular, take a look at what object class the &amp;quot;fora&amp;quot; function expects the gene sets to be, and what object class is produced by &amp;quot;msigdbr&amp;quot; with the command above?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #11:&#039;&#039;&#039; Can you directly use the gene sets produced by the msigdbr function as input for the &amp;quot;fora&amp;quot; function of &amp;quot;fgsea&amp;quot;? Why/why not?&lt;br /&gt;
&lt;br /&gt;
Run the following one-liner to prepare the biological process gene sets for over representation analysis using &amp;quot;fora&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
BP_list = split(x = BP_df$ensembl_gene, f = BP_df$gs_name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Running &amp;quot;fora&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
Take a look at the background list and any one of the gene sets of the BP_list. Then, extract cluster 1 genes from the node annotation table as your target list, taking care to include the gene identifier that matches the identifier used in the gene sets and background.&lt;br /&gt;
&lt;br /&gt;
Take a look at the results. As mentioned, &amp;quot;fora&amp;quot; produces a table with p-values, adjusted p-values, gene set size, and the size of the overlap between the gene set and the target list, but &#039;&#039;not&#039;&#039; the enrichment. &lt;br /&gt;
&lt;br /&gt;
Calculate the enrichment and add a column to your results table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; Run the analysis for cluster #1 for all three GO trunks (Biological Process, Molecular Function and Cellular Component), and include top 10 significantly enriched GO terms for each ontology. Add a section to your report discussing if the results fit with what we have previously learned about the function of cluster #1.&lt;br /&gt;
&lt;br /&gt;
== Repeat analysis on selected clusters ==&lt;br /&gt;
[[Image:Cogs_brain.png|50px]] As the final task of today&#039;s exercise we&#039;ll be re-visiting the &#039;&#039;&#039;10 clusters&#039;&#039;&#039; from last week&#039;s exercise. Pick the &#039;&#039;&#039;3 clusters&#039;&#039;&#039; which appear the most interesting to you. &lt;br /&gt;
&lt;br /&gt;
[[Image:Office-notes-line_drawing.png|30px|left]]&lt;br /&gt;
&#039;&#039;&#039;TASK/REPORT QUESTION #12:&#039;&#039;&#039; perform the following over-representation analysis and create a short report documenting you finding:&lt;br /&gt;
* Biological Process&lt;br /&gt;
* Molecular function&lt;br /&gt;
* Cellular component&lt;br /&gt;
* Question:&lt;br /&gt;
** Do the results make biological sense?&lt;br /&gt;
** How do these results compare to the broad categories we observed in the previous exercise?&lt;/div&gt;</summary>
		<author><name>Krivi</name></author>
	</entry>
</feed>