Skip to content

Commit cba3185

Browse files
committed
[DIRTY] dirty changeset to make OpenMS-gsl-less compile on Ubuntu 12.04
1 parent 77e2528 commit cba3185

11 files changed

Lines changed: 70 additions & 33 deletions

‎include/OpenMS/CHEMISTRY/SvmTheoreticalSpectrumGenerator.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ namespace OpenMS
208208

209209

210210
/// Generate the MS/MS according to the given probabilistic model
211-
void simulate(RichPeakSpectrum & spectrum, const AASequence & peptide, boost::random::mt19937_64& rng, Size precursor_charge);
211+
void simulate(RichPeakSpectrum & spectrum, const AASequence & peptide, boost::mt19937& rng, Size precursor_charge);
212212

213213
///Load a trained Svm and Prob. models
214214
void load();

‎include/OpenMS/CHEMISTRY/SvmTheoreticalSpectrumGeneratorSet.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ namespace OpenMS
7676
SvmTheoreticalSpectrumGeneratorSet & operator=(const SvmTheoreticalSpectrumGeneratorSet & tsg);
7777

7878
/// Generate the MS/MS according to the model for the given precursor_charge
79-
void simulate(RichPeakSpectrum & spectrum, const AASequence & peptide, boost::random::mt19937_64& rng, Size precursor_charge);
79+
void simulate(RichPeakSpectrum & spectrum, const AASequence & peptide, boost::mt19937& rng, Size precursor_charge);
8080

8181
///Load a trained Svm and Prob. models
8282
void load(String);

‎include/OpenMS/CONCEPT/UniqueIdGenerator.h‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
#include <OpenMS/CONCEPT/Types.h>
3939
#include <boost/random/mersenne_twister.hpp>
4040
#include <boost/random/variate_generator.hpp>
41-
#include <boost/random/uniform_int_distribution.hpp>
41+
//#include <boost/random/uniform_int_distribution.hpp>
42+
#include <boost/random/uniform_int.hpp>
4243

4344
namespace OpenMS
4445
{
@@ -76,8 +77,8 @@ namespace OpenMS
7677
private:
7778
static UInt64 seed_;
7879
static UniqueIdGenerator* instance_;
79-
static boost::random::mt19937_64* rng_;
80-
static boost::random::uniform_int_distribution<UInt64>* dist_;
80+
// static boost::random::mt19937_64* rng_;
81+
// static boost::random::uniform_int_distribution<UInt64>* dist_;
8182

8283
static UniqueIdGenerator& getInstance_();
8384
void init_();

‎include/OpenMS/SIMULATION/SimTypes.h‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
#include <boost/shared_ptr.hpp>
4343

4444
#include <boost/random/mersenne_twister.hpp>
45+
#include <boost/random/uniform_int.hpp>
46+
#include <boost/random/mersenne_twister.hpp>
47+
#include <boost/random/variate_generator.hpp>
4548

4649
#include <OpenMS/KERNEL/Peak2D.h>
4750
#include <OpenMS/KERNEL/RichPeak1D.h>
@@ -106,12 +109,12 @@ namespace OpenMS
106109
{
107110
public:
108111

109-
boost::random::mt19937_64& getBiologicalRng()
112+
boost::mt19937& getBiologicalRng()
110113
{
111114
return biological_rng_;
112115
}
113116

114-
boost::random::mt19937_64& getTechnicalRng()
117+
boost::mt19937& getTechnicalRng()
115118
{
116119
return technical_rng_;
117120
}
@@ -132,27 +135,27 @@ namespace OpenMS
132135
// use 0 as default seed to get reproducible experiments
133136
if (biological_random)
134137
{
135-
biological_rng_ = boost::random::mt19937_64(std::time(0));
138+
biological_rng_ = boost::mt19937(std::time(0));
136139
}
137140
else
138141
{
139-
biological_rng_ = boost::random::mt19937_64(0);
142+
biological_rng_ = boost::mt19937(0);
140143
}
141144

142145
if (technical_random)
143146
{
144-
technical_rng_ = boost::random::mt19937_64(std::time(0));
147+
technical_rng_ = boost::mt19937(std::time(0));
145148
}
146149
else
147150
{
148-
technical_rng_ = boost::random::mt19937_64(0);
151+
technical_rng_ = boost::mt19937(0);
149152
}
150153
}
151154
private:
152155
/// random number generator for biological variability
153-
boost::random::mt19937_64 biological_rng_;
156+
boost::mt19937 biological_rng_;
154157
/// random number generator for technical variability
155-
boost::random::mt19937_64 technical_rng_;
158+
boost::mt19937 technical_rng_;
156159

157160
};
158161

‎source/CHEMISTRY/SvmTheoreticalSpectrumGenerator.C‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include <iterator>
4444

4545
#include <boost/bind.hpp>
46-
#include <boost/random/discrete_distribution.hpp>
46+
// #include <boost/random/discrete_distribution.hpp>
4747

4848
#ifdef _OPENMP
4949
#include <omp.h>
@@ -730,7 +730,7 @@ namespace OpenMS
730730
}
731731
}
732732

733-
void SvmTheoreticalSpectrumGenerator::simulate(RichPeakSpectrum & spectrum, const AASequence & peptide, boost::random::mt19937_64& rng, Size precursor_charge)
733+
void SvmTheoreticalSpectrumGenerator::simulate(RichPeakSpectrum & spectrum, const AASequence & peptide, boost::mt19937& rng, Size precursor_charge)
734734
{
735735
RichPeak1D p_;
736736
// just in case someone wants the ion names;
@@ -926,13 +926,14 @@ namespace OpenMS
926926
std::vector<double>& props = mp_.conditional_prob[std::make_pair(*it, region)][bin];
927927
std::vector<double> weights;
928928
std::transform( props.begin(), props.end(), std::back_inserter(weights), boost::bind( std::multiplies<double>(), _1, 10 ) );
929+
/*
929930
boost::random::discrete_distribution<Size> ddist (weights.begin(), weights.end());
930931
Size binned_int = ddist(rng);
931-
932932
if (binned_int != 0)
933933
{
934934
peaks_to_generate.push_back(std::make_pair(std::make_pair(*it, mp_.intensity_bin_values[binned_int - 1]), i));
935935
}
936+
*/
936937
}
937938
}
938939
}

‎source/CHEMISTRY/SvmTheoreticalSpectrumGeneratorSet.C‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace OpenMS
6868
}
6969

7070
// Generate the MS/MS according to the given probabilistic model
71-
void SvmTheoreticalSpectrumGeneratorSet::simulate(RichPeakSpectrum & spectrum, const AASequence & peptide, boost::random::mt19937_64& rng, Size precursor_charge)
71+
void SvmTheoreticalSpectrumGeneratorSet::simulate(RichPeakSpectrum & spectrum, const AASequence & peptide, boost::mt19937& rng, Size precursor_charge)
7272
{
7373
std::map<Size, SvmTheoreticalSpectrumGenerator>::iterator it = simulators_.find(precursor_charge);
7474
if (it != simulators_.end())

‎source/CONCEPT/UniqueIdGenerator.C‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ namespace OpenMS
4141
{
4242
UInt64 UniqueIdGenerator::seed_ = 0;
4343
UniqueIdGenerator* UniqueIdGenerator::instance_ = NULL;
44-
boost::random::mt19937_64* UniqueIdGenerator::rng_ = NULL;
45-
boost::random::uniform_int_distribution<UInt64>* UniqueIdGenerator::dist_ = NULL;
44+
// boost::random::mt19937_64* UniqueIdGenerator::rng_ = NULL;
45+
// boost::random::uniform_int_distribution<UInt64>* UniqueIdGenerator::dist_ = NULL;
4646

4747
UInt64
4848
UniqueIdGenerator::getUniqueId()
4949
{
5050
UniqueIdGenerator& instance = getInstance_();
51-
return (*instance.dist_)(*instance.rng_);
51+
// return (*instance.dist_)(*instance.rng_);
5252
}
5353

5454
UInt64
@@ -62,8 +62,8 @@ namespace OpenMS
6262
{
6363
UniqueIdGenerator& instance = getInstance_();
6464
instance.seed_ = seed;
65-
instance.rng_->seed( instance.seed_ );
66-
instance.dist_->reset();
65+
// instance.rng_->seed( instance.seed_ );
66+
// instance.dist_->reset();
6767
}
6868

6969
UniqueIdGenerator::UniqueIdGenerator()
@@ -86,14 +86,14 @@ namespace OpenMS
8686
UniqueIdGenerator::init_()
8787
{
8888
seed_ = std::time(0);
89-
rng_ = new boost::random::mt19937_64 (seed_);
90-
dist_ = new boost::random::uniform_int_distribution<UInt64> (0,std::numeric_limits<UInt64>::max());
89+
// rng_ = new boost::random::mt19937_64 (seed_);
90+
// dist_ = new boost::random::uniform_int_distribution<UInt64> (0,std::numeric_limits<UInt64>::max());
9191
}
9292

9393
UniqueIdGenerator::~UniqueIdGenerator()
9494
{
95-
delete rng_;
96-
delete dist_;
95+
// delete rng_;
96+
// delete dist_;
9797
}
9898

9999
}

‎source/SIMULATION/IonizationSimulation.C‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
#include <boost/bind.hpp>
4646
#include <boost/random/binomial_distribution.hpp>
47-
#include <boost/random/discrete_distribution.hpp>
47+
//#include <boost/random/discrete_distribution.hpp>
4848

4949
#ifdef _OPENMP
5050
#include <omp.h>
@@ -274,6 +274,7 @@ public:
274274
boost::bind( std::multiplies<double>(), _1, 10 ) );
275275
for(size_t i=0; i<weights.size(); ++i )
276276
std::cout << "weights[" << i << "]: " << weights.at(i) << std::endl;
277+
#if 0
277278
boost::random::discrete_distribution<Size, double> ddist (weights.begin(), weights.end());
278279
// deprecated_gsl_ran_discrete_t * ran_lookup_esi_charge_impurity = deprecated_gsl_ran_discrete_preproc(esi_impurity_probabilities_.size(), &esi_impurity_probabilities_[0]);
279280

@@ -489,6 +490,7 @@ public:
489490
LOG_WARN << "Exception (" << e.what() << ") caught in " << __FILE__ << "\n";
490491
throw;
491492
}
493+
#endif
492494

493495
features.applyMemberFunction(&UniqueIdInterface::ensureUniqueId);
494496
charge_consensus.applyMemberFunction(&UniqueIdInterface::ensureUniqueId);
@@ -516,6 +518,7 @@ public:
516518
maldi_probabilities_.end(),
517519
std::back_inserter( weights ),
518520
boost::bind( std::multiplies<double>(), _1, 10 ) );
521+
#if 0
519522
boost::random::discrete_distribution<Size, double> ddist (weights.begin(), weights.end());
520523

521524
try
@@ -595,6 +598,7 @@ public:
595598
throw;
596599
}
597600

601+
#endif
598602
features.applyMemberFunction(&UniqueIdInterface::ensureUniqueId);
599603
charge_consensus.applyMemberFunction(&UniqueIdInterface::ensureUniqueId);
600604
}

‎source/SIMULATION/LABELING/ITRAQLabeler.C‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
#include <Eigen/Dense>
4141

42-
#include <boost/random/uniform_real_distribution.hpp>
42+
//#include <boost/random/uniform_real_distribution.hpp>
4343

4444
using std::vector;
4545
using std::pair;
@@ -237,6 +237,7 @@ namespace OpenMS
237237
channel_names[0].setMatrix<4, 1>(ItraqConstants::CHANNELS_FOURPLEX);
238238
channel_names[1].setMatrix<8, 1>(ItraqConstants::CHANNELS_EIGHTPLEX);
239239

240+
/*
240241
boost::random::uniform_real_distribution<DoubleReal> udist (0.0,1.0);
241242
242243
// add signal...
@@ -274,6 +275,7 @@ namespace OpenMS
274275
it->push_back(p);
275276
}
276277
}
278+
*/
277279

278280
}
279281

‎source/SIMULATION/RTSimulation.C‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
#include <boost/random/normal_distribution.hpp>
4848
#include <boost/random/cauchy_distribution.hpp>
49-
#include <boost/random/uniform_real_distribution.hpp>
49+
//#include <boost/random/uniform_real_distribution.hpp>
5050

5151
using std::vector;
5252
using std::cout;
@@ -259,6 +259,7 @@ namespace OpenMS
259259
predicted_retention_times[i] = features[i].getMetaValue("rt");
260260
}
261261
// add variation
262+
/*
262263
boost::random::normal_distribution<SimCoordinateType> ndist (rt_offset,rt_ft_stddev);
263264
SimCoordinateType rt_error = ndist(rnd_gen_->getTechnicalRng());
264265
predicted_retention_times[i] = predicted_retention_times[i] * rt_scale + rt_error;
@@ -267,6 +268,7 @@ namespace OpenMS
267268
{
268269
predicted_retention_times[i] = features[i].getMetaValue("RT");
269270
}
271+
*/
270272

271273
// remove invalid peptides & (later) display removed ones
272274
if (
@@ -287,26 +289,32 @@ namespace OpenMS
287289
DoubleReal variance = egh_variance_location_;
288290
if(egh_variance_scale_ != 0)
289291
{
292+
/*
290293
boost::random::cauchy_distribution<DoubleReal> cdist (0,egh_variance_scale_);
291294
variance += cdist( rnd_gen_->getTechnicalRng() );
295+
*/
292296
}
293297
DoubleReal tau = egh_tau_location_;
294298
if(egh_tau_scale_ != 0)
295299
{
300+
/*
296301
boost::random::cauchy_distribution<DoubleReal> cdist (0,egh_tau_scale_);
297302
tau += cdist( rnd_gen_->getTechnicalRng() );
303+
*/
298304
}
299305

300306
// resample variance if it is below 0
301307
// try this only 10 times to avoid endless loop in case of
302308
// a bad parameter combination
303309
Size retry_variance_sampling = 0;
310+
/*
304311
boost::random::cauchy_distribution<DoubleReal> cdistVar (0.0, egh_variance_scale_);
305312
while ((variance <= 0 || (fabs(variance - egh_variance_location_) > 10 * egh_variance_scale_)) && retry_variance_sampling < 9)
306313
{
307314
variance = egh_variance_location_ + cdistVar(rnd_gen_->getTechnicalRng());
308315
++retry_variance_sampling;
309316
}
317+
*/
310318

311319
if (variance <= 0 || (fabs(variance - egh_variance_location_) > 10 * egh_variance_scale_))
312320
{
@@ -318,12 +326,14 @@ namespace OpenMS
318326
// try this only 10 times to avoid endless loop in case of
319327
// a bad parameter combination
320328
Size retry_tau_sampling = 0;
329+
/*
321330
boost::random::cauchy_distribution<DoubleReal> cdistTau (0.0, egh_tau_scale_);
322331
while (fabs(tau - egh_tau_location_) > 10 * egh_tau_scale_ && retry_tau_sampling < 9)
323332
{
324333
tau = egh_tau_location_ + cdistTau(rnd_gen_->getTechnicalRng());
325334
++retry_tau_sampling;
326335
}
336+
*/
327337

328338
if (fabs(tau - egh_tau_location_) > 10 * egh_tau_scale_)
329339
{
@@ -584,6 +594,7 @@ namespace OpenMS
584594
void RTSimulation::predictContaminantsRT(FeatureMapSim& contaminants)
585595
{
586596
// iterate of feature map
597+
/*
587598
boost::random::uniform_real_distribution<SimCoordinateType> udist (0,total_gradient_time_);
588599
for (Size i = 0; i < contaminants.size(); ++i)
589600
{
@@ -592,6 +603,7 @@ namespace OpenMS
592603
SimCoordinateType retention_time = udist(rnd_gen_->getTechnicalRng());
593604
contaminants[i].setRT(retention_time);
594605
}
606+
*/
595607
}
596608

597609
bool RTSimulation::isRTColumnOn() const
@@ -664,6 +676,7 @@ namespace OpenMS
664676
{
665677
// initialize the previous value on position 0
666678
previous = (DoubleReal) experiment[0].getMetaValue("distortion");
679+
/*
667680
boost::random::uniform_real_distribution<DoubleReal> udist (1.0 - std::pow(fi + 1.0, 2) * 0.01, 1.0 + std::pow(fi + 1.0, 2) * 0.01);// distortion gets worse round by round
668681
#ifdef MSSIM_DEBUG_MOV_AVG_FILTER
669682
LOG_WARN << "d <- c(" << previous << ", ";
@@ -695,6 +708,7 @@ namespace OpenMS
695708
}
696709
LOG_WARN << next << ");" << endl;
697710
#endif
711+
*/
698712
}
699713
}
700714

0 commit comments

Comments
 (0)