org.openscience.nmrshiftdb.util
Class AtomUtils

java.lang.Object
  extended by org.openscience.nmrshiftdb.util.AtomUtils

public class AtomUtils
extends java.lang.Object

Contains some utils for Molecules/Atoms

Author:
shk3

Field Summary
private static org.openscience.cdk.interfaces.IRingSet allrings
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.BondsToAtomDescriptor btades
           
(package private) static int colsnumber
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.EffectiveAtomPolarizabilityDescriptor epdes
           
(package private) static java.lang.Boolean FALSE
           
(package private) static org.openscience.cdk.tools.HOSECodeGenerator hcg
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.IsProtonInAromaticSystemDescriptor ipiasdes
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.IsProtonInConjugatedPiSystemDescriptor ipicpsdes
           
private static java.lang.Integer[] maxparameters
           
private static org.w3c.dom.Document normalizerdoc
           
private static org.openscience.cdk.interfaces.IMolecule oldmol
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.PiElectronegativityDescriptor pedes
           
(package private) static org.openscience.cdk.qsar.descriptors.atompair.PiContactDetectionDescriptor picondes
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.PartialPiChargeDescriptor ppichargedes
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.PartialSigmaChargeDescriptor psigmachargedes
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.PeriodicTablePositionDescriptor ptpdes
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.RDFProtonDescriptor_G3R rdfg3r
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.RDFProtonDescriptor_GDR rdfgdr
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.RDFProtonDescriptor_GHR rdfghr
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.RDFProtonDescriptor_GHR_topol rdfghrtopol
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.RDFProtonDescriptor_GSR rdfgsr
           
(package private) static int rownumber
           
(package private) static java.lang.String rowstext
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.SigmaElectronegativityDescriptor sedes
           
(package private) static org.openscience.cdk.qsar.descriptors.atomic.VdWRadiusDescriptor vdwrdes
           
 
Constructor Summary
private AtomUtils()
          Constructor for the AtomUtils object (private since only static methods)
 
Method Summary
static void addAndPlaceHydrogens(org.openscience.cdk.interfaces.IMolecule container)
          Adds and places hydrogens to a molecule.
static java.util.Map analyzeFuzzyCriteria(java.lang.String criteria, boolean checkElements, boolean checkmultis)
          Analyzes a fuzzy search criteria string.
static boolean checkIfOnlyOneStructure(org.openscience.cdk.interfaces.IMolecule mol)
          This method checks if a cdk molecule object only contains one or multiple structures
private static void doPidescriptors(org.openscience.cdk.interfaces.IAtomContainer ac, org.openscience.cdk.interfaces.IAtom otheronfirstheavy, float[] floats, int startfield)
           
static org.openscience.cdk.interfaces.IRingSet getAllRings()
          Gets the allRings attribute, set with last run of getProtonClass.
static java.math.BigInteger getBigIntegerValue(java.util.BitSet bs, int num)
          Gets a BigIntger value representation of the Fingerprint bitset
static float[] getDescriptorSet(DBCondition temp, DBCondition field, DBCondition solvent, org.openscience.cdk.interfaces.IAtomContainer ac, org.openscience.cdk.interfaces.IAtom a, org.openscience.cdk.interfaces.IRingSet rs, int protonclass)
          Creates a set of Desctiptors taken from Jens Meilers's publications and Aires-do-Sousa..
static float[] getDescriptorSetDoSousa(org.openscience.cdk.interfaces.IAtomContainer ac, org.openscience.cdk.interfaces.IAtom a, org.openscience.cdk.interfaces.IAtom atomInFocus, org.openscience.cdk.interfaces.IRingSet rs, int protonclass)
          Creates a set of Desctiptors taken from Aires-do-Sousa publications.
static int getProtonClass(org.openscience.cdk.interfaces.IMolecule cdkmol, int atomnumber, org.openscience.cdk.interfaces.IRingSet ringSetL)
          Gets the proton Class of a proton according to aires-do-sousa/gasteiger system.
static java.lang.String getValuesForAtom(int atom, java.lang.String specFile)
          Gets the signals assigned to an atom out of the specfile as contained in specfile attribute of Spectrum in the database as a String like 1.2,3.4,...
static java.lang.String getValuesForAtomWithNumber(int atom, java.lang.String specFile, double value, int number)
          Gets the signals assigned to an atom out of the specfile as contained in specfile attribute of Spectrum in the database as a String like 1.2,3.4,...
private static void initminusone(float[] floats)
           
static java.util.ArrayList makeDoubleBondSet(org.openscience.cdk.interfaces.IMolecule mol, java.util.List dbbonds, boolean[] specification)
          Produces a list of double bonds in a molecule.
static boolean normalize(org.openscience.cdk.interfaces.IAtomContainer ac, java.lang.String path)
          Exuecutes cdk normalizer with given xml file
static double[] predictRange(org.openscience.cdk.interfaces.IMolecule mol, org.openscience.cdk.interfaces.IAtom a, boolean calculated, boolean measured, int ignoreSpectrum, 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, boolean trueonly)
          This method predicts the range and the shift of a C atom from the database.
static org.openscience.cdk.interfaces.IMolecule rearangeAtoms(org.openscience.cdk.interfaces.IMolecule mol)
          Sorts atoms like Cs-other heavy atoms-Hs.
private static int setThisAtomAsLinked(org.openscience.cdk.interfaces.IAtom atom, org.openscience.cdk.interfaces.IMolecule mol, int alreadyTouched)
          This method is called from checkIfOnlyOneStructure and counts the number of atoms which can be reached from atom.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rowstext

static java.lang.String rowstext

rownumber

static int rownumber

colsnumber

static int colsnumber

vdwrdes

static org.openscience.cdk.qsar.descriptors.atomic.VdWRadiusDescriptor vdwrdes

sedes

static org.openscience.cdk.qsar.descriptors.atomic.SigmaElectronegativityDescriptor sedes

pedes

static org.openscience.cdk.qsar.descriptors.atomic.PiElectronegativityDescriptor pedes

btades

static org.openscience.cdk.qsar.descriptors.atomic.BondsToAtomDescriptor btades

ptpdes

static org.openscience.cdk.qsar.descriptors.atomic.PeriodicTablePositionDescriptor ptpdes

FALSE

static final java.lang.Boolean FALSE

hcg

static org.openscience.cdk.tools.HOSECodeGenerator hcg

rdfg3r

static org.openscience.cdk.qsar.descriptors.atomic.RDFProtonDescriptor_G3R rdfg3r

rdfgdr

static org.openscience.cdk.qsar.descriptors.atomic.RDFProtonDescriptor_GDR rdfgdr

rdfghr

static org.openscience.cdk.qsar.descriptors.atomic.RDFProtonDescriptor_GHR rdfghr

rdfgsr

static org.openscience.cdk.qsar.descriptors.atomic.RDFProtonDescriptor_GSR rdfgsr

rdfghrtopol

static org.openscience.cdk.qsar.descriptors.atomic.RDFProtonDescriptor_GHR_topol rdfghrtopol

ipicpsdes

static org.openscience.cdk.qsar.descriptors.atomic.IsProtonInConjugatedPiSystemDescriptor ipicpsdes

ipiasdes

static org.openscience.cdk.qsar.descriptors.atomic.IsProtonInAromaticSystemDescriptor ipiasdes

epdes

static org.openscience.cdk.qsar.descriptors.atomic.EffectiveAtomPolarizabilityDescriptor epdes

ppichargedes

static org.openscience.cdk.qsar.descriptors.atomic.PartialPiChargeDescriptor ppichargedes

psigmachargedes

static org.openscience.cdk.qsar.descriptors.atomic.PartialSigmaChargeDescriptor psigmachargedes

picondes

static org.openscience.cdk.qsar.descriptors.atompair.PiContactDetectionDescriptor picondes

normalizerdoc

private static org.w3c.dom.Document normalizerdoc

oldmol

private static org.openscience.cdk.interfaces.IMolecule oldmol

allrings

private static org.openscience.cdk.interfaces.IRingSet allrings

maxparameters

private static java.lang.Integer[] maxparameters
Constructor Detail

AtomUtils

private AtomUtils()
Constructor for the AtomUtils object (private since only static methods)

Method Detail

getValuesForAtom

public static java.lang.String getValuesForAtom(int atom,
                                                java.lang.String specFile)
Gets the signals assigned to an atom out of the specfile as contained in specfile attribute of Spectrum in the database as a String like 1.2,3.4,...

Parameters:
atom - The number of the atom
specFile - The specfile
Returns:
The signals value

getValuesForAtomWithNumber

public static java.lang.String getValuesForAtomWithNumber(int atom,
                                                          java.lang.String specFile,
                                                          double value,
                                                          int number)
Gets the signals assigned to an atom out of the specfile as contained in specfile attribute of Spectrum in the database as a String like 1.2,3.4,... and it adds a text like Hx: to a certain signal

Parameters:
atom - The number of the atom
specFile - The specfile
value - The value a text should be added to
number - This text is added to value in a form like Hnumber:
Returns:
The signals value

getBigIntegerValue

public static java.math.BigInteger getBigIntegerValue(java.util.BitSet bs,
                                                      int num)
Gets a BigIntger value representation of the Fingerprint bitset

Parameters:
bs - Fingerprint bitset
num - A number between 63 and 1023 representing one of the 16 sectors of the Fingerprint
Returns:
The BigInteger representations of the specified Fingerprint sector

getProtonClass

public static int getProtonClass(org.openscience.cdk.interfaces.IMolecule cdkmol,
                                 int atomnumber,
                                 org.openscience.cdk.interfaces.IRingSet ringSetL)
                          throws java.lang.Exception
Gets the proton Class of a proton according to aires-do-sousa/gasteiger system.

Parameters:
cdkmol - The molecule to analyze
atomnumber - The atom to classify
arf - An existing instace of allringsfinder, to save time.
Returns:
The proton class (1-4)
Throws:
java.lang.Exception - Description of Exception

getAllRings

public static org.openscience.cdk.interfaces.IRingSet getAllRings()
Gets the allRings attribute, set with last run of getProtonClass.

Returns:
The allRings value

getDescriptorSetDoSousa

public static float[] getDescriptorSetDoSousa(org.openscience.cdk.interfaces.IAtomContainer ac,
                                              org.openscience.cdk.interfaces.IAtom a,
                                              org.openscience.cdk.interfaces.IAtom atomInFocus,
                                              org.openscience.cdk.interfaces.IRingSet rs,
                                              int protonclass)
                                       throws java.lang.Exception
Creates a set of Desctiptors taken from Aires-do-Sousa publications.

Parameters:
ac - The atom container.
a - The atom for which descriptors should be calculated.
atomInFocusInteger - The number of a as an Integer.
rs - The setOfAllRings of ac.
Returns:
The descriptorvalues.
Throws:
java.lang.Exception - Description of Exception.

doPidescriptors

private static void doPidescriptors(org.openscience.cdk.interfaces.IAtomContainer ac,
                                    org.openscience.cdk.interfaces.IAtom otheronfirstheavy,
                                    float[] floats,
                                    int startfield)
                             throws java.lang.Exception
Throws:
java.lang.Exception

initminusone

private static void initminusone(float[] floats)

getDescriptorSet

public static float[] getDescriptorSet(DBCondition temp,
                                       DBCondition field,
                                       DBCondition solvent,
                                       org.openscience.cdk.interfaces.IAtomContainer ac,
                                       org.openscience.cdk.interfaces.IAtom a,
                                       org.openscience.cdk.interfaces.IRingSet rs,
                                       int protonclass)
                                throws java.lang.Exception
Creates a set of Desctiptors taken from Jens Meilers's publications and Aires-do-Sousa..

Parameters:
temp - The temperature.
field - The field strength.
solvent - The solvent.
ac - The atomContainer.
a - The atom to create descriptors for.
rs - The setOfAllRings of ac
Returns:
The descriptors
Throws:
java.lang.Exception - Description of Exception

normalize

public static boolean normalize(org.openscience.cdk.interfaces.IAtomContainer ac,
                                java.lang.String path)
Exuecutes cdk normalizer with given xml file

Parameters:
ac - The structure to normalize.
path - The file to use.
Returns:
true=changed, false=unchanged.
Throws:
org.openscience.cdk.exception.InvalidSmilesException - Description of Exception
org.xml.sax.SAXException - Description of Exception
java.io.FileNotFoundException - Description of Exception
java.io.IOException - Description of Exception
javax.xml.parsers.ParserConfigurationException - Description of Exception
org.openscience.cdk.exception.CDKException - Description of Exception

checkIfOnlyOneStructure

public static boolean checkIfOnlyOneStructure(org.openscience.cdk.interfaces.IMolecule mol)
This method checks if a cdk molecule object only contains one or multiple structures

Parameters:
mol - The molecule to check
Returns:
true=one structure, false=multiple structures

predictRange

public static double[] predictRange(org.openscience.cdk.interfaces.IMolecule mol,
                                    org.openscience.cdk.interfaces.IAtom a,
                                    boolean calculated,
                                    boolean measured,
                                    int ignoreSpectrum,
                                    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,
                                    boolean trueonly)
                             throws org.openscience.cdk.exception.CDKException,
                                    java.lang.Exception
This method predicts the range and the shift of a C atom from the database.

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 (null=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.
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.
org.openscience.cdk.exception.CDKException - Description of Exception

makeDoubleBondSet

public static java.util.ArrayList makeDoubleBondSet(org.openscience.cdk.interfaces.IMolecule mol,
                                                    java.util.List dbbonds,
                                                    boolean[] specification)
Produces a list of double bonds in a molecule.

Parameters:
mol - The molecule.
dbbonds - Description of Parameter
specification - Description of Parameter
Returns:
A ArrayList of StringAndInts, each containing the number of a double bond (in StringAndInt.myInt) and a description (in String and Int.myString).

analyzeFuzzyCriteria

public static java.util.Map analyzeFuzzyCriteria(java.lang.String criteria,
                                                 boolean checkElements,
                                                 boolean checkmultis)
                                          throws NmrshiftdbException,
                                                 java.io.IOException,
                                                 java.lang.ClassNotFoundException
Analyzes a fuzzy search criteria string.

Parameters:
criteria - The criteria to analyze.
checkElements - Tells if element name should be checked for validity.
checkmultis - Description of Parameter
Returns:
A map with elements names as keys and an array of two strings as value which are lower and upper limit.
Throws:
NmrshiftdbException - Criteria not correct (see message).
java.io.IOException - From IsotopeFactory.
java.lang.ClassNotFoundException - From IsotopeFactory.

addAndPlaceHydrogens

public static void addAndPlaceHydrogens(org.openscience.cdk.interfaces.IMolecule container)
                                 throws java.io.IOException,
                                        java.lang.ClassNotFoundException,
                                        org.openscience.cdk.exception.CDKException
Adds and places hydrogens to a molecule.

Parameters:
container - The molecule to saturate.
Throws:
java.io.IOException - Description of Exception.
java.lang.ClassNotFoundException - Description of Exception.
org.openscience.cdk.exception.CDKException - Description of Exception

rearangeAtoms

public static org.openscience.cdk.interfaces.IMolecule rearangeAtoms(org.openscience.cdk.interfaces.IMolecule mol)
                                                              throws java.lang.Exception
Sorts atoms like Cs-other heavy atoms-Hs.

Parameters:
mol - The molecule to rearrange.
Returns:
The new molecule as mdl file.
Throws:
java.lang.Exception - Problems writing mdl.

setThisAtomAsLinked

private static int setThisAtomAsLinked(org.openscience.cdk.interfaces.IAtom atom,
                                       org.openscience.cdk.interfaces.IMolecule mol,
                                       int alreadyTouched)
This method is called from checkIfOnlyOneStructure and counts the number of atoms which can be reached from atom.

Parameters:
atom - The atom to start from.
mol - The molecule the atom is contained in.
alreadyTouched - The number of already touched atoms, an integer==0 for the first call.
Returns:
The number of atoms to reach from atom.