This version refers to rev. 2333 of the predictor.jars, for older versions see history of this article
In the nmrshiftdb2 file area you can find two files, predictorc.jar and predictorh.jar, which can be used as a standalone prediction tool for c or h nmr shifts. Both jars contain an identical java class org.openscience.nmrshiftdb.PredictionTool and a csv file. The file contains all hose codes and associated shift values from nmrshiftdb2 (as of the date of the file creation of course). Together with a couple of other jars you can use this to predict shifts either by calling the predict method of the class from your java code. The jars also contain a class Test, which has a main method. On command line, the call should look like this:
java -cp predictorc.jar:cdk-interfaces.jar:cdk-io.jar:cdk-core.jar:cdk-data.jar:cdk-standard.jar:cdk-sdg.jar:cdk-valencycheck.jar:cdk-atomtype.jar:cdk-legacy.jar:cdk-smiles.jar:cdk-ctab.jar:vecmath1.2-1.14.jar:jgrapht.jar:guava-17.0.jar:beam-core-0.9.2.jar:cdk-qsaratomic.jar:cdk-qsar.jar:cdk-qsarmolecular.jar Test 10008950.mdl "Chloroform-D1 (CDCl3)"
The results gives the min, average and max values of the shifts for all carbon atoms in the mol file. using predictorh.jar will do the hydorgens. The method properly configures the molcule (see below).
Notice the following points:
This is an example code for usage (thanks to Jean-Marc Nuzillard):
/* compile */
/* Unix: javac -classpath predictorc.jar:cdk-interfaces.jar:cdk-io.jar:cdk-core.jar:cdk-data.jar:cdk-standard.jar:cdk-sdg.jar:cdk-valencycheck.jar:cdk-atomtype.jar:cdk-legacy.jar:cdk-smiles.jar:cdk-ctab.jar:vecmath1.2-1.14.jar:jgrapht.jar:guava-17.0.jar:beam-core-1.3.3.jar:cdk-qsaratomic.jar:cdk-qsar.jar:cdk-qsarmolecular.jar Test.java */
/* Windows: javac -classpath predictorc.jar;cdk-interfaces.jar;cdk-io.jar;cdk-core.jar;cdk-data.jar;cdk-standard.jar;cdk-sdg.jar;cdk-valencycheck.jar;cdk-atomtype.jar;cdk-legacy.jar;cdk-smiles.jar;cdk-ctab.jar;vecmath1.2-1.14.jar;jgrapht.jar;guava-17.0.jar;beam-core-1.3.3.jar;cdk-qsaratomic.jar;cdk-qsar.jar;cdk-qsarmolecular.jar Test.java */
/* use */
/* Unix: java -Xmx1g -classpath predictorc.jar;cdk-interfaces.jar;cdk-io.jar;cdk-core.jar;cdk-data.jar;cdk-standard.jar;cdk-sdg.jar;cdk-valencycheck.jar;cdk-atomtype.jar;cdk-legacy.jar;cdk-smiles.jar;cdk-ctab.jar;vecmath1.2-1.14.jar;jgrapht.jar;guava-17.0.jar;beam-core-1.3.3.jar;cdk-qsaratomic.jar;cdk-qsar.jar;cdk-qsarmolecular.jar;. Test myfile.mol [solvent [no3d]] */
/* Windows: java -Xmx1g -classpath predictorc.jar;cdk-interfaces.jar;cdk-io.jar;cdk-core.jar;cdk-data.jar;cdk-standard.jar;cdk-sdg.jar;cdk-valencycheck.jar;cdk-atomtype.jar;cdk-legacy.jar;cdk-smiles.jar;cdk-ctab.jar;vecmath1.2-1.14.jar;jgrapht.jar;guava-17.0.jar;beam-core-1.3.3.jar;cdk-qsaratomic.jar;cdk-qsar.jar;cdk-qsarmolecular.jar;. Test myfile.mol [solvent [no3d]] */
/* Solvent must be "Chloroform-D1 (CDCl3)", "Methanol-D4 (CD3OD)", or "Dimethylsulphoxide-D6 (DMSO-D6, C2D6SO)" (with quotation marks)! or left unspecified
import java.io.FileReader;
import java.util.Locale;
import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.AtomContainer;
import org.openscience.cdk.aromaticity.CDKHueckelAromaticityDetector;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.io.MDLReader;
import org.openscience.nmrshiftdb.PredictionTool;
import org.openscience.nmrshiftdb.util.AtomUtils;
public class Test {
public static void main(String[] args) throws Exception {
if(args.length == 0){
/* file name as command line argument */
java.lang.System.exit(1);
}
/* if there is a second argument, it must be a solvent */
String solvent ="Unreported";
if((args.length == 2 || args.length == 3)) {
solvent = args[1];
if(!"Chloroform-D1 (CDCl3)Methanol-D4 (CD3OD)Dimethylsulphoxide-D6 (DMSO-D6, C2D6SO)".contains(solvent)) {
System.out.println("solvent must be \"Chloroform-D1 (CDCl3)\", \"Methanol-D4 (CD3OD)\", or \"Dimethylsulphoxide-D6 (DMSO-D6, C2D6SO)\" (with quotation marks)!");
System.exit(1);
}
}
/* if third argument is no3d, we do not use extended hose code generator */
boolean use3d = true;
if(args.length==3 && args[2].equals("no3d"))
use3d=false;
/* get mol file reader (for 1 structure) from file name */
MDLReader mdlreader = new MDLReader(new FileReader(args[0]));
/* get molecule for reader */
IAtomContainer mol = (IAtomContainer)mdlreader.read(DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class));
/* !!! No explicit H in mol !!! */
/* add explicit H atoms */
AtomUtils.addAndPlaceHydrogens(mol);
/* detect aromaticity */
CDKHueckelAromaticityDetector.detectAromaticity(mol);
/* current atom and current result */
float[] result;
IAtom curAtom;
/* get predictor */
PredictionTool predictor = new PredictionTool();
/* write header */
System.out.println(" C min. mean max.");
System.out.println(" ---------------------------");
/* loop over atoms in mol */
for(int i = 0 ; i < mol.getAtomCount() ; i++){
curAtom = mol.getAtom(i);
if(curAtom.getAtomicNumber() == 6) {
/* only for C atoms */
result = predictor.predict(mol, curAtom, use3d, solvent);
/* show result */
System.out.format(Locale.US, "%3d:%8.2f%8.2f%8.2f\n", i+1, result[0], result[1], result[2]);
}
}
java.lang.System.exit(0);
}
}