OpenMS  3.0.0
OMSFileLoad.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2022.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Hendrik Weisser $
32 // $Authors: Hendrik Weisser $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
40 
41 #include <QString>
42 class QSqlQuery;
43 
44 namespace OpenMS
45 {
46  namespace Internal
47  {
54  {
55  public:
56  using Key = qint64;
57 
68  OMSFileLoad(const String& filename, LogType log_type);
69 
75  ~OMSFileLoad();
76 
78  void load(IdentificationData& id_data);
79 
81  void load(FeatureMap& features);
82 
83  private:
84  // static CVTerm loadCVTerm_(int id);
85 
86  void loadScoreTypes_(IdentificationData& id_data);
87 
88  void loadInputFiles_(IdentificationData& id_data);
89 
91 
93 
95 
97 
99 
101 
103 
105 
106  void loadAdducts_(IdentificationData& id_data);
107 
109 
110  void loadMapMetaData_(FeatureMap& features);
111 
112  void loadDataProcessing_(FeatureMap& features);
113 
114  void loadFeatures_(FeatureMap& features);
115 
116  Feature loadFeatureAndSubordinates_(QSqlQuery& query_feat,
117  std::optional<QSqlQuery>& query_meta,
118  std::optional<QSqlQuery>& query_hull,
119  std::optional<QSqlQuery>& query_match);
120 
121  static DataValue makeDataValue_(const QSqlQuery& query);
122 
123  bool prepareQueryMetaInfo_(QSqlQuery& query, const String& parent_table);
124 
125  void handleQueryMetaInfo_(QSqlQuery& query, MetaInfoInterface& info,
126  Key parent_id);
127 
128  bool prepareQueryAppliedProcessingStep_(QSqlQuery& query,
129  const String& parent_table);
130 
132  QSqlQuery& query,
134  Key parent_id);
135 
137  QSqlQuery& query, IdentificationData::ParentMatches& parent_matches,
138  Key molecule_id);
139 
141  QSqlQuery& query, IdentificationData::ObservationMatch& match,
142  Key parent_id);
143 
144  // store name, not database connection itself (see https://stackoverflow.com/a/55200682):
145  QString db_name_;
146 
148 
149  // mappings between database keys and loaded data:
150  std::unordered_map<Key, IdentificationData::ScoreTypeRef> score_type_refs_;
151  std::unordered_map<Key, IdentificationData::InputFileRef> input_file_refs_;
152  std::unordered_map<Key, IdentificationData::ProcessingSoftwareRef> processing_software_refs_;
153  std::unordered_map<Key, IdentificationData::ProcessingStepRef> processing_step_refs_;
154  std::unordered_map<Key, IdentificationData::SearchParamRef> search_param_refs_;
155  std::unordered_map<Key, IdentificationData::ObservationRef> observation_refs_;
156  std::unordered_map<Key, IdentificationData::ParentSequenceRef> parent_refs_;
157  std::unordered_map<Key, IdentificationData::IdentifiedMolecule> identified_molecule_vars_;
158  std::unordered_map<Key, IdentificationData::ObservationMatchRef> observation_match_refs_;
159  std::unordered_map<Key, IdentificationData::AdductRef> adduct_refs_;
160  };
161  }
162 }
OpenMS::Internal::OMSFileLoad::handleQueryAppliedProcessingStep_
void handleQueryAppliedProcessingStep_(QSqlQuery &query, IdentificationDataInternal::ScoredProcessingResult &result, Key parent_id)
OpenMS::Internal::OMSFileLoad::~OMSFileLoad
~OMSFileLoad()
Destructor.
OpenMS::Internal::OMSFileLoad::loadObservationMatches_
void loadObservationMatches_(IdentificationData &id_data)
OpenMS::Internal::OMSFileLoad::loadDBSearchParams_
void loadDBSearchParams_(IdentificationData &id_data)
OpenMS::Internal::OMSFileLoad::loadObservations_
void loadObservations_(IdentificationData &id_data)
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::Internal::OMSFileLoad
Helper class for loading .oms files (SQLite format)
Definition: OMSFileLoad.h:53
OpenMS::Internal::OMSFileLoad::loadParentGroupSets_
void loadParentGroupSets_(IdentificationData &id_data)
OpenMS::Internal::OMSFileLoad::load
void load(IdentificationData &id_data)
Load data from database and populate an IdentificationData object.
OpenMS::Internal::OMSFileLoad::parent_refs_
std::unordered_map< Key, IdentificationData::ParentSequenceRef > parent_refs_
Definition: OMSFileLoad.h:156
OpenMS::Internal::OMSFileLoad::processing_step_refs_
std::unordered_map< Key, IdentificationData::ProcessingStepRef > processing_step_refs_
Definition: OMSFileLoad.h:153
OpenMS::Internal::OMSFileLoad::Key
qint64 Key
Type used for database keys.
Definition: OMSFileLoad.h:56
OpenMS::Internal::OMSFileLoad::makeDataValue_
static DataValue makeDataValue_(const QSqlQuery &query)
OpenMS::Internal::OMSFileLoad::db_name_
QString db_name_
Definition: OMSFileLoad.h:145
OpenMS::Internal::OMSFileLoad::loadScoreTypes_
void loadScoreTypes_(IdentificationData &id_data)
OpenMS::Internal::OMSFileLoad::observation_refs_
std::unordered_map< Key, IdentificationData::ObservationRef > observation_refs_
Definition: OMSFileLoad.h:155
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::Internal::OMSFileLoad::loadProcessingSteps_
void loadProcessingSteps_(IdentificationData &id_data)
OpenMS::Internal::OMSFileLoad::score_type_refs_
std::unordered_map< Key, IdentificationData::ScoreTypeRef > score_type_refs_
Definition: OMSFileLoad.h:150
OpenMS::Internal::OMSFileLoad::loadFeatures_
void loadFeatures_(FeatureMap &features)
OpenMS::Internal::OMSFileLoad::observation_match_refs_
std::unordered_map< Key, IdentificationData::ObservationMatchRef > observation_match_refs_
Definition: OMSFileLoad.h:158
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:52
OpenMS::Internal::OMSFileLoad::loadInputFiles_
void loadInputFiles_(IdentificationData &id_data)
OpenMS::DataValue
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:58
OpenMS::Internal::OMSFileLoad::identified_molecule_vars_
std::unordered_map< Key, IdentificationData::IdentifiedMolecule > identified_molecule_vars_
Definition: OMSFileLoad.h:157
ProgressLogger.h
OpenMS::Internal::OMSFileLoad::loadDataProcessing_
void loadDataProcessing_(FeatureMap &features)
OpenMS::Internal::OMSFileLoad::adduct_refs_
std::unordered_map< Key, IdentificationData::AdductRef > adduct_refs_
Definition: OMSFileLoad.h:159
OpenMS::Internal::OMSFileLoad::search_param_refs_
std::unordered_map< Key, IdentificationData::SearchParamRef > search_param_refs_
Definition: OMSFileLoad.h:154
OpenMS::MetaInfoInterface
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:60
OpenMS::Internal::OMSFileLoad::loadAdducts_
void loadAdducts_(IdentificationData &id_data)
OpenMS::IdentificationData::ParentMatches
IdentificationDataInternal::ParentMatches ParentMatches
Definition: IdentificationData.h:146
FeatureMap.h
OpenMS::Internal::OMSFileLoad::OMSFileLoad
OMSFileLoad(const String &filename, LogType log_type)
Constructor.
OpenMS::Internal::OMSFileLoad::loadIdentifiedSequences_
void loadIdentifiedSequences_(IdentificationData &id_data)
OpenMS::Internal::OMSFileLoad::prepareQueryMetaInfo_
bool prepareQueryMetaInfo_(QSqlQuery &query, const String &parent_table)
OpenMS::Internal::OMSFileLoad::loadMapMetaData_
void loadMapMetaData_(FeatureMap &features)
OpenMS::ProgressLogger::LogType
LogType
Possible log types.
Definition: ProgressLogger.h:68
OpenMS::Internal::OMSFileLoad::handleQueryParentMatch_
void handleQueryParentMatch_(QSqlQuery &query, IdentificationData::ParentMatches &parent_matches, Key molecule_id)
OpenMS::Internal::OMSFileLoad::loadIdentifiedCompounds_
void loadIdentifiedCompounds_(IdentificationData &id_data)
OpenMS::IdentificationData
Representation of spectrum identification results and associated data.
Definition: IdentificationData.h:94
OpenMS::FeatureMap
A container for features.
Definition: FeatureMap.h:98
OpenMS::IdentificationDataInternal::ScoredProcessingResult
Base class for ID data with scores and processing steps (and meta info)
Definition: ScoredProcessingResult.h:44
OpenMS::Internal::OMSFileLoad::loadParentSequences_
void loadParentSequences_(IdentificationData &id_data)
OpenMS::Internal::OMSFileLoad::handleQueryPeakAnnotation_
void handleQueryPeakAnnotation_(QSqlQuery &query, IdentificationData::ObservationMatch &match, Key parent_id)
OpenMS::Feature
An LC-MS feature.
Definition: Feature.h:70
OpenMS::Internal::OMSFileLoad::version_number_
int version_number_
schema version number
Definition: OMSFileLoad.h:147
OpenMS::Internal::OMSFileLoad::loadFeatureAndSubordinates_
Feature loadFeatureAndSubordinates_(QSqlQuery &query_feat, std::optional< QSqlQuery > &query_meta, std::optional< QSqlQuery > &query_hull, std::optional< QSqlQuery > &query_match)
OpenMS::Internal::OMSFileLoad::processing_software_refs_
std::unordered_map< Key, IdentificationData::ProcessingSoftwareRef > processing_software_refs_
Definition: OMSFileLoad.h:152
IdentificationData.h
OpenMS::Internal::OMSFileLoad::input_file_refs_
std::unordered_map< Key, IdentificationData::InputFileRef > input_file_refs_
Definition: OMSFileLoad.h:151
OpenMS::Internal::OMSFileLoad::handleQueryMetaInfo_
void handleQueryMetaInfo_(QSqlQuery &query, MetaInfoInterface &info, Key parent_id)
OpenMS::IdentificationDataInternal::ObservationMatch
Representation of a search hit (e.g. peptide-spectrum match).
Definition: ObservationMatch.h:73
OpenMS::Internal::OMSFileLoad::loadProcessingSoftwares_
void loadProcessingSoftwares_(IdentificationData &id_data)
OpenMS::Internal::OMSFileLoad::prepareQueryAppliedProcessingStep_
bool prepareQueryAppliedProcessingStep_(QSqlQuery &query, const String &parent_table)