OpenMS  3.0.0
MetaboliteFeatureDeconvolution.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-2022.
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: Fabian Aicheler $
32 // $Authors: $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 // OpenMS
43 
45 
46 #include <map>
47 
48 namespace OpenMS
49 {
50 
51  class Compomer;
52 
61  class OPENMS_DLLAPI MetaboliteFeatureDeconvolution :
62  public DefaultParamHandler
63  {
64 public:
65 
66  enum CHARGEMODE {QFROMFEATURE = 1, QHEURISTIC, QALL};
67 
71 
77 
80 
83 
87 
98  void compute(const FeatureMap& fm_in, FeatureMap& fm_out, ConsensusMap& cons_map, ConsensusMap& cons_map_p);
99 
100 
101 protected:
102 
103 
104  void updateMembers_() override;
105 
111  struct CmpInfo_;
112 
113  /*
114  @brief test for obviously wrong parameter settings and warn
115 
116  Currently supports the following scenarios:
117  * If the lower charge bound is too high, consensus features with gapped, even charges will occur (e.g. 30,32,34), instead of the true (15,16,17)
118  When more than 5% of the cf's look like this, we report it.
119 
120  */
121  void checkSolution_(const ConsensusMap& cons_map) const;
122 
127  void inferMoreEdges_(PairsType& edges, std::map<Size, std::set<CmpInfo_>>& feature_adducts);
128 
129  void candidateEdges_(FeatureMap& fm_out, const Adduct& default_adduct, PairsType& feature_relation, std::map<Size, std::set<CmpInfo_>>& feature_adducts);
130 
131  void annotate_feature_(FeatureMap& fm_out, Adduct& default_adduct, Compomer& c, const Size f_idx, const UInt side, const Int new_q, const Int old_q);
132 
134  void printEdgesOfConnectedFeatures_(Size idx_1, Size idx_2, const PairsType& feature_relation);
135 
142  inline bool intensityFilterPassed_(const Int q1, const Int q2, const Compomer& cmp, const Feature& f1, const Feature& f2) const;
143 
150  bool chargeTestworthy_(const Int feature_charge, const Int putative_charge, const bool other_unchanged) const;
151 
155  std::map<Size, String> map_label_;
157  std::map<String, Size> map_label_inverse_;
166 
167  };
168 } // namespace OpenMS
DefaultParamHandler.h
ConsensusXMLFile.h
OpenMS::TOPPBase
Base class for TOPP applications.
Definition: TOPPBase.h:147
double
OpenMS::ConsensusXMLFile::store
void store(const String &filename, const ConsensusMap &consensus_map)
Stores a consensus map to file.
DPosition.h
OpenMS::MetaboliteFeatureDeconvolution::CoordinateType
Feature::CoordinateType CoordinateType
Definition: MetaboliteFeatureDeconvolution.h:69
OpenMS::Param::insert
void insert(const std::string &prefix, const Param &param)
OpenMS::MetaboliteFeatureDeconvolution::CHARGEMODE
CHARGEMODE
Definition: MetaboliteFeatureDeconvolution.h:66
StopWatch.h
OpenMS::ILPDCWrapper::PairsType
std::vector< ChargePair > PairsType
Definition: ILPDCWrapper.h:55
ILPDCWrapper.h
OpenMS::String
A more convenient string class.
Definition: String.h:58
ConsensusMap.h
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
FeatureXMLFile.h
OpenMS::Constants::c
const double c
Definition: Constants.h:209
OpenMS::MetaboliteFeatureDeconvolution::q_try_
CHARGEMODE q_try_
status of charge discovery
Definition: MetaboliteFeatureDeconvolution.h:163
OpenMS::MetaboliteFeatureDeconvolution::compute
void compute(const FeatureMap &fm_in, FeatureMap &fm_out, ConsensusMap &cons_map, ConsensusMap &cons_map_p)
Compute a zero-charge feature map from a set of charged features.
OpenMS::MetaboliteFeatureDeconvolution::enable_intensity_filter_
bool enable_intensity_filter_
status of intensity filter for edges
Definition: MetaboliteFeatureDeconvolution.h:159
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
OpenMS::MetaboliteFeatureDeconvolution::potential_adducts_
MassExplainer::AdductsType potential_adducts_
List of adducts used to explain mass differences.
Definition: MetaboliteFeatureDeconvolution.h:153
OpenMS::Compomer
Holds information on an edge connecting two features from a (putative) charge ladder.
Definition: Compomer.h:58
OpenMS::Int
int Int
Signed integer type.
Definition: Types.h:102
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::MetaboliteFeatureDeconvolution::PairsType
ILPDCWrapper::PairsType PairsType
Definition: MetaboliteFeatureDeconvolution.h:70
OpenMS::MetaboliteFeatureDeconvolution::ClusterPointType
DPosition< 2 > ClusterPointType
Definition: MetaboliteFeatureDeconvolution.h:68
OpenMS::MetaboliteFeatureDeconvolution::map_label_
std::map< Size, String > map_label_
labeling table
Definition: MetaboliteFeatureDeconvolution.h:155
OpenMS::MetaboliteFeatureDeconvolution::negative_mode_
bool negative_mode_
status of ionization mode
Definition: MetaboliteFeatureDeconvolution.h:161
OpenMS::FeatureXMLFile::load
void load(const String &filename, FeatureMap &feature_map)
loads the file with name filename into map and calls updateRanges().
FeatureMap.h
OpenMS::StopWatch::start
void start()
Start the stop watch.
OpenMS::StopWatch::stop
void stop()
Stop the stop watch (can be resumed later). If the stop watch was not running an exception is thrown.
OpenMS::DefaultParamHandler::setParameters
void setParameters(const Param &param)
Sets the parameters.
OpenMS::MassExplainer::AdductsType
Adduct::AdductsType AdductsType
Definition: MassExplainer.h:59
OpenMS::MetaboliteFeatureDeconvolution::map_label_inverse_
std::map< String, Size > map_label_inverse_
labeling table inverse
Definition: MetaboliteFeatureDeconvolution.h:157
OpenMS::DefaultParamHandler::getParameters
const Param & getParameters() const
Non-mutable access to the parameters.
OpenMS::ConsensusMap
A container for consensus elements.
Definition: ConsensusMap.h:82
OpenMS::FeatureXMLFile::store
void store(const String &filename, const FeatureMap &feature_map)
stores the map feature_map in file with name filename.
OpenMS::DPosition< 2 >
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
OpenMS::DataProcessing::CHARGE_DECONVOLUTION
Charge deconvolution.
Definition: DataProcessing.h:61
OpenMS::StopWatch
This class is used to determine the current process' CPU (user and/or kernel) and wall time.
Definition: StopWatch.h:65
MetaboliteFeatureDeconvolution.h
OpenMS::Adduct
Definition: Adduct.h:44
main
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:71
OpenMS::ConsensusMap::getColumnHeaders
const ColumnHeaders & getColumnHeaders() const
Non-mutable access to the file descriptions.
OpenMS::FeatureMap
A container for features.
Definition: FeatureMap.h:98
OpenMS::Feature
An LC-MS feature.
Definition: Feature.h:70
OpenMS::Param::copy
Param copy(const std::string &prefix, bool remove_prefix=false) const
Returns a new Param object containing all entries that start with prefix.
OpenMS::MetaboliteFeatureDeconvolution
An algorithm to decharge small molecule features (i.e. as found by FeatureFinder).
Definition: MetaboliteFeatureDeconvolution.h:61
OpenMS::MetaboliteFeatureDeconvolution::QHEURISTIC
Definition: MetaboliteFeatureDeconvolution.h:66
OpenMS::FeatureXMLFile
This class provides Input/Output functionality for feature maps.
Definition: FeatureXMLFile.h:62
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:69
OpenMS::Internal::ClassTest::infile
std::ifstream infile
Questionable file tested by TEST_FILE_EQUAL.
OpenMS::MetaboliteFeatureDeconvolution::verbose_level_
Int verbose_level_
amount of debug information displayed
Definition: MetaboliteFeatureDeconvolution.h:165
MassExplainer.h
TOPPBase.h
OpenMS::ConsensusXMLFile
This class provides Input functionality for ConsensusMaps and Output functionality for alignments and...
Definition: ConsensusXMLFile.h:58