Created
May 5, 2009 15:20
-
-
Save olas/107008 to your computer and use it in GitHub Desktop.
Iterate over SDFile, calculates properties, and stores in new SDF.
This file contains 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
//*************************************************************** | |
// Script that iterates over a file, calculates properties | |
// and stores all in a new SDFile. Requires Sample Data installed. | |
// | |
// Author: Ola Spjuth | |
//**************************************************************** | |
it = cdk.createMoleculeIterator("/Sample Data/SDF/Fragments2.sdf"); | |
list=cdk.createMoleculeList(); | |
while (it.hasNext()){ | |
mol=it.next(); | |
i=inchi.generate(mol); | |
ikey=inchi.generateKey(mol); | |
fp=mol.getFingerprint(true); | |
//Store properties for the mol | |
cdk.setProperty(mol, "inchi", i) | |
cdk.setProperty(mol, "inchikey", ikey) | |
cdk.setProperty(mol, "cdk:fingerprint", fp) | |
list.add(mol); | |
} | |
cdk.saveSDFile("Virtual/Fragment2_with_props.sdf", list); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment