Skip to content

Instantly share code, notes, and snippets.

@jonalv
Forked from egonw/sstructuredb test script.js
Created February 4, 2009 12:42

Revisions

  1. @egonw egonw revised this gist Nov 17, 2008. 1 changed file with 12 additions and 11 deletions.
    23 changes: 12 additions & 11 deletions sstructuredb test script.js
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,21 @@
    var dbName = "exampleScriptDB";

    if ( structuredb.allDatabaseNames().contains(dbName) ) {
    structuredb.deleteDatabase(dbName);
    structuredb.deleteDatabase(dbName);
    }

    toluene = cdk.fromSMILES("Cc1ccccc1");
    ethanol = cdk.fromSMILES("CCO");
    oxygen = cdk.fromSMILES("O=O");

    structuredb.createDatabase(dbName);

    toluene = structuredb.createMolecule(dbName, "toluene", toluene);
    ethanol = structuredb.createMolecule(dbName, "ethanol", ethanol);
    oxygen = structuredb.createMolecule(dbName, "oxygen", oxygen);
    smiles = new Array("Cc1ccccc1", "CCO", "O=O");
    names = new Array("toluene", "beer", "air");

    js.print("Starting sub structure search");
    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;
    hits;

  2. jonalv created this gist Nov 11, 2008.
    20 changes: 20 additions & 0 deletions sstructuredb test script.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    var dbName = "exampleScriptDB";

    if ( structuredb.allDatabaseNames().contains(dbName) ) {
    structuredb.deleteDatabase(dbName);
    }

    toluene = cdk.fromSMILES("Cc1ccccc1");
    ethanol = cdk.fromSMILES("CCO");
    oxygen = cdk.fromSMILES("O=O");

    structuredb.createDatabase(dbName);

    toluene = structuredb.createMolecule(dbName, "toluene", toluene);
    ethanol = structuredb.createMolecule(dbName, "ethanol", ethanol);
    oxygen = structuredb.createMolecule(dbName, "oxygen", oxygen);

    js.print("Starting sub structure search");
    var hits = structuredb.subStructureSearch( dbName, cdk.fromSMILES("C") );
    js.print(hits);
    hits;