Link discovery and interactive exploration in biological databases
Biomine Explorer also supports programmatic access. The API is based on JSON protocol and offers two functions:
listing of databases
and search
.
list_databases
function to get a list of available Biomine databases;
api
function with the selected database and source and optionaly target query terms. Other optional parameters can also be adjusted. If you do not specify a database, the default one will be used.
Here is a Python code snippet which demonstrates the use of Biomine API. You can use it with Python 2 and 3, just make sure that you have the excellent requests library installed.
import requests
listdb_url = 'https://biomine.ijs.si/list_databases'
search_url = 'https://biomine.ijs.si/api'
# list all available databases
databases = requests.get(listdb_url).json()['databases']
print(databases)
# a minimal example: all parameters have default values
params1 = {'sourceTerms': 'UniProt:O15409, UniProt:P38398'}
graph1 = requests.post(search_url, params1).json()['graph']
# here we select the 'json' graph format instead of default '.bmg'
params2 = {'sourceTerms': 'InterPro:IPR011364, EntrezGene:672', 'graph_type': 'json'}
graph2 = requests.post(search_url, params2).json()['graph']
# here we do a connection search and set all parameters:
# database, sourceTerms, targetTerms, maxnodes, grouping, and graph_type
params3 = {'database': databases['biomine'][0],
'sourceTerms': 'EntrezGene:27086',
'targetTerms': 'EntrezGene:93986',
'maxnodes': 50,
'grouping': 0,
'graph_type': 'bmg'}
graph3 = requests.post(search_url, params3).json()['graph']