Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
AccurateMassSearchEngine.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-2013.
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: Erhan Kenar $
32 // $Authors: Erhan Kenar $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_ANALYSIS_ID_ACCURATEMASSSEARCHENGINE_H
36 #define OPENMS_ANALYSIS_ID_ACCURATEMASSSEARCHENGINE_H
37 
39 #include <OpenMS/KERNEL/Feature.h>
43 #include <OpenMS/FORMAT/MzTab.h>
47 
48 
49 #include <vector>
50 
51 namespace OpenMS
52 {
53  class OPENMS_DLLAPI AccurateMassSearchResult
54  {
55  public:
58 
61 
64 
67 
69  DoubleReal getAdductMass();
70  DoubleReal getAdductMass() const;
71 
72  void setAdductMass(const DoubleReal&);
73 
74  DoubleReal getQueryMass();
75  void setQueryMass(const DoubleReal&);
76 
77  DoubleReal getFoundMass();
78  void setFoundMass(const DoubleReal&);
79 
80  DoubleReal getCharge();
81  DoubleReal getCharge() const;
82  void setCharge(const DoubleReal&);
83 
84  DoubleReal getErrorPPM();
85 
86  void setErrorPPM(const DoubleReal&);
87 
88  DoubleReal getObservedRT();
89  DoubleReal getObservedRT() const;
90 
91  void setObservedRT(const DoubleReal& rt);
92 
93  DoubleReal getObservedIntensity();
94 
95  DoubleReal getObservedIntensity() const;
96 
97  void setObservedIntensity(const DoubleReal&);
98 
99  std::vector<DoubleReal> getIndividualIntensities();
100 
101  std::vector<DoubleReal> getIndividualIntensities() const;
102 
103  void setIndividualIntensities(const std::vector<DoubleReal>&);
104 
105  Size getMatchingIndex();
106 
107  void setMatchingIndex(const Size&);
108 
109  Size getSourceFeatureIndex();
110 
111  void setSourceFeatureIndex(const Size&);
112 
113  String getFoundAdduct();
114 
115  String getFoundAdduct() const;
116 
117  void setFoundAdduct(const String&);
118 
119  String getFormulaString();
120 
121  String getFormulaString() const;
122 
123  void setEmpiricalFormula(const String&);
124 
125  std::vector<String> getMatchingHMDBids();
126 
127  std::vector<String> getMatchingHMDBids() const;
128 
129  void setMatchingHMDBids(const std::vector<String>&);
130 
131  DoubleReal getIsotopesSimScore();
132 
133  DoubleReal getIsotopesSimScore() const;
134 
135  void setIsotopesSimScore(const DoubleReal&);
136 
137  // DoubleReal computeCombinedScore(); // not implemented
138  // debug/output functions
139  void outputResults() const;
140 
141  private:
150  std::vector<DoubleReal> individual_intensities_;
153 
156  std::vector<String> matching_hmdb_ids_;
157 
159  };
160 
161 
162  class OPENMS_DLLAPI AccurateMassSearchEngine :
163  public DefaultParamHandler,
164  public ProgressLogger
165  {
166 public:
169 
170  // Explicit constructor
171  // AccurateMassSearchEngine(const String& map_fname);
172 
174  virtual ~AccurateMassSearchEngine();
175 
176  void queryByMass(const DoubleReal&, const DoubleReal&, std::vector<AccurateMassSearchResult>&);
177  void queryByFeature(const Feature&, const Size&, std::vector<AccurateMassSearchResult>&);
178  void queryByConsensusFeature(const ConsensusFeature&, const Size&, const Size&, std::vector<AccurateMassSearchResult>&);
179 
181  void run(const FeatureMap<>&, MzTab&);
182  void run(const ConsensusMap&, MzTab&);
183 
184 
185 protected:
186  virtual void updateMembers_();
187 
188 private:
190  void parseMappingFile_(const String&);
191  void parseStructMappingFile_(const String&);
192  void parseAdductsFile_(const String&);
193  void searchMass_(const DoubleReal&, std::vector<Size>& hit_indices);
194 
195  void parseAdductString_(const String&, std::vector<String>&);
196  void computeNeutralMassFromAdduct_(const DoubleReal&, const String&, DoubleReal&, DoubleReal&);
197 
198  DoubleReal computeCosineSim_(const std::vector<DoubleReal>& x, const std::vector<DoubleReal>& y);
199  DoubleReal computeEuclideanDist_(const std::vector<DoubleReal>& x, const std::vector<DoubleReal>& y);
200  DoubleReal computeIsotopePatternSimilarity_(const Feature&, const EmpiricalFormula&);
201 
202  typedef std::vector<std::vector<AccurateMassSearchResult> > QueryResultsTable;
203 
204  void exportMzTab_(const QueryResultsTable&, MzTab&);
205 
207  typedef std::vector<std::vector<String> > MassIDMapping;
208  typedef std::map<String, std::vector<String> > HMDBPropsMapping;
209 
210  std::vector<DoubleReal> masskey_table_;
213  std::vector<String> mass_formula_mapping_;
214 
220 
223 
226  };
227 
228 
229 }
230 
231 
232 
233 
234 #endif // OPENMS_ANALYSIS_ID_ACCURATEMASSSEARCHENGINE_H
String ion_mode_
Definition: AccurateMassSearchEngine.h:218
String mass_error_unit_
Definition: AccurateMassSearchEngine.h:217
std::vector< DoubleReal > individual_intensities_
Definition: AccurateMassSearchEngine.h:150
A more convenient string class.
Definition: String.h:56
bool iso_similarity_
Definition: AccurateMassSearchEngine.h:219
DoubleReal query_mass_
Definition: AccurateMassSearchEngine.h:144
String empirical_formula_
Definition: AccurateMassSearchEngine.h:155
std::vector< std::vector< String > > MassIDMapping
private member variables
Definition: AccurateMassSearchEngine.h:207
StringList pos_adducts_
Definition: AccurateMassSearchEngine.h:224
MassIDMapping mass_id_mapping_
Definition: AccurateMassSearchEngine.h:211
A container for consensus elements.
Definition: ConsensusMap.h:60
std::vector< String > matching_hmdb_ids_
Definition: AccurateMassSearchEngine.h:156
String found_adduct_
Definition: AccurateMassSearchEngine.h:154
DoubleReal observed_rt_
Definition: AccurateMassSearchEngine.h:148
Definition: AccurateMassSearchEngine.h:53
HMDBPropsMapping hmdb_properties_mapping_
Definition: AccurateMassSearchEngine.h:212
Representation of an empirical formula.
Definition: EmpiricalFormula.h:78
DoubleReal mass_error_value_
parameter stuff
Definition: AccurateMassSearchEngine.h:216
String pos_adducts_fname_
Definition: AccurateMassSearchEngine.h:221
std::map< String, std::vector< String > > HMDBPropsMapping
Definition: AccurateMassSearchEngine.h:208
std::vector< std::vector< AccurateMassSearchResult > > QueryResultsTable
Definition: AccurateMassSearchEngine.h:202
An LC-MS feature.
Definition: Feature.h:66
StringList neg_adducts_
Definition: AccurateMassSearchEngine.h:225
String list.
Definition: StringList.h:56
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
Base class for all classes that want to report their progess.
Definition: ProgressLogger.h:56
DoubleReal error_ppm_
Definition: AccurateMassSearchEngine.h:147
std::vector< String > mass_formula_mapping_
Definition: AccurateMassSearchEngine.h:213
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:90
Size source_feature_index_
Definition: AccurateMassSearchEngine.h:152
Size matching_index_
Definition: AccurateMassSearchEngine.h:151
DoubleReal adduct_mass_
Stored information/results of DB query.
Definition: AccurateMassSearchEngine.h:143
String neg_adducts_fname_
Definition: AccurateMassSearchEngine.h:222
DoubleReal isotopes_sim_score_
Definition: AccurateMassSearchEngine.h:158
std::vector< DoubleReal > masskey_table_
Definition: AccurateMassSearchEngine.h:210
DoubleReal found_mass_
Definition: AccurateMassSearchEngine.h:145
DoubleReal observed_intensity_
Definition: AccurateMassSearchEngine.h:149
A 2-dimensional consensus feature.
Definition: ConsensusFeature.h:59
DoubleReal charge_
Definition: AccurateMassSearchEngine.h:146
Data model of MzTab files. Please see the official MzTab specification at https://code.google.com/p/mztab/.
Definition: MzTab.h:1355
Definition: AccurateMassSearchEngine.h:162

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:11 using doxygen 1.8.5