This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// will load a Gist from http://gist.github.com/ | |
// Gist 47981 actually is this JavaScript | |
gist.load(47981, "/Virtual/gist.47981.js") | |
// and open it in a JavaScript editor | |
ui.open("/Virtual/gist.47981.js") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bioclipse variant of SMILES Depict | |
var smiles = "CC=O" | |
var aceticAcid = cdk.fromSMILES(smiles) | |
aceticAcid = cdk.generate2dCoordinates(aceticAcid) | |
cdk.saveMDLMolfile(aceticAcid, "/Virtual/aceticAcid.mol") | |
ui.open("/Virtual/aceticAcid.mol") // should open JChemPaint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// debug CDK atom types starting from SMILES | |
var smiles = "[nH0]1c([nH0]cc1[N+](=O)[O-])" | |
var file = "/Virtual/smiles5.mol" | |
var mol = cdk.fromSMILES(smiles) | |
mol = cdk.generate2dCoordinates(mol) | |
cdk.saveMDLMolfile(mol, file) | |
cdx.perceiveCDKAtomTypes(mol) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX dbpedia: <http://dbpedia.org/ontology/> | |
PREFIX dbprop: <http://dbpedia.org/property/> | |
SELECT DISTINCT ?compound ?smiles WHERE { | |
?compound a dbpedia:ChemicalCompound . | |
?compound dbprop:section ?section . | |
?section dbprop:smiles ?smiles . | |
} ORDER BY ?compound LIMIT 1000 OFFSET 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX dbpedia: <http://dbpedia.org/ontology/> | |
PREFIX dbprop: <http://dbpedia.org/property/> | |
SELECT DISTINCT ?compound ?inchi WHERE { | |
?compound a dbpedia:ChemicalCompound . | |
?compound dbprop:section ?section . | |
?section dbprop:inchi ?inchi . | |
} ORDER BY ?compound LIMIT 1000 OFFSET 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// script that shows how the CDK parses SMILES | |
mol1 = cdk.fromSMILES("C") | |
mol2 = cdk.fromSMILES("[13C]") | |
cdx.diff(mol1, mol2) | |
// output: | |
// AtomContainerDiff{AtomDiff{H:4/0, AtomTypeDiff{IsotopeDiff{MN:NA/13}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPARQL listing all ONS Measurements | |
PREFIX ons: <http://spreadsheet.google.com/plwwufp30hfq0udnEmRD1aQ/onto#> | |
SELECT DISTINCT | |
?s | |
WHERE { | |
?s a ons:Measurement | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX dbpedia: <http://dbpedia.org/ontology/> | |
PREFIX dbprop: <http://dbpedia.org/property/> | |
SELECT DISTINCT ?compound ?smiles WHERE { | |
?compound a dbpedia:Drug . | |
?compound dbprop:smiles ?smiles | |
} ORDER BY ?compound LIMIT 1000 OFFSET 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// search and download entries from PubChem | |
var query = "aspirin"; | |
var searchResults = pubchem.search(query); | |
var max = Math.min(15, searchResults.size()); | |
for (i=0; i<max; i++) { | |
var cid = searchResults.get(i); | |
var filename = "/Virtual/" + query.replace(" ", "") + "." + cid + ".xml"; | |
var filename3d = "/Virtual/" + query.replace(" ", "") + "." + cid + ".mol"; | |
js.print("downloading CID " + cid + "...\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// download and process the ONS Solubility RDF data | |
ons = rdf.createStore() | |
rdf.importURL(ons,"http://github.com/egonw/onssolubility/raw/master/ons.solubility.rdf/ons.rdf") | |
rdf.sparql(ons,"SELECT DISTINCT ?type WHERE { ?s a ?type }") | |
// or, list all solutes: | |
rdf.sparql(ons,"SELECT ?s WHERE { ?s a <http://spreadsheet.google.com/plwwufp30hfq0udnEmRD1aQ/onto#Solute> }") | |
// or, just dump the whole database to the console | |
rdf.dump(ons) |