OpenMS  2.5.0
MzTab.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: Timo Sachsenberg $
32 // $Authors: Timo Sachsenberg $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
44 
45 #include <map>
46 #include <vector>
47 #include <list>
48 #include <algorithm>
49 
50 #pragma clang diagnostic push
51 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
52 
53 namespace OpenMS
54 {
65  {
71  };
72 
74  class OPENMS_DLLAPI MzTabNullAbleInterface
75  {
76 public:
77  virtual ~MzTabNullAbleInterface();
78  virtual bool isNull() const = 0;
79  virtual void setNull(bool b) = 0;
80  virtual String toCellString() const = 0;
81  virtual void fromCellString(const String&) = 0;
82  };
83 
85  class OPENMS_DLLAPI MzTabNullNaNAndInfAbleInterface :
87  {
88 public:
90  virtual bool isNaN() const = 0;
91  virtual void setNaN() = 0;
92  virtual bool isInf() const = 0;
93  virtual void setInf() = 0;
94  };
95 
97  class OPENMS_DLLAPI MzTabNullAbleBase :
99  {
100 public:
102 
103  ~MzTabNullAbleBase() override;
104 
105  bool isNull() const override;
106 
107  void setNull(bool b) override;
108 
109 protected:
110  bool null_;
111  };
112 
114  class OPENMS_DLLAPI MzTabNullNaNAndInfAbleBase :
116  {
117 public:
119 
120  ~MzTabNullNaNAndInfAbleBase() override;
121 
122  bool isNull() const override;
123 
124  void setNull(bool b) override;
125 
126  bool isNaN() const override;
127 
128  void setNaN() override;
129 
130  bool isInf() const override;
131 
132  void setInf() override;
133 
134 protected:
136  };
137 
138  class OPENMS_DLLAPI MzTabDouble :
140  {
141 public:
142  MzTabDouble();
143 
144  explicit MzTabDouble(const double v);
145 
146  ~MzTabDouble() override;
147 
148  void set(const double& value);
149 
150  double get() const;
151 
152  String toCellString() const override;
153 
154  void fromCellString(const String& s) override;
155 
156 protected:
157  double value_;
158  };
159 
160  class OPENMS_DLLAPI MzTabDoubleList :
161  public MzTabNullAbleBase
162  {
163 public:
164  MzTabDoubleList();
165 
166  ~MzTabDoubleList() override;
167 
168  bool isNull() const override;
169 
170  void setNull(bool b) override;
171 
172  String toCellString() const override;
173 
174  void fromCellString(const String& s) override;
175 
176  std::vector<MzTabDouble> get() const;
177 
178  void set(const std::vector<MzTabDouble>& entries);
179 
180 protected:
181  std::vector<MzTabDouble> entries_;
182  };
183 
184  class OPENMS_DLLAPI MzTabInteger :
186  {
187 public:
188  MzTabInteger();
189 
190  explicit MzTabInteger(const int v);
191 
192  ~MzTabInteger() override;
193 
194  void set(const Int& value);
195 
196  Int get() const;
197 
198  String toCellString() const override;
199 
200  void fromCellString(const String& s) override;
201 
202 protected:
204  };
205 
206  class OPENMS_DLLAPI MzTabIntegerList :
207  public MzTabNullAbleBase
208  {
209 public:
211 
212  bool isNull() const override;
213 
214  void setNull(bool b) override;
215 
216  String toCellString() const override;
217 
218  void fromCellString(const String& s) override;
219 
220  std::vector<MzTabInteger> get() const;
221 
222  void set(const std::vector<MzTabInteger>& entries);
223 
224 protected:
225  std::vector<MzTabInteger> entries_;
226  };
227 
228  class OPENMS_DLLAPI MzTabBoolean :
229  public MzTabNullAbleBase
230  {
231 public:
232  MzTabBoolean();
233 
234  explicit MzTabBoolean(bool v);
235 
236  ~MzTabBoolean() override;
237 
238  void set(const bool& value);
239 
240  Int get() const;
241 
242  String toCellString() const override;
243 
244  void fromCellString(const String& s) override;
245 
246 protected:
247  bool value_;
248  };
249 
250  class OPENMS_DLLAPI MzTabString :
252  {
253 public:
254  MzTabString();
255 
256  explicit MzTabString(const String& s);
257 
258  ~MzTabString() override;
259 
260  void set(const String& value);
261 
262  String get() const;
263 
264  bool isNull() const override;
265 
266  void setNull(bool b) override;
267 
268  String toCellString() const override;
269 
270  void fromCellString(const String& s) override;
271 
272 protected:
274  };
275 
276  class OPENMS_DLLAPI MzTabParameter :
278  {
279 public:
280  MzTabParameter();
281 
282  ~MzTabParameter() override;
283 
284  bool isNull() const override;
285 
286  void setNull(bool b) override;
287 
288  void setCVLabel(const String& CV_label);
289 
290  void setAccession(const String& accession);
291 
292  void setName(const String& name);
293 
294  void setValue(const String& value);
295 
296  String getCVLabel() const;
297 
298  String getAccession() const;
299 
300  String getName() const;
301 
302  String getValue() const;
303 
304  String toCellString() const override;
305 
306  void fromCellString(const String& s) override;
307 
308 protected:
313  };
314 
315  class OPENMS_DLLAPI MzTabParameterList :
317  {
318 public:
319 
320  ~MzTabParameterList() override;
321 
322  bool isNull() const override;
323 
324  void setNull(bool b) override;
325 
326  String toCellString() const override;
327 
328  void fromCellString(const String& s) override;
329 
330  std::vector<MzTabParameter> get() const;
331 
332  void set(const std::vector<MzTabParameter>& parameters);
333 
334 protected:
335  std::vector<MzTabParameter> parameters_;
336  };
337 
338  class OPENMS_DLLAPI MzTabStringList :
340  {
341 public:
342  MzTabStringList();
343 
344  ~MzTabStringList() override;
345 
347  void setSeparator(char sep);
348 
349  bool isNull() const override;
350 
351  void setNull(bool b) override;
352 
353  String toCellString() const override;
354 
355  void fromCellString(const String& s) override;
356 
357  std::vector<MzTabString> get() const;
358 
359  void set(const std::vector<MzTabString>& entries);
360 
361 protected:
362  std::vector<MzTabString> entries_;
363  char sep_;
364  };
365 
366  class OPENMS_DLLAPI MzTabModification :
368  {
369 public:
371 
372  ~MzTabModification() override;
373 
374  bool isNull() const override;
375 
376  void setNull(bool b) override;
377 
379  void setPositionsAndParameters(const std::vector<std::pair<Size, MzTabParameter> >& ppp);
380 
381  std::vector<std::pair<Size, MzTabParameter> > getPositionsAndParameters() const;
382 
383  void setModificationIdentifier(const MzTabString& mod_id);
384 
385  MzTabString getModOrSubstIdentifier() const;
386 
387  String toCellString() const override;
388 
389  void fromCellString(const String& s) override;
390 
391 protected:
392  std::vector<std::pair<Size, MzTabParameter> > pos_param_pairs_;
394  };
395 
396  class OPENMS_DLLAPI MzTabModificationList :
397  public MzTabNullAbleBase
398  {
399 public:
400  ~MzTabModificationList() override;
401 
402  bool isNull() const override;
403 
404  void setNull(bool b) override;
405 
406  String toCellString() const override;
407 
408  void fromCellString(const String& s) override;
409 
410  std::vector<MzTabModification> get() const;
411 
412  void set(const std::vector<MzTabModification>& entries);
413 
414 protected:
415  std::vector<MzTabModification> entries_;
416 
417  };
418 
419  class OPENMS_DLLAPI MzTabSpectraRef :
421  {
422 public:
423  MzTabSpectraRef();
424 
425  ~MzTabSpectraRef() override;
426 
427  bool isNull() const override;
428 
429  void setNull(bool b) override;
430 
431  void setMSFile(Size index);
432 
433  void setSpecRef(const String& spec_ref);
434 
435  String getSpecRef() const;
436 
437  Size getMSFile() const;
438 
439  void setSpecRefFile(const String& spec_ref);
440 
441  String toCellString() const override;
442 
443  void fromCellString(const String& s) override;
444 
445 protected:
446  Size ms_run_; //< number is specified in the meta data section.
448  };
449 
450 // MTD
451 
452  struct OPENMS_DLLAPI MzTabSampleMetaData
453  {
455  std::map<Size, MzTabParameter> species;
456  std::map<Size, MzTabParameter> tissue;
457  std::map<Size, MzTabParameter> cell_type;
458  std::map<Size, MzTabParameter> disease;
459  std::map<Size, MzTabParameter> custom;
460  };
461 
462  struct OPENMS_DLLAPI MzTabSoftwareMetaData
463  {
465  //TODO shouldn't settings always consist of the name of the setting
466  // and the value?
467  std::map<Size, MzTabString> setting;
468  };
469 
470  struct OPENMS_DLLAPI MzTabModificationMetaData
471  {
475  };
476 
477  struct OPENMS_DLLAPI MzTabAssayMetaData
478  {
480  std::map<Size, MzTabModificationMetaData> quantification_mod;
482  std::vector<int> ms_run_ref; // adapted to address https://github.com/HUPO-PSI/mzTab/issues/26
483  };
484 
485  struct OPENMS_DLLAPI MzTabCVMetaData
486  {
491  };
492 
493  struct OPENMS_DLLAPI MzTabInstrumentMetaData
494  {
497  std::map<Size, MzTabParameter> analyzer;
499  };
500 
501  struct OPENMS_DLLAPI MzTabContactMetaData
502  {
506  };
507 
508  struct OPENMS_DLLAPI MzTabMSRunMetaData
509  {
514  };
515 
516  struct OPENMS_DLLAPI MzTabStudyVariableMetaData
517  {
518  std::vector<int> assay_refs;
519  std::vector<int> sample_refs;
521  };
522 
524  class OPENMS_DLLAPI MzTabMetaData
525  {
526 public:
527  MzTabMetaData();
528 
535 
536  std::map<Size, MzTabParameter> protein_search_engine_score;
537  std::map<Size, MzTabParameter> peptide_search_engine_score;
538  std::map<Size, MzTabParameter> psm_search_engine_score;
539  std::map<Size, MzTabParameter> smallmolecule_search_engine_score;
540  std::map<Size, MzTabParameter> nucleic_acid_search_engine_score;
541  std::map<Size, MzTabParameter> oligonucleotide_search_engine_score;
542  std::map<Size, MzTabParameter> osm_search_engine_score;
543 
544  std::map<Size, MzTabParameterList> sample_processing;
545 
546  std::map<Size, MzTabInstrumentMetaData> instrument;
547 
548  std::map<Size, MzTabSoftwareMetaData> software;
549 
551 
552  std::map<Size, MzTabString> publication;
553 
554  std::map<Size, MzTabContactMetaData> contact;
555 
556  std::map<Size, MzTabString> uri;
557 
558  std::map<Size, MzTabModificationMetaData> fixed_mod;
559 
560  std::map<Size, MzTabModificationMetaData> variable_mod;
561 
563 
567 
568  std::map<Size, MzTabMSRunMetaData> ms_run;
569 
570  std::map<Size, MzTabParameter> custom;
571 
572  std::map<Size, MzTabSampleMetaData> sample;
573 
574  std::map<Size, MzTabAssayMetaData> assay;
575 
576  std::map<Size, MzTabStudyVariableMetaData> study_variable;
577 
578  std::map<Size, MzTabCVMetaData> cv;
579 
580  std::vector<String> colunit_protein;
581  std::vector<String> colunit_peptide;
582  std::vector<String> colunit_psm;
583  std::vector<String> colunit_small_molecule;
584  };
585 
586  typedef std::pair<String, MzTabString> MzTabOptionalColumnEntry; //< column name (not null able), value (null able)
587 
589  struct OPENMS_DLLAPI MzTabProteinSectionRow
590  {
599  std::map<Size, MzTabDouble> best_search_engine_score;
600  std::map<Size, std::map<Size, MzTabDouble> > search_engine_score_ms_run;
602  std::map<Size, MzTabInteger> num_psms_ms_run;
603  std::map<Size, MzTabInteger> num_peptides_distinct_ms_run;
604  std::map<Size, MzTabInteger> num_peptides_unique_ms_run;
610  std::map<Size, MzTabDouble> protein_abundance_assay;
611  std::map<Size, MzTabDouble> protein_abundance_study_variable;
612  std::map<Size, MzTabDouble> protein_abundance_stdev_study_variable;
613  std::map<Size, MzTabDouble> protein_abundance_std_error_study_variable;
614  std::vector<MzTabOptionalColumnEntry> opt_;
615 
617  struct RowCompare
618  {
619  bool operator()(const MzTabProteinSectionRow& row1,
620  const MzTabProteinSectionRow& row2) const
621  {
622  return row1.accession.get() < row2.accession.get();
623  }
624  };
625  };
626 
628  struct OPENMS_DLLAPI MzTabPeptideSectionRow
629  {
636  std::map<Size, MzTabDouble> best_search_engine_score;
637  std::map<Size, std::map<Size, MzTabDouble> > search_engine_score_ms_run;
646  std::map<Size, MzTabDouble> peptide_abundance_assay;
647  std::map<Size, MzTabDouble> peptide_abundance_study_variable;
648  std::map<Size, MzTabDouble> peptide_abundance_stdev_study_variable;
649  std::map<Size, MzTabDouble> peptide_abundance_std_error_study_variable;
650  std::vector<MzTabOptionalColumnEntry> opt_;
651 
653  struct RowCompare
654  {
656  const MzTabPeptideSectionRow& row2) const
657  {
658  return (std::make_pair(row1.sequence.get(), row1.accession.get()) <
659  std::make_pair(row2.sequence.get(), row2.accession.get()));
660  }
661  };
662  };
663 
665  struct OPENMS_DLLAPI MzTabPSMSectionRow
666  {
674  std::map<Size, MzTabDouble> search_engine_score;
687  std::vector<MzTabOptionalColumnEntry> opt_;
688 
690  struct RowCompare
691  {
692  bool operator()(const MzTabPSMSectionRow& row1,
693  const MzTabPSMSectionRow& row2) const
694  {
695  // @TODO: sort by "PSM_ID"? what's the point of that field?
696  return (std::make_tuple(row1.sequence.get(),
697  row1.spectra_ref.getMSFile(),
698  row1.spectra_ref.getSpecRef(),
699  row1.accession.get()) <
700  std::make_tuple(row2.sequence.get(),
701  row2.spectra_ref.getMSFile(),
702  row2.spectra_ref.getSpecRef(),
703  row2.accession.get()));
704  }
705  };
706  };
707 
709  struct OPENMS_DLLAPI MzTabSmallMoleculeSectionRow
710  {
728  std::map<Size, MzTabDouble> best_search_engine_score;
729  std::map<Size, std::map<Size, MzTabDouble> > search_engine_score_ms_run;
731  std::map<Size, MzTabDouble> smallmolecule_abundance_assay;
732  std::map<Size, MzTabDouble> smallmolecule_abundance_study_variable;
733  std::map<Size, MzTabDouble> smallmolecule_abundance_stdev_study_variable;
735  std::vector<MzTabOptionalColumnEntry> opt_;
736  };
737 
739  struct OPENMS_DLLAPI MzTabNucleicAcidSectionRow
740  {
748  std::map<Size, MzTabDouble> best_search_engine_score;
749  std::map<Size, std::map<Size, MzTabDouble> > search_engine_score_ms_run;
751  std::map<Size, MzTabInteger> num_osms_ms_run;
752  std::map<Size, MzTabInteger> num_oligos_distinct_ms_run;
753  std::map<Size, MzTabInteger> num_oligos_unique_ms_run;
757  // do GO terms make sense for nucleic acid sequences?
760  std::vector<MzTabOptionalColumnEntry> opt_;
761 
763  struct RowCompare
764  {
766  const MzTabNucleicAcidSectionRow& row2) const
767  {
768  return row1.accession.get() < row2.accession.get();
769  }
770  };
771  };
772 
774  struct OPENMS_DLLAPI MzTabOligonucleotideSectionRow
775  {
780  std::map<Size, MzTabDouble> best_search_engine_score;
781  std::map<Size, std::map<Size, MzTabDouble>> search_engine_score_ms_run;
791  std::vector<MzTabOptionalColumnEntry> opt_;
792 
794  struct RowCompare
795  {
797  const MzTabOligonucleotideSectionRow& row2) const
798  {
799  return (std::make_tuple(row1.sequence.get(), row1.accession.get(),
800  row1.start.get(), row1.end.get()) <
801  std::make_tuple(row2.sequence.get(), row2.accession.get(),
802  row2.start.get(), row2.end.get()));
803  }
804  };
805 
806  };
807 
809  struct OPENMS_DLLAPI MzTabOSMSectionRow
810  {
813  std::map<Size, MzTabDouble> search_engine_score;
822  std::vector<MzTabOptionalColumnEntry> opt_;
823 
825  struct RowCompare
826  {
827  bool operator()(const MzTabOSMSectionRow& row1,
828  const MzTabOSMSectionRow& row2) const
829  {
830  return (std::make_tuple(row1.sequence.get(),
831  row1.spectra_ref.getMSFile(),
832  row1.spectra_ref.getSpecRef()) <
833  std::make_tuple(row2.sequence.get(),
834  row2.spectra_ref.getMSFile(),
835  row2.spectra_ref.getSpecRef()));
836  }
837  };
838  };
839 
840  typedef std::vector<MzTabProteinSectionRow> MzTabProteinSectionRows;
841  typedef std::vector<MzTabPeptideSectionRow> MzTabPeptideSectionRows;
842  typedef std::vector<MzTabPSMSectionRow> MzTabPSMSectionRows;
843  typedef std::vector<MzTabSmallMoleculeSectionRow> MzTabSmallMoleculeSectionRows;
844  typedef std::vector<MzTabNucleicAcidSectionRow> MzTabNucleicAcidSectionRows;
845  typedef std::vector<MzTabOligonucleotideSectionRow> MzTabOligonucleotideSectionRows;
846  typedef std::vector<MzTabOSMSectionRow> MzTabOSMSectionRows;
847 
848 
855  class OPENMS_DLLAPI MzTab
856  {
857  public:
859  MzTab();
860 
862  virtual ~MzTab();
863 
864  const MzTabMetaData& getMetaData() const;
865 
866  void setMetaData(const MzTabMetaData& md);
867 
868  const MzTabProteinSectionRows& getProteinSectionRows() const;
869 
870  void setProteinSectionRows(const MzTabProteinSectionRows& psd);
871 
872  const MzTabPeptideSectionRows& getPeptideSectionRows() const;
873 
874  void setPeptideSectionRows(const MzTabPeptideSectionRows& psd);
875 
876  const MzTabPSMSectionRows& getPSMSectionRows() const;
877 
878  void setPSMSectionRows(const MzTabPSMSectionRows& psd);
879 
880  const MzTabSmallMoleculeSectionRows& getSmallMoleculeSectionRows() const;
881 
882  void setSmallMoleculeSectionRows(const MzTabSmallMoleculeSectionRows& smsd);
883 
884  const MzTabNucleicAcidSectionRows& getNucleicAcidSectionRows() const;
885 
886  void setNucleicAcidSectionRows(const MzTabNucleicAcidSectionRows& nasd);
887 
888  const MzTabOligonucleotideSectionRows& getOligonucleotideSectionRows() const;
889 
890  void setOligonucleotideSectionRows(const MzTabOligonucleotideSectionRows& onsd);
891 
892  const MzTabOSMSectionRows& getOSMSectionRows() const;
893 
894  void setOSMSectionRows(const MzTabOSMSectionRows& osd);
895 
896  void setCommentRows(const std::map<Size, String>& com);
897 
898  void setEmptyRows(const std::vector<Size>& empty);
899 
900  const std::vector<Size>& getEmptyRows() const;
901 
902  const std::map<Size, String>& getCommentRows() const;
903 
905  std::vector<String> getProteinOptionalColumnNames() const;
906 
908  std::vector<String> getPeptideOptionalColumnNames() const;
909 
911  std::vector<String> getPSMOptionalColumnNames() const;
912 
914  std::vector<String> getSmallMoleculeOptionalColumnNames() const;
915 
916 
924  static void addPepEvidenceToRows(const std::vector<PeptideEvidence>& peptide_evidences, MzTabPSMSectionRow& row, MzTabPSMSectionRows& rows);
925 
927  std::vector<String> getNucleicAcidOptionalColumnNames() const;
928 
930  std::vector<String> getOligonucleotideOptionalColumnNames() const;
931 
932  static void addMetaInfoToOptionalColumns(const std::set<String>& keys, std::vector<MzTabOptionalColumnEntry>& opt, const String& id, const MetaInfoInterface& meta);
933 
935  std::vector<String> getOSMOptionalColumnNames() const;
936 
937  static std::map<Size, MzTabModificationMetaData> generateMzTabStringFromModifications(const std::vector<String>& mods);
938 
939  static std::map<Size, MzTabModificationMetaData> generateMzTabStringFromVariableModifications(const std::vector<String>& mods);
940 
941  static std::map<Size, MzTabModificationMetaData> generateMzTabStringFromFixedModifications(const std::vector<String>& mods);
942 
943  static MzTab exportFeatureMapToMzTab(const FeatureMap& feature_map, const String& filename);
944 
959  static MzTab exportIdentificationsToMzTab(
960  const std::vector<ProteinIdentification>& prot_ids,
961  const std::vector<PeptideIdentification>& peptide_ids,
962  const String& filename,
963  bool first_run_inference_only,
964  std::map<std::pair<size_t,size_t>,size_t>& map_run_fileidx_2_msfileidx,
965  std::map<String, size_t>& idrun_2_run_index,
966  bool export_empty_pep_ids = false);
967 
971  static MzTabModificationList extractModificationListFromAASequence(const AASequence& aas, const std::vector<String>& fixed_mods = std::vector<String>());
972 
984  static MzTab exportConsensusMapToMzTab(
985  const ConsensusMap& consensus_map,
986  const String& filename,
987  const bool first_run_inference_only,
988  const bool export_unidentified_features,
989  const bool export_unassigned_ids,
990  const bool export_subfeatures,
991  const bool export_empty_pep_ids = false,
992  const String& title = "ConsensusMap export from OpenMS");
993 
994 
995  protected:
997  template <typename SectionRows>
998  std::vector<String> getOptionalColumnNames_(const SectionRows& rows) const
999  {
1000  // vector is used to preserve the column order
1001  std::vector<String> names;
1002  if (!rows.empty())
1003  {
1004  for (typename SectionRows::const_iterator it = rows.begin(); it != rows.end(); ++it)
1005  {
1006  for (std::vector<MzTabOptionalColumnEntry>::const_iterator it_opt = it->opt_.begin(); it_opt != it->opt_.end(); ++it_opt)
1007  {
1008  if (std::find(names.begin(), names.end(), it_opt->first) == names.end())
1009  {
1010  names.push_back(it_opt->first);
1011  }
1012  }
1013  }
1014  }
1015  return names;
1016  }
1017 
1018  static void checkSequenceUniqueness_(const std::vector<PeptideIdentification>& curr_pep_ids);
1019 
1021  MzTabProteinSectionRows protein_data_;
1022  MzTabPeptideSectionRows peptide_data_;
1023  MzTabPSMSectionRows psm_data_;
1024  MzTabSmallMoleculeSectionRows small_molecule_data_;
1025  MzTabNucleicAcidSectionRows nucleic_acid_data_;
1026  MzTabOligonucleotideSectionRows oligonucleotide_data_;
1027  MzTabOSMSectionRows osm_data_;
1028  std::vector<Size> empty_rows_;
1029  std::map<Size, String> comment_rows_;
1030  };
1031 
1032 } // namespace OpenMS
1033 
1034 #pragma clang diagnostic pop
1035 
std::map< Size, MzTabParameter > cell_type
Definition: MzTab.h:457
MzTabParameter small_molecule_quantification_unit
Definition: MzTab.h:566
MzTabDouble coverage
(0-1) Fraction of nucleic acid sequence identified.
Definition: MzTab.h:759
bool operator()(const MzTabNucleicAcidSectionRow &row1, const MzTabNucleicAcidSectionRow &row2) const
Definition: MzTab.h:765
std::map< Size, MzTabParameter > osm_search_engine_score
Definition: MzTab.h:542
std::map< Size, MzTabDouble > smallmolecule_abundance_stdev_study_variable
Definition: MzTab.h:733
std::vector< MzTabPeptideSectionRow > MzTabPeptideSectionRows
Definition: MzTab.h:841
Comparison operator for sorting rows.
Definition: MzTab.h:825
Definition: MzTab.h:366
MzTabInteger taxid
NEWT taxonomy for the species.
Definition: MzTab.h:720
std::map< Size, MzTabModificationMetaData > variable_mod
Definition: MzTab.h:560
MzTabString uri
Location of the PSMs source entry.
Definition: MzTab.h:644
Definition: MzTab.h:276
MzTabParameterList search_engine
Search engine(s) identifying the protein.
Definition: MzTab.h:598
MzTabInteger reliability
Definition: MzTab.h:601
MzTabParameter detector
Definition: MzTab.h:498
String spec_ref_
Definition: MzTab.h:447
Definition: MzTab.h:68
double value_
Definition: MzTab.h:157
MzTabParameter protein_quantification_unit
Definition: MzTab.h:564
std::vector< std::pair< Size, MzTabParameter > > pos_param_pairs_
Definition: MzTab.h:392
MzTabModificationList modifications
Modifications identified in the protein.
Definition: MzTab.h:606
std::vector< MzTabDouble > entries_
Definition: MzTab.h:181
std::map< Size, std::map< Size, MzTabDouble > > search_engine_score_ms_run
Definition: MzTab.h:637
MzTabString accession
The protein’s accession.
Definition: MzTab.h:592
String getSpecRef() const
std::map< Size, MzTabInteger > num_peptides_unique_ms_run
Definition: MzTab.h:604
std::map< Size, MzTabParameter > species
Definition: MzTab.h:455
Size ms_run_
Definition: MzTab.h:446
Definition: MzTab.h:419
std::vector< MzTabParameter > parameters_
Definition: MzTab.h:335
std::map< Size, MzTabInteger > num_psms_ms_run
Definition: MzTab.h:602
MzTabParameter quantification_method
Definition: MzTab.h:562
String get() const
std::vector< String > colunit_psm
Definition: MzTab.h:582
String value_
Definition: MzTab.h:312
std::map< Size, MzTabParameter > protein_search_engine_score
Definition: MzTab.h:536
std::map< Size, MzTabDouble > smallmolecule_abundance_assay
Definition: MzTab.h:731
MzTabString site
Definition: MzTab.h:473
MzTabString post
Definition: MzTab.h:684
std::map< Size, MzTabParameterList > sample_processing
Definition: MzTab.h:544
MzTabString database
Name of the sequence database.
Definition: MzTab.h:633
std::map< Size, MzTabString > setting
Definition: MzTab.h:467
MzTabString accession
The protein’s accession.
Definition: MzTab.h:631
std::vector< MzTabNucleicAcidSectionRow > MzTabNucleicAcidSectionRows
Definition: MzTab.h:844
std::map< Size, MzTabMSRunMetaData > ms_run
Definition: MzTab.h:568
MzTabPeptideSectionRows peptide_data_
Definition: MzTab.h:1022
std::vector< MzTabSmallMoleculeSectionRow > MzTabSmallMoleculeSectionRows
Definition: MzTab.h:843
MzTabInteger PSM_ID
Definition: MzTab.h:668
std::vector< MzTabProteinSectionRow > MzTabProteinSectionRows
Definition: MzTab.h:840
MzTabBoolean unique
0=false, 1=true, null else: Peptide is unique for the protein.
Definition: MzTab.h:632
MzTabDouble coverage
(0-1) Amount of protein sequence identified.
Definition: MzTab.h:609
MzTabString database
Name of the protein database.
Definition: MzTab.h:596
std::vector< MzTabString > entries_
Definition: MzTab.h:362
MzTabString description
Definition: MzTab.h:454
MzTabStringList go_terms
List of GO terms for the nucleic acid.
Definition: MzTab.h:758
bool operator()(const MzTabPeptideSectionRow &row1, const MzTabPeptideSectionRow &row2) const
Definition: MzTab.h:655
MzTabProteinSectionRows protein_data_
Definition: MzTab.h:1021
MzTabSpectraRef spectra_ref
Spectra identifying the peptide.
Definition: MzTab.h:645
std::map< Size, MzTabDouble > search_engine_score
Search engine(s) score(s) for the peptide.
Definition: MzTab.h:674
MzTabCellStateType
Data model of MzTab files.
Definition: MzTab.h:64
MzTabMetaData meta_data_
Definition: MzTab.h:1020
MzTabString inchi_key
InChi Key of the identified compound.
Definition: MzTab.h:714
std::map< Size, MzTabParameter > oligonucleotide_search_engine_score
Definition: MzTab.h:541
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
MzTabOSMSectionRows osm_data_
/ oligonucleotide-spectrum matches
Definition: MzTab.h:1027
MzTabString modifications
Modifications identified on the small molecule.
Definition: MzTab.h:730
MzTabString start
Definition: MzTab.h:685
std::map< Size, MzTabString > uri
Definition: MzTab.h:556
MzTabString full_name
Definition: MzTab.h:488
MzTabParameter quantification_reagent
Definition: MzTab.h:479
bool find(TFinder &finder, const Pattern< TNeedle, FuzzyAC > &me, PatternAuxData< TNeedle > &dh)
Definition: AhoCorasickAmbiguous.h:884
MzTabString sample_ref
Definition: MzTab.h:481
MzTabString sequence
The peptide’s sequence.
Definition: MzTab.h:630
MzTabString mz_tab_version
Definition: MzTab.h:529
MzTabString mz_tab_id
Definition: MzTab.h:532
bool value_
Definition: MzTab.h:247
std::vector< String > colunit_small_molecule
Definition: MzTab.h:583
std::map< Size, MzTabDouble > smallmolecule_abundance_std_error_study_variable
Definition: MzTab.h:734
std::map< Size, MzTabDouble > best_search_engine_score
Search engine(s) score(s) for the peptide.
Definition: MzTab.h:636
MzTabString description
Definition: MzTab.h:534
std::map< Size, MzTabSampleMetaData > sample
Definition: MzTab.h:572
std::map< Size, MzTabParameter > custom
Definition: MzTab.h:570
MzTabString location
Definition: MzTab.h:511
MzTabString pre
Definition: MzTab.h:683
std::map< Size, MzTabParameter > tissue
Definition: MzTab.h:456
MzTabString name
Definition: MzTab.h:503
Comparison operator for sorting rows.
Definition: MzTab.h:617
std::map< Size, MzTabInstrumentMetaData > instrument
Definition: MzTab.h:546
base class for atomic, non-container types (Double, Int)
Definition: MzTab.h:97
MzTabString email
Definition: MzTab.h:505
MzTabParameter source
Definition: MzTab.h:496
std::map< Size, MzTabSoftwareMetaData > software
Definition: MzTab.h:548
Definition: MzTab.h:67
std::vector< MzTabPSMSectionRow > MzTabPSMSectionRows
Definition: MzTab.h:842
MzTabString url
Definition: MzTab.h:490
std::map< Size, MzTabParameter > smallmolecule_search_engine_score
Definition: MzTab.h:539
MzTabCellStateType state_
Definition: MzTab.h:135
Definition: MzTab.h:70
MzTabParameterList false_discovery_rate
Definition: MzTab.h:550
A container for features.
Definition: FeatureMap.h:95
MzTabModificationList modifications
Modifications identified in the peptide.
Definition: MzTab.h:639
std::vector< Size > empty_rows_
index of empty rows
Definition: MzTab.h:1028
MzTabParameter peptide_quantification_unit
Definition: MzTab.h:565
Definition: MzTab.h:516
OLI - Oligonucleotide section (table-based)
Definition: MzTab.h:774
SML Small molecule section (table based)
Definition: MzTab.h:709
std::map< Size, MzTabDouble > protein_abundance_assay
Definition: MzTab.h:610
NUC - Nucleic acid section (table-based)
Definition: MzTab.h:739
std::map< Size, MzTabDouble > best_search_engine_score
best_search_engine_score[1-n]
Definition: MzTab.h:599
PSM - PSM section (Table based)
Definition: MzTab.h:665
PEP - Peptide section (Table based)
Definition: MzTab.h:628
std::vector< int > ms_run_ref
Definition: MzTab.h:482
OSM - OSM (oligonucleotide-spectrum match) section (table-based)
Definition: MzTab.h:809
std::vector< MzTabOligonucleotideSectionRow > MzTabOligonucleotideSectionRows
Definition: MzTab.h:845
Definition: MzTab.h:206
char sep_
Definition: MzTab.h:363
std::map< Size, MzTabAssayMetaData > assay
Definition: MzTab.h:574
Definition: MzTab.h:477
Definition: MzTab.h:485
Definition: MzTab.h:493
Definition: MzTab.h:462
Definition: MzTab.h:470
Definition: MzTab.h:452
MzTabString mz_tab_mode
Definition: MzTab.h:530
std::map< Size, MzTabParameter > peptide_search_engine_score
Definition: MzTab.h:537
Comparison operator for sorting rows.
Definition: MzTab.h:653
std::map< Size, MzTabModificationMetaData > fixed_mod
Definition: MzTab.h:558
Definition: MzTab.h:138
Definition: MzTab.h:501
Definition: MzTab.h:508
std::map< Size, String > comment_rows_
comments
Definition: MzTab.h:1029
std::map< Size, std::map< Size, MzTabDouble > > search_engine_score_ms_run
search_engine_score[index1]_ms_run[index2]
Definition: MzTab.h:600
std::map< Size, MzTabDouble > peptide_abundance_stdev_study_variable
Definition: MzTab.h:648
MzTabDoubleList retention_time_window
Definition: MzTab.h:641
MzTabString database_version
Version (and optionally # of entries).
Definition: MzTab.h:634
std::map< Size, MzTabInteger > num_oligos_distinct_ms_run
Definition: MzTab.h:752
MzTabString uri
Location of the protein’s source entry.
Definition: MzTab.h:607
String name_
Definition: MzTab.h:311
MzTabDouble calc_mass_to_charge
Definition: MzTab.h:680
std::map< Size, MzTabModificationMetaData > quantification_mod
Definition: MzTab.h:480
MzTabStringList ambiguity_members
Alternative nucleic acid identifications.
Definition: MzTab.h:754
MzTabStringList identifier
The small molecule’s identifier.
Definition: MzTab.h:711
MzTabSmallMoleculeSectionRows small_molecule_data_
Definition: MzTab.h:1024
Definition: MzTab.h:338
std::map< Size, MzTabDouble > protein_abundance_stdev_study_variable
Definition: MzTab.h:612
Definition: MzTab.h:69
Comparison operator for sorting rows.
Definition: MzTab.h:763
Definition: MzTab.h:250
MzTabString database_version
String Version of the protein database.
Definition: MzTab.h:597
MzTabString species
Human readable name of the species.
Definition: MzTab.h:595
MzTabString position
Definition: MzTab.h:474
std::map< Size, MzTabParameter > psm_search_engine_score
Definition: MzTab.h:538
std::vector< MzTabOSMSectionRow > MzTabOSMSectionRows
Definition: MzTab.h:846
std::map< Size, MzTabStudyVariableMetaData > study_variable
Definition: MzTab.h:576
MzTabParameterList search_engine
Search engine(s) that identified the peptide.
Definition: MzTab.h:635
MzTabString title
Definition: MzTab.h:533
MzTabDoubleList retention_time
Time points in seconds. Semantics may vary.
Definition: MzTab.h:640
MzTabString version
Definition: MzTab.h:489
Representation of a peptide/protein sequence.
Definition: AASequence.h:113
String value_
Definition: MzTab.h:273
std::map< Size, MzTabDouble > peptide_abundance_assay
Definition: MzTab.h:646
std::map< Size, MzTabInteger > num_peptides_distinct_ms_run
Definition: MzTab.h:603
std::map< Size, MzTabParameter > custom
Definition: MzTab.h:459
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:60
MzTabParameter modification
Definition: MzTab.h:472
PRT - Protein section (Table based)
Definition: MzTab.h:589
interface for NaN- and Inf- able datatypes (Double and Integer in MzTab). These are as well null-able...
Definition: MzTab.h:85
MzTabString species
Human readable name of the species.
Definition: MzTab.h:721
Int value_
Definition: MzTab.h:203
MzTabString label
Definition: MzTab.h:487
MzTabInteger taxid
NEWT taxonomy for the species.
Definition: MzTab.h:594
Data model of MzTab files. Please see the official MzTab specification at https://code.google.com/p/mztab/.
Definition: MzTab.h:855
Definition: MzTab.h:396
std::map< Size, MzTabInteger > num_oligos_unique_ms_run
Definition: MzTab.h:753
MzTabParameter id_format
Definition: MzTab.h:512
bool null_
Definition: MzTab.h:110
MzTabString mz_tab_type
Definition: MzTab.h:531
MzTabInteger charge
Precursor ion’s charge.
Definition: MzTab.h:642
MzTabInteger reliability
(1-3) 0=null Identification reliability for the peptide.
Definition: MzTab.h:638
Definition: MzTab.h:66
MzTabParameter software
Definition: MzTab.h:464
MzTabParameter format
Definition: MzTab.h:510
Comparison operator for sorting rows.
Definition: MzTab.h:690
Definition: MzTab.h:184
A more convenient string class.
Definition: String.h:58
std::map< Size, MzTabDouble > smallmolecule_abundance_study_variable
Definition: MzTab.h:732
MzTabString mod_identifier_
Definition: MzTab.h:393
bool operator()(const MzTabProteinSectionRow &row1, const MzTabProteinSectionRow &row2) const
Definition: MzTab.h:619
A container for consensus elements.
Definition: ConsensusMap.h:79
base class for the atomic non-container like MzTab data types (Double, Int)
Definition: MzTab.h:114
std::map< Size, MzTabParameter > disease
Definition: MzTab.h:458
MzTabDouble exp_mass_to_charge
The m/z ratio of the experimental precursor ion.
Definition: MzTab.h:679
MzTabParameter name
Definition: MzTab.h:495
std::map< Size, MzTabDouble > protein_abundance_study_variable
Definition: MzTab.h:611
all meta data of a mzTab file. Please refer to specification for documentation.
Definition: MzTab.h:524
basic interface for all MzTab datatypes (can be null; are converted from and to cell string) ...
Definition: MzTab.h:74
std::vector< int > sample_refs
Definition: MzTab.h:519
MzTabPSMSectionRows psm_data_
Definition: MzTab.h:1023
MzTabStringList ambiguity_members
Alternative protein identifications.
Definition: MzTab.h:605
std::map< Size, MzTabInteger > num_osms_ms_run
Definition: MzTab.h:751
MzTabNucleicAcidSectionRows nucleic_acid_data_
Definition: MzTab.h:1025
std::vector< MzTabOptionalColumnEntry > opt_
Optional columns must start with “opt_”.
Definition: MzTab.h:650
MzTabParameterList fragmentation_method
Definition: MzTab.h:513
std::vector< String > getOptionalColumnNames_(const SectionRows &rows) const
Helper function for "get...OptionalColumnNames" functions.
Definition: MzTab.h:998
std::map< Size, MzTabCVMetaData > cv
Definition: MzTab.h:578
std::map< Size, MzTabParameter > analyzer
Definition: MzTab.h:497
MzTabString chemical_formula
Chemical formula of the identified compound.
Definition: MzTab.h:712
std::vector< MzTabInteger > entries_
Definition: MzTab.h:225
std::map< Size, MzTabContactMetaData > contact
Definition: MzTab.h:554
std::map< Size, MzTabDouble > peptide_abundance_study_variable
Definition: MzTab.h:647
bool operator()(const MzTabOSMSectionRow &row1, const MzTabOSMSectionRow &row2) const
Definition: MzTab.h:827
Comparison operator for sorting rows.
Definition: MzTab.h:794
Definition: MzTab.h:315
std::map< Size, MzTabParameter > nucleic_acid_search_engine_score
Definition: MzTab.h:540
Definition: MzTab.h:228
std::vector< int > assay_refs
Definition: MzTab.h:518
std::map< Size, MzTabDouble > peptide_abundance_std_error_study_variable
Definition: MzTab.h:649
MzTabOligonucleotideSectionRows oligonucleotide_data_
Definition: MzTab.h:1026
bool operator()(const MzTabOligonucleotideSectionRow &row1, const MzTabOligonucleotideSectionRow &row2) const
Definition: MzTab.h:796
std::map< Size, MzTabDouble > protein_abundance_std_error_study_variable
Definition: MzTab.h:613
String accession_
Definition: MzTab.h:310
std::vector< String > colunit_protein
Definition: MzTab.h:580
std::map< Size, MzTabString > publication
Definition: MzTab.h:552
Definition: MzTab.h:160
MzTabStringList go_terms
List of GO terms for the protein.
Definition: MzTab.h:608
String CV_label_
Definition: MzTab.h:309
MzTabString end
Definition: MzTab.h:686
std::vector< MzTabOptionalColumnEntry > opt_
Optional Columns must start with “opt_”
Definition: MzTab.h:614
MzTabString affiliation
Definition: MzTab.h:504
bool operator()(const MzTabPSMSectionRow &row1, const MzTabPSMSectionRow &row2) const
Definition: MzTab.h:692
MzTabString smiles
Molecular structure in SMILES format.
Definition: MzTab.h:713
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
MzTabDouble mass_to_charge
Precursor ion’s m/z.
Definition: MzTab.h:643
std::pair< String, MzTabString > MzTabOptionalColumnEntry
Definition: MzTab.h:586
std::vector< String > colunit_peptide
Definition: MzTab.h:581
MzTabString description
Human readable description (i.e. the name)
Definition: MzTab.h:593
std::vector< MzTabModification > entries_
Definition: MzTab.h:415