InterMine constitutes a powerful open source data warehouse system which integrates diverse biological data sets and provides a growing number of analysis tools, including enrichment analysis widgets (Smith et al. 2012; Kalderimis et al. 2014).
Specifically, the gene set enrichment tool looks for annotations to a set of genes that occur more than would be expected by chance, given a background population of annotations. The hypergeometric distribution is used to calculate a P-value for each annotation and a choice of correction methods for multiple testing (Bonferonni, Holm-Bonferonni and Benjamini Hochberg) are available (Smith et al. 2012; Kalderimis et al. 2014).
InterMine provides Gene Ontology enrichment statistics as well as enrichment statistics for other annotation types including protein domains, pathways, human diseases, mammalian phenotypes and publications. The default background population is all genes in the genome with the specified annotation type. However, the background population can be changed by specifying another list. More information can be found in the online documentation.
Performing enrichment analysis with InterMineR is preceded by two steps:
Retrieve the list of bioentities of interest (Genes, Proteins, SNPs, etc.) for which the analysis will be performed.
Get the enrichment widget name which indicates the annotation types that you want to investigate for enrichment (e.g. Gene Ontology Terms, protein domains, KEGG and Reactome Pathways, human diseases, mammalian phenotypes and publications).
In this example, enrichment analysis is performed using a list of genes which are associated with all forms of Diabetes according to OMIM.
The PL_DiabetesGenes dataset is included in the InterMineR package and can also be found online in HumanMine.
Retrieve PL_DiabetesGenes data and get gene identifiers as HumanrMine Gene.symbol and Gene.primaryIdentifier values (ENTREZ IDs).
# get HumanMine instance
im.human = initInterMine(listMines()["HumanMine"])
# retrieve data model for HumanMine
hsa_model = getModel(im.human)
# all targets of HumanMine enrichment widgets possess InterMine ids
subset(hsa_model, type %in% c("Gene", "Protein", "SNP") & child_name == "id")
## [1] type child_name child_type
## <0 rows> (or 0-length row.names)
# load human genes which are associated with Diabetes (retrieved from HumanMine)
data("PL_DiabetesGenes")
head(PL_DiabetesGenes, 3)
## Gene.symbol Gene.name
## 1 ABCC8 ATP binding cassette subfamily C member 8
## 2 ACE angiotensin I converting enzyme
## 3 AKT2 AKT serine/threonine kinase 2
## Gene.primaryIdentifier Gene.secondaryIdentifier Gene.length
## 1 6833 ENSG00000006071 83961
## 2 1636 ENSG00000159640 21320
## 3 208 ENSG00000105221 55215
## Gene.organism.name
## 1 Homo sapiens
## 2 Homo sapiens
## 3 Homo sapiens
# get Gene.symbol
hsa_gene_names = as.character(PL_DiabetesGenes$Gene.symbol)
head(hsa_gene_names, 3)
## [1] "ABCC8" "ACE" "AKT2"
# get Gene.primaryIdentifiers (ENTREZ Gene identifiers)
hsa_gene_entrez = as.character(PL_DiabetesGenes$Gene.primaryIdentifier)
head(hsa_gene_entrez, 3)
## [1] "6833" "1636" "208"
After obtaining the Gene.id values of interest, we must determine the type of annotation for the enrichment analysis.
To retrieve all available widgets for a Mine we can use the getWidgets
function.
## startClassDisplay
## 1 primaryIdentifier
## 2 <NA>
## 3 primaryIdentifier
## 4 primaryIdentifier
## 5 <NA>
## 6 primaryIdentifier
## 7 primaryIdentifier
## 8 primaryIdentifier
## 9 primaryIdentifier
## 10 <NA>
## enrichIdentifier
## 1 GWASResults.study.publication.pubMedId
## 2 <NA>
## 3 goAnnotation.ontologyTerm.parents.identifier
## 4 publications.pubMedId
## 5 <NA>
## 6 pathways.identifier
## 7 GWASResults.study.publication.pubMedId
## 8 proteins.proteinDomainRegions.proteinDomain.primaryIdentifier
## 9 proteinDomainRegions.proteinDomain.primaryIdentifier
## 10 <NA>
## name
## 1 snp_gwas_study_enrichment
## 2 chromosome_distribution_for_snp
## 3 go_enrichment_for_gene
## 4 publication_enrichment
## 5 chromosome_distribution_for_gene
## 6 pathway_enrichment
## 7 snp_publication_enrichment
## 8 prot_dom_enrichment_for_gene
## 9 prot_dom_enrichment_for_protein
## 10 interactions
## description
## 1 GWAS studies enriched for SNPs in this list.
## 2 Actual: number of items in this list found on each chromosome. Expected: given the total number of items on the chromosome and the number of items in this list, the number of items expected to be found on each chromosome.
## 3 GO terms enriched for items in this list.
## 4 Publications enriched for genes in this list.
## 5 Actual: number of items in this list found on each chromosome. Expected: given the total number of items on the chromosome and the number of items in this list, the number of items expected to be found on each chromosome.
## 6 Pathways enriched for genes in this list - data from KEGG and Reactome
## 7 Publications enriched for SNPs in this list.
## 8 Protein Domains enriched for items in this list.
## 9 Protein Domains enriched for items in this list.
## 10 Genes (from the list or not) that interact with genes in this list. Counts may include the same interaction more than once if observed in multiple experiments.
## enrich startClass
## 1 GWASResults.study.name SNP
## 2 <NA> SNP
## 3 goAnnotation.ontologyTerm.parents.name Gene
## 4 publications.title Gene
## 5 <NA> Gene
## 6 pathways.name Gene
## 7 GWASResults.study.publication.title SNP
## 8 proteins.proteinDomainRegions.proteinDomain.name Gene
## 9 proteinDomainRegions.proteinDomain.name Protein
## 10 <NA> <NA>
## title targets widgetType chartType
## 1 GWAS study Enrichment for SNPs SNP enrichment <NA>
## 2 Chromosome Distribution SNP chart ColumnChart
## 3 Gene Ontology Enrichment Gene enrichment <NA>
## 4 Publication Enrichment Gene enrichment <NA>
## 5 Chromosome Distribution Gene chart ColumnChart
## 6 Pathway Enrichment Gene enrichment <NA>
## 7 Publication Enrichment for SNPs SNP enrichment <NA>
## 8 Protein Domain Enrichment Gene enrichment <NA>
## 9 Protein Domain Enrichment Protein enrichment <NA>
## 10 Interactions Gene table <NA>
## filters
## 1 <NA>
## 2 organism.name=[list]
## 3 biological_process,cellular_component,molecular_function
## 4 <NA>
## 5 organism.name=[list]
## 6 All,KEGG pathways data set,Reactome data set
## 7 <NA>
## 8 <NA>
## 9 <NA>
## 10 <NA>
## labels
## 1 <NA>
## 2 Chromosome & Count
## 3 <NA>
## 4 <NA>
## 5 Chromosome & Count
## 6 <NA>
## 7 <NA>
## 8 <NA>
## 9 <NA>
## 10 <NA>
HumanMine provides enrichment for genes, proteins and SNPs, but here we are interested only in the gene-related, enrichment widgets.
# get enrichment, gene-related widgets for HumanMine
subset(human.widgets, widgetType == 'enrichment' & targets == "Gene")
## startClassDisplay
## 3 primaryIdentifier
## 4 primaryIdentifier
## 6 primaryIdentifier
## 8 primaryIdentifier
## enrichIdentifier
## 3 goAnnotation.ontologyTerm.parents.identifier
## 4 publications.pubMedId
## 6 pathways.identifier
## 8 proteins.proteinDomainRegions.proteinDomain.primaryIdentifier
## name
## 3 go_enrichment_for_gene
## 4 publication_enrichment
## 6 pathway_enrichment
## 8 prot_dom_enrichment_for_gene
## description
## 3 GO terms enriched for items in this list.
## 4 Publications enriched for genes in this list.
## 6 Pathways enriched for genes in this list - data from KEGG and Reactome
## 8 Protein Domains enriched for items in this list.
## enrich startClass
## 3 goAnnotation.ontologyTerm.parents.name Gene
## 4 publications.title Gene
## 6 pathways.name Gene
## 8 proteins.proteinDomainRegions.proteinDomain.name Gene
## title targets widgetType chartType
## 3 Gene Ontology Enrichment Gene enrichment <NA>
## 4 Publication Enrichment Gene enrichment <NA>
## 6 Pathway Enrichment Gene enrichment <NA>
## 8 Protein Domain Enrichment Gene enrichment <NA>
## filters labels
## 3 biological_process,cellular_component,molecular_function <NA>
## 4 <NA> <NA>
## 6 All,KEGG pathways data set,Reactome data set <NA>
## 8 <NA> <NA>
The column names provides the character strings that can be passed as arguments to the doEnrichment
function and thus define the type of enrichment analysis.
We will perform Gene Ontology Enrichment analysis for the genes in our list using the Gene.id values and the ‘go_enrichment_for_gene’ widget.
# Assign directly the doEnrichment.string from getGeneIds function to the ids argument of doEnrichment to perform the analysis
# Perform enrichment analysis
GO_enrichResult = doEnrichment(
im = im.human,
ids = hsa_gene_entrez,
widget = "go_enrichment_for_gene"
# organism = "Homo sapiens" # optional if results from more than one organism are retrieved
)
As mentioned above ‘PL_DiabetesGenes’ constitutes a genelist which already exists in HumanMine. Therefore, the enrichment analysis could also be performed by passing the name of the list to the genelist argument, with the same results:
# Perform enrichment analysis with genelist name instead of ids
GO_enrichResult = doEnrichment(
im = im.human,
genelist = "PL_DiabetesGenes",
# ids = hsa_gene_entrez,
widget = "go_enrichment_for_gene"
)
doEnrichment
function returns a list which contains:
## identifier description pValue
## 1 GO:0030072 peptide hormone secretion 9.81265853781751E-18
## 2 GO:0046879 hormone secretion 1.5986231795125633E-17
## 3 GO:0009914 hormone transport 2.2282615946760607E-17
## 4 GO:0030073 insulin secretion 3.210684287248625E-15
## 5 GO:0090276 regulation of peptide hormone secretion 3.210684287248625E-15
## 6 GO:0023061 signal release 4.101837256141138E-15
## count populationAnnotationCount
## 1 20 245
## 2 21 307
## 3 21 318
## 4 17 204
## 5 17 204
## 6 21 423
## [1] 605 5
## [1] 16550
## [1] 6
## $mine
## HumanMine
## "http://www.humanmine.org/humanmine"
##
## $token
## [1] ""
## ids
## "1235835,1185671,1129067,1164655,1014959,1182172,1026855,1078771,1261786,1291584,1239232,1126478,1054286,1240839,1294982,1062720,1201489,1273444,1233761,1106559,1301803,1220144,1287576,1052328,1082303,1133465,1075062,1243724,1140044,1069955,1224445,1115672,1152472,1219022,1060537,1048042,1239605,1306762,1031296,1034597,1125756,1047283,1162290,1015601,1253335,1082576,1073202,1160911,1144227,1059405,1205493,1192047,1271603,1027000,1267467,1285090,1034194,1169205,1028953,1105120,1069422,1202736,1278500,1260432,1276262,1049648,1160651,1204074"
## widget
## "go_enrichment_for_gene"
## maxp
## "0.05"
## correction
## "Benjamini Hochberg"
Some of the enrichment widgets contain filters which, when applied, limit the annotation types of the enrichment analysis.
In our example, if we want to retrieve only the enriched GO terms in our list of genes that are related to molecular function, we will use the appropriate filter:
# get available filter values for Gene Ontology Enrichment widget
as.character(subset(human.widgets, name == "go_enrichment_for_gene")$filters)
## [1] "biological_process,cellular_component,molecular_function"
# Perform enrichment analysis for GO molecular function terms
GO_MF_enrichResult = doEnrichment(
im = im.human,
ids = hsa_gene_entrez,
widget = "go_enrichment_for_gene",
filter = "molecular_function")
head(GO_MF_enrichResult$data)
## identifier description
## 1 GO:0005158 insulin receptor binding
## 2 GO:0005102 signaling receptor binding
## 3 GO:0000976 transcription regulatory region sequence-specific DNA binding
## 4 GO:0001067 regulatory region nucleic acid binding
## 5 GO:1990837 sequence-specific double-stranded DNA binding
## 6 GO:0005159 insulin-like growth factor receptor binding
## pValue count populationAnnotationCount
## 1 0.004245591773598556 4 21
## 2 0.0131638206592664 18 1537
## 3 0.016014287998993088 12 765
## 4 0.01618448730649538 13 881
## 5 0.018939590980716323 12 805
## 6 0.019256729825164885 3 16
## [1] 17 5
To reduce the probability of false positive errors, three different multiple correction algorithms can be applied to the results of the enrichment analysis:
The application of one of these algorithms changes the p-values and determines the number of the results which will be returned from the analysis:
# Perform enrichment analysis for Protein Domains in list of genes
PD_FDR_enrichResult = doEnrichment(
im = im.human,
ids = hsa_gene_entrez,
widget = "prot_dom_enrichment_for_gene",
correction = "Benjamini Hochberg"
)
head(PD_FDR_enrichResult$data)
## NULL
# Perform enrichment analysis for Protein Domains in list of genes
# but without a correction algoritm this time
PD_None_enrichResult = doEnrichment(
im = im.human,
ids = hsa_gene_entrez,
widget = "prot_dom_enrichment_for_gene",
correction = "None"
)
head(PD_None_enrichResult$data)
## identifier description
## 1 IPR006897 Hepatocyte nuclear factor 1, beta isoform, C-terminal
## 2 IPR023219 Hepatocyte nuclear factor 1, N-terminal domain superfamily
## 3 IPR006899 Hepatocyte nuclear factor 1, N-terminal
## 4 IPR006020 PTB/PI domain
## 5 IPR000734 Triacylglycerol lipase family
## 6 IPR013818 Lipase/vitellogenin
## pValue count populationAnnotationCount
## 1 1.1119293663751075E-5 2 2
## 2 1.1119293663751075E-5 2 2
## 3 3.328549670935905E-5 2 3
## 4 3.27206451574323E-4 3 40
## 5 4.91754736757544E-4 2 10
## 6 4.91754736757544E-4 2 10
In order to visualize the InterMineR enrichment analysis results, we will use the function convertToGeneAnswers
. This function was created to facilitate the visualization of doEnrichment
function results by converting them into a GeneAnswers-class
object.
This way we can utilize the functions of the package GeneAnswers to visualize the results of the enrichment analysis and the relations between the features (e.g. genes) and/or the annoatation categories (e.g. GO terms) (Feng et al. 2010, 2012; Huang et al. 2014).
# load GeneAnswers package
library(GeneAnswers)
# convert InterMineR Gene Ontology Enrichment analysis results to GeneAnswers object
geneanswer_object = convertToGeneAnswers(
# assign with doEnrichment result:
enrichmentResult = GO_enrichResult,
# assign with list of genes:
geneInput = data.frame(GeneID = as.character(hsa_gene_entrez),
stringsAsFactors = FALSE),
# assign with the type of gene identifier
# in our example we use Gene.primaryIdentifier values (ENTREZ IDs):
geneInputType = "Gene.primaryIdentifier",
# assign with Bioconductor annotation package:
annLib = 'org.Hs.eg.db',
# assign with annotation category type
# in our example we use Gene Ontology (GO) terms:
categoryType = "GO"
#optional define manually if 'enrichIdentifier' is missing from getWidgets:
#enrichCategoryChildName = "Gene.goAnnotation.ontologyTerm.parents.identifier"
)
class(geneanswer_object)
## [1] "GeneAnswers"
## attr(,"package")
## [1] "GeneAnswers"
## This GeneAnswers instance was build from GO based on hyperG test.
## Statistical information of 605 categories with p value less than 0.05 are reported. Other categories are considered as nonsignificant.
## There are 605 categories related to the given 68 genes
##
## Summary of GeneAnswers instance information:
##
## Slot: geneInput
## GeneID
## 1 6833
## 2 1636
## 3 208
## 4 26060
## 5 359
## 6 551
## ......
##
## Slot: testType
## [1] "hyperG"
##
## Slot: pvalueT
## [1] 0.05
##
## Slot: genesInCategory
## $`GO:0030072`
## [1] "6833" "640" "11132" "2645" "3077" "6928" "3172" "3557"
## [9] "3569" "3630" "3667" "8660" "3710" "3767" "4544" "4760"
## [17] "3651" "6514" "169026" "6934"
##
## $`GO:0046879`
## [1] "6833" "640" "11132" "2645" "3077" "6928" "3172" "3557"
## [9] "3569" "3630" "3667" "8660" "3710" "3767" "4544" "4760"
## [17] "3651" "56729" "6514" "169026" "6934"
##
## $`GO:0009914`
## [1] "6833" "640" "11132" "2645" "3077" "6928" "3172" "3557"
## [9] "3569" "3630" "3667" "8660" "3710" "3767" "4544" "4760"
## [17] "3651" "56729" "6514" "169026" "6934"
##
## $`GO:0030073`
## [1] "6833" "640" "11132" "2645" "6928" "3172" "3557" "3667"
## [9] "8660" "3710" "3767" "4544" "4760" "3651" "6514" "169026"
## [17] "6934"
##
## $`GO:0090276`
## [1] "6833" "640" "11132" "2645" "3077" "3172" "3630" "3667"
## [9] "8660" "3710" "3767" "4544" "4760" "3651" "6514" "169026"
## [17] "6934"
##
## $`GO:0023061`
## [1] "6833" "640" "11132" "2645" "3077" "6928" "3172" "3557"
## [9] "3569" "3630" "3667" "8660" "3710" "3767" "4544" "4760"
## [17] "3651" "56729" "6514" "169026" "6934"
##
## ......
##
## Slot: geneExprProfile
## NULL
##
## Slot: annLib
## [1] "org.Hs.eg.db"
##
## Slot: categoryType
## [1] "GO"
##
## Slot: enrichmentInfo
## genes in Category percent in the observed List
## GO:0030072 20 0.2941176
## GO:0046879 21 0.3088235
## GO:0009914 21 0.3088235
## GO:0030073 17 0.2500000
## GO:0090276 17 0.2500000
## GO:0023061 21 0.3088235
## percent in the genome fold of overrepresents odds ratio
## GO:0030072 0.01480363 19.86795 27.72959
## GO:0046879 0.01854985 16.64830 23.64010
## GO:0009914 0.01921450 16.07242 22.80690
## GO:0030073 0.01232628 20.28186 26.70915
## GO:0090276 0.01232628 20.28186 26.70915
## GO:0023061 0.02555891 12.08281 17.03471
## p value fdr p value
## GO:0030072 9.812659e-18 9.812659e-18
## GO:0046879 1.598623e-17 1.598623e-17
## GO:0009914 2.228262e-17 2.228262e-17
## GO:0030073 3.210684e-15 3.210684e-15
## GO:0090276 3.210684e-15 3.210684e-15
## GO:0023061 4.101837e-15 4.101837e-15
## ......
GeneAnswers is package designed for the enrichment analysis and visualization of gene lists. It is worth mentioning that the InterMineR filters for the widgets of Gene Ontology and Pathway Enrichment:
as.character(
subset(human.widgets,
title %in% c("Gene Ontology Enrichment",
"Pathway Enrichment"))$filters
)
## [1] "biological_process,cellular_component,molecular_function"
## [2] "All,KEGG pathways data set,Reactome data set"
match the following available values:
InterMineR widget name | InterMineR filter | convertToGeneAnswers categoryType |
---|---|---|
go_enrichment_for_gene | biological_process | GO.BP |
go_enrichment_for_gene | cellular_component | GO.CC |
go_enrichment_for_gene | molecular_function | GO.MF |
pathway_enrichment | KEGG pathways data set | KEGG |
pathway_enrichment | Reactome data set | REACTOME.PATH |
for the categoryType argument of the geneAnswerBuilder
function, and can be assigned accordingly in the categoryType argument of the convertToGeneAnswers
, therby facilitating the conversion of InterMineR Gene Ontology and Pathway Enrichment analysis results to GeneAnswers-class
objects.
# convert to GeneAnswers results for GO terms associated with molecular function
geneanswer_MF_object = convertToGeneAnswers(
enrichmentResult = GO_MF_enrichResult,
geneInput = data.frame(GeneID = as.character(hsa_gene_entrez),
stringsAsFactors = FALSE),
geneInputType = "Gene.primaryIdentifier",
annLib = 'org.Hs.eg.db',
categoryType = "GO.MF"
#enrichCategoryChildName = "Gene.goAnnotation.ontologyTerm.parents.identifier"
)
class(geneanswer_MF_object)
## [1] "GeneAnswers"
## attr(,"package")
## [1] "GeneAnswers"
## This GeneAnswers instance was build from GO.MF based on hyperG test.
## Statistical information of 17 categories with p value less than 0.05 are reported. Other categories are considered as nonsignificant.
## There are 17 categories related to the given 68 genes
##
## Summary of GeneAnswers instance information:
##
## Slot: geneInput
## GeneID
## 1 6833
## 2 1636
## 3 208
## 4 26060
## 5 359
## 6 551
## ......
##
## Slot: testType
## [1] "hyperG"
##
## Slot: pvalueT
## [1] 0.05
##
## Slot: genesInCategory
## $`GO:0005158`
## [1] "3630" "3667" "8660" "5770"
##
## $`GO:0005102`
## [1] "1636" "551" "640" "2056" "3077" "3082" "3159" "3172" "3557" "3569"
## [11] "3630" "3643" "3667" "8660" "5468" "5770" "6934" "7422"
##
## $`GO:0000976`
## [1] "50943" "3159" "6927" "6928" "3172" "4760" "5078" "3651" "5325"
## [10] "5468" "6925" "6934"
##
## $`GO:0001067`
## [1] "50943" "3159" "6927" "6928" "3172" "8462" "4760" "5078" "3651"
## [10] "5325" "5468" "6925" "6934"
##
## $`GO:1990837`
## [1] "50943" "3159" "6927" "6928" "3172" "4760" "5078" "3651" "5325"
## [10] "5468" "6925" "6934"
##
## $`GO:0005159`
## [1] "3630" "3643" "3667"
##
## ......
##
## Slot: geneExprProfile
## NULL
##
## Slot: annLib
## [1] "org.Hs.eg.db"
##
## Slot: categoryType
## [1] "GO.MF"
##
## Slot: enrichmentInfo
## genes in Category percent in the observed List
## GO:0005158 4 0.05882353
## GO:0005102 18 0.26470588
## GO:0000976 12 0.17647059
## GO:0001067 13 0.19117647
## GO:1990837 12 0.17647059
## GO:0005159 3 0.04411765
## percent in the genome fold of overrepresents odds ratio
## GO:0005158 0.0012825211 45.865546 48.669643
## GO:0005102 0.0938683278 2.819970 3.475159
## GO:0000976 0.0467204104 3.777163 4.372269
## GO:0001067 0.0538048125 3.553148 4.156620
## GO:1990837 0.0491633077 3.589478 4.144366
## GO:0005159 0.0009771589 45.148897 47.186538
## p value fdr p value
## GO:0005158 0.004245592 0.004245592
## GO:0005102 0.013163821 0.013163821
## GO:0000976 0.016014288 0.016014288
## GO:0001067 0.016184487 0.016184487
## GO:1990837 0.018939591 0.018939591
## GO:0005159 0.019256730 0.019256730
## ......
Briefly, in the following sections we present how to use several functions of the GeneAnswers package to visualize the results of the Gene Ontology Enrichment analysis on the PL_DiabetesGenes
gene list.
For more information about the usage of GeneAnswers package, the user should look at the respective documentation.
# GeneAnswers pieChart
geneAnswersChartPlots(geneanswer_object,
chartType='pieChart',
sortBy = 'correctedPvalue',
top = 5)
Figure 1: Pie chart of the top five GO terms with the smallest FDR-corrected p-values.
# GeneAnswers barplot
geneAnswersChartPlots(geneanswer_object,
chartType='barPlot',
sortBy = 'correctedPvalue',
top = 5)
Figure 2: Bar plot of the top five GO terms with the smallest FDR-corrected p-values.
# generate concept-gene network
geneAnswersConceptNet(geneanswer_object,
colorValueColumn=NULL,
centroidSize='correctedPvalue',
output='interactive',
catTerm = FALSE,
catID = FALSE,
showCats = 1:5)
Figure 3: Screen shot of concept-gene network for the first five GO terms. The size of nodes is proportional to the number of genes in each GO term.
The color of gene nodes can be changed based on the numeric values associated with the genes.
# generate concept-gene network
# for visualization purposes add a column of RANDOM numbers in geneInput
set.seed(123)
geneanswer_object@geneInput$random_values = rnorm(nrow(geneanswer_object@geneInput))
geneAnswersConceptNet(geneanswer_object,
colorValueColumn=2,
centroidSize='correctedPvalue',
output='interactive',
catTerm = FALSE,
catID = FALSE,
showCats = 1:5)
Figure 4: Screen shot of concept-gene network for the first five GO terms. Random numeric values have been assigned as column to geneInput in order to visualize the ability to add color to gene nodes. The size of nodes is proportional to the number of genes in each GO term.
# visualize the relations between the first two GO terms
geneAnswersConceptRelation(geneanswer_object,
directed=TRUE,
netMode='connection',
catTerm=TRUE,
catID=TRUE,
showCats = 1:2)
Figure 5: Screen shot of Gene Ontology structure network for the first two GO terms. The size of nodes is proportional to number of genes in these GO terms. The color of nodes stand for how relative the given genes are to the GO terms. More red, more relative. The given GO terms are yellow framed dots with dark purple edges as connections.
The functions of GeneAnswers package make use of several Bioconductor Annotation Packages, which are primarily based on Entrez Gene identifiers.
In our example, GeneAnswers uses the annotation package ‘org.Hs.eg.db’, which was specified previously in convertToGeneAnswers
function, to retrieve gene interactions for the specified genes.
# visualize interactions between the first five genes
buildNet(getGeneInput(geneanswer_object)[1:5,1],
idType='GeneInteraction',
layers=2,
filterGraphIDs=getGeneInput(geneanswer_object)[,1],
filterLayer=2,
netMode='connection')
Figure 6: Screen shot of gene interaction network for the first five genes of PL_DiabetesGenes. The large black dots with yellow frame stand for the five given genes. They also connect to other genes by dark-blue-purple edges. Small black dots represent the other genes from getGeneInput
. Small white dots are genes that are not in the genes from getGeneInput
, but interact with these genes.
# generate GO terms - Genes cross tabulation
geneAnswersHeatmap(geneanswer_object,
catTerm=TRUE,
geneSymbol=TRUE,
showCats = 5:10,
cex.axis = 0.75)
## initial value 9.613898
## final value 9.613898
## converged
## initial value 2.752192
## iter 5 value 1.438996
## iter 10 value 0.073365
## final value 0.006492
## converged
Although GeneAnswers package is designed for performing enrichment analysis on genes and reporting enriched pathways, it is possible to utilize some of its functions to visualize the results of the various enrichment widgets used by InterMineR.
Specifically in the current example we will show how to perform visualizations on publication enrichment analysis results.
# publication enrichment analysis
publication_enrichResult = doEnrichment(
im = im.human,
ids = hsa_gene_entrez,
widget = "publication_enrichment")
Since we are performing conversion of enrichment results that are not related to pathways there are three things to notice here:
# convert to GeneAnswer-class
# use Gene.symbol values instead of Gene.primaryIdentifier (ENTREZ)
geneanswer_pubs_object = convertToGeneAnswers(
enrichmentResult = publication_enrichResult,
geneInput = data.frame(GeneID = as.character(hsa_gene_names),
stringsAsFactors = FALSE),
geneInputType = "Gene.symbol",
annLib = 'org.Hs.eg.db',
categoryType = NULL,
enrichCategoryChildName = "Gene.publications.pubMedId"
)
class(geneanswer_pubs_object)
## [1] "GeneAnswers"
## attr(,"package")
## [1] "GeneAnswers"
## This GeneAnswers instance was build from based on hyperG test.
## Statistical information of 1276 categories with p value less than 0.05 are reported. Other categories are considered as nonsignificant.
## There are 1276 categories related to the given 68 genes
##
## Summary of GeneAnswers instance information:
##
## Slot: geneInput
## GeneID
## 1 ABCC8
## 2 ACE
## 3 AKT2
## 4 APPL1
## 5 AQP2
## 6 AVP
## ......
##
## Slot: testType
## [1] "hyperG"
##
## Slot: pvalueT
## [1] 0.05
##
## Slot: genesInCategory
## $`29792621`
## [1] "ABCC8" "APPL1" "BLK" "CEL" "GCK" "HNF1A" "HNF1B"
## [8] "HNF4A" "INS" "KCNJ11" "KLF11" "NEUROD1" "PAX4" "PDX1"
##
## $`19578796`
## [1] "ABCC8" "ACE" "CAPN10" "CCR5" "ENPP1" "GCGR" "GCK" "HNF1A"
## [9] "HNF4A" "IL6" "INS" "INSR" "IRS1" "KCNJ11" "LIPC" "PAX4"
## [17] "PDX1" "PON1" "PPARG" "PTPN1" "RETN" "VEGFA"
##
## $`19913121`
## [1] "ABCC8" "ACE" "AKT2" "AVPR2" "CCR5" "CDKAL1" "CEL"
## [8] "CTLA4" "EIF2AK3" "ENPP1" "EPO" "GCK" "HFE" "HGF"
## [15] "HMGA1" "HNF1A" "HNF1B" "HNF4A" "IGF2BP2" "IL1RN" "IL2RA"
## [22] "IL6" "INS" "INSR" "IRS1" "IRS2" "ITPR3" "KCNJ11"
## [29] "LIPC" "NEUROD1" "PDX1" "PON1" "PPARG" "PTPN22" "RETN"
## [36] "SLC2A2" "SOD2" "TCF7L2" "VEGFA" "WFS1"
##
## $`20628086`
## [1] "ABCC8" "ACE" "AKT2" "AVPR2" "CCR5" "CDKAL1" "CEL"
## [8] "CTLA4" "EIF2AK3" "ENPP1" "EPO" "GCK" "HFE" "HGF"
## [15] "HMGA1" "HNF1A" "HNF1B" "HNF4A" "IGF2BP2" "IL1RN" "IL2RA"
## [22] "IL6" "INS" "INSR" "IRS1" "IRS2" "ITPR3" "KCNJ11"
## [29] "LIPC" "NEUROD1" "PDX1" "PON1" "PPARG" "PTPN22" "RETN"
## [36] "SLC2A2" "SOD2" "TCF7L2" "VEGFA" "WFS1"
##
## $`20682687`
## [1] "ABCC8" "ACE" "CAPN10" "GCK" "HNF1A" "HNF1B" "HNF4A"
## [8] "IL6" "IRS1" "KCNJ11" "LIPC" "NEUROD1" "PDX1" "PPARG"
## [15] "PTPN1"
##
## $`20384434`
## [1] "ABCC8" "CDKAL1" "HNF1B" "HNF4A" "IGF2BP2" "IL6" "IRS1"
## [8] "KCNJ11" "LIPC" "PPARG" "SLC30A8" "TCF7L2" "WFS1"
##
## ......
##
## Slot: geneExprProfile
## NULL
##
## Slot: annLib
## [1] "org.Hs.eg.db"
##
## Slot: categoryType
## NULL
##
## Slot: enrichmentInfo
## genes in Category percent in the observed List
## 29792621 14 0.2058824
## 19578796 22 0.3235294
## 19913121 40 0.5882353
## 20628086 40 0.5882353
## 20682687 15 0.2205882
## 20384434 13 0.1911765
## percent in the genome fold of overrepresents odds ratio
## 29792621 0.0003784909 543.955882 684.72222
## 19578796 0.0041093298 78.730457 115.90589
## 19913121 0.0600178431 9.801007 22.37387
## 20628086 0.0596123172 9.867680 22.53580
## 20682687 0.0013787883 159.987024 204.98335
## 20384434 0.0007299467 261.904684 323.57306
## p value fdr p value
## 29792621 5.695149e-34 5.695149e-34
## 19578796 4.518844e-31 4.518844e-31
## 19913121 1.200879e-26 1.200879e-26
## 20628086 1.231787e-26 1.231787e-26
## 20682687 4.964528e-25 4.964528e-25
## 20384434 1.279153e-24 1.279153e-24
## ......
# GeneAnswers pieChart
geneAnswersChartPlots(geneanswer_pubs_object,
chartType='pieChart',
sortBy = 'correctedPvalue',
top = 5)
Figure 7: Pie chart of the top five PubMed IDs with the smallest FDR-corrected p-values.
# GeneAnswers barplot
geneAnswersChartPlots(geneanswer_pubs_object,
chartType='barPlot',
sortBy = 'correctedPvalue',
top = 5)
Figure 8: Bar plot of the top five PubMed IDs with the smallest FDR-corrected p-values.
It is important to note that the arguments catTerm and catID are assigned with FALSE. This is because the function is not expecting PubMed IDs as annotation categories and it will fail to convert them to short descriptions (as it would do with GO terms or KEGG and REACTOME pathways).
# generate concept-gene network
geneAnswersConceptNet(geneanswer_pubs_object,
colorValueColumn=NULL,
centroidSize='correctedPvalue',
output='interactive',
catTerm = FALSE,
catID = FALSE,
showCats = 1:5)
Figure 9: Screen shot of concept-gene network for the first five PubMed IDs. The size of nodes is proportional to the number of genes in each PubMed ID.
To generate a gene interaction network it is necessary to replace Gene.symbol with Gene.primaryIdentifier values because buildNet
function retrieves gene interactions from the ‘org.Hs.eg.db’ package, which uses ENTREZ identifiers for mapping.
# copy the existing GeneAnswer-class object
geneanswer_pubs_object2 = geneanswer_pubs_object
# replace Gene.symbol with Gene.primaryIdentifier values
geneanswer_pubs_object2@geneInput = data.frame(
GeneID = as.character(hsa_gene_entrez),
stringsAsFactors = FALSE)
# generate gene interaction network
buildNet(getGeneInput(geneanswer_pubs_object2)[1:5,1],
idType='GeneInteraction',
layers=2,
filterGraphIDs=getGeneInput(geneanswer_pubs_object)[,1],
filterLayer=2,
netMode='connection')
Figure 10: Screen shot of gene interaction network for the first five genes of PL_DiabetesGenes. The large black dots with yellow frame stand for the five given genes. They also connect to other genes by dark-blue-purple edges. Small black dots represent the other genes from getGeneInput
. Small white dots are genes that are not in the genes from getGeneInput
, but interact with these genes.
## R version 3.5.1 Patched (2018-07-12 r74967)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 16.04.5 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.7-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.7-bioc/R/lib/libRlapack.so
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=C LC_COLLATE=C
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] parallel stats4 stats graphics grDevices utils datasets
## [8] methods base
##
## other attached packages:
## [1] org.Hs.eg.db_3.6.0 GO.db_3.6.0 GeneAnswers_2.22.0
## [4] RColorBrewer_1.1-2 Heatplus_2.26.0 MASS_7.3-50
## [7] annotate_1.58.0 XML_3.98-1.16 AnnotationDbi_1.42.1
## [10] IRanges_2.14.10 S4Vectors_0.18.3 Biobase_2.40.0
## [13] BiocGenerics_0.26.0 RCurl_1.95-4.11 bitops_1.0-6
## [16] igraph_1.2.2 RSQLite_2.1.1 InterMineR_1.2.1
## [19] BiocStyle_2.8.2
##
## loaded via a namespace (and not attached):
## [1] Rcpp_0.12.18 lattice_0.20-35
## [3] Biostrings_2.48.0 rprojroot_1.3-2
## [5] digest_0.6.15 R6_2.2.2
## [7] GenomeInfoDb_1.16.0 chron_2.3-52
## [9] backports_1.1.2 evaluate_0.11
## [11] httr_1.3.1 sqldf_0.4-11
## [13] zlibbioc_1.26.0 curl_3.2
## [15] blob_1.1.1 Matrix_1.2-14
## [17] rmarkdown_1.10 gsubfn_0.7
## [19] proto_1.0.0 BiocParallel_1.14.2
## [21] downloader_0.4 stringr_1.3.1
## [23] bit_1.1-14 DelayedArray_0.6.5
## [25] compiler_3.5.1 xfun_0.3
## [27] pkgconfig_2.0.2 htmltools_0.3.6
## [29] tcltk_3.5.1 SummarizedExperiment_1.10.1
## [31] GenomeInfoDbData_1.1.0 bookdown_0.7
## [33] matrixStats_0.54.0 grid_3.5.1
## [35] RBGL_1.56.0 jsonlite_1.5
## [37] xtable_1.8-2 DBI_1.0.0
## [39] magrittr_1.5 graph_1.58.0
## [41] stringi_1.2.4 XVector_0.20.0
## [43] xml2_1.2.0 tools_3.5.1
## [45] RJSONIO_1.3-0 bit64_0.9-7
## [47] yaml_2.2.0 GenomicRanges_1.32.6
## [49] memoise_1.1.0 knitr_1.20
Feng, Gang, Pan Du, Nancy L Krett, Michael Tessel, Steven Rosen, Warren A Kibbe, and Simon M Lin. 2010. “A collection of bioconductor methods to visualize gene-list annotations.” BMC Research Notes 3 (1):10. https://doi.org/10.1186/1756-0500-3-10.
Feng, Gang, Pamela Shaw, Steven T. Rosen, Simon M. Lin, and Warren A. Kibbe. 2012. “Using the Bioconductor GeneAnswers Package to Interpret Gene Lists.” In Methods in Molecular Biology (Clifton, N.j.), 802:101–12. https://doi.org/10.1007/978-1-61779-400-1_7.
Huang, Lei, Gang Feng, Pan Du, Tian Xia, Xishu Wang, Jing Wen, Warren Kibbe, and Simon Lin. 2014. “GeneAnswers: Integrated Interpretation of Genes.” Bioconductor. https://www.bioconductor.org/packages/release/bioc/html/GeneAnswers.html.
Kalderimis, Alex, Rachel Lyne, Daniela Butano, Sergio Contrino, Mike Lyne, Joshua Heimbach, Fengyuan Hu, et al. 2014. “InterMine: extensive web services for modern biology.” Nucleic Acids Research 42 (Web Server issue). Oxford University Press:W468–72. https://doi.org/10.1093/nar/gku301.
Smith, R. N., J. Aleksic, D. Butano, A. Carr, S. Contrino, F. Hu, M. Lyne, et al. 2012. “InterMine: a flexible data warehouse system for the integration and analysis of heterogeneous biological data.” Bioinformatics 28 (23):3163–5. https://doi.org/10.1093/bioinformatics/bts577.