OpenMS  2.8.0
MzTabM.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-2020.
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: Oliver Alka $
32 // $Authors: Oliver Alka $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
41 #include <set>
42 
43 namespace OpenMS
44 {
53  {
55  {
56  return lhs->identified_molecule_var.getIdentifiedCompoundRef()->identifier < rhs->identified_molecule_var.getIdentifiedCompoundRef()->identifier;
57  }
58  };
59 
63  class OPENMS_DLLAPI MzTabMAssayMetaData
64  {
65  public:
67  std::map<Size,MzTabParameter> custom;
71  };
72 
76  class OPENMS_DLLAPI MzTabMMSRunMetaData
77  {
78  public:
83  std::map<Size, MzTabParameter> fragmentation_method;
84  std::map<Size, MzTabParameter> scan_polarity;
87  };
88 
92  class OPENMS_DLLAPI MzTabMStudyVariableMetaData
93  {
94  public:
96  std::vector<int> assay_refs;
101  };
102 
106  class OPENMS_DLLAPI MzTabMDatabaseMetaData // mztab-m
107  {
108  public:
113  };
114 
118  class OPENMS_DLLAPI MzTabMMetaData
119  {
120  public:
122 
127  std::map<Size, MzTabParameterList> sample_processing;
128  std::map<Size, MzTabInstrumentMetaData> instrument;
129  std::map<Size, MzTabSoftwareMetaData> software;
130  std::map<Size, MzTabString> publication;
131  std::map<Size, MzTabContactMetaData> contact;
132  std::map<Size, MzTabString> uri;
133  std::map<Size, MzTabString> external_study_uri;
135  std::map<Size, MzTabSampleMetaData> sample;
136  std::map<Size, MzTabMMSRunMetaData> ms_run;
137  std::map<Size, MzTabMAssayMetaData> assay;
138  std::map<Size, MzTabMStudyVariableMetaData> study_variable;
139  std::map<Size, MzTabParameter> custom;
140  std::map<Size, MzTabCVMetaData> cv;
141  std::map<Size, MzTabMDatabaseMetaData> database;
142  std::map<Size, MzTabParameter> derivatization_agent;
146  std::map<Size, MzTabParameter> id_confidence_measure;
147  std::vector<MzTabString> colunit_small_molecule;
148  std::vector<MzTabString> colunit_small_molecule_feature;
149  std::vector<MzTabString> colunit_small_molecule_evidence;
150  };
151 
155  class OPENMS_DLLAPI MzTabMSmallMoleculeSectionRow
156  {
157  public:
168  // Reliability information of the used indentificavtion method has to be stored in the ID data structure
172  std::map<Size, MzTabDouble> small_molecule_abundance_assay;
173  std::map<Size, MzTabDouble> small_molecule_abundance_study_variable;
175  std::vector<MzTabOptionalColumnEntry> opt_;
176  };
177 
182  {
183  public:
194  std::map<Size, MzTabDouble> small_molecule_feature_abundance_assay;
195  std::vector<MzTabOptionalColumnEntry> opt_;
196  };
197 
202  {
203  public:
220  std::map<Size, MzTabDouble> id_confidence_measure;
222  std::vector<MzTabOptionalColumnEntry> opt_;
223  };
224 
225  typedef std::vector<MzTabMSmallMoleculeSectionRow> MzTabMSmallMoleculeSectionRows;
226  typedef std::vector<MzTabMSmallMoleculeFeatureSectionRow> MzTabMSmallMoleculeFeatureSectionRows;
227  typedef std::vector<MzTabMSmallMoleculeEvidenceSectionRow> MzTabMSmallMoleculeEvidenceSectionRows;
228 
233  class OPENMS_DLLAPI MzTabM : public MzTabBase
234  {
235  public:
237  MzTabM() = default;
238 
240  ~MzTabM() = default;
241 
243  const MzTabMMetaData& getMetaData() const;
244 
246  void setMetaData(const MzTabMMetaData& m_md);
247 
250 
253 
256 
259 
262 
265 
267  void setCommentRows(const std::map<Size, String>& com);
268 
270  void setEmptyRows(const std::vector<Size>& empty);
271 
273  const std::vector<Size>& getEmptyRows() const;
274 
276  const std::map<Size, String>& getCommentRows() const;
277 
279  std::vector<String> getMSmallMoleculeOptionalColumnNames() const;
280 
282  std::vector<String> getMSmallMoleculeFeatureOptionalColumnNames() const;
283 
285  std::vector<String> getMSmallMoleculeEvidenceOptionalColumnNames() const;
286 
287  static void addMetaInfoToOptionalColumns(const std::set<String>& keys,
288  std::vector<MzTabOptionalColumnEntry>& opt,
289  const String& id, const MetaInfoInterface& meta);
290 
296  static MzTabM exportFeatureMapToMzTabM(const FeatureMap& feature_map);
297 
298  protected:
303  std::vector<Size> empty_rows_;
304  std::map<Size, String> comment_rows_;
305  std::vector<String> sml_optional_column_names_;
306  std::vector<String> smf_optional_column_names_;
307  std::vector<String> sme_optional_column_names_;
308 
310 
311  static void getFeatureMapMetaValues_(const FeatureMap& feature_map,
312  std::set<String>& feature_user_value_keys,
313  std::set<String>& observationmatch_user_value_keys,
314  std::set<String>& compound_user_value_keys);
315 
316  };
317 } // namespace OpenMS
A container for features.
Definition: FeatureMap.h:106
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:61
Definition: MzTabBase.h:387
Definition: MzTabBase.h:105
Definition: MzTabBase.h:67
Definition: MzTabBase.h:127
MztabM Metadata.
Definition: MzTabM.h:119
std::map< Size, MzTabCVMetaData > cv
Controlled Vocabulary details.
Definition: MzTabM.h:140
std::vector< MzTabString > colunit_small_molecule
Defines the unit used for a specific column.
Definition: MzTabM.h:147
MzTabString mz_tab_version
MzTab-M Version.
Definition: MzTabM.h:123
std::map< Size, MzTabMAssayMetaData > assay
Assay details.
Definition: MzTabM.h:137
std::vector< MzTabString > colunit_small_molecule_evidence
Defines the unit used for a specific column.
Definition: MzTabM.h:149
std::map< Size, MzTabParameter > id_confidence_measure
Confidence measures / scores.
Definition: MzTabM.h:146
std::map< Size, MzTabMStudyVariableMetaData > study_variable
Study Variable details.
Definition: MzTabM.h:138
MzTabParameter quantification_method
Quantification method used in the experiment.
Definition: MzTabM.h:134
std::map< Size, MzTabString > publication
Associated publication(s)
Definition: MzTabM.h:130
MzTabString mz_tab_id
MzTab-M file id (e.g. repository-, local identifier)
Definition: MzTabM.h:124
std::map< Size, MzTabMDatabaseMetaData > database
Database details.
Definition: MzTabM.h:141
MzTabString description
Description.
Definition: MzTabM.h:126
std::map< Size, MzTabContactMetaData > contact
Contact name.
Definition: MzTabM.h:131
std::vector< MzTabString > colunit_small_molecule_feature
Defines the unit used for a specific column.
Definition: MzTabM.h:148
MzTabParameter small_molecule_quantification_unit
Description of the unit type used.
Definition: MzTabM.h:143
std::map< Size, MzTabParameterList > sample_processing
List of parameters describing the sample processing/preparation/handling.
Definition: MzTabM.h:127
std::map< Size, MzTabInstrumentMetaData > instrument
List of parameters describing the instrument.
Definition: MzTabM.h:128
std::map< Size, MzTabParameter > custom
Custom parameters.
Definition: MzTabM.h:139
std::map< Size, MzTabSampleMetaData > sample
Sample details.
Definition: MzTabM.h:135
std::map< Size, MzTabMMSRunMetaData > ms_run
MS run details.
Definition: MzTabM.h:136
MzTabString title
Title.
Definition: MzTabM.h:125
std::map< Size, MzTabString > external_study_uri
Pointing to an external file with more details about the study (e.g. ISA-TAB file)
Definition: MzTabM.h:133
MzTabParameter small_molecule_identification_reliability
Reliability of identification (4-level schema)
Definition: MzTabM.h:145
MzTabParameter small_molecule_feature_quantification_unit
Description of the unit type used.
Definition: MzTabM.h:144
std::map< Size, MzTabString > uri
Pointing to file source (e.g. MetaboLights)
Definition: MzTabM.h:132
std::map< Size, MzTabParameter > derivatization_agent
A description of derivatization agents applied to small molecules.
Definition: MzTabM.h:142
std::map< Size, MzTabSoftwareMetaData > software
Software used to analyze the data.
Definition: MzTabM.h:129
Data model of MzTab-M files Please see the MzTab-M specification at https://github....
Definition: MzTabM.h:234
MzTabMSmallMoleculeFeatureSectionRows m_small_molecule_feature_data_
Definition: MzTabM.h:301
const std::map< Size, String > & getCommentRows() const
Get comment rows.
MzTabM()=default
Default constructor.
std::vector< Size > empty_rows_
index of empty rows
Definition: MzTabM.h:303
void setMetaData(const MzTabMMetaData &m_md)
Set MzTabMMetaData.
const std::vector< Size > & getEmptyRows() const
Get empty rows.
~MzTabM()=default
Destructor.
static void addMetaInfoToOptionalColumns(const std::set< String > &keys, std::vector< MzTabOptionalColumnEntry > &opt, const String &id, const MetaInfoInterface &meta)
const MzTabMMetaData & getMetaData() const
Extract MzTabMMetaData.
static String getAdductString_(const IdentificationDataInternal::ObservationMatchRef &match_ref)
std::map< Size, String > comment_rows_
comments
Definition: MzTabM.h:304
MzTabMSmallMoleculeEvidenceSectionRows m_small_molecule_evidence_data_
Definition: MzTabM.h:302
void setMSmallMoleculeEvidenceSectionRows(const MzTabMSmallMoleculeEvidenceSectionRows &m_smesd)
Set MzTabMSmallMoleculeEvidenceSectionRows.
std::vector< String > getMSmallMoleculeFeatureOptionalColumnNames() const
Extract opt_ (custom, optional column names)
MzTabMSmallMoleculeSectionRows m_small_molecule_data_
Definition: MzTabM.h:300
static MzTabM exportFeatureMapToMzTabM(const FeatureMap &feature_map)
Export FeatureMap with Identifications to MzTabM.
const MzTabMSmallMoleculeSectionRows & getMSmallMoleculeSectionRows() const
Extract MzTabMSmallMoleculeSectionRows.
const MzTabMSmallMoleculeEvidenceSectionRows & getMSmallMoleculeEvidenceSectionRows() const
Extract MzTabMSmallMoleculeEvidenceSectionRows.
static void getFeatureMapMetaValues_(const FeatureMap &feature_map, std::set< String > &feature_user_value_keys, std::set< String > &observationmatch_user_value_keys, std::set< String > &compound_user_value_keys)
std::vector< String > smf_optional_column_names_
Definition: MzTabM.h:306
std::vector< String > sml_optional_column_names_
Definition: MzTabM.h:305
MzTabMMetaData m_meta_data_
Definition: MzTabM.h:299
void setEmptyRows(const std::vector< Size > &empty)
Set empty rows.
void setMSmallMoleculeFeatureSectionRows(const MzTabMSmallMoleculeFeatureSectionRows &m_smfsd)
Set MzTabMSmallMoleculeFeatureSectionRows.
std::vector< String > getMSmallMoleculeEvidenceOptionalColumnNames() const
Extract opt_ (custom, optional column names)
std::vector< String > sme_optional_column_names_
Definition: MzTabM.h:307
std::vector< String > getMSmallMoleculeOptionalColumnNames() const
Extract opt_ (custom, optional column names)
void setCommentRows(const std::map< Size, String > &com)
Set comment rows.
void setMSmallMoleculeSectionRows(const MzTabMSmallMoleculeSectionRows &m_smsd)
Set MzTabMSmallMoleculeSectionRows.
const MzTabMSmallMoleculeFeatureSectionRows & getMSmallMoleculeFeatureSectionRows() const
Extract MzTabMSmallMoleculeFeatureSectionRows.
Definition: MzTabBase.h:269
Definition: MzTabBase.h:232
Definition: MzTabBase.h:318
Definition: MzTabBase.h:292
Definition: MzTabBase.h:206
A more convenient string class.
Definition: String.h:60
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
MzTabSpectraRef spectra_ref
Reference to a spectrum.
Definition: MzTabM.h:217
MzTabDouble calc_mass_to_charge
Precursor ion’s m/z.
Definition: MzTabM.h:216
std::map< Size, MzTabParameter > scan_polarity
The polarity mode of a given run.
Definition: MzTabM.h:84
MzTabString inchi
InChi of the potential compound identifications.
Definition: MzTabM.h:209
MzTabString prefix
The prefix used in the “identifier” column of data tables.
Definition: MzTabM.h:110
MzTabStringList adducts
Adducts.
Definition: MzTabM.h:167
MzTabStringList inchi
InChi of the potential compound identifications.
Definition: MzTabM.h:163
MzTabParameter isotopomer
If de-isotoping has not been performed, then the isotopomer quantified MUST be reported here.
Definition: MzTabM.h:188
MzTabString name
Name of the assay.
Definition: MzTabM.h:66
MzTabString external_uri
A reference to further information about the assay.
Definition: MzTabM.h:68
MzTabParameter format
Parameter specifying the data format of the external MS data file.
Definition: MzTabM.h:81
MzTabParameter derivatized_form
derivatized form.
Definition: MzTabM.h:212
std::map< Size, MzTabDouble > small_molecule_feature_abundance_assay
Feature abundance in every assay.
Definition: MzTabM.h:194
MzTabString sml_identifier
The small molecule’s identifier.
Definition: MzTabM.h:158
MzTabParameter ms_level
The highest MS level used to inform identification.
Definition: MzTabM.h:219
MzTabString smiles
Potential molecular structure as SMILES.
Definition: MzTabM.h:208
MzTabString uri
The URI to the database.
Definition: MzTabM.h:112
std::map< Size, MzTabParameter > fragmentation_method
The type of fragmentation used in a given ms run.
Definition: MzTabM.h:83
std::vector< int > assay_refs
References to the IDs of assays grouped in the study variable.
Definition: MzTabM.h:96
MzTabString reliability
Reliability of the given small molecule identification.
Definition: MzTabM.h:169
std::map< Size, MzTabParameter > custom
Additional parameters or values for a given assay.
Definition: MzTabM.h:67
MzTabInteger sme_id_ref_ambiguity_code
Ambiguity in identifications.
Definition: MzTabM.h:186
MzTabStringList uri
The source entry’s location.
Definition: MzTabM.h:165
MzTabParameter id_format
Parameter specifying the id format used in the external data file.
Definition: MzTabM.h:82
MzTabInteger charge
Precursor ion’s charge.
Definition: MzTabM.h:190
MzTabParameter variation_function
The function used to calculate the study variable quantification variation value.
Definition: MzTabM.h:98
MzTabString adduct
Adduct.
Definition: MzTabM.h:187
MzTabInteger instrument_ref
Link to a specific instrument.
Definition: MzTabM.h:80
MzTabString description
A textual description of the study variable.
Definition: MzTabM.h:99
MzTabStringList chemical_name
Possible chemical/common names or general description.
Definition: MzTabM.h:164
MzTabDouble rt_end
The end time of the feature on the retention time axis.
Definition: MzTabM.h:193
MzTabDouble retention_time
Time point in seconds.
Definition: MzTabM.h:191
MzTabParameter identification_method
Database search, search engine or process that was used to identify this small molecule.
Definition: MzTabM.h:218
MzTabStringList sme_id_refs
Reference to the identification evidence.
Definition: MzTabM.h:185
MzTabParameter average_function
The function used to calculate the study variable quantification value.
Definition: MzTabM.h:97
MzTabString smf_identifier
Within file unique identifier for the small molecule feature.
Definition: MzTabM.h:184
std::map< Size, MzTabDouble > small_molecule_abundance_study_variable
The small molecule’s abundance in all the study variables described in the metadata section.
Definition: MzTabM.h:173
MzTabParameter database
The description of databases used.
Definition: MzTabM.h:109
MzTabDouble rt_start
The start time of the feature on the retention time axis.
Definition: MzTabM.h:192
std::map< Size, MzTabDouble > small_molecule_abundance_variation_study_variable
A measure of the variability of the study variable abundance measurement.
Definition: MzTabM.h:174
MzTabString database_identifier
The putative identification for the small molecule sourced from an external database.
Definition: MzTabM.h:206
std::vector< MzTabMSmallMoleculeFeatureSectionRow > MzTabMSmallMoleculeFeatureSectionRows
Definition: MzTabM.h:226
MzTabStringList database_identifier
Names of the used databases.
Definition: MzTabM.h:160
MzTabStringList smiles
Molecular structure in SMILES format.
Definition: MzTabM.h:162
MzTabString location
Location of the external data file.
Definition: MzTabM.h:79
std::vector< MzTabMSmallMoleculeEvidenceSectionRow > MzTabMSmallMoleculeEvidenceSectionRows
Definition: MzTabM.h:227
MzTabParameter hash_method
Parameter specifying the hash methods.
Definition: MzTabM.h:86
MzTabDoubleList theoretical_neutral_mass
Precursor theoretical neutral mass.
Definition: MzTabM.h:166
MzTabDouble exp_mass_to_charge
Precursor ion’s m/z.
Definition: MzTabM.h:189
MzTabDouble best_id_confidence_value
The best confidence measure.
Definition: MzTabM.h:171
MzTabStringList smf_id_refs
References to all the features on which quantification has been based.
Definition: MzTabM.h:159
std::vector< MzTabOptionalColumnEntry > opt_
Optional columns must start with “opt_”.
Definition: MzTabM.h:175
MzTabString chemical_name
Possible chemical/common names or general description.
Definition: MzTabM.h:210
std::vector< MzTabMSmallMoleculeSectionRow > MzTabMSmallMoleculeSectionRows
Definition: MzTabM.h:225
MzTabString chemical_formula
The putative molecular formula.
Definition: MzTabM.h:207
MzTabString hash
Hash value of the corresponding external MS data file.
Definition: MzTabM.h:85
MzTabString sme_identifier
Within file unique identifier for the small molecule evidence result.
Definition: MzTabM.h:204
MzTabString evidence_input_id
Within file unique identifier for the input data used to support this identification e....
Definition: MzTabM.h:205
std::map< Size, MzTabDouble > small_molecule_abundance_assay
The small molecule’s abundance in every assay described in the metadata section.
Definition: MzTabM.h:172
MzTabParameterList factors
Additional parameters or factors.
Definition: MzTabM.h:100
MzTabInteger sample_ref
An association from a given assay to the sample analysed.
Definition: MzTabM.h:69
std::map< Size, MzTabDouble > id_confidence_measure
Statistical value or score for the identification.
Definition: MzTabM.h:220
MzTabString version
The database version.
Definition: MzTabM.h:111
MzTabInteger rank
Rank of the identification (1 = best)
Definition: MzTabM.h:221
MzTabParameter best_id_confidence_measure
The identification approach with the highest confidence.
Definition: MzTabM.h:170
MzTabInteger ms_run_ref
An association from a given assay to the source MS run.
Definition: MzTabM.h:70
MzTabStringList chemical_formula
Potential chemical formula of the reported compound.
Definition: MzTabM.h:161
MztabM Assay Metadata.
Definition: MzTabM.h:64
MztabM Database Metadata.
Definition: MzTabM.h:107
MztabM MSRun Metadata.
Definition: MzTabM.h:77
SME Small molecule evidence section (mztab-m)
Definition: MzTabM.h:202
SMF Small molecule feature section (mztab-m)
Definition: MzTabM.h:182
SML Small molecule section (mztab-m)
Definition: MzTabM.h:156
MztabM StudyVariable Metadata.
Definition: MzTabM.h:93
Data model of MzTabM files. Please see the official MzTabM specification at https://github....
Definition: MzTabM.h:53
bool operator()(const IdentificationDataInternal::ObservationMatchRef &lhs, const IdentificationDataInternal::ObservationMatchRef &rhs) const
Definition: MzTabM.h:54
Wrapper that adds operator< to iterators, so they can be used as (part of) keys in maps/sets or multi...
Definition: MetaData.h:46