OpenMS
Loading...
Searching...
No Matches
OMSFileLoad.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Hendrik Weisser $
6// $Authors: Hendrik Weisser, Chris Bielow $
7// --------------------------------------------------------------------------
8
9#pragma once
10
14
15namespace SQLite
16{
17 class Database;
18} // namespace SQLite
19
20namespace OpenMS
21{
22 class FeatureMap;
23 class ConsensusMap;
24
25 namespace Internal
26 {
33 {
34 public:
36
47 OMSFileLoad(const String& filename, LogType log_type);
48
55
57 void load(IdentificationData& id_data);
58
60 void load(FeatureMap& features);
61
63 void load(ConsensusMap& consensus);
64
66 void exportToJSON(std::ostream& output);
67
68 private:
70 static bool isEmpty_(const SQLite::Statement& query);
71
73 static DataValue makeDataValue_(const SQLite::Statement& query);
74
75 // static CVTerm loadCVTerm_(int id);
76
79
82
85
88
91
94
97
100
103
106
109
112
114 template <class MapType> String loadMapMetaDataTemplate_(MapType& features);
115
118
121
123 void loadDataProcessing_(std::vector<DataProcessing>& data_processing);
124
126 void loadFeatures_(FeatureMap& features);
127
129 Feature loadFeatureAndSubordinates_(SQLite::Statement& query_feat,
130 SQLite::Statement& query_meta,
131 SQLite::Statement& query_match,
132 SQLite::Statement& query_hull);
133
136
139
141 BaseFeature makeBaseFeature_(int id, SQLite::Statement& query_feat,
142 SQLite::Statement& query_meta,
143 SQLite::Statement& query_match);
144
146 void prepareQueriesBaseFeature_(SQLite::Statement& query_meta,
147 SQLite::Statement& query_match);
148
150 bool prepareQueryMetaInfo_(SQLite::Statement& query, const String& parent_table);
151
153 void handleQueryMetaInfo_(SQLite::Statement& query, MetaInfoInterface& info,
154 Key parent_id);
155
157 bool prepareQueryAppliedProcessingStep_(SQLite::Statement& query,
158 const String& parent_table);
159
162 SQLite::Statement& query,
164 Key parent_id);
165
168 SQLite::Statement& query, IdentificationData::ParentMatches& parent_matches,
169 Key molecule_id);
170
173 SQLite::Statement& query, IdentificationData::ObservationMatch& match,
174 Key parent_id);
175
177 std::unique_ptr<SQLite::Database> db_;
178
180
182
183 // mappings between database keys and loaded data:
184 std::unordered_map<Key, IdentificationData::ScoreTypeRef> score_type_refs_;
185 std::unordered_map<Key, IdentificationData::InputFileRef> input_file_refs_;
186 std::unordered_map<Key, IdentificationData::ProcessingSoftwareRef> processing_software_refs_;
187 std::unordered_map<Key, IdentificationData::ProcessingStepRef> processing_step_refs_;
188 std::unordered_map<Key, IdentificationData::SearchParamRef> search_param_refs_;
189 std::unordered_map<Key, IdentificationData::ObservationRef> observation_refs_;
190 std::unordered_map<Key, IdentificationData::ParentSequenceRef> parent_sequence_refs_;
191 std::unordered_map<Key, IdentificationData::IdentifiedMolecule> identified_molecule_vars_;
192 std::unordered_map<Key, IdentificationData::ObservationMatchRef> observation_match_refs_;
193 std::unordered_map<Key, IdentificationData::AdductRef> adduct_refs_;
194
195 // mapping: table name -> ordering critera (for JSON export)
196 static std::map<String, String> export_order_by_;
197 };
198 }
199}
A basic LC-MS feature.
Definition BaseFeature.h:34
A container for consensus elements.
Definition ConsensusMap.h:67
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition DataValue.h:32
A container for features.
Definition FeatureMap.h:78
An LC-MS feature.
Definition Feature.h:46
Definition IdentificationData.h:87
IdentificationDataInternal::ParentMatches ParentMatches
Definition IdentificationData.h:138
Helper class for loading .oms files (SQLite format)
Definition OMSFileLoad.h:33
String subquery_score_
query for score types used in JSON export
Definition OMSFileLoad.h:181
String loadMapMetaDataTemplate_(MapType &features)
Helper function for loading meta data on feature/consensus maps from the database.
void loadConsensusFeatures_(ConsensusMap &consensus)
Load information on consensus features from the database into a consensus map.
std::unordered_map< Key, IdentificationData::IdentifiedMolecule > identified_molecule_vars_
Definition OMSFileLoad.h:191
void loadParentSequences_(IdentificationData &id_data)
Load information on parent sequences (e.g. proteins) from the database into IdentificationData.
void loadIdentifiedSequences_(IdentificationData &id_data)
Load information on identified sequences (peptides or oligonucleotides) from the database into Identi...
std::unordered_map< Key, IdentificationData::ProcessingSoftwareRef > processing_software_refs_
Definition OMSFileLoad.h:186
void load(IdentificationData &id_data)
Load data from database and populate an IdentificationData object.
void loadProcessingSoftwares_(IdentificationData &id_data)
Load information on data processing software from the database into IdentificationData.
void loadScoreTypes_(IdentificationData &id_data)
Load information on score type from the database into IdentificationData.
std::unordered_map< Key, IdentificationData::ParentSequenceRef > parent_sequence_refs_
Definition OMSFileLoad.h:190
void loadDataProcessing_(std::vector< DataProcessing > &data_processing)
Load information on data processing for feature/consensus maps from the database.
std::unordered_map< Key, IdentificationData::InputFileRef > input_file_refs_
Definition OMSFileLoad.h:185
void loadObservationMatches_(IdentificationData &id_data)
Load information on observation matches (e.g. PSMs) from the database into IdentificationData.
OMSFileStore::Key Key
Type used for database keys.
Definition OMSFileLoad.h:35
static DataValue makeDataValue_(const SQLite::Statement &query)
Generate a DataValue with information returned by an SQL query.
static std::map< String, String > export_order_by_
Definition OMSFileLoad.h:196
void loadMapMetaData_(FeatureMap &features)
Load feature map meta data from the database.
int version_number_
schema version number
Definition OMSFileLoad.h:179
void loadFeatures_(FeatureMap &features)
Load information on features from the database into a feature map.
void loadParentGroupSets_(IdentificationData &id_data)
Load information on parent group sets (e.g. protein groups) from the database into IdentificationData...
Feature loadFeatureAndSubordinates_(SQLite::Statement &query_feat, SQLite::Statement &query_meta, SQLite::Statement &query_match, SQLite::Statement &query_hull)
Generate a feature (incl. subordinate features) from data returned by SQL queries.
void handleQueryAppliedProcessingStep_(SQLite::Statement &query, IdentificationDataInternal::ScoredProcessingResult &result, Key parent_id)
Store results from an SQL query on processing metadata in a ScoredProcessingResult(-derived) object.
void exportToJSON(std::ostream &output)
Export database contents in JSON format, write to stream.
std::unordered_map< Key, IdentificationData::ObservationRef > observation_refs_
Definition OMSFileLoad.h:189
void load(ConsensusMap &consensus)
Load data from database and populate a ConsensusMap object.
std::unordered_map< Key, IdentificationData::SearchParamRef > search_param_refs_
Definition OMSFileLoad.h:188
void load(FeatureMap &features)
Load data from database and populate a FeatureMap object.
bool prepareQueryMetaInfo_(SQLite::Statement &query, const String &parent_table)
Prepare SQL query for loading meta values associated with a particular class (stored in parent_table)
bool prepareQueryAppliedProcessingStep_(SQLite::Statement &query, const String &parent_table)
Prepare SQL query for loading processing metadata associated with a particular class (stored in paren...
void handleQueryParentMatch_(SQLite::Statement &query, IdentificationData::ParentMatches &parent_matches, Key molecule_id)
Store results from an SQL query on parent matches.
void loadProcessingSteps_(IdentificationData &id_data)
Load information on data processing steps from the database into IdentificationData.
std::unordered_map< Key, IdentificationData::ObservationMatchRef > observation_match_refs_
Definition OMSFileLoad.h:192
BaseFeature makeBaseFeature_(int id, SQLite::Statement &query_feat, SQLite::Statement &query_meta, SQLite::Statement &query_match)
Generate a BaseFeature (parent class) from data returned by SQL queries.
void loadAdducts_(IdentificationData &id_data)
Load information on adducts from the database into IdentificationData.
void handleQueryPeakAnnotation_(SQLite::Statement &query, IdentificationData::ObservationMatch &match, Key parent_id)
Store results from an SQL query on peak annotations in an observation match.
void loadConsensusColumnHeaders_(ConsensusMap &consensus)
Load consensus map column headers from the database.
void loadObservations_(IdentificationData &id_data)
Load information on observations (e.g. spectra) from the database into IdentificationData.
OMSFileLoad(const String &filename, LogType log_type)
Constructor.
std::unordered_map< Key, IdentificationData::ScoreTypeRef > score_type_refs_
Definition OMSFileLoad.h:184
void loadInputFiles_(IdentificationData &id_data)
Load information on input files from the database into IdentificationData.
std::unique_ptr< SQLite::Database > db_
The database connection (read)
Definition OMSFileLoad.h:177
void loadDBSearchParams_(IdentificationData &id_data)
Load information on sequence database search parameters from the database into IdentificationData.
std::unordered_map< Key, IdentificationData::ProcessingStepRef > processing_step_refs_
Definition OMSFileLoad.h:187
void prepareQueriesBaseFeature_(SQLite::Statement &query_meta, SQLite::Statement &query_match)
Prepare SQL queries for loading (meta) data on BaseFeatures from the database.
std::unordered_map< Key, IdentificationData::AdductRef > adduct_refs_
Definition OMSFileLoad.h:193
void loadMapMetaData_(ConsensusMap &consensus)
Load consensus map meta data from the database.
void handleQueryMetaInfo_(SQLite::Statement &query, MetaInfoInterface &info, Key parent_id)
Store results from an SQL query on meta values in a MetaInfoInterface(-derived) object.
static bool isEmpty_(const SQLite::Statement &query)
Does the query contain an empty SQL statement (signifying that it shouldn't be executed)?
void loadIdentifiedCompounds_(IdentificationData &id_data)
Load information on identified compounds from the database into IdentificationData.
int64_t Key
< Type used for database keys
Definition OMSFileStore.h:62
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition MetaInfoInterface.h:36
Base class for all classes that want to report their progress.
Definition ProgressLogger.h:27
LogType
Possible log types.
Definition ProgressLogger.h:43
A more convenient string class.
Definition String.h:32
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Definition OMSFileLoad.h:16
Representation of a search hit (e.g. peptide-spectrum match).
Definition ObservationMatch.h:48
Base class for ID data with scores and processing steps (and meta info)
Definition ScoredProcessingResult.h:19