Skip to content

Commit 1d18895

Browse files
[INTERNAL,API] gsl-removal: replace GSL function with Eigen functions
removed gsl_linalg_LU_decomp & _LU_solve removed gsl_lanalg_SV_devomp with Eigen SVD removed gsl_blas_dgemm removed fft removed fft deletion of CompareFouriertransform changed PeakPickerHiRes spline to Eigen changed spline in TOFCalibration wrapped spline functionality changed cubic spline in TransformationModel changed b_spline in TransformationModel changed LM-Fitter in GammaDistributionFitter changed LM in GaussFitter changed LM in GumbelDistFitter changed LM in PeakPickerWavelet changed LM in TwoDOptimizer changed LM in TraceFitters changd LM in LevMarqFitter and EmgFitter changed LM in OptimizedPeak remove debug output to std::out in SavitzkyGolayFilter
1 parent f356963 commit 1d18895

139 files changed

Lines changed: 5249 additions & 8427 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎doc/doxygen/parameters/DefaultParamHandlerDocumenter.C‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
#include <OpenMS/COMPARISON/SPECTRA/SpectrumPrecursorComparator.h>
9898
#include <OpenMS/COMPARISON/SPECTRA/SteinScottImproveScore.h>
9999
#include <OpenMS/COMPARISON/SPECTRA/ZhangSimilarityScore.h>
100-
#include <OpenMS/COMPARISON/SPECTRA/CompareFouriertransform.h>
101100
#include <OpenMS/FILTERING/CALIBRATION/InternalCalibration.h>
102101
#include <OpenMS/FILTERING/SMOOTHING/SavitzkyGolayFilter.h>
103102
#include <OpenMS/FILTERING/SMOOTHING/LowessSmoothing.h>
@@ -149,7 +148,6 @@
149148
#include <OpenMS/COMPARISON/SPECTRA/BinnedSumAgreeingIntensities.h>
150149
#include <OpenMS/COMPARISON/SPECTRA/BinnedSpectralContrastAngle.h>
151150
#include <OpenMS/COMPARISON/SPECTRA/PeakAlignment.h>
152-
#include <OpenMS/COMPARISON/SPECTRA/CompareFouriertransform.h>
153151
#include <OpenMS/FILTERING/NOISEESTIMATION/SignalToNoiseEstimatorMeanIterative.h>
154152
#include <OpenMS/FILTERING/NOISEESTIMATION/SignalToNoiseEstimatorMedian.h>
155153
#include <OpenMS/FILTERING/SMOOTHING/GaussFilter.h>
@@ -433,7 +431,6 @@ int main(int argc, char ** argv)
433431
DOCME(TwoDOptimization);
434432
DOCME(WindowMower);
435433
DOCME(ZhangSimilarityScore);
436-
DOCME(CompareFouriertransform);
437434
DOCME(PrecursorIonSelection);
438435
DOCME(PrecursorIonSelectionPreprocessing);
439436
DOCME(MorphologicalFilter);
@@ -464,7 +461,7 @@ int main(int argc, char ** argv)
464461
DOCME(PeptideAndProteinQuant);
465462
DOCME(Math::PosteriorErrorProbabilityModel);
466463
// workarounds for documenting model parameters in MapAligners:
467-
writeParameters("MapAlignerIdentificationModel", TOPPMapAlignerBase::getModelDefaults("b_spline"), true);
464+
writeParameters("MapAlignerIdentificationModel", TOPPMapAlignerBase::getModelDefaults("interpolated"), true);
468465
writeParameters("MapAlignerPoseClusteringModel", TOPPMapAlignerBase::getModelDefaults("linear"), true);
469466
writeParameters("MapAlignerSpectrumModel", TOPPMapAlignerBase::getModelDefaults("interpolated"), true);
470467
writeParameters("MapRTTransformerModel", TOPPMapAlignerBase::getModelDefaults("none"), true);

‎include/OpenMS/ANALYSIS/MAPMATCHING/MapAlignmentAlgorithmIdentification.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// --------------------------------------------------------------------------
2+
23
// OpenMS -- Open-Source Mass Spectrometry
34
// --------------------------------------------------------------------------
45
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,

‎include/OpenMS/ANALYSIS/MAPMATCHING/MapAlignmentAlgorithmSpectrumAlignment.h‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -161,22 +161,6 @@ namespace OpenMS
161161
*/
162162
void msFilter_(MSExperiment<> & peakmap, std::vector<MSSpectrum<> *> & spectrum_pointer_container);
163163

164-
/**
165-
@brief does the transformation if the Discrete Cosines Fourier Transformation is selected.
166-
167-
Call internally the function transform, only if the comparison score function Fourier is selected.
168-
@param spectrum_pointer_container is the sequence which has to be transform
169-
*/
170-
void fourierActivation_(std::vector<MSSpectrum<> *> & spectrum_pointer_container);
171-
172-
/**
173-
@brief calculate the Discrete Cosines Fourier Transformation.
174-
175-
This Function transforms a given MSSpectrum to a Discrete Cosines Fourier Transformation. It stores only the part of the cosines of the FFT in
176-
the FloatDataArray which is a container from the MSSpectrum. Only call this function, if you are sure there is no other transformation done earlier over the same MSSpectrum, because it isn't checked if there already exists a transformation.
177-
*/
178-
void transform_(MSSpectrum<> & spec);
179-
180164
/**
181165
@brief function for the test if cell i,j of the grid is inside the band
182166
@@ -280,13 +264,6 @@ namespace OpenMS
280264
*/
281265
void debugFileCreator_(const std::vector<MSSpectrum<> *> & pattern, std::vector<MSSpectrum<> *> & aligned);
282266

283-
/**
284-
@brief Delete entries of the FloatDataArray which was made from CompareFouriertransform
285-
286-
This function erase the entries with was done by the CompareFouriertransform function.
287-
*/
288-
void eraseFloatDataArrayEntry_(std::vector<MSSpectrum<> *> & spectrum_pointer_container);
289-
290267
/**
291268
@brief Rounding the score of two spectra, only necessary for debugging
292269

‎include/OpenMS/ANALYSIS/MAPMATCHING/TransformationDescription.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ namespace OpenMS
4949
- @p none (TransformationModel): \f$ f(x) = x \f$ (identity)
5050
- @p identity: Same as @p none, but intended for reference files (used to indicate that no other model should be fit, because the identity is already optimal).
5151
- @p linear (TransformationModelLinear): \f$ f(x) = slope * x + intercept \f$
52-
- @p interpolated (TransformationModelInterpolated): Interpolation between pairs, extrapolation using first and last pair. Supports different interpolation types.
53-
- @p b_spline (TransformationModelBSpline): Smoothing cubic B-spline.
52+
- @p interpolated (TransformationModelInterpolated): Smoothing cubic B-spline.
5453
5554
@remark TransformationDescription stores data points, TransformationModel stores parameters. That way, data can be modeled using different models/parameters, and models can still keep a representation of the data in the format they need (if at all).
5655
@@ -107,7 +106,7 @@ namespace OpenMS
107106
const DataPoints & getDataPoints() const;
108107

109108
/// Non-mutable access to the model parameters
110-
void getModelParameters(Param & params) const;
109+
const Param& getModelParameters() const;
111110

112111
/// Computes an (approximate) inverse of the transformation
113112
void invert();

‎include/OpenMS/ANALYSIS/MAPMATCHING/TransformationModel.h‎

Lines changed: 5 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <OpenMS/DATASTRUCTURES/Param.h>
3939

4040
#include "OpenMS/MATH/GSL_WRAPPER/gsl_wrapper.h"
41+
#include "OpenMS/MATH/MISC/Spline2d.h"
4142

4243
namespace OpenMS
4344
{
@@ -74,9 +75,9 @@ namespace OpenMS
7475
}
7576

7677
/// Gets the (actual) parameters
77-
void getParameters(Param & params) const
78+
const Param & getParameters() const
7879
{
79-
params = params_;
80+
return params_;
8081
}
8182

8283
/// Gets the default parameters
@@ -147,7 +148,7 @@ namespace OpenMS
147148
148149
Between the data points, the interpolation uses the neighboring points. Outside the range spanned by the points, we extrapolate using a line through the first and the last point.
149150
150-
Different types of interpolation (controlled by the parameter @p interpolation_type) are supported: "linear", "polynomial", "cspline", and "akima". Note that the number of required data points may differ between types.
151+
Interpolation is done by a cubic spline. Note that at least 4 data point are required.
151152
152153
@ingroup MapAlignment
153154
*/
@@ -175,80 +176,13 @@ namespace OpenMS
175176
protected:
176177
/// Data coordinates
177178
std::vector<double> x_, y_;
178-
/// Number of data points
179-
size_t size_;
180-
/// Look-up accelerator
181-
deprecated_gsl_interp_accel * acc_;
182179
/// Interpolation function
183-
deprecated_gsl_interp * interp_;
180+
Spline2d<double> * interp_;
184181
/// Linear model for extrapolation
185182
TransformationModelLinear * lm_;
186183
};
187184

188185

189-
/**
190-
@brief B-spline model for transformations
191-
192-
In the range of the data points, the transformation is evaluated from a cubic smoothing spline fit to the points. The number of breakpoints is given as a parameter (@p num_breakpoints). Outside of this range, linear extrapolation through the last point with the slope of the spline at that point is used.
193-
194-
Positioning of the breakpoints is controlled by the parameter @p break_positions. Valid choices are "uniform" (equidistant spacing on the data range) and "quantiles" (equal numbers of data points in every interval).
195-
196-
@ingroup MapAlignment
197-
*/
198-
class OPENMS_DLLAPI TransformationModelBSpline :
199-
public TransformationModel
200-
{
201-
public:
202-
/**
203-
@brief Constructor
204-
205-
@exception IllegalArgument is thrown if not enough data points are given or if the required parameter @p num_breakpoints is missing.
206-
*/
207-
TransformationModelBSpline(const DataPoints & data, const Param & params);
208-
209-
/// Destructor
210-
~TransformationModelBSpline();
211-
212-
/// Evaluates the model at the given value
213-
DoubleReal evaluate(const DoubleReal value) const;
214-
215-
/// Gets the default parameters
216-
static void getDefaultParameters(Param & params);
217-
218-
protected:
219-
/**
220-
@brief Finds quantile values
221-
222-
@param x Data vector to find quantiles in
223-
@param quantiles Quantiles to find (values between 0 and 1)
224-
@param results Resulting quantiles (vector must be already allocated to the correct size!)
225-
*/
226-
void getQuantiles_(const deprecated_gsl_vector * x, const std::vector<double> &
227-
quantiles, deprecated_gsl_vector * results);
228-
229-
/// Computes the B-spline fit
230-
void computeFit_();
231-
232-
/// Computes the linear extrapolation
233-
void computeLinear_(const double pos, double & slope, double & offset,
234-
double & sd_err);
235-
236-
/// Vectors for B-spline computation
237-
deprecated_gsl_vector * x_, * y_, * w_, * bsplines_, * coeffs_;
238-
/// Covariance matrix
239-
deprecated_gsl_matrix * cov_;
240-
/// B-spline workspace
241-
deprecated_gsl_bspline_workspace * workspace_;
242-
/// Number of data points and coefficients
243-
size_t size_, ncoeffs_;
244-
// First/last breakpoint
245-
double xmin_, xmax_;
246-
/// Parameters for linear extrapolation
247-
double slope_min_, slope_max_, offset_min_, offset_max_;
248-
/// Fitting errors of linear extrapolation
249-
double sd_err_left_, sd_err_right_;
250-
};
251-
252186
} // end of namespace OpenMS
253187

254188
#endif // OPENMS_ANALYSIS_MAPMATCHING_TRANSFORMATIONMODEL_H

‎include/OpenMS/ANALYSIS/QUANTITATION/IsobaricIsotopeCorrector.h‎

Lines changed: 23 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@
3939

4040
#include <OpenMS/ANALYSIS/QUANTITATION/IsobaricQuantitationMethod.h>
4141
#include <OpenMS/ANALYSIS/QUANTITATION/IsobaricQuantifierStatistics.h>
42+
#include <OpenMS/DATASTRUCTURES/Matrix.h>
4243

4344
#include <OpenMS/MATH/GSL_WRAPPER/gsl_wrapper.h>
4445

46+
#include <Eigen/Core>
47+
4548
namespace OpenMS
4649
{
4750
/**
@@ -50,89 +53,52 @@ namespace OpenMS
5053
class OPENMS_DLLAPI IsobaricIsotopeCorrector
5154
{
5255
public:
53-
/**
54-
@brief Constructor given an IsobaricQuantitationMethod (e.g., iTRAQ 4 plex).
55-
56-
@param quant_method The quantification method used for the data set to analyze.
57-
*/
58-
explicit IsobaricIsotopeCorrector(const IsobaricQuantitationMethod* const quant_method);
59-
60-
/// Copy c'tor
61-
IsobaricIsotopeCorrector(const IsobaricIsotopeCorrector& other);
62-
63-
/// Assignment operator
64-
IsobaricIsotopeCorrector& operator=(const IsobaricIsotopeCorrector& rhs);
65-
66-
~IsobaricIsotopeCorrector();
67-
6856
/**
6957
@brief Apply isotope correction to the given input map and store the corrected values in the output map.
7058
7159
@param consensus_map_in The map containing the values that should be corrected.
7260
@param consensus_map_out The map where the corrected values should be stored.
61+
@param IsobaricQuantitationMethod (e.g., iTRAQ 4 plex)
7362
7463
@throws Exception::FailedAPICall If the least-squares fit fails.
7564
@throws Exception::InvalidParameter If the given correction matrix is invalid.
7665
*/
77-
IsobaricQuantifierStatistics correctIsotopicImpurities(const ConsensusMap& consensus_map_in, ConsensusMap& consensus_map_out);
66+
static IsobaricQuantifierStatistics
67+
correctIsotopicImpurities(const ConsensusMap& consensus_map_in,
68+
ConsensusMap& consensus_map_out,
69+
const IsobaricQuantitationMethod& quant_method);
7870

7971
private:
80-
/// The quantification method used for the dataset to be analyzed.
81-
const IsobaricQuantitationMethod* quant_method_;
82-
83-
/// @brief GSL objects used for the isotope correction.
84-
/// @{
85-
deprecated_gsl_matrix* m_;
86-
deprecated_gsl_permutation* p_;
87-
deprecated_gsl_vector* b_;
88-
deprecated_gsl_vector* x_;
89-
90-
/// Indicates whether memory was allocated for the gsl vector/matrix pointers.
91-
bool allocated_;
92-
93-
/// Free all memory allocated by GSL objects.
94-
void freeGSLMemory_();
95-
/// @}
96-
97-
/**
98-
@brief Checks if the given matrix is an identity matrix.
99-
100-
@param channel_frequency The matrix to check.
101-
@return True if the given matrix is an identity matrix, false otherwise.
102-
*/
103-
bool isIdentityMatrix_(const Matrix<double>& channel_frequency) const;
104-
105-
/**
106-
@brief Checks if the gsl matrix is invertible (see IsobaricIsotopeCorrector::m_).
107-
108-
@return True if the matrix is invertible, false otherwise.
109-
*/
110-
bool isInvertible_() const;
111-
11272
/**
11373
@brief Fills the input vector for the gsl/NNLS step given the ConsensusFeature.
11474
*/
115-
void fillInputVector_(deprecated_gsl_vector* b, Matrix<double>& m_b, const ConsensusFeature& cf, const ConsensusMap& cm) const;
116-
117-
/**
118-
@brief Solves the
119-
*/
120-
void solvedeprecated_gsl_(const deprecated_gsl_matrix* m, const deprecated_gsl_permutation* p, const deprecated_gsl_vector* b, deprecated_gsl_vector* x) const;
75+
static void
76+
fillInputVector_(Eigen::VectorXd& b, Matrix<double>& m_b,
77+
const ConsensusFeature& cf, const ConsensusMap& cm);
12178

12279
/**
12380
@brief
12481
*/
125-
void solveNNLS_(const Matrix<double>& correction_matrix, const Matrix<double>& m_b, Matrix<double>& m_x) const;
82+
static void
83+
solveNNLS_(const Matrix<double>& correction_matrix,
84+
const Matrix<double>& m_b, Matrix<double>& m_x);
12685

12786
/**
12887
@brief
12988
*/
130-
void computeStats_(const Matrix<double>& m_x, deprecated_gsl_vector* x, const ConsensusFeature::IntensityType cf_intensity, IsobaricQuantifierStatistics& stats);
89+
static void
90+
computeStats_(const Matrix<double>& m_x, const Eigen::MatrixXd& x,
91+
const ConsensusFeature::IntensityType cf_intensity,
92+
const IsobaricQuantitationMethod& quant_method,
93+
IsobaricQuantifierStatistics& stats);
13194

13295
/**
13396
@brief
13497
*/
135-
ConsensusFeature::IntensityType updateOutpuMap_(const ConsensusMap& consensus_map_in, ConsensusMap& consensus_map_out, ConsensusMap::size_type current_cf, const Matrix<double>& m_x) const;
98+
static ConsensusFeature::IntensityType
99+
updateOutpuMap_(const ConsensusMap& consensus_map_in,
100+
ConsensusMap& consensus_map_out, ConsensusMap::size_type current_cf,
101+
const Matrix<double>& m_x);
136102
};
137103
} // namespace
138104

‎include/OpenMS/APPLICATIONS/MapAlignerBase.h‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,10 @@ class TOPPMapAlignerBase :
9191
TransformationModelLinear::getDefaultParameters(model_params);
9292
params.insert("linear:", model_params);
9393
params.setSectionDescription("linear", "Parameters for 'linear' model");
94-
TransformationModelBSpline::getDefaultParameters(model_params);
95-
params.insert("b_spline:", model_params);
96-
params.setSectionDescription("b_spline", "Parameters for 'b_spline' model");
9794
TransformationModelInterpolated::getDefaultParameters(model_params);
98-
// "polynomial" interpolation is not suitable for RT data, so remove it:
99-
const Param::ParamEntry & entry =
100-
model_params.getEntry("interpolation_type");
101-
StringList interpolation_types = entry.valid_strings;
102-
StringList::iterator pos = find(interpolation_types.begin(),
103-
interpolation_types.end(), "polynomial");
104-
interpolation_types.erase(pos);
105-
model_params.setValidStrings("interpolation_type", interpolation_types);
95+
params.insert("cspline:", model_params);
96+
params.setSectionDescription("cspline", "Parameters for 'cspline' model");
97+
TransformationModelInterpolated::getDefaultParameters(model_params);
10698
params.insert("interpolated:", model_params);
10799
params.setSectionDescription("interpolated",
108100
"Parameters for 'interpolated' model");

0 commit comments

Comments
 (0)