OpenMS
Loading...
Searching...
No Matches
QCBase.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: Chris Bielow, Tom Waschischeck $
7// --------------------------------------------------------------------------
8
9#pragma once
10
14#include <algorithm>
15#include <map>
16
17namespace OpenMS
18{
19 class MSExperiment;
20 class ConsensusMap;
21
28 class OPENMS_DLLAPI QCBase
29 {
30 public:
34 enum class Requires : UInt64 // 64 bit unsigned type for bitwise and/or operations (see below)
35 {
36 NOTHING, //< default, does not require anything
37 RAWMZML, //< mzML file is required
38 POSTFDRFEAT, //< Features with FDR-filtered pepIDs
39 PREFDRFEAT, //< Features with unfiltered pepIDs
40 CONTAMINANTS, //< Contaminant Database
41 TRAFOALIGN, //< transformationXMLs for RT-alignment
42 ID, //< idXML with protein IDs
43 SIZE_OF_REQUIRES
44 };
46 static const std::string names_of_requires[];
47
48 enum class ToleranceUnit
49 {
50 AUTO,
51 PPM,
52 DA,
53 SIZE_OF_TOLERANCEUNIT
54 };
56 static const std::string names_of_toleranceUnit[];
57
58
62 class OPENMS_DLLAPI SpectraMap
63 {
64 public:
66 SpectraMap() = default;
67
69 explicit SpectraMap(const MSExperiment& exp);
70
72 ~SpectraMap() = default;
73
75 void calculateMap(const MSExperiment& exp);
76
79 UInt64 at(const String& identifier) const;
80
82 void clear();
83
85 bool empty() const;
86
88 Size size() const;
89
90 private:
91 std::map<String, UInt64> nativeid_to_index_; //< nativeID to index
92 };
93
95
96
100 virtual const String& getName() const = 0;
101
105 virtual Status requirements() const = 0;
106
107
110 bool isRunnable(const Status& s) const;
111
113 static bool isLabeledExperiment(const ConsensusMap& cm);
114
116 template<typename MAP>
117 static bool hasPepID(const MAP& fmap)
118 {
119 if (!fmap.getUnassignedPeptideIdentifications().empty())
120 return true;
121
122 return std::any_of(fmap.cbegin(), fmap.cend(), [](const auto& f) { return !f.getPeptideIdentifications().empty(); });
123 }
124 };
125} // namespace OpenMS
A container for consensus elements.
Definition ConsensusMap.h:68
Stores and handles combinations of enum values, e.g. a set of flags as bits flipped in an UInt64.
Definition FlagSet.h:28
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
Map to find a spectrum via its NativeID.
Definition QCBase.h:63
std::map< String, UInt64 > nativeid_to_index_
Definition QCBase.h:91
bool empty() const
check if empty
SpectraMap(const MSExperiment &exp)
CTor which allows immediate indexing of an MSExperiment.
UInt64 at(const String &identifier) const
void calculateMap(const MSExperiment &exp)
calculate a new map, delete the old one
SpectraMap()=default
Constructor.
void clear()
clear the map
Size size() const
get size of map
~SpectraMap()=default
Destructor.
This class serves as an abstract base class for all QC classes.
Definition QCBase.h:29
static bool hasPepID(const MAP &fmap)
does the container have a PeptideIdentification in its members or as unassignedPepID ?
Definition QCBase.h:117
virtual Status requirements() const =0
Returns the input data requirements of the compute(...) function.
static bool isLabeledExperiment(const ConsensusMap &cm)
check if the IsobaricAnalyzer TOPP tool was used to create this ConsensusMap
virtual const String & getName() const =0
Returns the name of the metric.
bool isRunnable(const Status &s) const
Requires
Enum to encode a file type as a bit.
Definition QCBase.h:35
ToleranceUnit
Definition QCBase.h:49
A more convenient string class.
Definition String.h:34
uint64_t UInt64
Unsigned integer type (64bit)
Definition Types.h:47
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
@ PPM
parts-per-million