Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Private Member Functions | Private Attributes

DBAdapter Class Reference
[Database IO]

A class for accessing and storing data in a SQL database. More...

#include <OpenMS/FORMAT/DB/DBAdapter.h>

List of all members.

Public Member Functions

 DBAdapter (DBConnection &db_con)
 Constructor.
 ~DBAdapter ()
 Destructor.
template<class ExperimentType >
void storeExperiment (ExperimentType &exp)
 Stores a MSExperiment.
template<class ExperimentType >
void loadExperiment (UID id, ExperimentType &exp)
 Reads a MSExperiment.
template<class SpectrumType >
void loadSpectrum (UID id, SpectrumType &spec)
 Reads a MSSpectrum.
PeakFileOptionsgetOptions ()
 Mutable access to the options for loading/storing.
const PeakFileOptionsgetOptions () const
 Non-mutable access to the options for loading/storing.
bool checkDBVersion (bool warning)
 Returns true if the DB is up-to-date (Checks the version in ADMIN_Version table).
void createDB ()
 Deletes all tables in the database and creates a new OpenMS database.

Private Member Functions

 DBAdapter ()
 Not implemented.
UID storeMetaInfo_ (const String &parent_table, UID parent_id, const MetaInfoInterface &info)
 Stores, updates or deletes MetaInfo data.
UID storeMetaInfo_ (const String &parent_table, UID parent_id, const Peak1D &peak)
 Overload for Peak1D that does nothing.
UID storeMetaInfo_ (const String &parent_table, UID parent_id, const RichPeak1D &peak)
 Overloaded method for RichPeak1D, which is both a MetaInfoInterface and a Peak1D.
UID storeMetaInfo_ (const String &parent_table, UID parent_id, const Precursor &peak)
 Overloaded method for RichPeak1D, which is both a MetaInfoInterface (via CVTermList) and a and a Peak1D.
void loadMetaInfo_ (UID id, MetaInfoInterface &info)
 Loads MetaInfo data from database.
void loadMetaInfo_ (UID id, Peak1D &peak)
 Overloaded method for Peak1D, which does nothing.
void loadMetaInfo_ (UID id, RichPeak1D &peak)
 Overloaded method for RichPeak1D, which is both a MetaInfoInterface and a Peak1D.
void loadMetaInfo_ (UID id, Precursor &peak)
 Overloaded method for Precursor, which is both a MetaInfoInterface (via CVTermList) and a Peak1D.
void deleteMetaInfo_ (const String &parent_table, const String &condition)
 Conditionally deletes MetaInfo data from database.
UID storeFile_ (const String &parent_table, UID parent_id, const SourceFile &file)
 Stores, updates or deletes file information.
void loadFile_ (UID id, SourceFile &file)
 Loads file information.
UID storeSample_ (const Sample &sample, UID exp_id, UID parent_id)
 Stores, updates or deletes sample information.
void loadSample_ (UID id, Sample &sample)
 Loads sample information.

Private Attributes

DBConnectiondb_con_
 Reference to the DB connection handed over in the constructor.
PeakFileOptions options_

Detailed Description

A class for accessing and storing data in a SQL database.

It can be used to create objects from the DB or store them in the DB.

Todo:

Add DataProcessing to MetaInfoDescription (Hiwi, Mathias)

Check if test is really complete (Hiwi, Mathias)

Check that all values are quoted (Hiwi, Mathias)

Implement StringDataArray and IntegerDataArray of spectrum (Hiwi, Mathias)


Constructor & Destructor Documentation

DBAdapter ( DBConnection db_con  ) 

Constructor.

~DBAdapter (  ) 

Destructor.

DBAdapter (  )  [private]

Not implemented.


Member Function Documentation

bool checkDBVersion ( bool  warning  ) 

Returns true if the DB is up-to-date (Checks the version in ADMIN_Version table).

Parameters:
warning if this is set, a warning is issued to stderr if the db is not up-to-date.

Referenced by DBAdapter::loadExperiment(), DBAdapter::loadSpectrum(), and DBAdapter::storeExperiment().

void createDB (  ) 

Deletes all tables in the database and creates a new OpenMS database.

void deleteMetaInfo_ ( const String parent_table,
const String condition 
) [private]

Conditionally deletes MetaInfo data from database.

Referenced by DBAdapter::storeExperiment().

const PeakFileOptions& getOptions (  )  const

Non-mutable access to the options for loading/storing.

PeakFileOptions& getOptions (  ) 

Mutable access to the options for loading/storing.

Referenced by TOPPViewBase::metadataDatabaseDialog().

void loadExperiment ( UID  id,
ExperimentType &  exp 
)

Reads a MSExperiment.

References DBAdapter::checkDBVersion(), DBAdapter::db_con_, DBConnection::executeQuery(), PeakFileOptions::getMetadataOnly(), PeakFileOptions::getMSLevels(), PeakFileOptions::getRTRange(), ProteinIdentification::getSearchParameters(), PeakFileOptions::hasMSLevels(), PeakFileOptions::hasRTRange(), DBAdapter::loadMetaInfo_(), DBAdapter::loadSample_(), DBAdapter::loadSpectrum(), DIntervalBase< D >::maxPosition(), DIntervalBase< D >::minPosition(), DBAdapter::options_, DateTime::set(), ProteinHit::setAccession(), MassAnalyzer::setAccuracy(), IonDetector::setAcquisitionMode(), IonDetector::setADCSamplingFrequency(), ContactPerson::setContactInfo(), ProteinIdentification::setDateTime(), ContactPerson::setEmail(), MassAnalyzer::setFinalMSExponent(), ContactPerson::setFirstName(), ProteinIdentification::setHigherScoreBetter(), ProteinIdentification::setHits(), IonSource::setInletType(), ContactPerson::setInstitution(), IonSource::setIonizationMethod(), MassAnalyzer::setIsolationWidth(), ContactPerson::setLastName(), MassAnalyzer::setMagneticFieldStrength(), Software::setName(), MassAnalyzer::setOrder(), IonSource::setOrder(), IonDetector::setOrder(), IonSource::setPolarity(), ProteinHit::setRank(), MassAnalyzer::setReflectronState(), MassAnalyzer::setResolution(), IonDetector::setResolution(), MassAnalyzer::setResolutionMethod(), MassAnalyzer::setResolutionType(), MassAnalyzer::setScanDirection(), MassAnalyzer::setScanLaw(), MassAnalyzer::setScanRate(), MassAnalyzer::setScanTime(), ProteinHit::setScore(), ProteinIdentification::setScoreType(), ProteinIdentification::setSearchEngine(), ProteinIdentification::setSearchEngineVersion(), ProteinIdentification::setSearchParameters(), ProteinHit::setSequence(), ProteinIdentification::setSignificanceThreshold(), MassAnalyzer::setTOFTotalPathLength(), MassAnalyzer::setType(), IonDetector::setType(), Software::setVersion(), and String::toQString().

Referenced by TOPPViewBase::addDataDB(), and TOPPViewBase::metadataDatabaseDialog().

void loadFile_ ( UID  id,
SourceFile file 
) [private]

Loads file information.

Referenced by DBAdapter::loadSpectrum().

void loadMetaInfo_ ( UID  id,
Precursor peak 
) [private]

Overloaded method for Precursor, which is both a MetaInfoInterface (via CVTermList) and a Peak1D.

void loadMetaInfo_ ( UID  id,
MetaInfoInterface info 
) [private]

Loads MetaInfo data from database.

Referenced by DBAdapter::loadExperiment(), and DBAdapter::loadSpectrum().

void loadMetaInfo_ ( UID  id,
Peak1D peak 
) [private]

Overloaded method for Peak1D, which does nothing.

void loadMetaInfo_ ( UID  id,
RichPeak1D peak 
) [private]

Overloaded method for RichPeak1D, which is both a MetaInfoInterface and a Peak1D.

void loadSample_ ( UID  id,
Sample sample 
) [private]

Loads sample information.

Referenced by DBAdapter::loadExperiment().

void loadSpectrum ( UID  id,
SpectrumType &  spec 
)
void storeExperiment ( ExperimentType &  exp  ) 
UID storeFile_ ( const String parent_table,
UID  parent_id,
const SourceFile file 
) [private]

Stores, updates or deletes file information.

Returns:
the id of the new META_File table row

Referenced by DBAdapter::storeExperiment().

UID storeMetaInfo_ ( const String parent_table,
UID  parent_id,
const Precursor peak 
) [private]

Overloaded method for RichPeak1D, which is both a MetaInfoInterface (via CVTermList) and a and a Peak1D.

UID storeMetaInfo_ ( const String parent_table,
UID  parent_id,
const RichPeak1D peak 
) [private]

Overloaded method for RichPeak1D, which is both a MetaInfoInterface and a Peak1D.

UID storeMetaInfo_ ( const String parent_table,
UID  parent_id,
const MetaInfoInterface info 
) [private]

Stores, updates or deletes MetaInfo data.

Returns:
the id of the new META_MetaInfo table row

Referenced by DBAdapter::storeExperiment().

UID storeMetaInfo_ ( const String parent_table,
UID  parent_id,
const Peak1D peak 
) [private]

Overload for Peak1D that does nothing.

UID storeSample_ ( const Sample sample,
UID  exp_id,
UID  parent_id 
) [private]

Stores, updates or deletes sample information.

Returns:
the id of the new META_Sample table row

Referenced by DBAdapter::storeExperiment().


Member Data Documentation

DBConnection& db_con_ [private]

Reference to the DB connection handed over in the constructor.

Referenced by DBAdapter::loadExperiment(), DBAdapter::loadSpectrum(), and DBAdapter::storeExperiment().


OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:53 using doxygen 1.7.1