View mashup.R
---
title: "Searching Nanopubs"
output: html_notebook
---
The first step is to set up a search for the NanoPublications
REST API. We use the `curl` library for that, and the `jsonlite`
to process the JSON.
```{r}
View code.R
library(jsonlite)
library("curl")
mapUriService = "http://localhost:8081/QueryExpander/mapUri"
# gene to variants
gene = "http://rdf.ebi.ac.uk/resource/ensembl/ENSG00000198947"
targetUriPattern = "http://identifiers.org/dbsnp"
h <- new_handle()
View gist:df5c8033eb1e2510bcaa0373d684d213
SELECT DISTINCT ?compound ?compoundLabel ?propEntity ?propEntityLabel ?value ?source ?sourceLabel ?doi
WITH {
SELECT DISTINCT ?compound ?propEntity ?value ?source ?doi WHERE {
?compound ?propp ?statement ;
wdt:P3117 ?value .
OPTIONAL {
?statement prov:wasDerivedFrom/pr:P248 ?source .
OPTIONAL { ?source wdt:P356 ?doi . }
}
View chemical identifiers.rq
SELECT ?IDpred ?IDpredLabel ?count WITH {
SELECT ?IDpred (COUNT(?id) AS ?count) WHERE {
?chemical ?IDdir ?id .
?IDpred wikibase:directClaim ?IDdir ;
wdt:P31 wd:Q19833835 .
FILTER (?IDpred != wd:P639)
FILTER (?IDpred != wd:P2926)
} GROUP BY ?IDpred
} AS %RESULTS {
View script.groovy
// Copyright (C) 2018 Egon Willighagen
// License: MIT
totalArticleCount = 15500000
batchSize = 500000
concept = "MetaboLights"
conceptQ = "Q24174701"
def renewFile(file) {
View spectre.c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
View query.rq
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>
SELECT DISTINCT ?sourceWD ?sourceWDLabel ?sourceSMILEScan ?sourceSMILESiso ?targetWD ?targetWDLabel ?targetSMILEScan ?targetSMILESiso WITH {
SELECT ?sourceWD ?targetWD WHERE {
SERVICE <http://sparql.wikipathways.org/> {
?pathway a wp:Pathway .
?interaction dcterms:isPartOf ?pathway .
?interaction a wp:Interaction, wp:Conversion .
?interaction wp:source ?source . ?source a wp:Metabolite; wp:bdbWikidata ?sourceWD .
View curation1.groovy
// Copyright (C) 2017 Egon Willighagen
// MIT license
// see https://www.wikidata.org/wiki/Wikidata:WikiProject_Chemistry/Tools#Chemical_compound_without_InChI
/* results (2017-10-29):
Number of missing InChIs: 2098
InChI too long: 1736
With undefined stereo: 348
View calcuateMZs.groovy
bioclipse.requireVersion("2.7.0")
// download all GPML files for a species, and save those in /WikiPathways/data/
// first, calculate m/z values for everything in Wikidata
referenceFile = "/WikiPathways/mz_smiles.tsv"
mzData = new java.util.HashMap()
new File(bioclipse.fullPath(referenceFile)).eachLine { line ->
tokens = line.tokenize( '\t' )
if (tokens[0] != "compound") {
wkid = tokens[0].substring(31)
View bbl processor
/**
* LaTeX .bbl output.
*
* (Code contributed by Egon Willighagen, based on the prototype.text code.)
*/
CSL.Output.Formats.prototype.latex = {
"text_escape": function (text) {
if (!text) {
text = "";
}