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 
76 
78  void load(IdentificationData& id_data);
79 
81  void load(FeatureMap& features);
82 
83  private:
84  // static CVTerm loadCVTerm_(int id);
85 
87 
89 
91 
93 
95 
97 
99 
101 
103 
105 
107 
109 
110  void loadMapMetaData_(FeatureMap& features);
111 
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 }
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:59
A container for features.
Definition: FeatureMap.h:106
An LC-MS feature.
Definition: Feature.h:72
Representation of spectrum identification results and associated data.
Definition: IdentificationData.h:95
IdentificationDataInternal::ParentMatches ParentMatches
Definition: IdentificationData.h:146
Helper class for loading .oms files (SQLite format)
Definition: OMSFileLoad.h:54
std::unordered_map< Key, IdentificationData::IdentifiedMolecule > identified_molecule_vars_
Definition: OMSFileLoad.h:157
void loadParentSequences_(IdentificationData &id_data)
void loadIdentifiedSequences_(IdentificationData &id_data)
std::unordered_map< Key, IdentificationData::ProcessingSoftwareRef > processing_software_refs_
Definition: OMSFileLoad.h:152
void load(IdentificationData &id_data)
Load data from database and populate an IdentificationData object.
void loadProcessingSoftwares_(IdentificationData &id_data)
void loadScoreTypes_(IdentificationData &id_data)
void handleQueryParentMatch_(QSqlQuery &query, IdentificationData::ParentMatches &parent_matches, Key molecule_id)
std::unordered_map< Key, IdentificationData::InputFileRef > input_file_refs_
Definition: OMSFileLoad.h:151
void loadObservationMatches_(IdentificationData &id_data)
void loadMapMetaData_(FeatureMap &features)
int version_number_
schema version number
Definition: OMSFileLoad.h:147
void loadFeatures_(FeatureMap &features)
void loadParentGroupSets_(IdentificationData &id_data)
qint64 Key
Type used for database keys.
Definition: OMSFileLoad.h:56
bool prepareQueryMetaInfo_(QSqlQuery &query, const String &parent_table)
std::unordered_map< Key, IdentificationData::ObservationRef > observation_refs_
Definition: OMSFileLoad.h:155
std::unordered_map< Key, IdentificationData::ParentSequenceRef > parent_refs_
Definition: OMSFileLoad.h:156
std::unordered_map< Key, IdentificationData::SearchParamRef > search_param_refs_
Definition: OMSFileLoad.h:154
void load(FeatureMap &features)
Load data from database and populate a FeatureMap object.
static DataValue makeDataValue_(const QSqlQuery &query)
void loadProcessingSteps_(IdentificationData &id_data)
std::unordered_map< Key, IdentificationData::ObservationMatchRef > observation_match_refs_
Definition: OMSFileLoad.h:158
void loadAdducts_(IdentificationData &id_data)
void loadObservations_(IdentificationData &id_data)
void handleQueryMetaInfo_(QSqlQuery &query, MetaInfoInterface &info, Key parent_id)
OMSFileLoad(const String &filename, LogType log_type)
Constructor.
std::unordered_map< Key, IdentificationData::ScoreTypeRef > score_type_refs_
Definition: OMSFileLoad.h:150
bool prepareQueryAppliedProcessingStep_(QSqlQuery &query, const String &parent_table)
void loadInputFiles_(IdentificationData &id_data)
void handleQueryAppliedProcessingStep_(QSqlQuery &query, IdentificationDataInternal::ScoredProcessingResult &result, Key parent_id)
void handleQueryPeakAnnotation_(QSqlQuery &query, IdentificationData::ObservationMatch &match, Key parent_id)
void loadDBSearchParams_(IdentificationData &id_data)
std::unordered_map< Key, IdentificationData::ProcessingStepRef > processing_step_refs_
Definition: OMSFileLoad.h:153
std::unordered_map< Key, IdentificationData::AdductRef > adduct_refs_
Definition: OMSFileLoad.h:159
void loadDataProcessing_(FeatureMap &features)
Feature loadFeatureAndSubordinates_(QSqlQuery &query_feat, std::optional< QSqlQuery > &query_meta, std::optional< QSqlQuery > &query_hull, std::optional< QSqlQuery > &query_match)
void loadIdentifiedCompounds_(IdentificationData &id_data)
QString db_name_
Definition: OMSFileLoad.h:145
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:61
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:53
LogType
Possible log types.
Definition: ProgressLogger.h:69
A more convenient string class.
Definition: String.h:60
FLASHIda C++ to C# (or vice versa) bridge functions The functions here are called in C# to invoke fun...
Definition: FeatureDeconvolution.h:48
Representation of a search hit (e.g. peptide-spectrum match).
Definition: ObservationMatch.h:74
Base class for ID data with scores and processing steps (and meta info)
Definition: ScoredProcessingResult.h:45