org.openscience.nmrshiftdb.om
Class DBSpectrum

java.lang.Object
  extended by org.apache.torque.om.BaseObject
      extended by org.openscience.nmrshiftdb.om.BaseDBSpectrum
          extended by org.openscience.nmrshiftdb.om.DBSpectrum
All Implemented Interfaces:
java.io.Serializable, org.apache.torque.om.Persistent

public class DBSpectrum
extends BaseDBSpectrum
implements org.apache.torque.om.Persistent

You should add additional methods to this class to meet the application requirements. This class will only be generated as long as it does not already exist in the output directory.

Author:
shk3
See Also:
Serialized Form

Field Summary
(package private)  java.text.DecimalFormat format
           
(package private)  int intensities
           
(package private)  java.util.List keywordsVector
           
(package private)  java.util.List literaturesNew
           
(package private)  java.util.List measurementConditions
           
(package private)  java.util.Vector options
           
(package private)  int otherspectrastringsize
           
 boolean predict
           
 org.apache.turbine.util.RunData runData
          Description of the Field
(package private)  java.util.Map<java.lang.Float,java.lang.Float> searchSignalMap
           
(package private) static long serialVersionUID
           
(package private)  double similarity
           
(package private)  java.lang.StringBuffer unusedtext
           
 
Fields inherited from class org.openscience.nmrshiftdb.om.BaseDBSpectrum
collDBCouplings, collDBRawFileDBSpectrums, collDBSignals, collDBSpectrumDBConditions, collDBSpectrumDBKeywords, collDBSpectrumDBLiteratures, collDBSpectrumHyperlinks, collDBUserDBSpectrumEdits, collDBUserDBSpectrumMarks, collDBUserDBSpectrums
 
Fields inherited from class org.apache.torque.om.BaseObject
NEW_ID
 
Constructor Summary
DBSpectrum()
           
 
Method Summary
 void addMark(int mark, org.apache.turbine.om.security.User user, java.lang.String comment)
          Adds a mark to this DBSpectrum.
 void delete(java.sql.Connection dbconn, boolean doMolecule)
          Deletes this spectrum plus all associated rows.
 java.util.Date getAsssignedDate()
          Gets the Date the last assignment of the DBSpectrum object took place
 nu.xom.Element getCmlSpect()
          Gets this spectrum as cmlSpect.
 java.lang.String getCommentAsString()
          Gets the comment attribute of the DBSpectrum object
 java.lang.String getConditionType()
          Gets the condition type of this DBSpectrum object
 org.apache.jetspeed.om.security.turbine.TurbineUser getContributor()
          Gets the contributor of this DBSpectrum object
 DBSpectrum getCurrentSpectrum()
          Gives you the current spectrum of the edit chain of this spectrum.
 int getDisplaymark()
          Returns the mark necessary for a spectrum to be displayed
 java.lang.String getEmailOfAsssignedReviewer()
          Gets the email of the last reviewer the DBSpectrum object was assigned to
 java.lang.String getFrequency()
           
 java.lang.String getKeywords()
          Gets the keywords attribute of the DBSpectrum object.
 java.lang.String getKeywords(boolean separatedByNewline)
          Gets the keywords attribute of the DBSpectrum object.
 java.util.List getLinks()
          Gets the links of the DBSpectrum object
 java.lang.String getLinksAsString()
          Gets the links of the DBSpectrum object as a string
 java.util.List getLiteraturesNew()
          Gets the DBLiterature objects of the DBSpectrum object
 int getMark()
          Gets the mark of the DBSpectrum object
 java.lang.String getMarkComment()
          Gets the Comments for marks of the DBSpectrum object.
private  int getMdlNumberPlus1(DBAtom atom, DBAtom[] atoms)
          Gets the mdl number of an atom, similar to getMdlNumberPlus1 in DBAtom, but much faster for repeated calls
 SubmittingData getMeAsSubmittingData(boolean useUser, java.lang.String path, boolean no3d)
          This makes a submittingData object populated with the values from this spectrum and its molecule.
 java.util.List getMeasurementConditions()
          Gets the Conditions of this DBSpectrum object
 java.util.List getMeasurementConditions(java.sql.Connection dbconn)
          Gets the Conditions of this DBSpectrum object
 java.lang.String getMeasurementConditionValueWithName(java.lang.String name)
           
 DBCondition getMeasurementConditionWithName(java.lang.String name)
          Gets the value of a certain condition of this DBSpectrum object
 DBCondition getMeasurementConditionWithName(java.lang.String name, java.sql.Connection dbconn)
          Gets the value of a certain condition of this DBSpectrum object
 java.lang.String getNameOfAsssignedReviewer()
          Gets the name of the last reviwer the DBSpectrum object was assigned to
 java.util.Vector getOptions()
          Gets the shifts table for this spectrum.
 java.lang.String getOtherSpectraString(int atomNumber)
           
 java.lang.String getOtherSpectraStringHeader()
           
 int getOtherSpectraStringSize()
           
 java.util.List getReviewAssignments()
          Gets the DBUserDBSpectrum objects related with this spectrum
private  float[] getShifts(int atomNumber)
          Gets the shifts of a certain atom in this spectrum.
private  float[] getShifts(int atomNumber, DBMolecule mol)
          Gets the shifts of a certain atom in this spectrum.
private  java.util.List getSignals(int atomNumber)
          Gets the shifts of a certain atom in this spectrum.
private  java.util.List getSignals(int atomNumber, DBMolecule mol)
          Gets the shifts of a certain atom in this spectrum.
 double getSimilarity()
          Returns the similarity in percent between this spectrum and another spectrum, set by initSimilarity
 double getSimilarityFormatted()
          Returns the similarity with two digits after .
 java.lang.String getSpecfile()
          Get the Specfile
 java.lang.String getSpecfileOld()
           
 java.lang.String getSpectrumForApplet()
          Gets the specFile attribute of the DBSpectrum object as a string
 java.lang.String getSpectrumForAppletNewFormat()
          Gets the spectrum in the format needed for the new spectrumapplet (R 1.0).
 java.lang.String getSpectrumForAppletNewFormat(DBAtom[] atoms, org.openscience.cdk.interfaces.IMolecule cdkmol)
          Gets the spectrum in the format needed for the new spectrumapplet (R 1.0).
 java.lang.String getSpectrumForAppletWithMultis()
           
 java.lang.String getSpectrumTypeName()
          Gets the spectrumType name of the DBSpectrum object
 java.lang.String getUnassignedText()
          Gives a string with the unassigned shifts in this spectrum, "" if none.
 java.lang.String getUnusedText()
          Returns a text telling unsed spectra.
 boolean hasAnyIdentifier()
          Tells if there is any atom identifier for this spectrum.
 boolean hasAnyIntensities()
          Tells if any signal in this spectrum has an intensity != 0.
 java.util.Map initSimilarity(java.util.List otherSignalsL, boolean isSubSpectrum)
          Sets the similarity between this and another spectrum
 boolean isSimilarityNot0()
          Tells if the similarity of this spectrum is zero or not
 
Methods inherited from class org.openscience.nmrshiftdb.om.BaseDBSpectrum
addDBCoupling, addDBRawFileDBSpectrum, addDBSignal, addDBSpectrumDBCondition, addDBSpectrumDBKeyword, addDBSpectrumDBLiterature, addDBSpectrumHyperlink, addDBUserDBSpectrum, addDBUserDBSpectrumEdit, addDBUserDBSpectrumMark, copy, copyInto, getByName, getByPeerName, getByPosition, getComment, getCommentSoundex, getDate, getDBCouplings, getDBCouplings, getDBCouplings, getDBCouplings, getDBCouplingsJoinDBAtomRelatedByAtomId1, getDBCouplingsJoinDBAtomRelatedByAtomId2, getDBCouplingsJoinDBSpectrum, getDBMolecule, getDBRawFileDBSpectrums, getDBRawFileDBSpectrums, getDBRawFileDBSpectrums, getDBRawFileDBSpectrums, getDBRawFileDBSpectrumsJoinDBRawFile, getDBRawFileDBSpectrumsJoinDBSpectrum, getDBSignals, getDBSignals, getDBSignals, getDBSignals, getDBSignalsJoinDBSpectrum, getDBSpectrumDBConditions, getDBSpectrumDBConditions, getDBSpectrumDBConditions, getDBSpectrumDBConditions, getDBSpectrumDBConditionsJoinDBCondition, getDBSpectrumDBConditionsJoinDBSpectrum, getDBSpectrumDBKeywords, getDBSpectrumDBKeywords, getDBSpectrumDBKeywords, getDBSpectrumDBKeywords, getDBSpectrumDBKeywordsJoinDBKeyword, getDBSpectrumDBKeywordsJoinDBSpectrum, getDBSpectrumDBLiteratures, getDBSpectrumDBLiteratures, getDBSpectrumDBLiteratures, getDBSpectrumDBLiteratures, getDBSpectrumDBLiteraturesJoinDBLiterature, getDBSpectrumDBLiteraturesJoinDBSpectrum, getDBSpectrumHyperlinks, getDBSpectrumHyperlinks, getDBSpectrumHyperlinks, getDBSpectrumHyperlinks, getDBSpectrumHyperlinksJoinDBSpectrum, getDBSpectrumType, getDBUserDBSpectrumEdits, getDBUserDBSpectrumEdits, getDBUserDBSpectrumEdits, getDBUserDBSpectrumEdits, getDBUserDBSpectrumEditsJoinDBSpectrum, getDBUserDBSpectrumEditsJoinNmrshiftdbUser, getDBUserDBSpectrumMarks, getDBUserDBSpectrumMarks, getDBUserDBSpectrumMarks, getDBUserDBSpectrumMarks, getDBUserDBSpectrumMarksJoinDBSpectrum, getDBUserDBSpectrumMarksJoinNmrshiftdbUser, getDBUserDBSpectrums, getDBUserDBSpectrums, getDBUserDBSpectrums, getDBUserDBSpectrums, getDBUserDBSpectrumsJoinDBSpectrum, getDBUserDBSpectrumsJoinNmrshiftdbUser, getFieldNames, getFingerprint, getLiterature, getLiteratureSoundex, getMoleculeId, getNmrshiftdbUser, getPeer, getPrimaryKey, getReviewFlag, getReviewKey, getSimpleSpecfile, getSpectrumId, getSpectrumTypeId, getUserId, initDBCouplings, initDBRawFileDBSpectrums, initDBSignals, initDBSpectrumDBConditions, initDBSpectrumDBKeywords, initDBSpectrumDBLiteratures, initDBSpectrumHyperlinks, initDBUserDBSpectrumEdits, initDBUserDBSpectrumMarks, initDBUserDBSpectrums, save, save, save, setComment, setCommentSoundex, setDate, setDBMolecule, setDBMoleculeKey, setDBSpectrumType, setDBSpectrumTypeKey, setFingerprint, setLiterature, setLiteratureSoundex, setMoleculeId, setNmrshiftdbUser, setNmrshiftdbUserKey, setPrimaryKey, setPrimaryKey, setReviewFlag, setReviewKey, setSimpleSpecfile, setSpecfile, setSpectrumId, setSpectrumTypeId, setUserId, toString
 
Methods inherited from class org.apache.torque.om.BaseObject
equals, equals, getLog, hashCode, isModified, isNew, log, resetModified, setModified, setNew, setPrimaryKey
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.torque.om.Persistent
getPrimaryKey, isModified, isNew, save, save, save, setModified, setNew, setPrimaryKey, setPrimaryKey
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

runData

public org.apache.turbine.util.RunData runData
Description of the Field


predict

public boolean predict

measurementConditions

java.util.List measurementConditions

similarity

double similarity

searchSignalMap

java.util.Map<java.lang.Float,java.lang.Float> searchSignalMap

intensities

int intensities

options

java.util.Vector options

unusedtext

java.lang.StringBuffer unusedtext

format

java.text.DecimalFormat format

literaturesNew

java.util.List literaturesNew

keywordsVector

java.util.List keywordsVector

otherspectrastringsize

int otherspectrastringsize
Constructor Detail

DBSpectrum

public DBSpectrum()
Method Detail

getSpecfileOld

public java.lang.String getSpecfileOld()

getSpecfile

public java.lang.String getSpecfile()
Description copied from class: BaseDBSpectrum
Get the Specfile

Overrides:
getSpecfile in class BaseDBSpectrum
Returns:
String

getConditionType

public java.lang.String getConditionType()
                                  throws java.lang.Exception
Gets the condition type of this DBSpectrum object

Returns:
The conditionType, "m"=measured spectrum, "c"=calculatedSpectrum
Throws:
java.lang.Exception - Description of Exception

getLinks

public java.util.List getLinks()
                        throws java.lang.Exception
Gets the links of the DBSpectrum object

Returns:
The links
Throws:
java.lang.Exception - Database problems

getSimilarity

public double getSimilarity()
Returns the similarity in percent between this spectrum and another spectrum, set by initSimilarity

Returns:
A double from 0 to 100

isSimilarityNot0

public boolean isSimilarityNot0()
Tells if the similarity of this spectrum is zero or not

Returns:
The similarityNot0 value

getSimilarityFormatted

public double getSimilarityFormatted()
Returns the similarity with two digits after .

Returns:
A double from 0 to 100

getOptions

public java.util.Vector getOptions()
                            throws java.lang.Exception
Gets the shifts table for this spectrum. This is a vector of ValuesForVelocityBean objects. In case the runData object is set a prediction is done.

Returns:
The shifts table.
Throws:
java.lang.Exception - Database problems.

getMdlNumberPlus1

private int getMdlNumberPlus1(DBAtom atom,
                              DBAtom[] atoms)
                       throws NmrshiftdbException
Gets the mdl number of an atom, similar to getMdlNumberPlus1 in DBAtom, but much faster for repeated calls

Parameters:
atom - The atom to ask for
atoms - All atoms of this molecule, as you get them with DBMolecule.getAtomsAsArrayInMDLOrder
Returns:
The mdl number
Throws:
NmrshiftdbException - No such atom in atoms. This means the atoms passed where from another molecule than the atom.

getMeasurementConditions

public java.util.List getMeasurementConditions()
                                        throws java.lang.Exception
Gets the Conditions of this DBSpectrum object

Returns:
A vector of DBConditions
Throws:
java.lang.Exception - Description of Exception

getMeasurementConditions

public java.util.List getMeasurementConditions(java.sql.Connection dbconn)
                                        throws java.lang.Exception
Gets the Conditions of this DBSpectrum object

Returns:
A vector of DBConditions
Throws:
java.lang.Exception - Description of Exception

getMeasurementConditionWithName

public DBCondition getMeasurementConditionWithName(java.lang.String name)
                                            throws java.lang.Exception
Gets the value of a certain condition of this DBSpectrum object

Parameters:
name - The name of the conditon to tell.
Returns:
The value.
Throws:
java.lang.Exception - Description of Exception.

getFrequency

public java.lang.String getFrequency()
                              throws java.lang.Exception
Throws:
java.lang.Exception

getMeasurementConditionWithName

public DBCondition getMeasurementConditionWithName(java.lang.String name,
                                                   java.sql.Connection dbconn)
                                            throws java.lang.Exception
Gets the value of a certain condition of this DBSpectrum object

Parameters:
name - The name of the conditon to tell.
Returns:
The value.
Throws:
java.lang.Exception - Description of Exception.

getMeasurementConditionValueWithName

public java.lang.String getMeasurementConditionValueWithName(java.lang.String name)
                                                      throws java.lang.Exception
Throws:
java.lang.Exception

getSpectrumForApplet

public java.lang.String getSpectrumForApplet()
Gets the specFile attribute of the DBSpectrum object as a string

Returns:
The specFile value

getContributor

public org.apache.jetspeed.om.security.turbine.TurbineUser getContributor()
                                                                   throws java.lang.Exception
Gets the contributor of this DBSpectrum object

Returns:
The contributor value
Throws:
java.lang.Exception - Something went wrong with reading the database

getSpectrumForAppletWithMultis

public java.lang.String getSpectrumForAppletWithMultis()
                                                throws java.lang.Exception
Throws:
java.lang.Exception

getSpectrumTypeName

public java.lang.String getSpectrumTypeName()
                                     throws java.lang.Exception
Gets the spectrumType name of the DBSpectrum object

Returns:
The spectrumType name value
Throws:
java.lang.Exception - Problems with reading database

getReviewAssignments

public java.util.List getReviewAssignments()
                                    throws java.lang.Exception
Gets the DBUserDBSpectrum objects related with this spectrum

Returns:
The reviewAssignments, vector of DBUserDBSpectrum obejects
Throws:
java.lang.Exception - Database problems

getNameOfAsssignedReviewer

public java.lang.String getNameOfAsssignedReviewer()
                                            throws java.lang.Exception
Gets the name of the last reviwer the DBSpectrum object was assigned to

Returns:
The name
Throws:
java.lang.Exception - Database problems

getEmailOfAsssignedReviewer

public java.lang.String getEmailOfAsssignedReviewer()
                                             throws java.lang.Exception
Gets the email of the last reviewer the DBSpectrum object was assigned to

Returns:
The email
Throws:
java.lang.Exception - Database problems

getAsssignedDate

public java.util.Date getAsssignedDate()
                                throws java.lang.Exception
Gets the Date the last assignment of the DBSpectrum object took place

Returns:
The asssignment Date value
Throws:
java.lang.Exception - Database problems

getCommentAsString

public java.lang.String getCommentAsString()
Gets the comment attribute of the DBSpectrum object

Returns:
The comment value

getLinksAsString

public java.lang.String getLinksAsString()
                                  throws java.lang.Exception
Gets the links of the DBSpectrum object as a string

Returns:
The links value
Throws:
java.lang.Exception - Description of Exception

getLiteraturesNew

public java.util.List getLiteraturesNew()
                                 throws java.lang.Exception
Gets the DBLiterature objects of the DBSpectrum object

Returns:
The literature value
Throws:
java.lang.Exception - Description of Exception

getKeywords

public java.lang.String getKeywords()
                             throws java.lang.Exception
Gets the keywords attribute of the DBSpectrum object.

Returns:
The keywords value.
Throws:
java.lang.Exception - Database problems.

getKeywords

public java.lang.String getKeywords(boolean separatedByNewline)
                             throws java.lang.Exception
Gets the keywords attribute of the DBSpectrum object.

Parameters:
separatedByNewline - If true keywords are separated by \n else by ,.
Returns:
The keywords value.
Throws:
java.lang.Exception - Database problems.

getMeAsSubmittingData

public SubmittingData getMeAsSubmittingData(boolean useUser,
                                            java.lang.String path,
                                            boolean no3d)
                                     throws java.lang.Exception
This makes a submittingData object populated with the values from this spectrum and its molecule.

Parameters:
useUser - Description of Parameter
path - Description of Parameter
Returns:
The SubmittingData object.
Throws:
java.lang.Exception - Database problems.

getMark

public int getMark()
            throws java.lang.Exception
Gets the mark of the DBSpectrum object

Returns:
The mark value
Throws:
java.lang.Exception - Description of Exception

getMarkComment

public java.lang.String getMarkComment()
                                throws java.lang.Exception
Gets the Comments for marks of the DBSpectrum object.

Returns:
The comment value.
Throws:
java.lang.Exception - Database problems.

getDisplaymark

public int getDisplaymark()
                   throws java.io.FileNotFoundException,
                          java.io.IOException
Returns the mark necessary for a spectrum to be displayed

Returns:
The displaymark value
Throws:
java.io.FileNotFoundException - Description of Exception
java.io.IOException - Description of Exception

getCmlSpect

public nu.xom.Element getCmlSpect()
                           throws org.xmlcml.cml.base.CMLException,
                                  org.apache.torque.TorqueException
Gets this spectrum as cmlSpect.

Returns:
The cmlSpect value.
Throws:
java.lang.Exception - Database problems
org.xmlcml.cml.base.CMLException - xml problems.
org.apache.torque.TorqueException - Something wrong with database reading.

getUnusedText

public java.lang.String getUnusedText()
Returns a text telling unsed spectra. Initialized by initSimilarity().

Returns:
The unusedText value.

hasAnyIntensities

public boolean hasAnyIntensities()
                          throws java.lang.Exception
Tells if any signal in this spectrum has an intensity != 0.

Returns:
True=yes, false=no.
Throws:
java.lang.Exception - Database problems.

initSimilarity

public java.util.Map initSimilarity(java.util.List otherSignalsL,
                                    boolean isSubSpectrum)
Sets the similarity between this and another spectrum

Parameters:
isSubSpectrum - Is this a subspectrum search ?
otherSignalsL - Description of Parameter
Returns:
Description of the Returned Value

hasAnyIdentifier

public boolean hasAnyIdentifier()
                         throws java.lang.Exception
Tells if there is any atom identifier for this spectrum.

Returns:
True=yes, false=no.
Throws:
java.lang.Exception - Database problems.

addMark

public void addMark(int mark,
                    org.apache.turbine.om.security.User user,
                    java.lang.String comment)
             throws java.lang.Exception
Adds a mark to this DBSpectrum.

Parameters:
mark - The mark.
user - The user marking.
comment - The feature to be added to the Mark attribute
Throws:
java.lang.Exception - Database problems.

delete

public void delete(java.sql.Connection dbconn,
                   boolean doMolecule)
            throws java.lang.Exception
Deletes this spectrum plus all associated rows.

Parameters:
dbconn - The connection to use.
Throws:
java.lang.Exception - Database problems.

getShifts

private float[] getShifts(int atomNumber,
                          DBMolecule mol)
                   throws java.lang.Exception
Gets the shifts of a certain atom in this spectrum.

Parameters:
atomNumber - The mdl number of the atom to look for.
Returns:
The shifts value.
Throws:
java.lang.Exception - Database problems.

getShifts

private float[] getShifts(int atomNumber)
                   throws java.lang.Exception
Gets the shifts of a certain atom in this spectrum.

Parameters:
atomNumber - The mdl number of the atom to look for.
Returns:
The shifts value.
Throws:
java.lang.Exception - Database problems.

getSignals

private java.util.List getSignals(int atomNumber,
                                  DBMolecule mol)
                           throws java.lang.Exception
Gets the shifts of a certain atom in this spectrum.

Parameters:
atomNumber - The mdl number of the atom to look for.
Returns:
The shifts value.
Throws:
java.lang.Exception - Database problems.

getSignals

private java.util.List getSignals(int atomNumber)
                           throws java.lang.Exception
Gets the shifts of a certain atom in this spectrum.

Parameters:
atomNumber - The mdl number of the atom to look for.
Returns:
The shifts value.
Throws:
java.lang.Exception - Database problems.

getSpectrumForAppletNewFormat

public java.lang.String getSpectrumForAppletNewFormat()
                                               throws java.lang.Exception
Gets the spectrum in the format needed for the new spectrumapplet (R 1.0). Assignments are to heavy atoms in H spectra.

Returns:
The shifts value.
Throws:
java.lang.Exception - Database problems.

getSpectrumForAppletNewFormat

public java.lang.String getSpectrumForAppletNewFormat(DBAtom[] atoms,
                                                      org.openscience.cdk.interfaces.IMolecule cdkmol)
                                               throws java.lang.Exception
Gets the spectrum in the format needed for the new spectrumapplet (R 1.0). Assignments are to heavy atoms in H spectra.

Returns:
The shifts value.
Throws:
java.lang.Exception - Database problems.

getOtherSpectraStringHeader

public java.lang.String getOtherSpectraStringHeader()
                                             throws java.lang.Exception
Throws:
java.lang.Exception

getOtherSpectraString

public java.lang.String getOtherSpectraString(int atomNumber)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

getOtherSpectraStringSize

public int getOtherSpectraStringSize()
                              throws java.lang.Exception
Throws:
java.lang.Exception

getUnassignedText

public java.lang.String getUnassignedText()
                                   throws org.apache.torque.TorqueException
Gives a string with the unassigned shifts in this spectrum, "" if none.

Returns:
The string
Throws:
org.apache.torque.TorqueException - Probably a database problem

getCurrentSpectrum

public DBSpectrum getCurrentSpectrum()
                              throws org.apache.torque.NoRowsException,
                                     org.apache.torque.TooManyRowsException,
                                     org.apache.torque.TorqueException
Gives you the current spectrum of the edit chain of this spectrum. If this spectrum has not been edited, this spectrum will be returned.

Returns:
The current instance of this spectrum.
Throws:
org.apache.torque.NoRowsException
org.apache.torque.TooManyRowsException
org.apache.torque.TorqueException