Created
March 1, 2009 18:44
-
-
Save egonw/72430 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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 ." + | |
| "}" | |
| ) | |
| mols = cdk.createMoleculeList() | |
| for (i=0; i<results.size(); i++) { | |
| var row = results.get(i); | |
| var title = row.get(0); | |
| var smiles = row.get(1); | |
| mol = cdk.fromSMILES(smiles); | |
| mol = cdk.generate2dCoordinates(mol) | |
| mol.getAtomContainer().setProperty("title", title); | |
| mols.add(mol) | |
| } | |
| cdk.saveSDFile("/Virtual/test.sdf", mols) | |
| ui.open("/Virtual/test.sdf") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment