Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

RawMSSignalSimulation.h

Go to the documentation of this file.
00001 // --------------------------------------------------------------------------
00002 //                   OpenMS -- Open-Source Mass Spectrometry
00003 // --------------------------------------------------------------------------
00004 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
00005 // ETH Zurich, and Freie Universitaet Berlin 2002-2012.
00006 //
00007 // This software is released under a three-clause BSD license:
00008 //  * Redistributions of source code must retain the above copyright
00009 //    notice, this list of conditions and the following disclaimer.
00010 //  * Redistributions in binary form must reproduce the above copyright
00011 //    notice, this list of conditions and the following disclaimer in the
00012 //    documentation and/or other materials provided with the distribution.
00013 //  * Neither the name of any author or any participating institution
00014 //    may be used to endorse or promote products derived from this software
00015 //    without specific prior written permission.
00016 // For a full list of authors, refer to the file AUTHORS.
00017 // --------------------------------------------------------------------------
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
00022 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00024 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00025 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00026 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00027 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00028 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 //
00030 // --------------------------------------------------------------------------
00031 // $Maintainer: Stephan Aiche$
00032 // $Authors: Stephan Aiche, Chris Bielow$
00033 // --------------------------------------------------------------------------
00034 
00035 #ifndef OPENMS_SIMULATION_RAWMSSIGNALSIMULATION_H
00036 #define OPENMS_SIMULATION_RAWMSSIGNALSIMULATION_H
00037 
00038 #include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
00039 #include <OpenMS/CONCEPT/ProgressLogger.h>
00040 
00041 #include <OpenMS/SIMULATION/SimTypes.h>
00042 #include <OpenMS/SIMULATION/EGHModel.h>
00043 
00044 #include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/ProductModel.h>
00045 
00046 namespace OpenMS
00047 {
00048 
00049   class IsotopeModel;
00050 
00061   class OPENMS_DLLAPI RawMSSignalSimulation :
00062     public DefaultParamHandler,
00063     public ProgressLogger
00064   {
00065 
00066 public:
00070 
00071     RawMSSignalSimulation(const SimRandomNumberGenerator & rng);
00072 
00074     RawMSSignalSimulation(const RawMSSignalSimulation & source);
00075 
00077     virtual ~RawMSSignalSimulation();
00079 
00080     RawMSSignalSimulation & operator=(const RawMSSignalSimulation & source);
00081 
00085     void loadContaminants();
00086 
00088     void generateRawSignals(FeatureMapSim & features, MSSimExperiment & experiment, MSSimExperiment & experiment_ct, FeatureMapSim & contaminants);
00089 
00090 protected:
00091 
00092     enum IONIZATIONMETHOD {IM_ESI = 0, IM_MALDI = 1, IM_ALL = 2};
00093     enum PROFILESHAPE {RT_RECTANGULAR, RT_GAUSSIAN};
00094     enum RESOLUTIONMODEL {RES_CONSTANT, RES_LINEAR, RES_SQRT};
00095 
00096 
00098     RawMSSignalSimulation();
00099 
00101     void updateMembers_();
00102 
00104     void setDefaultParams_();
00105 
00113     void add1DSignal_(Feature & feature, MSSimExperiment & experiment, MSSimExperiment & experiment_ct);
00114 
00122     void add2DSignal_(Feature & feature, MSSimExperiment & experiment, MSSimExperiment & experiment_ct);
00123 
00134     void samplePeptideModel1D_(const IsotopeModel & iso,
00135                                const SimCoordinateType mz_start,
00136                                const SimCoordinateType mz_end,
00137                                MSSimExperiment & experiment,
00138                                MSSimExperiment & experiment_ct,
00139                                Feature & activeFeature);
00140 
00153     void samplePeptideModel2D_(const ProductModel<2> & pm,
00154                                const SimCoordinateType mz_start,
00155                                const SimCoordinateType mz_end,
00156                                SimCoordinateType rt_start,
00157                                SimCoordinateType rt_end,
00158                                MSSimExperiment & experiment,
00159                                MSSimExperiment & experiment_ct,
00160                                Feature & activeFeature);
00161 
00165     void chooseElutionProfile_(EGHModel * const elutionmodel, Feature & feature, const double scale, const DoubleReal rt_sampling_rate, const MSSimExperiment & experiment);
00166 
00170     void createContaminants_(FeatureMapSim & contaminants, MSSimExperiment & exp, MSSimExperiment & exp_ct);
00171 
00173     void addShotNoise_(MSSimExperiment & experiment, SimCoordinateType minimal_mz_measurement_limit, SimCoordinateType maximal_mz_measurement_limit);
00174 
00176     void addWhiteNoise_(MSSimExperiment & experiment);
00177 
00179     void addDetectorNoise_(MSSimExperiment & experiment);
00180 
00182     void addBaseLine_(MSSimExperiment & experiment, SimCoordinateType minimal_mz_measurement_limit);
00183 
00185     void getSamplingGrid_(std::vector<SimCoordinateType> & grid, const SimCoordinateType mz_min, const SimCoordinateType mz_max, const Int step_Da);
00186 
00188     void compressSignals_(MSSimExperiment & experiment);
00189 
00191     Int sampling_points_per_FWHM_;
00192 
00194     SimCoordinateType mz_error_mean_;
00196     SimCoordinateType mz_error_stddev_;
00197 
00206     SimIntensityType getFeatureScaledIntensity_(const SimIntensityType feature_intensity, const SimIntensityType natural_scaling_factor);
00207 
00208 
00220     DoubleReal getResolution_(const DoubleReal query_mz, const DoubleReal resolution, const RESOLUTIONMODEL model) const;
00221 
00225     DoubleReal getPeakWidth_(const DoubleReal mz, const bool is_gaussian) const;
00226 
00228     SimIntensityType intensity_scale_;
00230     SimIntensityType intensity_scale_stddev_;
00231 
00232 
00234     RESOLUTIONMODEL res_model_;
00236     DoubleReal res_base_;
00238     std::vector<SimCoordinateType> grid_;
00239 
00241     SimRandomNumberGenerator const * rnd_gen_;
00242 
00243     struct ContaminantInfo
00244     {
00245       String name;
00246       EmpiricalFormula sf;
00247       DoubleReal rt_start, rt_end, intensity;
00248       Int q;
00249       PROFILESHAPE shape;
00250       IONIZATIONMETHOD im;
00251     };
00252 
00253     std::vector<ContaminantInfo> contaminants_;
00254 
00258     std::vector<std::vector<double> > threaded_random_numbers_;
00259 
00264     std::vector<Size> threaded_random_numbers_index_;
00265 
00266     static const Size THREADED_RANDOM_NUMBER_POOL_SIZE_ = 500;
00267 
00268     bool contaminants_loaded_;
00269   };
00270 
00271 }
00272 
00273 #endif

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:44 using doxygen 1.7.1