OpenMS  3.0.0
OMSFileLoad Class Reference

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

#include <OpenMS/FORMAT/OMSFileLoad.h>

Inheritance diagram for OMSFileLoad:
ProgressLogger

Public Types

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

Public Member Functions

 OMSFileLoad (const String &filename, LogType log_type)
 Constructor. More...
 
 ~OMSFileLoad ()
 Destructor. More...
 
void load (IdentificationData &id_data)
 Load data from database and populate an IdentificationData object. More...
 
void load (FeatureMap &features)
 Load data from database and populate a FeatureMap object. More...
 
void exportToJSON (std::ostream &output)
 Export database contents in JSON format, write to stream. 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 loadScoreTypes_ (IdentificationData &id_data)
 
void loadInputFiles_ (IdentificationData &id_data)
 
void loadProcessingSoftwares_ (IdentificationData &id_data)
 
void loadDBSearchParams_ (IdentificationData &id_data)
 
void loadProcessingSteps_ (IdentificationData &id_data)
 
void loadObservations_ (IdentificationData &id_data)
 
void loadParentSequences_ (IdentificationData &id_data)
 
void loadParentGroupSets_ (IdentificationData &id_data)
 
void loadIdentifiedCompounds_ (IdentificationData &id_data)
 
void loadIdentifiedSequences_ (IdentificationData &id_data)
 
void loadAdducts_ (IdentificationData &id_data)
 
void loadObservationMatches_ (IdentificationData &id_data)
 
void loadMapMetaData_ (FeatureMap &features)
 
void loadDataProcessing_ (FeatureMap &features)
 
void loadFeatures_ (FeatureMap &features)
 
Feature loadFeatureAndSubordinates_ (SQLite::Statement &query_feat, std::optional< SQLite::Statement > &query_meta, std::optional< SQLite::Statement > &query_hull, std::optional< SQLite::Statement > &query_match)
 
bool prepareQueryMetaInfo_ (SQLite::Statement &query, const String &parent_table)
 
void handleQueryMetaInfo_ (SQLite::Statement &query, MetaInfoInterface &info, Key parent_id)
 
bool prepareQueryAppliedProcessingStep_ (SQLite::Statement &query, const String &parent_table)
 
void handleQueryAppliedProcessingStep_ (SQLite::Statement &query, IdentificationDataInternal::ScoredProcessingResult &result, Key parent_id)
 
void handleQueryParentMatch_ (SQLite::Statement &query, IdentificationData::ParentMatches &parent_matches, Key molecule_id)
 
void handleQueryPeakAnnotation_ (SQLite::Statement &query, IdentificationData::ObservationMatch &match, Key parent_id)
 
void createView_ (const String &name, const String &select)
 
QJsonArray exportTableToJSON_ (const QString &table, const QString &order_by)
 

Static Private Member Functions

static DataValue makeDataValue_ (const SQLite::Statement &query)
 

Private Attributes

std::unique_ptr< SQLite::Database > db_
 The database connection (read) More...
 
int version_number_
 schema version number More...
 
QString subquery_score_
 query for score types used in JSON export More...
 
std::unordered_map< Key, IdentificationData::ScoreTypeRefscore_type_refs_
 
std::unordered_map< Key, IdentificationData::InputFileRefinput_file_refs_
 
std::unordered_map< Key, IdentificationData::ProcessingSoftwareRefprocessing_software_refs_
 
std::unordered_map< Key, IdentificationData::ProcessingStepRefprocessing_step_refs_
 
std::unordered_map< Key, IdentificationData::SearchParamRefsearch_param_refs_
 
std::unordered_map< Key, IdentificationData::ObservationRefobservation_refs_
 
std::unordered_map< Key, IdentificationData::ParentSequenceRefparent_sequence_refs_
 
std::unordered_map< Key, IdentificationData::IdentifiedMoleculeidentified_molecule_vars_
 
std::unordered_map< Key, IdentificationData::ObservationMatchRefobservation_match_refs_
 
std::unordered_map< Key, IdentificationData::AdductRefadduct_refs_
 

Static Private Attributes

static std::map< QString, QString > export_order_by_
 

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 loading .oms files (SQLite format)

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

Member Typedef Documentation

◆ Key

Type used for database keys.

Constructor & Destructor Documentation

◆ OMSFileLoad()

OMSFileLoad ( const String filename,
LogType  log_type 
)

Constructor.

Opens the connection to the database file (in read-only mode).

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

◆ ~OMSFileLoad()

Destructor.

Closes the connection to the database file.

Member Function Documentation

◆ createView_()

void createView_ ( const String name,
const String select 
)
private

◆ exportTableToJSON_()

QJsonArray exportTableToJSON_ ( const QString &  table,
const QString &  order_by 
)
private

◆ exportToJSON()

void exportToJSON ( std::ostream &  output)

Export database contents in JSON format, write to stream.

◆ handleQueryAppliedProcessingStep_()

void handleQueryAppliedProcessingStep_ ( SQLite::Statement &  query,
IdentificationDataInternal::ScoredProcessingResult result,
Key  parent_id 
)
private

◆ handleQueryMetaInfo_()

void handleQueryMetaInfo_ ( SQLite::Statement &  query,
MetaInfoInterface info,
Key  parent_id 
)
private

◆ handleQueryParentMatch_()

void handleQueryParentMatch_ ( SQLite::Statement &  query,
IdentificationData::ParentMatches parent_matches,
Key  molecule_id 
)
private

◆ handleQueryPeakAnnotation_()

void handleQueryPeakAnnotation_ ( SQLite::Statement &  query,
IdentificationData::ObservationMatch match,
Key  parent_id 
)
private

◆ load() [1/2]

void load ( IdentificationData id_data)

Load data from database and populate an IdentificationData object.

◆ load() [2/2]

void load ( FeatureMap features)

Load data from database and populate a FeatureMap object.

◆ loadAdducts_()

void loadAdducts_ ( IdentificationData id_data)
private

◆ loadDataProcessing_()

void loadDataProcessing_ ( FeatureMap features)
private

◆ loadDBSearchParams_()

void loadDBSearchParams_ ( IdentificationData id_data)
private

◆ loadFeatureAndSubordinates_()

Feature loadFeatureAndSubordinates_ ( SQLite::Statement &  query_feat,
std::optional< SQLite::Statement > &  query_meta,
std::optional< SQLite::Statement > &  query_hull,
std::optional< SQLite::Statement > &  query_match 
)
private

◆ loadFeatures_()

void loadFeatures_ ( FeatureMap features)
private

◆ loadIdentifiedCompounds_()

void loadIdentifiedCompounds_ ( IdentificationData id_data)
private

◆ loadIdentifiedSequences_()

void loadIdentifiedSequences_ ( IdentificationData id_data)
private

◆ loadInputFiles_()

void loadInputFiles_ ( IdentificationData id_data)
private

◆ loadMapMetaData_()

void loadMapMetaData_ ( FeatureMap features)
private

◆ loadObservationMatches_()

void loadObservationMatches_ ( IdentificationData id_data)
private

◆ loadObservations_()

void loadObservations_ ( IdentificationData id_data)
private

◆ loadParentGroupSets_()

void loadParentGroupSets_ ( IdentificationData id_data)
private

◆ loadParentSequences_()

void loadParentSequences_ ( IdentificationData id_data)
private

◆ loadProcessingSoftwares_()

void loadProcessingSoftwares_ ( IdentificationData id_data)
private

◆ loadProcessingSteps_()

void loadProcessingSteps_ ( IdentificationData id_data)
private

◆ loadScoreTypes_()

void loadScoreTypes_ ( IdentificationData id_data)
private

◆ makeDataValue_()

static DataValue makeDataValue_ ( const SQLite::Statement &  query)
staticprivate

◆ prepareQueryAppliedProcessingStep_()

bool prepareQueryAppliedProcessingStep_ ( SQLite::Statement &  query,
const String parent_table 
)
private

◆ prepareQueryMetaInfo_()

bool prepareQueryMetaInfo_ ( SQLite::Statement &  query,
const String parent_table 
)
private

Member Data Documentation

◆ adduct_refs_

std::unordered_map<Key, IdentificationData::AdductRef> adduct_refs_
private

◆ db_

std::unique_ptr<SQLite::Database> db_
private

The database connection (read)

◆ export_order_by_

std::map<QString, QString> export_order_by_
staticprivate

◆ identified_molecule_vars_

std::unordered_map<Key, IdentificationData::IdentifiedMolecule> identified_molecule_vars_
private

◆ input_file_refs_

std::unordered_map<Key, IdentificationData::InputFileRef> input_file_refs_
private

◆ observation_match_refs_

std::unordered_map<Key, IdentificationData::ObservationMatchRef> observation_match_refs_
private

◆ observation_refs_

std::unordered_map<Key, IdentificationData::ObservationRef> observation_refs_
private

◆ parent_sequence_refs_

std::unordered_map<Key, IdentificationData::ParentSequenceRef> parent_sequence_refs_
private

◆ processing_software_refs_

std::unordered_map<Key, IdentificationData::ProcessingSoftwareRef> processing_software_refs_
private

◆ processing_step_refs_

std::unordered_map<Key, IdentificationData::ProcessingStepRef> processing_step_refs_
private

◆ score_type_refs_

std::unordered_map<Key, IdentificationData::ScoreTypeRef> score_type_refs_
private

◆ search_param_refs_

std::unordered_map<Key, IdentificationData::SearchParamRef> search_param_refs_
private

◆ subquery_score_

QString subquery_score_
private

query for score types used in JSON export

◆ version_number_

int version_number_
private

schema version number