Skip to content

Instantly share code, notes, and snippets.

View egonw's full-sized avatar
💭
I want peace and climate action

Egon Willighagen egonw

💭
I want peace and climate action
View GitHub Profile
var ons = rdf.createStore()
// output: RDFStore: 0 triples
rdf.importURL(ons,
"http://github.com/egonw/onssolubility/raw/master/ons.solubility.rdf/ons.rdf")
// output: RDFStore: 1206 triples
var results = rdf.sparql(ons, "PREFIX owl: <http://www.w3.org/2002/07/owl#> " +
"PREFIX ons: <http://spreadsheet.google.com/plwwufp30hfq0udnEmRD1aQ/onto#> " +
"SELECT DISTINCT ?same WHERE { " +
var ons = rdf.createStore()
rdf.importURL(ons,
"http://github.com/egonw/onssolubility/raw/master/ons.solubility.rdf/ons.rdf")
var results = rdf.sparql(ons, "PREFIX ons: <http://spreadsheet.google.com/plwwufp30hfq0udnEmRD1aQ/onto#> " +
"PREFIX chemblog: <http://blueobelisk.sourceforge.net/chemistryblogs/>" +
"PREFIX dc: <http://purl.org/dc/elements/1.1/> " +
"SELECT DISTINCT ?title ?smiles WHERE { " +
" ?solvent dc:title ?title . " +
" ?solvent chemblog:smiles ?smiles ." +
xmpp.connect();
service = xmpp.getService("descriptor.ws1.bmc.uu.se");
service.discoverSync(5000);
service.getFunctions();
f = service.getFunction("XLogP");
ios = f.getIoSchemataSync(90000);
// and it fails with:
iof = xmpp.getIoFactory(ios);
<rdf:RDF
xmlns:mw="http://metware.sf.net/onto/#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#" >
<rdf:Description rdf:about="urn:lsid:localhost:net.sf.metware.beans.MetidMetabolitesAddonPubchemBean:297">
<owl:sameAs rdf:resource="urn:lsid:localhost:net.sf.metware.beans.MetidMetabolitesBean:16"/>
<mw:PubChemCID>297</mw:PubChemCID>
<rdf:type rdf:resource="http://metware.sf.net/onto/#PubChemExtras"/>
</rdf:Description>
<rdf:Description rdf:about="urn:lsid:localhost:net.sf.metware.beans.MetidMetabolitesBean:16">
var owl = rdf.createStore();
rdf.importURL(owl,
"http://qsar.svn.sf.net/viewvc/qsar/trunk/qsar-dicts/descriptor-algorithms.owl?revision=210"
);
// list of topological descriptors
rdf.sparql(owl,
"PREFIX qsar: <http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#> " +
"SELECT ?s WHERE { ?s ?p qsar:topologicalDescriptor}"
);
// connect to the XMPP hive
xmpp.connect();
// we are going to call the XLogP function of the descriptor service
service = xmpp.getService("descriptor.ws1.bmc.uu.se");
service.discoverSync(5000);
service.getFunctions();
f = service.getFunction("XLogP");
// we use Bioclipse to create a CML document, starting from a SMILES
@egonw
egonw / buildMolecule.js
Created April 16, 2009 18:57 — forked from olas/buildmol
Build a molecule using Bioclipse script for JChemPaint
/*******************************************************************************
* Bioclipse-script to iteratively build a molecule in JChemPaint
* Author: Ola Spjuth
* Author: Egon Willighagen
******************************************************************************/
//Start with a carbon and open in JCP
mol=cdk.fromSMILES("C")
mol2=cdk.generate2dCoordinates(mol)
ui.open(mol2)
import org.openscience.cdk.*
import org.openscience.cdk.io.*
import org.openscience.cdk.nonotify.*
cid = 5282253
reader = new PCCompoundXMLReader(
new URL(
"http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=$cid&disopt=SaveXML"
).newInputStream()
)
1. Get a copy of PubChem
$ mkdir pubchem
$ cd pubchem
$ wget -r ftp://ftp.ncbi.nlm.nih.gov/pubchem/Compound/CURRENT-Full/XML/ -c
$ ln -s ftp.ncbi.nlm.nih.gov/pubchem/Compound/CURRENT-Full/XML XML
2. Set up MySQL
CREATE TABLE IF NOT EXISTS `compounds` (
// connect to the XMPP hive
xmpp.connect();
// we are going to call the TPSA function of the descriptor service
service = xmpp.getService("descriptor.ws1.bmc.uu.se");
service.discoverSync(5000);
service.getFunctions();
f = service.getFunction("TPSA");
// we use Bioclipse to create a CML document, starting from a SMILES