Biomine API

Besides the web search application Biomine also supports programmatic access. The API is based on JSON protocol and offers two functions: listing of databases and search.

How to use API

The Biomine API is always used in the following way:

  1. call the list_databases function to get a list of available Biomine databases
  2. call the api function with the selected database and source and optionaly target query terms (few other optional parameters can also be adjusted)

Note that if the target query terms are also given a connection-mode search will be performed instead of the usual neighbourhood-mode.


Here is a Python2 code snippet which demonstrates the use of Biomine API. You can also use it with Python3, just use urllib.request.urlopen instead of urllib2.urlopen and print() function instead of print statement.

import urllib
import urllib2
import json

listdb_url = ''
search_url = ''

## list all available databases
databases = json.loads(urllib2.urlopen(listdb_url).read())['databases']
print databases

## a minimal example: all parameters have default values
params1 = urllib.urlencode({'sourceTerms': 'UniProt:O15409, UniProt:P38398'})
graph1 = json.loads(urllib2.urlopen(search_url, params1).read())

## here we select the 'json' graph format instead of default '.bmg'
params2 = urllib.urlencode({'sourceTerms': 'InterPro:IPR011364, EntrezGene:672',
                             'graph_type': 'json'})
graph2 = json.loads(urllib2.urlopen(search_url, params2).read())

## here we do a connection search and set all parameters:
## database, sourceTerms, targetTerms,maxnodes, grouping, and graph_type
params3 = urllib.urlencode({'database': databases['biomine'][0],
                            'sourceTerms': 'EntrezGene:27086',
                            'targetTerms': 'EntrezGene:93986',
                            'maxnodes': 50,
                            'grouping': 0,
                            'graph_type': 'bmg'})
graph3 = json.loads(urllib2.urlopen(search_url, params3).read())