#Begin by activating the InterMineR library: library(InterMineR) listMines() humanMine <- listMines()["HumanMine"] #select humanmine humanMine #print out the value to see what's inside im <- initInterMine(mine=humanMine) # First, we'll retrieve the widgets available from HumanMine. This will tell us what types of enrichment are available. humanWidgets <- getWidgets(im) # Print out the widgets so we can see what there is humanWidgets # We'll put the widget list in a data frame, so it's easy to filter. humanWidgetsDataFrame <- as.data.frame(humanWidgets) # Now let's ask the data frame to give us a subset of the widgets. subset(humanWidgetsDataFrame, widgetType == 'enrichment' & targets == 'Gene') # We're using the widget `go_enrichment_for_gene` against the list name # `PL_GenomicsEngland_GenePanel:Genetic_Epilepsy_Syndromes` # #Syntax: # # GO_enrichResult = doEnrichment( # im = YOUR_CHOSEN_INTERMINE_HERE # genelist = LIST_NAME_SAVE_ON_YOUR_CHOSEN_INTERMINE, # widget = "go_enrichment_for_gene" # organism = "Homo sapiens" # optional if results from more than one organism are retrieved # ) GOEnrichmentResult = doEnrichment( im = im, genelist = "PL_GenomicsEngland_GenePanel:Genetic_Epilepsy_Syndromes", widget = "go_enrichment_for_gene" ) # Print the results GOEnrichmentResult # We'll be using the setQuery method here # # Syntax: # setQuery( # select = c("VIEW.NAME1", "VIEW.NAME2", .... ), # where = setConstraints( # paths = c("CONSTRAINT.PATH.A", "CONSTRAINT.PATH.B"), # operators = c("CONSTRAINT.OPERATOR.A", "CONSTRAINT.OPERATOR.B"), # values = list("CONSTRAINT.VALUE.A","CONSTRAINT.VALUE.B") # ) #) queryEpilepsy <- setQuery( # Choose which columns of data we'd like to see select = c("Gene.primaryIdentifier"), where = setConstraints( paths = c("Gene"), operators = c("IN"), values = list("PL_GenomicsEngland_GenePanel:Genetic_Epilepsy_Syndromes")) ) queryEpilepsyResults <- runQuery(im, queryEpilepsy) queryEpilepsyResults # load GeneAnswers package library(GeneAnswers) # convert InterMineR Gene Ontology Enrichment analysis results to GeneAnswers object queryEpilepsyForGeneAnswers = convertToGeneAnswers( # Pass the enrichment results we ran earlier to GeneAnswers: enrichmentResult = GOEnrichmentResult, # Pass in our original list of gene IDs geneInput = data.frame(GeneID = queryEpilepsyResults, stringsAsFactors = FALSE), # in our example we use Gene.primaryIdentifier values geneInputType = "Gene.primaryIdentifier", # The type of enrichment widget we ran # in our example we use Gene Ontology (GO) terms: categoryType = "GO" ) summary(queryEpilepsyForGeneAnswers) geneAnswersConceptNet(queryEpilepsyForGeneAnswers, colorValueColumn=NULL, centroidSize='correctedPvalue', output='fixed', geneSymbol = TRUE) geneAnswersConceptRelation(queryEpilepsyForGeneAnswers, directed=TRUE, output="fixed", netMode='connection') buildNet(getGeneInput(queryEpilepsyForGeneAnswers)[,1], idType='GeneInteraction', layers=3, output="fixed", filterGraphIDs=getGeneInput(queryEpilepsyForGeneAnswers)[,1], filterLayer=2, netMode='connection') geneAnswersHeatmap(queryEpilepsyForGeneAnswers, catTerm=TRUE, geneSymbol=TRUE, cex.axis = 0.75)