OpenMS
MQExporterHelper.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Chris Bielow$
6 // $Authors: Virginia Rossow, Lenny Kovac, Hendrik Beschorner$
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <fstream>
14 #include <OpenMS/KERNEL/Feature.h>
18 
19 class OPENMS_DLLAPI MQExporterHelper
25 {
26 public:
27 
29  {
30  std::stringstream modifications;
31  char acetyl;
32  std::stringstream oxidation;
33  std::stringstream gene_names;
34  std::stringstream protein_names;
35  std::stringstream msms_mz;
36  std::stringstream mass_error_ppm;
37  std::stringstream mass_error_da;
38  std::stringstream uncalibrated_mass_error_ppm;
39  std::stringstream uncalibrated_mass_error_da;
40  std::stringstream uncalibrated_calibrated_mz_ppm;
41  std::stringstream uncalibrated_calibrated_mz_mda;
42  std::stringstream base_peak_fraction;
43 
44  // common columns in msms and evividence exporter
45  //file_ << "Sequence" << "\t"; maybe, relativ trivial
46  //file_ << "Length" << "\t";
47  //file_ << "Modifications" << "\t"; implementieren
48  // file_ << "Modified sequence" << "\t"; implementieren
49  //file_ << "Acetyl (Protein N-term)" << "\t"; implementieren
50  //file_ << "Oxidation (M)" << "\t"; implementieren
51  //file_ << "Missed cleavages" << "\t"; trivial
52  //file_ << "Proteins" << "\t"; trivial
53  //file_ << "Gene Names" << "\t"; // in progress, aber implementieren
54  //file_ << "Protein Names" << "\t"; // in progress, aber implementieren
55  //file_ << "Type" << "\t"; TODO different type
56  //file_ << "Raw file" << "\t"; trivial
57  //file_ << "MS/MS m/z" << "\t"; implementieren TODO is m/z in MSMS MS/MS m/z
58  //file_ << "Charge" << "\t"; trivial
59  //file_ << "m/z" << "\t"; trivial TODO
60  //file_ << "Mass" << "\t"; trivial
61  //file_ << "Mass Error [ppm]" << "\t"; vielleicht, beim einen halt noch calibrated dabei
62  //file_ << "Mass Error [Da]" << "\t"; vielleicht, beim einen halt noch calibrated dabei
63  //file_ << "Retention time" << "\t"; trivial
64  //file_ << "Fraction of total spectrum" << "\t"; trivial
65  //file_ << "Base peak fraction" << "\t"; trvial
66  //file_ << "PEP" << "\t"; trivial
67  //file_ << "MS/MS Scan Number" << "\t"; trivial
68  //file_ << "Score" << "\t"; trivial
69  //file_ << "Delta score" << "\t"; trivial
70  //file_ << "Reverse" << "\t";
71  //file_ << "id" << "\t"; ?
72  //file_ << "Protein group IDs" << "\n"; trivial
73 
74  explicit MQCommonOutputs(
75  const OpenMS::Feature& f,
76  const OpenMS::ConsensusMap& cmap,
77  const OpenMS::Size c_feature_number,
78  const std::multimap<OpenMS::String, std::pair<OpenMS::Size, OpenMS::Size>>& UIDs,
80  const OpenMS::MSExperiment& exp,
81  const std::map<OpenMS::String,OpenMS::String>& prot_mapper);
82  };
83 
89 static OpenMS::String extractGeneName(const OpenMS::String& prot_description);
90 
104  static OpenMS::Size proteinGroupID_(std::map<OpenMS::String, OpenMS::Size>& database,
105  const OpenMS::String& protein_accession);
106 
117  static std::map<OpenMS::Size, OpenMS::Size> makeFeatureUIDtoConsensusMapIndex_(const OpenMS::ConsensusMap& cmap);
118 
132  static bool hasValidPepID_(
133  const OpenMS::Feature& f,
134  const OpenMS::Size c_feature_number,
135  const std::multimap<OpenMS::String, std::pair<OpenMS::Size, OpenMS::Size>>& UIDs,
137 
149 
150 
157  static bool isValid(const std::string& filename_);
158 };
Helper class for common functions and NON trivial values needed for exporting MaxQuant outputs.
Definition: MQExporterHelper.h:25
static bool isValid(const std::string &filename_)
Checks if file is writable (i.e. the path in the ctor was not empty and could be created)
static OpenMS::String extractGeneName(const OpenMS::String &prot_description)
Extract a gene name from a protein description by looking for the substring 'GN='.
static std::map< OpenMS::Size, OpenMS::Size > makeFeatureUIDtoConsensusMapIndex_(const OpenMS::ConsensusMap &cmap)
Creates map that has the information which FeatureUID is mapped to which ConsensusFeature in Consensu...
static bool hasValidPepID_(const OpenMS::Feature &f, const OpenMS::Size c_feature_number, const std::multimap< OpenMS::String, std::pair< OpenMS::Size, OpenMS::Size >> &UIDs, const OpenMS::ProteinIdentification::Mapping &mp_f)
Checks if Feature has valid PeptideIdentifications.
static bool hasPeptideIdentifications_(const OpenMS::ConsensusFeature &cf)
Checks if ConsensusFeature has valid PeptideIdentifications.
static OpenMS::Size proteinGroupID_(std::map< OpenMS::String, OpenMS::Size > &database, const OpenMS::String &protein_accession)
Returns a unique ID (number) for each distinct protein accession, or creates a new ID by augmenting t...
A consensus feature spanning multiple LC-MS/MS experiments.
Definition: ConsensusFeature.h:45
A container for consensus elements.
Definition: ConsensusMap.h:66
An LC-MS feature.
Definition: Feature.h:46
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:46
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
Definition: MQExporterHelper.h:29
std::stringstream mass_error_ppm
Definition: MQExporterHelper.h:36
std::stringstream uncalibrated_mass_error_ppm
Definition: MQExporterHelper.h:38
std::stringstream modifications
Definition: MQExporterHelper.h:30
std::stringstream base_peak_fraction
Definition: MQExporterHelper.h:42
std::stringstream mass_error_da
Definition: MQExporterHelper.h:37
std::stringstream uncalibrated_calibrated_mz_mda
Definition: MQExporterHelper.h:41
std::stringstream gene_names
Definition: MQExporterHelper.h:33
std::stringstream uncalibrated_calibrated_mz_ppm
Definition: MQExporterHelper.h:40
std::stringstream uncalibrated_mass_error_da
Definition: MQExporterHelper.h:39
std::stringstream protein_names
Definition: MQExporterHelper.h:34
std::stringstream msms_mz
Definition: MQExporterHelper.h:35
std::stringstream oxidation
Definition: MQExporterHelper.h:32
char acetyl
Definition: MQExporterHelper.h:31
MQCommonOutputs(const OpenMS::Feature &f, const OpenMS::ConsensusMap &cmap, const OpenMS::Size c_feature_number, const std::multimap< OpenMS::String, std::pair< OpenMS::Size, OpenMS::Size >> &UIDs, const OpenMS::ProteinIdentification::Mapping &mp_f, const OpenMS::MSExperiment &exp, const std::map< OpenMS::String, OpenMS::String > &prot_mapper)
two way mapping from ms-run-path to protID|pepID-identifier
Definition: ProteinIdentification.h:57