Skip to content

Instantly share code, notes, and snippets.

@olas
Created July 24, 2009 11:33
Show Gist options
  • Select an option

  • Save olas/154028 to your computer and use it in GitHub Desktop.

Select an option

Save olas/154028 to your computer and use it in GitHub Desktop.
Add property to SDF from file
//***************************************************************
// Script that iterates over an SDFile and adds precalculated values
// from an external file as a property and saves as a new SDFile.
//
// The file with values have one value per row in same order as
// the molecukes in the SDFile.
//
// Author: Ola Spjuth
//****************************************************************
PROPERTY_NAME="pdgfr_response";
it = cdk.createMoleculeIterator("/raj1/molecules/pdgfr.sdf");
responses=ui.readFileIntoArray("/raj1/plasma.depv");
//Create a list to hold the resulting molecules
list=cdk.createMoleculeList();
ix=0;
while (it.hasNext()){
mol=it.next();
prop=responses[ix];
cdk.setProperty(mol, PROPERTY_NAME, prop);
list.add(mol);
ix++;
}
cdk.saveSDFile("raj1/pdgfr_props.sdf", list);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment