knitr::opts_chunk$set( collapse = TRUE, comment = "#>", ## edited options below fig.width = 8, fig.asp = 0.8, out.width = "100%", dpi = 300 )
This vignette provides a quick guide to ontoClust
package.
devtools::install_github("altintasali/ontoClust")
library(ontoClust)
In a typical differential expression analysis, you may want to check the ontology terms (e.g. GO, KEGG) enriched using the differentially expressed genes. A typical enrichment result looks like this:
head(sample_data$GOBP)
Let's check how many enriched terms there are for a given comparison (so called "contrast").
enr <- sample_data$GOBP enrSub <- enr[enr$Condition == "AvsB",] enrSub <- enrSub[enrSub$qvalue < 0.05,] nrow(enrSub)
As you can imagine, it is really hard to go through r nrow(enrSub)
GO terms manually. This is where ontoClust
becomes handy.
In order to create ontology (GO) networks, we need to provide a similarity metric across GO terms in a pairwise fashion. ontoClust
uses Jaccard Similarity Index using the gene content of each ontology term. createOntologyNetwork
function makes this process easy for you.
For the sake of computation time, let's work with a random subset of those r nrow(enrSub)
GO terms. 75 terms is ideal for a quick run.
# set.seed(6) # subsetTerms <- sample(x = enrSub$ID, size = 100) subsetTerms <- enrSub$ID[1:75] head(subsetTerms)
Now that we have the terms to work with, we can create the network.
network <- createOntologyNetwork(subsetTerms) head(network)
In order to create link communities, we need to provide the network of GO terms. The getLC
will help us to do that.
lc <- getLC(network, verbose = FALSE) lc
Finally, we can calculate the clusters of GO Terms:
oc <- getOntoClust(lc, verbose = FALSE) head(oc$result) tail(oc$result) table(oc$ontology_clusters)
heatmapOntoClust(oc, filename = "heatmapOntoClust.png", silent = TRUE)
knitr::include_graphics("heatmapOntoClust.png")
plotOntoNetwork(oc)
plotOntoNetwork(oc, facet_by = "ontology_cluster", label_n = 3)
plotOntoNetwork(oc, facet_by = "ontology_cluster", background = FALSE, label_n = 3)
Although Word Clouds are not the best way of scientific visualization, it can be helpful to get a quick grasp of the ontology clusters. You can create Word Clouds by using the functions below.
wc <- createWordCloud(oc) # plot top 10 words for each ontology clusters plotWordCloud(wc, n = 10)
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.