Skip to content

Instantly share code, notes, and snippets.

@jonalv
Created September 25, 2009 14:58
Show Gist options
  • Save jonalv/193599 to your computer and use it in GitHub Desktop.
Save jonalv/193599 to your computer and use it in GitHub Desktop.
var FILTERING = "Filtering";
var FILTERED = "Filtered";
if ( structuredb.allDatabaseNames().contains(FILTERING) ) {
structuredb.deleteDatabase(FILTERING);
}
structuredb.createDatabase(FILTERING);
structuredb.addMoleculesFromSDF(FILTERING, "/Sample Data/SDF/Fragments2.sdf");
var iterator = structuredb.allStructuresIterator( FILTERING );
var filteredAnnotation = structuredb.createTextAnnotation( FILTERING, "label", FILTERED );
while ( iterator.hasNext() ) {
var molecule = iterator.next();
if ( cdk.calculateSMILES(molecule).contains( "Cl" ) ) {
molecule.addAnnotation(filteredAnnotation);
structuredb.updateMolecule(FILTERING, molecule);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment