Skip to content

Instantly share code, notes, and snippets.

@egonw
Forked from jonalv/sstructuredb test script.js
Created November 17, 2008 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save egonw/25713 to your computer and use it in GitHub Desktop.
Save egonw/25713 to your computer and use it in GitHub Desktop.
Creates a local structure database and adds three molecules to it.
var dbName = "exampleScriptDB";
if ( structuredb.allDatabaseNames().contains(dbName) ) {
structuredb.deleteDatabase(dbName);
}
structuredb.createDatabase(dbName);
smiles = new Array("Cc1ccccc1", "CCO", "O=O");
names = new Array("toluene", "beer", "air");
for (i=0; i<3; i++) {
mol = cdk.fromSMILES(smiles[i]);
structuredb.createMolecule(dbName, names[i], mol);
}
js.print("Starting sub structure search");
var hits = structuredb.subStructureSearch( dbName, cdk.fromSMILES("C") );
js.print(hits);
hits;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment