OpenMS
RawMSSignalSimulation Class Reference

Simulates MS signals for a given set of peptides. More...

#include <OpenMS/SIMULATION/RawMSSignalSimulation.h>

Inheritance diagram for RawMSSignalSimulation:
[legend]
Collaboration diagram for RawMSSignalSimulation:
[legend]

Classes

struct  ContaminantInfo
 

Constructors and Destructors

enum  IONIZATIONMETHOD { IM_ESI = 0 , IM_MALDI = 1 , IM_ALL = 2 }
 
enum  PROFILESHAPE { RT_RECTANGULAR , RT_GAUSSIAN }
 
enum  RESOLUTIONMODEL { RES_CONSTANT , RES_LINEAR , RES_SQRT }
 
Int sampling_points_per_FWHM_
 number of points sampled per peak's FWHM More...
 
SimTypes::SimCoordinateType mz_error_mean_
 Mean of peak m/z error. More...
 
SimTypes::SimCoordinateType mz_error_stddev_
 Standard deviation of peak m/z error. More...
 
SimTypes::SimIntensityType intensity_scale_
 Scaling factor of peak intensities. More...
 
SimTypes::SimIntensityType intensity_scale_stddev_
 Standard deviation of peak intensity scaling. More...
 
RESOLUTIONMODEL res_model_
 model of how resolution behaves with increasing m/z More...
 
double res_base_
 base resolution at 400 Th More...
 
std::vector< SimTypes::SimCoordinateTypegrid_
 m/z sampling grid for all signals More...
 
SimTypes::MutableSimRandomNumberGeneratorPtr rnd_gen_
 Random number generator. More...
 
std::vector< ContaminantInfocontaminants_
 
std::vector< std::vector< double > > threaded_random_numbers_
 
std::vector< Sizethreaded_random_numbers_index_
 
bool contaminants_loaded_
 
static const Size THREADED_RANDOM_NUMBER_POOL_SIZE_ = 500
 
 RawMSSignalSimulation ()
 Default constructor. More...
 
 RawMSSignalSimulation (SimTypes::MutableSimRandomNumberGeneratorPtr rng)
 Constructor taking a random generator. More...
 
 RawMSSignalSimulation (const RawMSSignalSimulation &source)
 Copy constructor. More...
 
 ~RawMSSignalSimulation () override
 Destructor. More...
 
RawMSSignalSimulationoperator= (const RawMSSignalSimulation &source)
 
void loadContaminants ()
 
void generateRawSignals (SimTypes::FeatureMapSim &features, SimTypes::MSSimExperiment &experiment, SimTypes::MSSimExperiment &experiment_ct, SimTypes::FeatureMapSim &contaminants)
 fill experiment with signals and noise More...
 
void updateMembers_ () override
 Synchronize members with param class. More...
 
void setDefaultParams_ ()
 Set default parameters. More...
 
void add1DSignal_ (Feature &feature, SimTypes::MSSimExperiment &experiment, SimTypes::MSSimExperiment &experiment_ct)
 Add a 1D signal for a single feature. More...
 
void add2DSignal_ (Feature &feature, SimTypes::MSSimExperiment &experiment, SimTypes::MSSimExperiment &experiment_ct)
 Add a 2D signal for a single feature. More...
 
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. More...
 
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. More...
 
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. More...
 
void createContaminants_ (SimTypes::FeatureMapSim &contaminants, SimTypes::MSSimExperiment &exp, SimTypes::MSSimExperiment &exp_ct)
 build contaminant feature map More...
 
void addShotNoise_ (SimTypes::MSSimExperiment &experiment, SimTypes::SimCoordinateType minimal_mz_measurement_limit, SimTypes::SimCoordinateType maximal_mz_measurement_limit)
 Add shot noise to the experiment. More...
 
void addWhiteNoise_ (SimTypes::MSSimExperiment &experiment)
 Add white noise to the experiment. More...
 
void addDetectorNoise_ (SimTypes::MSSimExperiment &experiment)
 Add detector noise to the experiment. More...
 
void addBaseLine_ (SimTypes::MSSimExperiment &experiment, SimTypes::SimCoordinateType minimal_mz_measurement_limit)
 Add a base line to the experiment. More...
 
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 More...
 
void compressSignals_ (SimTypes::MSSimExperiment &experiment)
 Compress signals in a single RT scan (to merge signals which were sampled overlapping) More...
 
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 the passed parameter natural_scaling_factor. More...
 
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. More...
 
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) More...
 

Additional Inherited Members

- Public Types inherited from ProgressLogger
enum  LogType { CMD , GUI , NONE }
 Possible log types. More...
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const String &name)
 Constructor with name that is displayed in error messages. More...
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor. More...
 
virtual ~DefaultParamHandler ()
 Destructor. More...
 
DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator. More...
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator. More...
 
void setParameters (const Param &param)
 Sets the parameters. More...
 
const ParamgetParameters () const
 Non-mutable access to the parameters. More...
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters. More...
 
const StringgetName () const
 Non-mutable access to the name. More...
 
void setName (const String &name)
 Mutable access to the name. More...
 
const std::vector< String > & getSubsections () const
 Non-mutable access to the registered subsections. More...
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor. More...
 
virtual ~ProgressLogger ()
 Destructor. More...
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor. More...
 
ProgressLoggeroperator= (const ProgressLogger &other)
 Assignment Operator. More...
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE! More...
 
LogType getLogType () const
 Returns the type of progress log being used. More...
 
void startProgress (SignedSize begin, SignedSize end, const String &label) const
 Initializes the progress display. More...
 
void setProgress (SignedSize value) const
 Sets the current progress. More...
 
void endProgress () const
 Ends the progress display. More...
 
void nextProgress () const
 increment progress by 1 (according to range begin-end) More...
 
- Static Public Member Functions inherited from DefaultParamHandler
static void writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const String &key_prefix="")
 Writes all parameters to meta values. More...
 
- Protected Member Functions inherited from DefaultParamHandler
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. More...
 
- Static Protected Member Functions inherited from ProgressLogger
static String logTypeToFactoryName_ (LogType type)
 Return the name of the factory product used for this log type. More...
 
- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters. More...
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes! More...
 
std::vector< Stringsubsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes! More...
 
String error_name_
 Name that is displayed in error messages during the parameter checking. More...
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;. More...
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;. More...
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

Simulates MS signals for a given set of peptides.

Simulates MS signals for a given set of peptides, with charge annotation, given detectabilities, predicted retention times and charge values.

Parameters of this class are:

NameTypeDefaultRestrictionsDescription
enabled stringtrue true, falseEnable RAW signal simulation? (select 'false' if you only need feature-maps)
ionization_type stringESI MALDI, ESIType of Ionization (MALDI or ESI)
peak_shape stringGaussian Gaussian, LorentzianPeak Shape used around each isotope peak (be aware that the area under the curve is constant for both types, but the maximal height will differ (~ 2:3 = Lorentz:Gaussian) due to the wider base of the Lorentzian
resolution:value int50000  Instrument resolution at 400 Th
resolution:type stringlinear constant, linear, sqrtHow does resolution change with increasing m/z?! QTOFs usually show 'constant' behavior, FTs have linear degradation, and on Orbitraps the resolution decreases with square root of mass
baseline:scaling float0.0 min: 0.0Scale of baseline. Set to 0 to disable simulation of baseline
baseline:shape float0.5 min: 0.0The baseline is modeled by an exponential probability density function (pdf) with f(x) = shape*e^(- shape*x)
mz:sampling_points int3 min: 2Number of raw data points per FWHM of the peak
contaminants:file stringSIMULATION/contaminants.csv  Contaminants file with sum formula and absolute RT interval. See 'share/OpenMS/SIMULATION/contaminants.txt' for details
variation:mz:error_mean float0.0  Average systematic m/z error (in Da)
variation:mz:error_stddev float0.0  Standard deviation for m/z errors. Set to 0 to disable simulation of m/z errors
variation:intensity:scale float100.0 min: 0.0Constant scale factor of the feature intensity. Set to 1.0 to get the real intensity values provided in the FASTA file
variation:intensity:scale_stddev float0.0 min: 0.0Standard deviation of peak intensity (relative to the scaled peak height). Set to 0 to get simple rescaled intensities
noise:shot:rate float0.0 min: 0.0Poisson rate of shot noise per unit m/z (random peaks in m/z, where the number of peaks per unit m/z follows a Poisson distribution). Set this to 0 to disable simulation of shot noise
noise:shot:intensity-mean float1.0  Shot noise intensity mean (exponentially distributed with given mean)
noise:white:mean float0.0  Mean value of white noise (Gaussian) being added to each *measured* signal intensity
noise:white:stddev float0.0  Standard deviation of white noise being added to each *measured* signal intensity
noise:detector:mean float0.0  Mean intensity value of the detector noise (Gaussian distribution)
noise:detector:stddev float0.0  Standard deviation of the detector noise (Gaussian distribution)

Note:
  • If a section name is documented, the documentation is displayed as tooltip.
  • Advanced parameter names are italic.

Class Documentation

◆ OpenMS::RawMSSignalSimulation::ContaminantInfo

struct OpenMS::RawMSSignalSimulation::ContaminantInfo
Collaboration diagram for RawMSSignalSimulation::ContaminantInfo:
[legend]
Class Members
IONIZATIONMETHOD im
double intensity
String name
Int q
double rt_end
double rt_start
EmpiricalFormula sf
PROFILESHAPE shape

Member Enumeration Documentation

◆ IONIZATIONMETHOD

enum IONIZATIONMETHOD
protected
Enumerator
IM_ESI 
IM_MALDI 
IM_ALL 

◆ PROFILESHAPE

enum PROFILESHAPE
protected
Enumerator
RT_RECTANGULAR 
RT_GAUSSIAN 

◆ RESOLUTIONMODEL

enum RESOLUTIONMODEL
protected
Enumerator
RES_CONSTANT 
RES_LINEAR 
RES_SQRT 

Constructor & Destructor Documentation

◆ RawMSSignalSimulation() [1/3]

Default constructor.

◆ RawMSSignalSimulation() [2/3]

Constructor taking a random generator.

◆ RawMSSignalSimulation() [3/3]

Copy constructor.

◆ ~RawMSSignalSimulation()

~RawMSSignalSimulation ( )
override

Destructor.

Member Function Documentation

◆ add1DSignal_()

void add1DSignal_ ( Feature feature,
SimTypes::MSSimExperiment experiment,
SimTypes::MSSimExperiment experiment_ct 
)
protected

Add a 1D signal for a single feature.

Parameters
featureThe feature which should be simulated
experimentThe experiment to which the simulated signals should be added
experiment_ctGround truth for picked peaks

◆ add2DSignal_()

void add2DSignal_ ( Feature feature,
SimTypes::MSSimExperiment experiment,
SimTypes::MSSimExperiment experiment_ct 
)
protected

Add a 2D signal for a single feature.

Parameters
featureThe feature which should be simulated
experimentThe experiment to which the simulated signals should be added
experiment_ctGround truth for picked peaks

◆ addBaseLine_()

void addBaseLine_ ( SimTypes::MSSimExperiment experiment,
SimTypes::SimCoordinateType  minimal_mz_measurement_limit 
)
protected

Add a base line to the experiment.

◆ addDetectorNoise_()

void addDetectorNoise_ ( SimTypes::MSSimExperiment experiment)
protected

Add detector noise to the experiment.

◆ addShotNoise_()

void addShotNoise_ ( SimTypes::MSSimExperiment experiment,
SimTypes::SimCoordinateType  minimal_mz_measurement_limit,
SimTypes::SimCoordinateType  maximal_mz_measurement_limit 
)
protected

Add shot noise to the experiment.

◆ addWhiteNoise_()

void addWhiteNoise_ ( SimTypes::MSSimExperiment experiment)
protected

Add white noise to the experiment.

◆ chooseElutionProfile_()

void chooseElutionProfile_ ( EGHModel *const  elutionmodel,
Feature feature,
const double  scale,
const double  rt_sampling_rate,
const SimTypes::MSSimExperiment experiment 
)
protected

Add the correct Elution profile to the passed ProductModel.

◆ compressSignals_()

void compressSignals_ ( SimTypes::MSSimExperiment experiment)
protected

Compress signals in a single RT scan (to merge signals which were sampled overlapping)

◆ createContaminants_()

void createContaminants_ ( SimTypes::FeatureMapSim contaminants,
SimTypes::MSSimExperiment exp,
SimTypes::MSSimExperiment exp_ct 
)
protected

build contaminant feature map

◆ generateRawSignals()

void generateRawSignals ( SimTypes::FeatureMapSim features,
SimTypes::MSSimExperiment experiment,
SimTypes::MSSimExperiment experiment_ct,
SimTypes::FeatureMapSim contaminants 
)

fill experiment with signals and noise

◆ getFeatureScaledIntensity_()

SimTypes::SimIntensityType getFeatureScaledIntensity_ ( const SimTypes::SimIntensityType  feature_intensity,
const SimTypes::SimIntensityType  natural_scaling_factor 
)
protected

Computes a rescaled feature intensity based on the set parameters for feature intensity scaling and the passed parameter natural_scaling_factor.

Parameters
feature_intensityIntensity of the current feature.
natural_scaling_factorAdditional scaling factor used by some of the sampling models.
Returns
Rescaled feature intensity.

◆ getPeakWidth_()

double getPeakWidth_ ( const double  mz,
const bool  is_gaussian 
) const
protected

compute the peak's SD (Gaussian) at a given m/z (internally the resolution model is used)

◆ getResolution_()

double getResolution_ ( const double  query_mz,
const double  resolution,
const RESOLUTIONMODEL  model 
) const
protected

Compute resolution at a given m/z given a base resolution and how it degrades with increasing m/z.

Parameters
query_mzThe m/z value where the resolution should be estimated
resolutionThe resolution at 400 Th
modelThe model describing how resolution behaves, i.e.
  • RES_CONSTANT: resolution does not change with m/z (this will just return resolution)
  • RES_LINEAR: resolution decreases linear with m/z, i.e. at 800 Th, it will have 50% of original
  • RES_SQRT: the resolution decreases with square root of mass, i.e. at 1600 Th, it will have 50% of original (sqrt(400) = sqrt(1600)*0.5)

◆ getSamplingGrid_()

void getSamplingGrid_ ( std::vector< SimTypes::SimCoordinateType > &  grid,
const SimTypes::SimCoordinateType  mz_min,
const SimTypes::SimCoordinateType  mz_max,
const Int  step_Da 
)
protected

get the mz grid where all m/z values will be mapped to

◆ loadContaminants()

void loadContaminants ( )

load the contaminants from contaminants:file param You do not have to call this function before calling generateRawSignals(), but it might be useful to check if the contaminant file is valid

◆ operator=()

RawMSSignalSimulation& operator= ( const RawMSSignalSimulation source)

◆ samplePeptideModel1D_()

void samplePeptideModel1D_ ( const IsotopeModel iso,
const SimTypes::SimCoordinateType  mz_start,
const SimTypes::SimCoordinateType  mz_end,
SimTypes::MSSimExperiment experiment,
SimTypes::MSSimExperiment experiment_ct,
Feature activeFeature 
)
protected

Samples signals for the given 1D model.

Parameters
isoThe isotope model from which the signals will be sampled
mz_startStart coordinate (in m/z dimension) of the region where the signals will be sampled
mz_endEnd coordinate (in m/z dimension) of the region where the signals will be sampled
experimentExperiment to which the sampled signals will be added
experiment_ctExperiment to which the centroided Ground Truth sampled signals will be added
activeFeatureThe current feature that is simulated

◆ samplePeptideModel2D_()

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 
)
protected

Samples signals for the given 2D model.

Parameters
pmThe product model from which the signals will be sampled
mz_startStart coordinate (in m/z dimension) of the region where the signals will be sampled
mz_endEnd coordinate (in m/z dimension) of the region where the signals will be sampled
rt_startStart coordinate (in rt dimension) of the region where the signals will be sampled
rt_endEnd coordinate (in rt dimension) of the region where the signals will be sampled
experimentExperiment to which the sampled signals will be added
experiment_ctExperiment to which the centroided Ground Truth sampled signals will be added
activeFeatureThe current feature that is simulated

◆ setDefaultParams_()

void setDefaultParams_ ( )
protected

Set default parameters.

◆ updateMembers_()

void updateMembers_ ( )
overrideprotectedvirtual

Synchronize members with param class.

Reimplemented from DefaultParamHandler.

Member Data Documentation

◆ contaminants_

std::vector<ContaminantInfo> contaminants_
protected

◆ contaminants_loaded_

bool contaminants_loaded_
protected

◆ grid_

std::vector<SimTypes::SimCoordinateType> grid_
protected

m/z sampling grid for all signals

◆ intensity_scale_

SimTypes::SimIntensityType intensity_scale_
protected

Scaling factor of peak intensities.

◆ intensity_scale_stddev_

SimTypes::SimIntensityType intensity_scale_stddev_
protected

Standard deviation of peak intensity scaling.

◆ mz_error_mean_

SimTypes::SimCoordinateType mz_error_mean_
protected

Mean of peak m/z error.

◆ mz_error_stddev_

SimTypes::SimCoordinateType mz_error_stddev_
protected

Standard deviation of peak m/z error.

◆ res_base_

double res_base_
protected

base resolution at 400 Th

◆ res_model_

RESOLUTIONMODEL res_model_
protected

model of how resolution behaves with increasing m/z

◆ rnd_gen_

Random number generator.

◆ sampling_points_per_FWHM_

Int sampling_points_per_FWHM_
protected

number of points sampled per peak's FWHM

◆ THREADED_RANDOM_NUMBER_POOL_SIZE_

const Size THREADED_RANDOM_NUMBER_POOL_SIZE_ = 500
staticprotected

◆ threaded_random_numbers_

std::vector<std::vector<double> > threaded_random_numbers_
protected

threaded_random_numbers keeps a set of random numbers for each thread simulating a feature.

◆ threaded_random_numbers_index_

std::vector<Size> threaded_random_numbers_index_
protected

Indicates which random numbers each thread has used already and if the random number pool should be rebuild.