{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Using a Jupyter Notebook to perform a reproducible scientific analysis over semantic web sources\n", "\n", "Alasdair J G Gray ([ORCID:0000-0002-5711-4872](http://orcid.org/0000-0002-5711-4872)) \n", "_Heriot-Watt University, Edinburgh, UK_" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__Abstract:__ In recent years there has been a reproducibility crisis in science. Computational notebooks, such as Jupyter, have been touted as one solution to this problem. However, when executing analyses over live SPARQL endpoints, we get different answers depending upon when the analysis in the notebook was executed. In this paper, we identify some of the issues discovered in trying to develop a reproducible analysis over a collection of biomedical data sources and suggest some best practice to overcome these issues.\n", "\n", "__Keywords:__ Reproducibility, Computational Notebooks" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Introduction\n", "\n", "In recent years there has been a reproducibility crisis in science ([Baker; 2016](#Baker2016)). Open science advocates to overcome this crisis by openly publishing your work, included data, methods, and analysis ([Pearce; 2012](#Pearce2012)). Computational notebooks such as Jupyter ([Kluyver et al; 2016](#Kluyver2016)) that combine analysis with narrative are one approach to publishing scientific analysis methods. The approach is known as Literate Programming ([Knuth; 1984](#Knuth1984)). A key idea of Literate Programming is that the documentation of the analysis code is kept up to date with the code, as they are edited in the same environment. When writing the analysis, the author is forced to think about how others can understand and interpret the analysis, thus writing analysis in a way to aid understanding of the code ([Piccolo, Frampton; 2016](#Piccolo2016)). Ideally, the computation notebook becomes the publication, as this notebook attempts. Specifically, in this notebook we investigate the feasibility of publishing a reusable data analysis paper as a Jupyter Notebook in the Semanatic Web community. \n", "\n", "There is existing work on publishing computational workflows via notebooks ([Kluyver et al; 2016](#Kluyver2016)), and works in several scientific disciplines that have also used Jupyter Notebooks, e.g. Astronomy ([Farr et al; 2017](#Farr2017), [Medvedev et al; 2016](#Medvedev2016)), Biology ([Grüning et al; 2017](#Gruning2017)), and Oceanography ([Turner and Gill; 2018](#Turner2018)). In their paper Kluyver et al ([2016](#Kluyver2016)) recognise some of the limitations of academic publishing within a Jupyter notebook, particularly in the lack of support for citations. In this work, we are looking at performing an analysis over pharmacology Linked Data. The contents of this notebook provide a good starting point for those who want to do an analysis of the content of the chemical substances known in some of the leading chemisty databases used to support early stage pharmacology research, and supports the understanding of the evolution of their content. The analysis will compare the compound count between ChEBI ([Hastings et al; 2016](#Hastings2016)), ChEMBL ([Gaulton et al; 2017](#Gaulton2017)), DrugBank ([Wishart et al; 2018](#Wishart2018)), and Guide to Pharmacology ([Harding et al; 2018](#Harding2018)).\n", "\n", "In the rest of this notebook, we will first setup our computational environment in [Section 2](#Method). We will then perform a simple, but crucial, analysis in [Section 3](#Analysis) that does a crude comparison over four major pharmacology datasets. We will then discuss and conclude the paper in [Section 4](#Conclusions)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "## 2. Method" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.1 Computational Environment\n", "\n", "This notebook was prepared using [Jupyter server](http://jupyter.org/) version 5.0.0 running on Python 3.6.3 distributed by [Anaconda, Inc.](https://anaconda.org/) (default, Oct 6 2017, 12:04:38) \n", "[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)].\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.2 Configuring the Environment\n", "\n", "The following cells load various support libraries and define functions. The functions enable the running of queries over SPARQL endpoints and printing the results.\n", "\n", "First we will pull in various libraries that we will use. At the time of publication, the following versions of these libraries were used:\n", "- [SPARQLWrapper](https://rdflib.github.io/sparqlwrapper/doc/1.8.1/): 1.8.1\n", "- JSON ([simplejson](https://pypi.org/project/simplejson/)): 3.15\n", "\n", "The SPARQLWrapper dependency is captured in the [requirements.txt](https://github.com/AlasdairGray/SemSci2018/blob/master/requirements.txt) file on GitHub which enables this notebook to be run through the [Binder Service](https://mybinder.org). \n", "[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/AlasdairGray/SemSci2018/master?filepath=SemSci2018%20Publication.ipynb)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from SPARQLWrapper import SPARQLWrapper, JSON" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Ideally at this point we would print the version number of each module imported automatically. However the `print (SPARQLWrapper.__version__)` command does not work when using the `from SPARQLWrapper` import mechanism." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.3 Configuring SPARQL endpoints\n", "\n", "The endpoints used in this workbook:\n", "- DrugBank: http://bio2rdf.org/sparql\n", "- EBI: https://www.ebi.ac.uk/rdf/services/sparql\n", "- Guide to Pharmacology: https://rdf.guidetopharmacology.org/sparql\n", "\n", "Note that the EBI SPARQL endpoint is used to query both ChEBI and ChEMBL ([Jupp et al; 2014](#Jupp2014)). DrugBank is not originally published as RDF, so we use the Bio2RDF conversion and endpoint ([Callahan et al; 2013](#Callahan2013)). " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 2.3.1 DrugBank Endpoint" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "#Define DrugBank SPARQL endpoint and function to run queries over it\n", "dbSparql = SPARQLWrapper(\"http://bio2rdf.org/sparql\")\n", "dbSparql.setReturnFormat(JSON)\n", "def queryDrugBank(query):\n", " dbSparql.setQuery(query)\n", " results = dbSparql.queryAndConvert()\n", " return results" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "While the Bio2RDF [documentation](https://github.com/bio2rdf/bio2rdf-scripts/wiki/Bio2RDF-Dataset-Provenance#querying-the-provenance-graph) includes a query to extract the VoID metadata for the dataset, the query only provides results for the DisGeNet dataset, not DrugBank in which we are interestered. " ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'head': {'link': [],\n", " 'vars': ['dataset',\n", " 'datasetLabel',\n", " 'creationDate',\n", " 'creationScript',\n", " 'license',\n", " 'parentDataSet',\n", " 'downloadLink',\n", " 'endpointLink']},\n", " 'results': {'bindings': [], 'distinct': False, 'ordered': True}}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "query = \"\"\"\n", "PREFIX dcterms: \n", "PREFIX prov: \n", "PREFIX void: \n", "PREFIX rdf: \n", "PREFIX rdfs: \n", "SELECT * WHERE { \n", "?dataset rdf:type void:Dataset . \n", "?dataset rdfs:label ?datasetLabel . \n", "?dataset dcterms:created ?creationDate . \n", "?dataset dcterms:creator ?creationScript . \n", "?dataset dcterms:rights ?license . \n", "?dataset prov:wasDerivedFrom ?parentDataSet . \n", "?dataset void:dataDump ?downloadLink . \n", "?dataset void:sparqlEndpoint ?endpointLink . \n", "}\n", "\"\"\"\n", "queryDrugBank(query)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "According to the Bio2RDF [website](http://download.bio2rdf.org/files/release/3/release.html), the version of DrugBank loaded dates from 2014-07-25. The original DrugBank version is not stated." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 2.3.2 EBI SPARQL Endpoint" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "#Define EBI SPARQL endpoint and function to run queries over it\n", "#EBI endpoint can be used to query a variety of datasets including ChEMBL and ChEBI\n", "ebiSparql = SPARQLWrapper(\"https://www.ebi.ac.uk/rdf/services/sparql\")\n", "ebiSparql.setReturnFormat(JSON)\n", "def queryEBI(query):\n", " ebiSparql.setQuery(query)\n", " results = ebiSparql.queryAndConvert()\n", " return results" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The following cell executes a query to determine what version of ChEMBL is currently loaded into the EBI triplestore. At the time of writing, the verion was 24.0, which was last modified on 5 January 2018." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'head': {'vars': ['version', 'dateOfLastUpdate']},\n", " 'results': {'bindings': [{'dateOfLastUpdate': {'datatype': 'http://www.w3.org/2001/XMLSchema#dateTime',\n", " 'type': 'typed-literal',\n", " 'value': '2018-01-05T00:00:00Z'},\n", " 'version': {'type': 'literal', 'value': '24.1'}}]}}" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Query to determine the version of ChEMBL loaded\n", "query = \"\"\"\n", "PREFIX dcterms: \n", "PREFIX pav: \n", "\n", "SELECT ?version ?dateOfLastUpdate\n", "where {\n", " pav:hasCurrentVersion ?currentVersion.\n", " ?currentVersion pav:version ?version ;\n", " dcterms:hasDistribution ?dist.\n", " ?dist pav:lastUpdateOn ?dateOfLastUpdate\n", "}\n", "\"\"\"\n", "queryEBI(query)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We now determine the version of ChEBI that is loaded in the EBI triplestore. Note that slightly different metadata is available for ChEBI so we retrieve the date issued as the last update date is not available. However, the version URL may indicate that the dataset has been updated more recently than the last issue date. When executing in July 2018 the version is `http://rdf.ebi.ac.uk/dataset/chebi/03-07-2018` while the issued date is `2018-01-01`." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'head': {'vars': ['version', 'dateIssued']},\n", " 'results': {'bindings': [{'dateIssued': {'datatype': 'http://www.w3.org/2001/XMLSchema#date',\n", " 'type': 'typed-literal',\n", " 'value': '2018-01-01'},\n", " 'version': {'type': 'literal',\n", " 'value': 'http://rdf.ebi.ac.uk/dataset/chebi/03-07-2018'}}]}}" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Query to determine the version of ChEBI loaded\n", "query = \"\"\"\n", "PREFIX dcterms: \n", "PREFIX pav: \n", "\n", "SELECT ?version ?dateIssued\n", "where {\n", " pav:hasCurrentVersion ?currentVersion.\n", " ?currentVersion pav:version ?version ;\n", " dcterms:issued ?dateIssued\n", "}\n", "\"\"\"\n", "queryEBI(query)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 2.3.3 Guide to Pharmacology SPARQL Endpoint" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": true }, "outputs": [], "source": [ "#Define Guide to Pharmacology SPARQL endpoint and function to run queries over it\n", "gtpSparql = SPARQLWrapper(\"https://rdf.guidetopharmacology.org/sparql\")\n", "gtpSparql.setReturnFormat(JSON)\n", "def queryGtPdb(query):\n", " gtpSparql.setQuery(query)\n", " results = gtpSparql.queryAndConvert()\n", " return results" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Currently, the Guide to Pharmacology does not support querying of their metadata. A VoID file is available through their [website](http://www.guidetopharmacology.org/download.jsp#rdf) but this has not yet been loaded into their triplestore. The latest version of the Guide to Pharmacology data is listed as `2018.2`." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 2.3.4 Discussion\n", "\n", "It would be ideal to query each of the endpoints to programmatically determine the version of the dataset that was loaded at the time of execution, as we did with the EBI endpoint. This can be achieved using the [VoID](https://www.w3.org/TR/void/) vocabulary, although acquiring the knowledge to the structure of the metadata and the graph in which it is loaded is often reliant on the documentation of the data." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "## 3. Analysis: Compare the number of compound structures known in GtoPdb, ChEMBL, DrugBank, and ChEBI\n", "\n", "This question arose from discussions with [Chris Southan](https://scholar.google.co.uk/citations?user=y1DsHJ8AAAAJ&hl=en), University of Edinburgh, whilst creating the Guide to Pharmacology RDF data. Chris currently performs his investigation on [PubChem](https://pubchem.ncbi.nlm.nih.gov/). I recreated Chris's search queries (15/3/2018) and generated the output shown in the figure below:\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Each of the queries can be rerun by the following links:\n", "- ChEBI: [\"ChEBI\"[SourceName]](https://www.ncbi.nlm.nih.gov/pccompound?term=%22ChEBI%22%5BSourceName%5D&cmd=DetailsSearch)\n", "- ChEMBL: [\"ChEMBL\"[SourceName]](https://www.ncbi.nlm.nih.gov/pccompound?term=%22ChEMBL%22%5BSourceName%5D&cmd=DetailsSearch)\n", "- DrugBank: [\"DrugBank\"[SourceName]](https://www.ncbi.nlm.nih.gov/pccompound?term=%22DrugBank%22%5BSourceName%5D&cmd=DetailsSearch)\n", "- Guide to Pharmacology: [\"IUPHAR/BPS Guide to Pharmacology\"[SourceName]](https://www.ncbi.nlm.nih.gov/pccompound?term=%22IUPHAR/BPS Guide to Pharmacology%22%5BSourceName%5D&cmd=DetailsSearch)\n", "- Intersection of all sources: [((\"IUPHAR/BPS Guide to Pharmacology\"[SourceName] AND \"DrugBank\"[SourceName]) AND \"ChEMBL\"[SourceName]) AND \"ChEBI\"[SourceName]\n", "](https://www.ncbi.nlm.nih.gov/pccompound?term=%28%28%22IUPHAR/BPS%20Guide%20to%20Pharmacology%22%5BSourceName%5D%20AND%20%22DrugBank%22%5BSourceName%5D%29%20AND%20%22ChEMBL%22%5BSourceName%5D%29%20AND%20%22ChEBI%22%5BSourceName%5D&cmd=DetailsSearch)\n", "\n", "We will now recreate the same data by querying the SPARQL endpoints." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'ChEBI': '90510', 'ChEMBL': '1820035', 'DrugBank': '6810', 'GtPDb': '7146'}\n" ] } ], "source": [ "# Define function to extract count result from JSON SPARQL result set\n", "def extract_count(results):\n", " \"\"\"\n", " Extract the count result from the JSON format\n", " \"\"\"\n", " for result in results[\"results\"][\"bindings\"]:\n", " return result[\"count\"][\"value\"]\n", " \n", "#Initialise counts dictionary to store count for each dataset in\n", "counts = {}\n", "\n", "# Find the number of InChI Keys stored in ChEBI\n", "query = \"\"\"\n", "SELECT (count(?inchikey) as ?count)\n", "WHERE {\n", " ?ligand ?inchikey.\n", "}\n", "\"\"\"\n", "results = queryEBI(query)\n", "counts['ChEBI'] = extract_count(results)\n", "\n", "# Find the number of InChI Keys stored in ChEMBL\n", "query = \"\"\"\n", "SELECT (COUNT(?substance) as ?count)\n", "FROM \n", "WHERE {\n", "?substance a \n", "}\n", "\"\"\"\n", "results = queryEBI(query)\n", "counts['ChEMBL'] = extract_count(results)\n", "\n", "#Find the number of InChI Keys stored in DrugBank\n", "query = \"\"\"\n", " SELECT (COUNT(?s) as ?count) \n", " WHERE {?s a }\n", "\"\"\"\n", "results = queryDrugBank(query)\n", "counts['DrugBank'] = extract_count(results)\n", "\n", "# Find the number of InChI Keys stored in GtPdb\n", "query = \"\"\"\n", " PREFIX gtpo: \n", " SELECT (count(?inchikey) as ?count)\n", " WHERE {\n", " ?ligand gtpo:inChIKey ?inchikey.\n", " }\n", "\"\"\"\n", "results = queryGtPdb(query)\n", "counts['GtPDb'] = extract_count(results)\n", "\n", "# Print results\n", "print (counts)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The table below captures the counts of the number of InChI keys in PubChem in March 2018, and then the SPARQL queries which have been executed in June and July of 2018.\n", "\n", "| Dataset | PubChem
(2018-03-15) | SPARQL
(2018-06-08) | SPARQL
(2018-07-24) |\n", "|:----------------------|---------------------:|--------------------:|--------------------:|\n", "| ChEBI | 91,407 | 184,393 | 90,510 |\n", "| ChEMBL | 1,729,327 | 1,820,035 | 1,820,035 |\n", "| DrugBank | 9,789 | 6,810 | 6,810 |\n", "| Guide to Pharmacology | 6,969 | 7,065 | 7,146 |\n", "| Intersection | 1,523 | -- | -- |\n", "\n", "The ChEMBL and Guide to Pharmacology datasets contain more data in the SPARQL endpoint than the PubChem version. This is to be expected as the datasets available through the SPARQL endpoints are newer and the datasets are adding more content. The Guide to Pharmacology change between June and July corresponds with the release of version [2018.3](https://blog.guidetopharmacology.org/2018/06/28/database-release-2018-3/) on 28 June 2018. The exception to this is DrugBank, which has seen a decrease. This is due to the Bio2RDF endpoint offering an older version of the dataset.\n", "\n", "On PubChem we were able to calculate the intersection of the datasets, i.e. we could count the number of substances that are contained in all the datasets. This has not been possible with the SPARQL endpoints due to the distributed nature of the endpoints and the unreliability of federated queries. There are also complications due to the way that the substance structures (InChI Keys) are represented in the various datasets. The following queries demonstrate the output of the first 5 results of each dataset." ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'head': {'vars': ['inchikey']},\n", " 'results': {'bindings': [{'inchikey': {'datatype': 'http://www.w3.org/2001/XMLSchema#string',\n", " 'type': 'typed-literal',\n", " 'value': 'MHWLWQUZZRMNGJ-UHFFFAOYSA-N'}},\n", " {'inchikey': {'datatype': 'http://www.w3.org/2001/XMLSchema#string',\n", " 'type': 'typed-literal',\n", " 'value': 'DURULFYMVIFBIR-UHFFFAOYSA-N'}},\n", " {'inchikey': {'datatype': 'http://www.w3.org/2001/XMLSchema#string',\n", " 'type': 'typed-literal',\n", " 'value': 'MYKUKUCHPMASKF-VIFPVBQESA-N'}},\n", " {'inchikey': {'datatype': 'http://www.w3.org/2001/XMLSchema#string',\n", " 'type': 'typed-literal',\n", " 'value': 'IEDVJHCEMCRBQM-UHFFFAOYSA-N'}},\n", " {'inchikey': {'datatype': 'http://www.w3.org/2001/XMLSchema#string',\n", " 'type': 'typed-literal',\n", " 'value': 'ZZUFCTLCJUWOSV-UHFFFAOYSA-N'}}]}}" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Show 5 InChI Keys stored in ChEBI\n", "query = \"\"\"\n", "SELECT ?inchikey\n", "WHERE {\n", " ?ligand ?inchikey.\n", "} LIMIT 5\n", "\"\"\"\n", "queryEBI(query)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'head': {'vars': ['inchiKey']},\n", " 'results': {'bindings': [{'inchiKey': {'type': 'literal',\n", " 'value': 'YAPYGARUFVRIHX-ACCUITESSA-N'}},\n", " {'inchiKey': {'type': 'literal', 'value': 'IDDOHJSCLCKCAC-UHFFFAOYSA-N'}},\n", " {'inchiKey': {'type': 'literal', 'value': 'JJVMPIBZWGJKIV-GLGDLAMFSA-N'}},\n", " {'inchiKey': {'type': 'literal', 'value': 'MZITZBZTMCXZQS-FVNDCLGZSA-N'}},\n", " {'inchiKey': {'type': 'literal', 'value': 'KPNTUIZGUAJMMK-DWKDZXJCSA-N'}}]}}" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Show 5 InChI Keys stored in ChEMBL\n", "query = \"\"\"\n", "SELECT ?inchiKey\n", "FROM \n", "WHERE {\n", "?substance a ;\n", " ?inchiKey .\n", "} LIMIT 5\n", "\"\"\"\n", "queryEBI(query)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'head': {'link': [], 'vars': ['inchi']},\n", " 'results': {'bindings': [{'inchi': {'datatype': 'http://www.w3.org/2001/XMLSchema#string',\n", " 'type': 'typed-literal',\n", " 'value': 'InChIKey=PMATZTZNYRCHOR-IMVLJIQENA-N'}},\n", " {'inchi': {'datatype': 'http://www.w3.org/2001/XMLSchema#string',\n", " 'type': 'typed-literal',\n", " 'value': 'InChIKey=SFKQVVDKFKYTNA-YVGXZPIDNA-N'}},\n", " {'inchi': {'datatype': 'http://www.w3.org/2001/XMLSchema#string',\n", " 'type': 'typed-literal',\n", " 'value': 'InChIKey=DEQANNDTNATYII-RRCPSWKPSA-N'}},\n", " {'inchi': {'datatype': 'http://www.w3.org/2001/XMLSchema#string',\n", " 'type': 'typed-literal',\n", " 'value': 'InChIKey=NGVDGCNFYWLIFO-UHFFFAOYSA-N'}},\n", " {'inchi': {'datatype': 'http://www.w3.org/2001/XMLSchema#string',\n", " 'type': 'typed-literal',\n", " 'value': 'InChIKey=SEKGMJVHSBBHRD-WZHZPDAFSA-M'}}],\n", " 'distinct': False,\n", " 'ordered': True}}" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Show 5 InChI Keys stored in DrugBank\n", "query = \"\"\"\n", " SELECT ?inchi\n", " WHERE {?s a ;\n", " ?inchi.\n", " } LIMIT 5\n", "\"\"\"\n", "queryDrugBank(query)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As can be seen from the results, additional string processing would be required to compare the InChI Key string from DrugBank with the other datasets. This would be a costly, but not impossible operation. However, one that would be best suited to centralising all the data first and then performing the SPARQL queries." ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "\n", "## 4. Conclusions\n", "\n", "In this notebook, we have conducted a very simple analysis, counting the number of compounds in different pharmacology datasets. The purpose of publishing this as a notebook (c.f. open science) is to enable the repetition of this computation, since the datasets are continuously evolving, and to share our methods in a way that allows others to reproduce our results whilst also reading our narrative. However, this has raised the following questions:\n", "\n", "1. How should you present the computational environment used?\n", "1. How should you present the results of the original computation against those of the live results when the content of datasets is evolving?\n", "\n", "For the first question, you would ideally use the computational environment to report about itself. However, this is not always straightforward. Libraries don't necessarily report their versions, and SPARQL endpoints all have different approaches (or perhaps none) for providing metadata about their datasets.\n", "\n", "The second question focuses on recognising that sources change over time, often gaining more data, although as shown with the ChEBI data sometimes containing errors too. The publication of this notebook captures a point in time, or indeed three. The first is the time when the query was run over the PubChem database (15 March 2018), the second when the SAPRQL queries were executed for the peer review version of this notebook (8 June 2018), and the third when the camera ready version was prepared (24 July 2018). This allowed us to compare the results at the different timepoints. In this notebook we chose to copy the results of the computation for publication into the text in order to allow others reusing the notebook to be able to compare their answers. We hope that this proves to be a useful approach. We note that the reuse of this notebook relies on the continued availability of the SPARQL endpoints. Newer computational notebook environments are being developed that overcome some of the limitations of Jupyter, e.g. Wrattler ([Petricek et al; 2018](#Petricek2018)), although these still need to mature and gain wider uptake by the community.\n", "\n", "We have deliberately not used any Jupyter extensions in this notebook, believing that this will aid reproducibility into the future. However, this complicated the generating of the paper in this notebook, as there is no inbuilt support for academic references. If the use of computational notebooks is to grow, then referencing needs to become a core feature. In the future, it would be interesting to investigate the additional effort required in making the notebook itself a semantic resource. There have already been several discussions on embedding metadata in Jupyter Notebooks. However, there is no UI support for entering this metadata, no standard approach for representing authorship metadata, and no support for creating this as semantic annotations.\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Acknowledgements\n", "\n", "This work was conducted through the ELIXIR-EXCELERATE project that is funded by the European Commission within the Research Infrastructures programme of Horizon 2020, grant number 676559.\n", "\n", "The author would also like to thank the reviewers – [Idafen Santana-Perez](http://orcid.org/0000-0001-8296-8629), [Michel Dumontier](https://orcid.org/0000-0003-4727-9435), and [Oscar Corcho](https://orcid.org/0000-0002-9260-0753) – for their helpful [comments](https://semsci.github.io/SemSci2018/openReview/Gray.txt) that have been used to improve the published version of this notebook." ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "## References\n", "\n", "\n", "Baker, M. 1,500 scientists lift the lid on reproducibility. Nature 533, 452–454 (2016). \n", "DOI: [10.1038/533452a](https://doi.org/10.1038/533452a)\n", "\n", "\n", "Callahan A., Cruz-Toledo J., Ansell P., Dumontier M. Bio2RDF Release 2: Improved Coverage, Interoperability and Provenance of Life Science Linked Data. ESWC 2013: 200-212. (2013) \n", "DOI: [10.1007/978-3-642-38288-8_14](https://doi.org/10.1007/978-3-642-38288-8_14) \n", "\n", "\n", "Farr, W. M., Stevenson, S., Coleman Miller, M., Mandel, I., Farr, B., and Vecchio, A. Distinguishing spin-aligned and isotropic black hole populations with gravitational waves. Nature 548, 426 (2017). \n", "DOI: [10.0.4.14/nature23453](https://doi.org/10.0.4.14/nature23453)\n", "\n", "\n", "Gaulton A, Hersey A, Nowotka M, Bento AP, Chambers J, Mendez D, Mutowo P, Atkinson F, Bellis LJ, Cibrián-Uhalte E, Davies M, Dedman N, Karlsson A, Magariños MP, Overington JP, Papadatos G, Smit I, Leach AR. The ChEMBL database in 2017. Nucleic Acids Research, 45(D1) D945-D954. (2017) \n", "DOI: [10.1093/nar/gkw1074](https://doi.org/10.1093/nar/gkw1074)\n", "\n", "\n", "Grüning BA, Rasche E, Rebolledo-Jaramillo B, Eberhard C, Houwaart T, Chilton J, Coraor N, Backofen R, Taylor J, and Nekrutenko A. Jupyter and Galaxy: Easing entry barriers into complex data analyses for biomedical researchers. PLoS Comput Biol 13(5): e1005425 (2017). \n", "DOI: [10.1371/journal.pcbi.1005425](https://doi.org/10.1371/journal.pcbi.1005425)\n", "\n", "\n", "Harding SD, Sharman JL, Faccenda E, Southan C, Pawson AJ, Ireland S, Gray AJG, Bruce L, Alexander SPH, Anderton S, Bryant C, Davenport AP, Doerig C, Fabbro D, Levi-Schaffer F, Spedding M, Davies JA; NC-IUPHAR. The IUPHAR/BPS Guide to PHARMACOLOGY in 2018: updates and expansion to encompass the new guide to IMMUNOPHARMACOLOGY. Nucleic Acids Research, 46 (Issue D1): D1091-D1106 (2018). \n", "DOI: [10.1093/nar/gkx1121](https://doi.org/10.1093/nar/gkx1121)\n", "\n", "\n", "Hastings J, Owen G, Dekker A, Ennis M, Kale N, Muthukrishnan V, Turner S, Swainston N, Mendes P, Steinbeck C. ChEBI in 2016: Improved services and an expanding collection of metabolites. Nucleic Acids Research (2016). \n", "DOI: [10.1093/nar/gkv1031](https://doi.org/10.1093/nar/gkv1031)\n", "\n", "\n", "Jupp S, Malone J, Bolleman J, Brandizi M., Davies M., Garcia L., Gaulton A., Gehant S., Laibe C., Redaschi N., Wimalaratne S.M., Martin M., Le Novère N., Parkinson H., Birney E. and Jenkinson A.M. The EBI RDF Platform: Linked Open Data for the Life Sciences Bioinformatics 30 1338-1339. 2014. \n", "DOI: [10.1093/bioinformatics/btt765](https://doi.org/10.1093/bioinformatics/btt765)\n", "\n", "\n", "Kluyver T., Ragan-Kelley B., Pérez F., Granger B.E., Bussonnier M., Frederic J., Kelley K., Hamrick J.B., Grout J., Corlay S. and Ivanov P. Jupyter Notebooks-a publishing format for reproducible computational workflows. In ELPUB, 87-90 (2016). \n", "DOI: [10.3233/978-1-61499-649-1-87](https://doi.org/10.3233/978-1-61499-649-1-87)\n", "\n", "\n", "Knuth, D. E. Literate Programming. The Computer Journal 27, 97–111 (1984). \n", "DOI: [10.1093/comjnl/27.2.97](https://doi.org/10.1093/comjnl/27.2.97)\n", "\n", "\n", "Medvedev D, Lemson G, and Rippin M. SciServer Compute: Bringing Analysis Close to the Data. In Proceedings of the 28th International Conference on Scientific and Statistical Database Management (SSDBM '16), Article 27, 4 pages (2016). \n", "DOI: [10.1145/2949689.2949700](https://doi.org/10.1145/2949689.2949700)\n", "\n", "\n", "Pearce, J. M. Open Source Research in Sustainability. Sustainability: The Journal of Record, 5, 238–243 (2012). \n", "DOI: [10.1089/SUS.2012.9944](https://doi.org/10.1089/SUS.2012.9944)\n", "\n", "\n", "Petricek, T., Geddes, J. and Sutton, C. Wrattler: Reproducible, live and polyglot notebooks. in 10th USENIX Workshop on The Theory and Practice of Provenance (TaPP 2018) (2018). \n", "[https://www.usenix.org/conference/tapp2018/presentation/petricek](https://www.usenix.org/conference/tapp2018/presentation/petricek)\n", "\n", "\n", "Piccolo S.R. and Frampton M. B. Tools and techniques for computational reproducibility. Gigascience 5, 30 (2016). \n", "DOI: [10.1186/s13742-016-0135-4](https://doi.org/10.1186/s13742-016-0135-4)\n", "\n", "\n", "Turner C., and Gill, I. Developing a Data Management Platform for the Ocean Science Community. Marine Technology Society Journal 52, no. 3: 28-32 (2018). \n", "DOI: [10.4031/MTSJ.52.3.8](https://doi.org/10.4031/MTSJ.52.3.8)\n", "\n", "\n", "Wishart DS, Feunang YD, Guo AC, Lo EJ, Marcu A, Grant JR, Sajed T, Johnson D, Li C, Sayeeda Z, Assempour N, Iynkkaran I, Liu Y, Maciejewski A, Gale N, Wilson A, Chin L, Cummings R, Le D, Pon A, Knox C, Wilson M. DrugBank 5.0: a major update to the DrugBank database for 2018. Nucleic Acids Research, 2017. \n", "DOI: [10.1093/nar/gkx1037](https://10.1093/nar/gkx1037)\n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Version History\n", "\n", "- 2018-08-28 Updated license for CEUR publication ([967e5ef](https://github.com/AlasdairGray/SemSci2018/commit/967e5efcb044821f02ee36609611d139acb286c5))\n", "- 2018-07-31 Camera ready version ([e7d1dce](https://github.com/AlasdairGray/SemSci2018/commit/e7d1dcee4fba3b64038761dadcf4c173cac8f9e4)) \n", "- 2018-06-08 Version submitted to Semantic Science 2018 workshop ([8130dda](https://github.com/AlasdairGray/SemSci2018/commit/8130ddaa41238d4fc65a2a198fde2953689db3e0))" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.3" } }, "nbformat": 4, "nbformat_minor": 2 }