OpenMS  2.8.0
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
OMSFileStore Class Reference

Helper class for storing .oms files (SQLite format) More...

#include <OpenMS/FORMAT/OMSFileStore.h>

Inheritance diagram for OMSFileStore:
[legend]
Collaboration diagram for OMSFileStore:
[legend]

Public Types

using Key = qint64
 Type used for database keys. More...
 
- Public Types inherited from ProgressLogger
enum  LogType { CMD , GUI , NONE }
 Possible log types. More...
 

Public Member Functions

 OMSFileStore (const String &filename, LogType log_type)
 Constructor. More...
 
 ~OMSFileStore ()
 Destructor. More...
 
void store (const IdentificationData &id_data)
 Write data from an IdentificationData object to database. More...
 
void store (const FeatureMap &features)
 Write data from a FeatureMap object to database. More...
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor. More...
 
virtual ~ProgressLogger ()
 Destructor. More...
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor. More...
 
ProgressLoggeroperator= (const ProgressLogger &other)
 Assignment Operator. More...
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE! More...
 
LogType getLogType () const
 Returns the type of progress log being used. More...
 
void startProgress (SignedSize begin, SignedSize end, const String &label) const
 Initializes the progress display. More...
 
void setProgress (SignedSize value) const
 Sets the current progress. More...
 
void endProgress () const
 Ends the progress display. More...
 
void nextProgress () const
 increment progress by 1 (according to range begin-end) More...
 

Private Member Functions

void storeVersionAndDate_ ()
 
void storeScoreTypes_ (const IdentificationData &id_data)
 
void storeInputFiles_ (const IdentificationData &id_data)
 
void storeProcessingSoftwares_ (const IdentificationData &id_data)
 
void storeDBSearchParams_ (const IdentificationData &id_data)
 
void storeProcessingSteps_ (const IdentificationData &id_data)
 
void storeObservations_ (const IdentificationData &id_data)
 
void storeParentSequences_ (const IdentificationData &id_data)
 
void storeParentGroupSets_ (const IdentificationData &id_data)
 
void storeIdentifiedCompounds_ (const IdentificationData &id_data)
 
void storeIdentifiedSequences_ (const IdentificationData &id_data)
 
void storeAdducts_ (const IdentificationData &id_data)
 
void storeObservationMatches_ (const IdentificationData &id_data)
 
void storeFeatures_ (const FeatureMap &features)
 
void createTable_ (const String &name, const String &definition, bool may_exist=false)
 
void createTableMoleculeType_ ()
 
void createTableDataValue_ ()
 
Key storeDataValue_ (const DataValue &value)
 
void createTableCVTerm_ ()
 
Key storeCVTerm_ (const CVTerm &cv_term)
 
void createTableMetaInfo_ (const String &parent_table, const String &key_column="id")
 
void storeMetaInfo_ (const MetaInfoInterface &info, const String &parent_table, Key parent_id)
 
void createTableAppliedProcessingStep_ (const String &parent_table)
 
void storeAppliedProcessingStep_ (const IdentificationData::AppliedProcessingStep &step, Size step_order, const String &parent_table, Key parent_id)
 
void createTableIdentifiedMolecule_ ()
 
Key getAddress_ (const IdentificationData::IdentifiedMolecule &molecule_var)
 
void createTableParentMatches_ ()
 
void storeParentMatches_ (const IdentificationData::ParentMatches &matches, Key molecule_id)
 
template<class MetaInfoInterfaceContainer >
void storeMetaInfos_ (const MetaInfoInterfaceContainer &container, const String &parent_table)
 
template<class ScoredProcessingResultContainer >
void storeScoredProcessingResults_ (const ScoredProcessingResultContainer &container, const String &parent_table)
 
void storeFeature_ (const FeatureMap &features)
 
void storeFeatureAndSubordinates_ (const Feature &feature, int &feature_id, int parent_id)
 
template<class FeatureContainer , class Predicate >
bool anyFeaturePredicate_ (const FeatureContainer &features, const Predicate &pred)
 check whether a predicate is true for any feature (or subordinate thereof) in a container More...
 
void storeMapMetaData_ (const FeatureMap &features)
 
void storeDataProcessing_ (const FeatureMap &features)
 

Private Attributes

QString db_name_
 
std::map< std::string, QSqlQuery > prepared_queries_
 prepared queries for inserting data into different tables More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from ProgressLogger
static String logTypeToFactoryName_ (LogType type)
 Return the name of the factory product used for this log type. More...
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

Helper class for storing .oms files (SQLite format)

This class encapsulates the SQLite database in a .oms file and allows to write data to it.

Member Typedef Documentation

◆ Key

using Key = qint64

Type used for database keys.

Constructor & Destructor Documentation

◆ OMSFileStore()

OMSFileStore ( const String filename,
LogType  log_type 
)

Constructor.

Deletes the output file if it exists, then creates an SQLite database in its place. Opens the database and configures it for fast writing.

Parameters
filenamePath to the .oms output file (SQLite database)
log_typeType of logging to use
Exceptions
Exception::FailedAPICallDatabase cannot be opened

◆ ~OMSFileStore()

Destructor.

Closes the connection to the database file.

Member Function Documentation

◆ anyFeaturePredicate_()

bool anyFeaturePredicate_ ( const FeatureContainer &  features,
const Predicate &  pred 
)
inlineprivate

check whether a predicate is true for any feature (or subordinate thereof) in a container

◆ createTable_()

void createTable_ ( const String name,
const String definition,
bool  may_exist = false 
)
private

◆ createTableAppliedProcessingStep_()

void createTableAppliedProcessingStep_ ( const String parent_table)
private

◆ createTableCVTerm_()

void createTableCVTerm_ ( )
private

◆ createTableDataValue_()

void createTableDataValue_ ( )
private

◆ createTableIdentifiedMolecule_()

void createTableIdentifiedMolecule_ ( )
private

◆ createTableMetaInfo_()

void createTableMetaInfo_ ( const String parent_table,
const String key_column = "id" 
)
private

◆ createTableMoleculeType_()

void createTableMoleculeType_ ( )
private

◆ createTableParentMatches_()

void createTableParentMatches_ ( )
private

◆ getAddress_()

Key getAddress_ ( const IdentificationData::IdentifiedMolecule molecule_var)
private

◆ store() [1/2]

void store ( const FeatureMap features)

Write data from a FeatureMap object to database.

◆ store() [2/2]

void store ( const IdentificationData id_data)

Write data from an IdentificationData object to database.

◆ storeAdducts_()

void storeAdducts_ ( const IdentificationData id_data)
private

◆ storeAppliedProcessingStep_()

void storeAppliedProcessingStep_ ( const IdentificationData::AppliedProcessingStep step,
Size  step_order,
const String parent_table,
Key  parent_id 
)
private

◆ storeCVTerm_()

Key storeCVTerm_ ( const CVTerm cv_term)
private

◆ storeDataProcessing_()

void storeDataProcessing_ ( const FeatureMap features)
private

◆ storeDataValue_()

Key storeDataValue_ ( const DataValue value)
private

◆ storeDBSearchParams_()

void storeDBSearchParams_ ( const IdentificationData id_data)
private

◆ storeFeature_()

void storeFeature_ ( const FeatureMap features)
private

◆ storeFeatureAndSubordinates_()

void storeFeatureAndSubordinates_ ( const Feature feature,
int &  feature_id,
int  parent_id 
)
private

◆ storeFeatures_()

void storeFeatures_ ( const FeatureMap features)
private

◆ storeIdentifiedCompounds_()

void storeIdentifiedCompounds_ ( const IdentificationData id_data)
private

◆ storeIdentifiedSequences_()

void storeIdentifiedSequences_ ( const IdentificationData id_data)
private

◆ storeInputFiles_()

void storeInputFiles_ ( const IdentificationData id_data)
private

◆ storeMapMetaData_()

void storeMapMetaData_ ( const FeatureMap features)
private

◆ storeMetaInfo_()

void storeMetaInfo_ ( const MetaInfoInterface info,
const String parent_table,
Key  parent_id 
)
private

◆ storeMetaInfos_()

void storeMetaInfos_ ( const MetaInfoInterfaceContainer &  container,
const String parent_table 
)
inlineprivate

◆ storeObservationMatches_()

void storeObservationMatches_ ( const IdentificationData id_data)
private

◆ storeObservations_()

void storeObservations_ ( const IdentificationData id_data)
private

◆ storeParentGroupSets_()

void storeParentGroupSets_ ( const IdentificationData id_data)
private

◆ storeParentMatches_()

void storeParentMatches_ ( const IdentificationData::ParentMatches matches,
Key  molecule_id 
)
private

◆ storeParentSequences_()

void storeParentSequences_ ( const IdentificationData id_data)
private

◆ storeProcessingSoftwares_()

void storeProcessingSoftwares_ ( const IdentificationData id_data)
private

◆ storeProcessingSteps_()

void storeProcessingSteps_ ( const IdentificationData id_data)
private

◆ storeScoredProcessingResults_()

void storeScoredProcessingResults_ ( const ScoredProcessingResultContainer &  container,
const String parent_table 
)
inlineprivate

◆ storeScoreTypes_()

void storeScoreTypes_ ( const IdentificationData id_data)
private

◆ storeVersionAndDate_()

void storeVersionAndDate_ ( )
private

Member Data Documentation

◆ db_name_

QString db_name_
private

◆ prepared_queries_

std::map<std::string, QSqlQuery> prepared_queries_
private

prepared queries for inserting data into different tables