OpenMS
RawMSSignalSimulation.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-2023.
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: Stephan Aiche, Chris Bielow$
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
39 
42 
44 
45 namespace OpenMS
46 {
47 
48  class IsotopeModel;
49 
60  class OPENMS_DLLAPI RawMSSignalSimulation :
61  public DefaultParamHandler,
62  public ProgressLogger
63  {
64 
65 public:
71 
74 
77 
81 
83 
88 
91  SimTypes::MSSimExperiment& experiment,
92  SimTypes::MSSimExperiment& experiment_ct,
93  SimTypes::FeatureMapSim& contaminants);
94 
95 protected:
96 
97  enum IONIZATIONMETHOD {IM_ESI = 0, IM_MALDI = 1, IM_ALL = 2};
98  enum PROFILESHAPE {RT_RECTANGULAR, RT_GAUSSIAN};
99  enum RESOLUTIONMODEL {RES_CONSTANT, RES_LINEAR, RES_SQRT};
100 
102  void updateMembers_() override;
103 
106 
114  void add1DSignal_(Feature& feature, SimTypes::MSSimExperiment& experiment, SimTypes::MSSimExperiment& experiment_ct);
115 
123  void add2DSignal_(Feature& feature, SimTypes::MSSimExperiment& experiment, SimTypes::MSSimExperiment& experiment_ct);
124 
136  const SimTypes::SimCoordinateType mz_start,
137  const SimTypes::SimCoordinateType mz_end,
138  SimTypes::MSSimExperiment& experiment,
139  SimTypes::MSSimExperiment& experiment_ct,
140  Feature& activeFeature);
141 
155  const SimTypes::SimCoordinateType mz_start,
156  const SimTypes::SimCoordinateType mz_end,
159  SimTypes::MSSimExperiment& experiment,
160  SimTypes::MSSimExperiment& experiment_ct,
161  Feature& activeFeature);
162 
166  void chooseElutionProfile_(EGHModel* const elutionmodel,
167  Feature& feature,
168  const double scale,
169  const double rt_sampling_rate,
170  const SimTypes::MSSimExperiment& experiment);
171 
176 
178  void addShotNoise_(SimTypes::MSSimExperiment& experiment, SimTypes::SimCoordinateType minimal_mz_measurement_limit, SimTypes::SimCoordinateType maximal_mz_measurement_limit);
179 
182 
185 
187  void addBaseLine_(SimTypes::MSSimExperiment& experiment, SimTypes::SimCoordinateType minimal_mz_measurement_limit);
188 
190  void getSamplingGrid_(std::vector<SimTypes::SimCoordinateType>& grid,
191  const SimTypes::SimCoordinateType mz_min,
192  const SimTypes::SimCoordinateType mz_max,
193  const Int step_Da);
194 
197 
200 
205 
215  const SimTypes::SimIntensityType natural_scaling_factor);
216 
217 
229  double getResolution_(const double query_mz, const double resolution, const RESOLUTIONMODEL model) const;
230 
234  double getPeakWidth_(const double mz, const bool is_gaussian) const;
235 
240 
241 
245  double res_base_;
247  std::vector<SimTypes::SimCoordinateType> grid_;
248 
251 
253  {
256  double rt_start, rt_end, intensity;
260  };
261 
262  std::vector<ContaminantInfo> contaminants_;
263 
267  std::vector<std::vector<double> > threaded_random_numbers_;
268 
274 
275  static const Size THREADED_RANDOM_NUMBER_POOL_SIZE_ = 500;
276 
278  };
279 
280 }
281 
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
Exponential-Gaussian hybrid distribution model for elution profiles.
Definition: EGHModel.h:55
Representation of an empirical formula.
Definition: EmpiricalFormula.h:85
A container for features.
Definition: FeatureMap.h:106
An LC-MS feature.
Definition: Feature.h:72
Isotope distribution approximated using linear interpolation.
Definition: IsotopeModel.h:60
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:72
The class template is only implemented for D=2 because we use Peak2D here.
Definition: ProductModel.h:66
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:53
Simulates MS signals for a given set of peptides.
Definition: RawMSSignalSimulation.h:63
SimTypes::SimCoordinateType mz_error_mean_
Mean of peak m/z error.
Definition: RawMSSignalSimulation.h:202
std::vector< std::vector< double > > threaded_random_numbers_
Definition: RawMSSignalSimulation.h:267
void add1DSignal_(Feature &feature, SimTypes::MSSimExperiment &experiment, SimTypes::MSSimExperiment &experiment_ct)
Add a 1D signal for a single feature.
PROFILESHAPE
Definition: RawMSSignalSimulation.h:98
Int q
Definition: RawMSSignalSimulation.h:257
void chooseElutionProfile_(EGHModel *const elutionmodel, Feature &feature, const double scale, const double rt_sampling_rate, const SimTypes::MSSimExperiment &experiment)
Add the correct Elution profile to the passed ProductModel.
double intensity
Definition: RawMSSignalSimulation.h:256
IONIZATIONMETHOD
Definition: RawMSSignalSimulation.h:97
void samplePeptideModel2D_(const ProductModel< 2 > &pm, const SimTypes::SimCoordinateType mz_start, const SimTypes::SimCoordinateType mz_end, SimTypes::SimCoordinateType rt_start, SimTypes::SimCoordinateType rt_end, SimTypes::MSSimExperiment &experiment, SimTypes::MSSimExperiment &experiment_ct, Feature &activeFeature)
Samples signals for the given 2D model.
SimTypes::SimIntensityType intensity_scale_
Scaling factor of peak intensities.
Definition: RawMSSignalSimulation.h:237
void compressSignals_(SimTypes::MSSimExperiment &experiment)
Compress signals in a single RT scan (to merge signals which were sampled overlapping)
EmpiricalFormula sf
Definition: RawMSSignalSimulation.h:255
void addBaseLine_(SimTypes::MSSimExperiment &experiment, SimTypes::SimCoordinateType minimal_mz_measurement_limit)
Add a base line to the experiment.
RESOLUTIONMODEL res_model_
model of how resolution behaves with increasing m/z
Definition: RawMSSignalSimulation.h:243
double res_base_
base resolution at 400 Th
Definition: RawMSSignalSimulation.h:245
RawMSSignalSimulation(SimTypes::MutableSimRandomNumberGeneratorPtr rng)
Constructor taking a random generator.
PROFILESHAPE shape
Definition: RawMSSignalSimulation.h:258
std::vector< Size > threaded_random_numbers_index_
Definition: RawMSSignalSimulation.h:273
void generateRawSignals(SimTypes::FeatureMapSim &features, SimTypes::MSSimExperiment &experiment, SimTypes::MSSimExperiment &experiment_ct, SimTypes::FeatureMapSim &contaminants)
fill experiment with signals and noise
SimTypes::SimIntensityType intensity_scale_stddev_
Standard deviation of peak intensity scaling.
Definition: RawMSSignalSimulation.h:239
void setDefaultParams_()
Set default parameters.
double getResolution_(const double query_mz, const double resolution, const RESOLUTIONMODEL model) const
Compute resolution at a given m/z given a base resolution and how it degrades with increasing m/z.
std::vector< ContaminantInfo > contaminants_
Definition: RawMSSignalSimulation.h:262
std::vector< SimTypes::SimCoordinateType > grid_
m/z sampling grid for all signals
Definition: RawMSSignalSimulation.h:247
bool contaminants_loaded_
Definition: RawMSSignalSimulation.h:277
void samplePeptideModel1D_(const IsotopeModel &iso, const SimTypes::SimCoordinateType mz_start, const SimTypes::SimCoordinateType mz_end, SimTypes::MSSimExperiment &experiment, SimTypes::MSSimExperiment &experiment_ct, Feature &activeFeature)
Samples signals for the given 1D model.
SimTypes::SimCoordinateType mz_error_stddev_
Standard deviation of peak m/z error.
Definition: RawMSSignalSimulation.h:204
RawMSSignalSimulation()
Default constructor.
IONIZATIONMETHOD im
Definition: RawMSSignalSimulation.h:259
String name
Definition: RawMSSignalSimulation.h:254
void createContaminants_(SimTypes::FeatureMapSim &contaminants, SimTypes::MSSimExperiment &exp, SimTypes::MSSimExperiment &exp_ct)
build contaminant feature map
double getPeakWidth_(const double mz, const bool is_gaussian) const
compute the peak's SD (Gaussian) at a given m/z (internally the resolution model is used)
Int sampling_points_per_FWHM_
number of points sampled per peak's FWHM
Definition: RawMSSignalSimulation.h:199
~RawMSSignalSimulation() override
Destructor.
void addDetectorNoise_(SimTypes::MSSimExperiment &experiment)
Add detector noise to the experiment.
RawMSSignalSimulation & operator=(const RawMSSignalSimulation &source)
void updateMembers_() override
Synchronize members with param class.
SimTypes::SimIntensityType getFeatureScaledIntensity_(const SimTypes::SimIntensityType feature_intensity, const SimTypes::SimIntensityType natural_scaling_factor)
Computes a rescaled feature intensity based on the set parameters for feature intensity scaling and t...
RawMSSignalSimulation(const RawMSSignalSimulation &source)
Copy constructor.
void addShotNoise_(SimTypes::MSSimExperiment &experiment, SimTypes::SimCoordinateType minimal_mz_measurement_limit, SimTypes::SimCoordinateType maximal_mz_measurement_limit)
Add shot noise to the experiment.
SimTypes::MutableSimRandomNumberGeneratorPtr rnd_gen_
Random number generator.
Definition: RawMSSignalSimulation.h:250
void addWhiteNoise_(SimTypes::MSSimExperiment &experiment)
Add white noise to the experiment.
RESOLUTIONMODEL
Definition: RawMSSignalSimulation.h:99
@ RES_CONSTANT
Definition: RawMSSignalSimulation.h:99
void add2DSignal_(Feature &feature, SimTypes::MSSimExperiment &experiment, SimTypes::MSSimExperiment &experiment_ct)
Add a 2D signal for a single feature.
void getSamplingGrid_(std::vector< SimTypes::SimCoordinateType > &grid, const SimTypes::SimCoordinateType mz_min, const SimTypes::SimCoordinateType mz_max, const Int step_Da)
get the mz grid where all m/z values will be mapped to
Definition: RawMSSignalSimulation.h:253
A more convenient string class.
Definition: String.h:60
int Int
Signed integer type.
Definition: Types.h:102
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
boost::shared_ptr< SimRandomNumberGenerator > MutableSimRandomNumberGeneratorPtr
Definition: SimTypes.h:174
Peak2D::IntensityType SimIntensityType
Abundance of proteins/peptides.
Definition: SimTypes.h:62
Peak2D::CoordinateType SimCoordinateType
Coordinate type in mz and rt dimension.
Definition: SimTypes.h:59
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48