Hi Jean-Marc,
sorry for late reply. I had a look at this and indeed over time the number of
libraries needed to run the predictor has manifolded due to changes in cdk
and NMRShiftDB. If you download the predictor jar from
http://nmrshiftdb2.svn.sourceforge.net/viewvc/nmrshiftdb2/trunk/snapshots/predictorh.jar?view=log
and run it with a command like this:
/usr/local/jdk1.6.0_02/bin/java -cp
predictorc.jar:../workspace2/nmrshiftdb2/lib/cdk-core.jar:../workspace2/nmrshiftdb2/lib/cdk-data.jar:../workspace2/nmrshiftdb2/lib/cdk-interfaces.jar:../workspace2/nmrshiftdb2/lib/cdk-io.jar:../workspace2/nmrshiftdb2/lib/vecmath1.2-1.14.jar:../workspace2/nmrshiftdb2/lib/JNL.jar:../workspace2/nmrshiftdb2/jetspeed/WEB-INF/lib/torque-3.1.jar:../workspace2/nmrshiftdb2/lib/cdk-standard.jar:.
PredictorTest ../strychnin.mol 1
it should work. Obviously the paths to the jars depend on your system. The
class PredictorTest I used looks like this:
import java.io.FileReader;
import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.Molecule;
import org.openscience.cdk.io.MDLReader;
import org.openscience.nmrshiftdb.PredictionTool;
public class PredictorTest {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
MDLReader mdlreader= new MDLReader(new FileReader(args[0]));
Molecule mol =
(Molecule)mdlreader.read(DefaultChemObjectBuilder.getInstance().newInstance(Molecule.class));
PredictionTool predictor = new PredictionTool();
double[] result= predictor.predict(mol,
mol.getAtom(Integer.parseInt(args[1])));
System.out.println(result[0]+" "+result[1]+" "+result[2]);
}
}
Some remarks:
1) The core of the whole system is the csv file, which contains a list of hose
codes and shift values. The actual prediction class (called PredictionTool)
looks a bit complicated, because it either reads from file or database, but
that can be stripped down to a few lines if only the file reading is
required.
2) The dependencies are needed for HOSE code calculation etc. I am sure they
can be stripped down a bit if needed. The idea was to embed the jar in a
system where cdk and it's dependencies (JNL etc.) would be there anyway. The
torque jar is really from NMRShiftDB and it's not really needed for the
prediciton, this could for example go if the class is rewritten to provide a
smallest possible autonomous predictor.
3) Make sure your molecule has no explicit Hs and all implicit Hs set and
aromaticity detected (this can all be done by cdk). If this is not the case,
you do not get an error, but no values, since HOSE code generator generated
from whatever is in the atom, and it will e. g. include "H" for explicit Hs,
then the HOSE code will never be found in the list, which has been generated
without explicit Hs.
I hope this helps. If there are any questions, please feel free to contact
me - it depends on what you want to do what I can do for you.
Greetings,
Stefan
On Saturday 11 February 2012 17:59:55 [email protected] wrote:
> -----Ursprüngliche Nachricht-----
> Gesendet: Saturday, 11 February 2012 um 14:41:02 Uhr
> Von: "JEAN-MARC NUZILLARD" <[email protected]>
> An: [email protected]
> Betreff: 13C-NMR Predictor, again
> Dear CDK users,
>
> I made some progress in my attempt to run
> the NMRShiftDB-related PredictionTool application.
>
> I downloaded predictorc.jar from
> ftp://ftp.ebi.ac.uk/pub/databases/nmrshiftdb/.
> I extracted the nmrshiftdb.csv file and the org directory.
> I downloaded cdk-1.4.7.jar and torque-3.3.jar
>
> I think I managed to start running the code, but I am stopped at:
>
> jmn@jmn-laptop:~/Predictor$ java -Xmx256m -classpath
> .:cdk-1.4.7.jar:torque-3.3.jar
> org.openscience.nmrshiftdb.PredictionTool myfile.sdf
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/openscience/nmrshiftdb/util/AtomUtils
> at
> org.openscience.nmrshiftdb.PredictionTool.main(PredictionTool.java:84)
> Caused by: java.lang.ClassNotFoundException:
> org.openscience.nmrshiftdb.util.AtomUtils
> at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
> ... 1 more
>
> I have not been able to find a jar file on the web with
> org/openscience/nmrshiftdb/util/AtomUtils inside.
>
> I gave up with cdk-core.jar and cdk-extras.jar as they seemed me to
> be fairly uncomplete.
>
> Best Regards,
>
> Jean-Marc Nuzillard
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user