org.openscience.nmrshiftdb
Class PredictionTool
java.lang.Object
org.openscience.nmrshiftdb.PredictionTool
public class PredictionTool
- extends java.lang.Object
This class offers a stand-alone prediction based on HOSE codes from NMRShiftDB. Apart from this class, you need a data dump.
You can get a jar containing class and dump from any nmrshiftdb server with a URL like http://servername/download/NmrshiftdbServlet/predictor.jar?nmrshiftdbaction=predictor.
For an example how to use this class, see the main method. For running this class you need the following additional jars: cdk-core.jar, cdk-extra.jar, JNL.jar.
Since the HOSE code table is kept in memory, this class needs a lot of memory depending on the size of the database. We recommand to run the JVM with at least 128 MB memory.
Also always set all references to this class to null if you no longer need it in order to have it removed by garbage collection.
- Author:
- shk3
Constructor Summary |
PredictionTool()
Constructor for the PredictionTool object |
Method Summary |
static double[] |
generalPredict(org.openscience.cdk.interfaces.IAtomContainer mol,
org.openscience.cdk.interfaces.IAtom a,
boolean calculated,
boolean measured,
int ignoreSpectrum,
int ignoreSpectrumEnd,
java.lang.StringBuffer comment,
boolean commentWithMinMax,
boolean withRange,
org.apache.turbine.util.RunData runData,
java.util.Map predictionValuesForApplet,
int maxSpheresToUse,
boolean cache,
java.lang.StringBuffer hoseCodeOut,
int spheresMax,
boolean fromDB,
boolean trueonly)
This method does a prediction, either from the database or from the mapsmap initialized in the constructor. |
static void |
main(java.lang.String[] args)
The main program for the PredictionTool class. |
double[] |
predict(org.openscience.cdk.interfaces.IMolecule mol,
org.openscience.cdk.interfaces.IAtom atom)
Does a prediction. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
confidencelimits
private static double[] confidencelimits
mapsmap
private static java.util.HashMap mapsmap
PredictionTool
public PredictionTool()
throws java.io.IOException
- Constructor for the PredictionTool object
- Throws:
java.io.IOException
- Problems reading the HOSE code file.
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- The main program for the PredictionTool class.
- Parameters:
args
- The file name of the test mdl file.
- Throws:
java.lang.Exception
- Description of Exception.
generalPredict
public static double[] generalPredict(org.openscience.cdk.interfaces.IAtomContainer mol,
org.openscience.cdk.interfaces.IAtom a,
boolean calculated,
boolean measured,
int ignoreSpectrum,
int ignoreSpectrumEnd,
java.lang.StringBuffer comment,
boolean commentWithMinMax,
boolean withRange,
org.apache.turbine.util.RunData runData,
java.util.Map predictionValuesForApplet,
int maxSpheresToUse,
boolean cache,
java.lang.StringBuffer hoseCodeOut,
int spheresMax,
boolean fromDB,
boolean trueonly)
throws java.lang.Exception
- This method does a prediction, either from the database or from the mapsmap initialized in the constructor. This should not be used directly when using the stand-alone predictor; use predict() then.
- Parameters:
comment
- Contains additional text after processing predictRange().mol
- The molecule the atoms comes from.a
- The atom the shift of which to be predicted.commentWithMinMax
- Shall min/max values be included in comments.ignoreSpectrum
- A molecule to be ignored in the prediction (-1=none).withRange
- Is the range to be calculated as well ? (use only when needed for performance reasons).calculated
- Use calculated spectra.measured
- Use measured spectra.runData
- The current runData object.predictionValuesForApplet
- Will become the String to diplay the histogram in the applet, null if not wished.maxSpheresToUse
- Restrict number of spheres to use, to use max spheres set -1.cache
- true=Use HOSE_CODES table, false=do join query.hoseCodeOut
- Contains the used HOSE_CODE.spheresMax
- Default maximum spheres to use.fromDB
- Do prediction from db or mapsmap?trueonly
- Use only spectra review as true
- Returns:
- An array of doubles. Meaning: 0=lower limit, 1=mean, 2=upper limit calculated via confidence limits, 3=median, 4=used spheres, 5=number of values, 6=standard deviation, 7=min value, 8=max value.
- Throws:
java.lang.Exception
- Database problems.
predict
public double[] predict(org.openscience.cdk.interfaces.IMolecule mol,
org.openscience.cdk.interfaces.IAtom atom)
throws java.lang.Exception
- Does a prediction.
- Parameters:
mol
- The molecule.atom
- The atom for which to predict. Typ of spectrum corresponds to element of this atom.
- Returns:
- An array of doubles. Meaning: 0=lower limit, 1=mean, 2=upper limit calculated via confidence limits, 3=median, 4=used spheres, 5=number of values, 6=standard deviation, 7=min value, 8=max value
- Throws:
java.lang.Exception
- Description of Exception