| OpenMS 2.5.0

SimTypes.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-2020.
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
37 #include <vector>
38 #include <utility>
39 #include <map>
40 #include <utility>
41 #include <boost/shared_ptr.hpp>
42
43 #include <boost/random/mersenne_twister.hpp>
44
45 #include <OpenMS/CHEMISTRY/AASequence.h>
46 #include <OpenMS/FORMAT/FASTAFile.h>
47 #include <OpenMS/KERNEL/FeatureMap.h>
48 #include <OpenMS/KERNEL/MSExperiment.h>
49 #include <OpenMS/KERNEL/Peak2D.h>
50 #include <OpenMS/KERNEL/StandardTypes.h>
51 #include <OpenMS/METADATA/MetaInfoInterface.h>
52
53 namespace OpenMS
54 {
55
56 namespace SimTypes
57 {
59 typedef Peak2D::CoordinateType SimCoordinateType;
60
62 typedef Peak2D::IntensityType SimIntensityType;
63
65 typedef Feature::ChargeType SimChargeType;
66
68 typedef Peak1D SimPointType;
69
73 struct SimProtein
74 {
76 FASTAFile::FASTAEntry entry;
78 MetaInfoInterface meta;
79
83 SimProtein(FASTAFile::FASTAEntry& e, MetaInfoInterface& m) :
84 entry(e),
85 meta(m)
86 {}
87 };
88
90 typedef std::vector<SimProtein> SampleProteins;
91
93 typedef std::vector<SampleProteins> SampleChannels;
94
96 typedef FeatureMap FeatureMapSim;
97
99 typedef std::vector<FeatureMapSim> FeatureMapSimVector;
100
102 typedef PeakMap MSSimExperiment;
103
118 class SimRandomNumberGenerator
119 {
120 public:
121
122 boost::random::mt19937_64& getBiologicalRng()
123 {
124 return biological_rng_;
125 }
126
127 boost::random::mt19937_64& getTechnicalRng()
128 {
129 return technical_rng_;
130 }
131
132 void setBiologicalRngSeed(unsigned long int seed)
133 {
134 biological_rng_.seed(seed);
135 }
136
137 void setTechnicalRngSeed(unsigned long int seed)
138 {
139 technical_rng_.seed(seed);
140 }
141
143 void initialize(bool biological_random, bool technical_random)
144 {
145 // use 0 as default seed to get reproducible experiments
146 if (biological_random)
147 {
148 biological_rng_ = boost::random::mt19937_64(std::time(nullptr));
149 }
150 else
151 {
152 biological_rng_ = boost::random::mt19937_64(0);
153 }
154
155 if (technical_random)
156 {
157 technical_rng_ = boost::random::mt19937_64(std::time(nullptr));
158 }
159 else
160 {
161 technical_rng_ = boost::random::mt19937_64(0);
162 }
163 }
164
165 private:
167 boost::random::mt19937_64 biological_rng_;
169 boost::random::mt19937_64 technical_rng_;
170
171 };
172
173 //Sim Shared Pointer type
174 typedef boost::shared_ptr<SimRandomNumberGenerator> MutableSimRandomNumberGeneratorPtr;
175
176 }
177
178 }
179
OpenMS::SimTypes::MSSimExperiment
PeakMap MSSimExperiment
Sim MSExperiment type.
Definition: SimTypes.h:102
OpenMS::SimTypes::SampleProteins
std::vector< SimProtein > SampleProteins
Container for FASTAEntry & abundance information.
Definition: SimTypes.h:90
OpenMS::SimTypes::SimRandomNumberGenerator::setTechnicalRngSeed
void setTechnicalRngSeed(unsigned long int seed)
Definition: SimTypes.h:137
AASequence.h
OpenMS::SimTypes::SampleChannels
std::vector< SampleProteins > SampleChannels
Container for multiple channels of SampleProteins.
Definition: SimTypes.h:93
OpenMS::SimTypes::FeatureMapSimVector
std::vector< FeatureMapSim > FeatureMapSimVector
Sim FeatureMap Vector.
Definition: SimTypes.h:99
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
OpenMS::SimTypes::SimRandomNumberGenerator::setBiologicalRngSeed
void setBiologicalRngSeed(unsigned long int seed)
Definition: SimTypes.h:132
OpenMS::SimTypes::SimChargeType
Feature::ChargeType SimChargeType
Charge of a peptide.
Definition: SimTypes.h:65
OpenMS::SimTypes::SimRandomNumberGenerator
Wrapper class for random number generators used by the simulation classes.
Definition: SimTypes.h:118
OpenMS::FeatureMap
A container for features.
Definition: FeatureMap.h:95
StandardTypes.h
OpenMS::SimTypes::SimRandomNumberGenerator::getBiologicalRng
boost::random::mt19937_64 & getBiologicalRng()
Definition: SimTypes.h:122
OpenMS::SimTypes::SimIntensityType
Peak2D::IntensityType SimIntensityType
Abundance of proteins/peptides.
Definition: SimTypes.h:62
OpenMS::Peak1D
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:54
FeatureMap.h
FASTAFile.h
OpenMS::SimTypes::SimRandomNumberGenerator::biological_rng_
boost::random::mt19937_64 biological_rng_
random number generator for biological variability
Definition: SimTypes.h:167
OpenMS::SimTypes::SimRandomNumberGenerator::technical_rng_
boost::random::mt19937_64 technical_rng_
random number generator for technical variability
Definition: SimTypes.h:169
OpenMS::SimTypes::SimProtein::meta
MetaInfoInterface meta
MetaInfoInterface holding the abundance information.
Definition: SimTypes.h:78
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
Peak2D.h
OpenMS::SimTypes::FeatureMapSim
FeatureMap FeatureMapSim
Sim FeatureMap.
Definition: SimTypes.h:96
MSExperiment.h
OpenMS::FASTAFile::FASTAEntry
FASTA entry type (identifier, description and sequence)
Definition: FASTAFile.h:76
double
float
OpenMS::SimTypes::SimRandomNumberGenerator::getTechnicalRng
boost::random::mt19937_64 & getTechnicalRng()
Definition: SimTypes.h:127
int
OpenMS::SimTypes::SimProtein::SimProtein
SimProtein(FASTAFile::FASTAEntry &e, MetaInfoInterface &m)
c&#39;tor
Definition: SimTypes.h:83
MetaInfoInterface.h
OpenMS::SimTypes::SimProtein
Plain data object holding sequence and abundance information on a single protein. ...
Definition: SimTypes.h:73
OpenMS::SimTypes::SimCoordinateType
Peak2D::CoordinateType SimCoordinateType
Coordinate type in mz and rt dimension.
Definition: SimTypes.h:59
OpenMS::SimTypes::SimProtein::entry
FASTAFile::FASTAEntry entry
FASTAEntry holding the sequence information.
Definition: SimTypes.h:76
OpenMS::SimTypes::SimRandomNumberGenerator::initialize
void initialize(bool biological_random, bool technical_random)
Initialize the RNGs.
Definition: SimTypes.h:143
OpenMS::SimTypes::MutableSimRandomNumberGeneratorPtr
boost::shared_ptr< SimRandomNumberGenerator > MutableSimRandomNumberGeneratorPtr
Definition: SimTypes.h:174
OpenMS::SimTypes::SimPointType
Peak1D SimPointType
Raw data point.
Definition: SimTypes.h:68
OpenMS::MetaInfoInterface
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:60