From 02d8df63547825ae5cd8cf504f893a1ae386c9cc Mon Sep 17 00:00:00 2001 From: solvejlilienthal Date: Wed, 12 Apr 2023 14:50:09 +0200 Subject: [PATCH 1/3] FeatureFinderMetaboIdent_parallel --- .../OPENSWATH/MRMTransitionGroupPicker.h | 65 ++++++++++++------- .../OpenMS/FILTERING/SMOOTHING/GaussFilter.h | 2 +- .../SMOOTHING/GaussFilterAlgorithm.h | 30 ++++++--- .../FILTERING/SMOOTHING/SavitzkyGolayFilter.h | 4 +- .../FILTERING/SMOOTHING/GaussFilter.cpp | 4 +- .../FeatureFinderAlgorithmMetaboIdent.cpp | 21 +++++- 6 files changed, 85 insertions(+), 41 deletions(-) diff --git a/src/openms/include/OpenMS/ANALYSIS/OPENSWATH/MRMTransitionGroupPicker.h b/src/openms/include/OpenMS/ANALYSIS/OPENSWATH/MRMTransitionGroupPicker.h index b743a7746c5..cdf21361962 100644 --- a/src/openms/include/OpenMS/ANALYSIS/OPENSWATH/MRMTransitionGroupPicker.h +++ b/src/openms/include/OpenMS/ANALYSIS/OPENSWATH/MRMTransitionGroupPicker.h @@ -46,6 +46,7 @@ #include #include +#include // Cross-correlation #include @@ -115,43 +116,61 @@ namespace OpenMS OPENMS_PRECONDITION(transition_group.isInternallyConsistent(), "Consistent state required") OPENMS_PRECONDITION(transition_group.chromatogramIdsMatch(), "Chromatogram native IDs need to match keys in transition group") - std::vector picked_chroms; - std::vector smoothed_chroms; + std::vector picked_chroms; + std::vector smoothed_chroms; - // Pick fragment ion chromatograms - for (Size k = 0; k < transition_group.getChromatograms().size(); k++) + picked_chroms.resize(transition_group.getChromatograms().size()); + smoothed_chroms.resize(transition_group.getChromatograms().size()); + + // double timer_start = omp_get_wtime(); + #pragma omp parallel { - MSChromatogram& chromatogram = transition_group.getChromatograms()[k]; - String native_id = chromatogram.getNativeID(); - - // only pick detecting transitions (skip all others) - if (transition_group.getTransitions().size() > 0 && - transition_group.hasTransition(native_id) && - !transition_group.getTransition(native_id).isDetectingTransition() ) + PeakPickerMRM picker_temp(picker_); + #pragma omp for + for (Size k = 0; k < transition_group.getChromatograms().size(); k++) // Pick fragment ion chromatograms { - continue; - } + MSChromatogram& chromatogram = transition_group.getChromatograms()[k]; + String native_id = chromatogram.getNativeID(); - MSChromatogram picked_chrom, smoothed_chrom; - smoothed_chrom.setNativeID(native_id); - picker_.pickChromatogram(chromatogram, picked_chrom, smoothed_chrom); - picked_chrom.sortByIntensity(); - picked_chroms.push_back(std::move(picked_chrom)); - smoothed_chroms.push_back(std::move(smoothed_chrom)); + // only pick detecting transitions (skip all others) + if (transition_group.getTransitions().size() > 0 && + transition_group.hasTransition(native_id) && + !transition_group.getTransition(native_id).isDetectingTransition() ) + { + continue; + } + + MSChromatogram picked_chrom, smoothed_chrom; + smoothed_chrom.setNativeID(native_id); + picker_temp.pickChromatogram(chromatogram, picked_chrom, smoothed_chrom); + picked_chrom.sortByIntensity(); + picked_chroms[k] = std::move(picked_chrom); + smoothed_chroms[k] = std::move(smoothed_chrom); + } } + // double timer_end = omp_get_wtime(); + // std::cout << timer_end - timer_start << std::endl; - // Pick precursor chromatograms + // Pick precursor chromatograms if (use_precursors_) { + #ifdef _OPENMP + int in_parallel = omp_in_parallel(); + #endif + #pragma omp parallel for if (in_parallel == 0) for (Size k = 0; k < transition_group.getPrecursorChromatograms().size(); k++) { SpectrumT picked_chrom, smoothed_chrom; + picked_chrom.reserve(transition_group.getPrecursorChromatograms().size()); + smoothed_chrom.reserve(transition_group.getPrecursorChromatograms().size()); + SpectrumT& chromatogram = transition_group.getPrecursorChromatograms()[k]; + PeakPickerMRM picker_temp = picker_; - picker_.pickChromatogram(chromatogram, picked_chrom, smoothed_chrom); + picker_temp.pickChromatogram(chromatogram, picked_chrom, smoothed_chrom); picked_chrom.sortByIntensity(); - picked_chroms.push_back(picked_chrom); - smoothed_chroms.push_back(smoothed_chrom); + picked_chroms[k] = picked_chrom; + smoothed_chroms[k] = smoothed_chrom; } } diff --git a/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilter.h b/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilter.h index 6ef23ec07ab..1b7f3c33ff9 100644 --- a/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilter.h +++ b/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilter.h @@ -87,7 +87,7 @@ namespace OpenMS */ void filter(MSSpectrum & spectrum); - void filter(MSChromatogram & chromatogram); + void filter(MSChromatogram & chromatogram) const; /** @brief Smoothes an MSExperiment containing profile data. diff --git a/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilterAlgorithm.h b/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilterAlgorithm.h index 93facd7d645..36db33a30f9 100644 --- a/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilterAlgorithm.h +++ b/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilterAlgorithm.h @@ -39,7 +39,10 @@ #include #include #include +#include +#include +using namespace std; namespace OpenMS { /** @@ -134,21 +137,23 @@ namespace OpenMS ConstIterT mz_in_end, ConstIterT int_in_start, IterT mz_out, - IterT int_out) + IterT int_out) const { bool found_signal = false; - ConstIterT mz_it = mz_in_start; + ConstIterT mz_it; ConstIterT int_it = int_in_start; - for (; mz_it != mz_in_end; mz_it++, int_it++) + GaussFilterAlgorithm g = *this; + + for (mz_it = mz_in_start; mz_it != mz_in_end; mz_it++) { // if ppm tolerance is used, calculate a reasonable width value for this m/z if (use_ppm_tolerance_) { - initialize((*mz_it) * ppm_tolerance_ * 10e-6, spacing_, ppm_tolerance_, use_ppm_tolerance_ ); + g.initialize((*mz_it) * ppm_tolerance_ * 10e-6, spacing_, ppm_tolerance_, use_ppm_tolerance_ ); } - double new_int = integrate_(mz_it, int_it, mz_in_start, mz_in_end); + double new_int = g.integrate_(mz_it, int_it, mz_in_start, mz_in_end); // store new intensity and m/z into output iterator *mz_out = *mz_it; @@ -156,13 +161,19 @@ namespace OpenMS ++mz_out; ++int_out; - if (fabs(new_int) > 0) found_signal = true; + if (new_int != 0) found_signal = true; + int_it++; } return found_signal; } void initialize(double gaussian_width, double spacing, double ppm_tolerance, bool use_ppm_tolerance); + // TODO + /* + Testdateien anpassen (Signaturen) + for-Schleife parallelisieren -X + */ protected: ///Coefficients @@ -178,7 +189,7 @@ namespace OpenMS /// Computes the convolution of the raw data at position x and the gaussian kernel template - double integrate_(InputPeakIterator x /* mz */, InputPeakIterator y /* int */, InputPeakIterator first, InputPeakIterator last) + double integrate_(InputPeakIterator x /* mz */, InputPeakIterator y /* int */, InputPeakIterator first, InputPeakIterator last) const { double v = 0.; // norm the gaussian kernel area to one @@ -203,7 +214,7 @@ namespace OpenMS Size left_position = (Size)floor(distance_in_gaussian / spacing_); // search for the true left adjacent data point (because of rounding errors) - for (int j = 0; ((j < 3) && (distance(first, help_x - j) >= 0)); ++j) + for (UInt j = 0; ((j < 3) && (distance(first, help_x - j) >= 0)); ++j) { if (((left_position - j) * spacing_ <= distance_in_gaussian) && ((left_position - j + 1) * spacing_ >= distance_in_gaussian)) { @@ -234,7 +245,6 @@ namespace OpenMS std::cout << "interpolated value left " << coeffs_right << std::endl; #endif - // search for the corresponding datapoint for (help-1) in the gaussian (take the left most adjacent point) distance_in_gaussian = fabs((*x) - (*(help_x - 1))); left_position = (Size)floor(distance_in_gaussian / spacing_); @@ -273,7 +283,6 @@ namespace OpenMS << std::endl; #endif - norm += fabs((*(help_x - 1)) - (*help_x)) / 2. * (coeffs_left + coeffs_right); v += fabs((*(help_x - 1)) - (*help_x)) / 2. * (*(help_y - 1) * coeffs_left + (*help_y) * coeffs_right); @@ -364,6 +373,7 @@ namespace OpenMS << "* " << coeffs_right << std::endl; #endif + norm += fabs((*help_x) - (*(help_x + 1)) ) / 2. * (coeffs_left + coeffs_right); v += fabs((*help_x) - (*(help_x + 1)) ) / 2. * ((*help_y) * coeffs_left + (*(help_y + 1)) * coeffs_right); diff --git a/src/openms/include/OpenMS/FILTERING/SMOOTHING/SavitzkyGolayFilter.h b/src/openms/include/OpenMS/FILTERING/SMOOTHING/SavitzkyGolayFilter.h index 3cb4ba62571..18a292b8f88 100644 --- a/src/openms/include/OpenMS/FILTERING/SMOOTHING/SavitzkyGolayFilter.h +++ b/src/openms/include/OpenMS/FILTERING/SMOOTHING/SavitzkyGolayFilter.h @@ -112,7 +112,7 @@ namespace OpenMS // low level template to filters spectra and chromatograms // raw data and meta data needs to be copied to the output container before calling this function template - void filter(InputIt first, InputIt last, OutputIt d_first) + void filter(InputIt first, InputIt last, OutputIt d_first) const { size_t n = std::distance(first, last); @@ -198,7 +198,7 @@ namespace OpenMS /** @brief Removed the noise from an MSChromatogram */ - void filter(MSChromatogram & chromatogram) + void filter(MSChromatogram & chromatogram) const { // copy the data AND META DATA to the output container MSChromatogram output = chromatogram; diff --git a/src/openms/source/FILTERING/SMOOTHING/GaussFilter.cpp b/src/openms/source/FILTERING/SMOOTHING/GaussFilter.cpp index e8b45f774ce..17f0a856beb 100644 --- a/src/openms/source/FILTERING/SMOOTHING/GaussFilter.cpp +++ b/src/openms/source/FILTERING/SMOOTHING/GaussFilter.cpp @@ -68,7 +68,7 @@ namespace OpenMS write_log_messages_ = param_.getValue("write_log_messages").toBool(); } - void GaussFilter::filter(MSSpectrum & spectrum) + void GaussFilter::filter(MSSpectrum & spectrum) { // make sure the right data type is set spectrum.setType(SpectrumSettings::PROFILE); @@ -115,7 +115,7 @@ namespace OpenMS } } - void GaussFilter::filter(MSChromatogram & chromatogram) + void GaussFilter::filter(MSChromatogram & chromatogram) const { if (param_.getValue("use_ppm_tolerance").toBool()) { diff --git a/src/openms/source/TRANSFORMATIONS/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp b/src/openms/source/TRANSFORMATIONS/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp index 9e4cfa66160..999896e0f45 100644 --- a/src/openms/source/TRANSFORMATIONS/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp +++ b/src/openms/source/TRANSFORMATIONS/FEATUREFINDER/FeatureFinderAlgorithmMetaboIdent.cpp @@ -315,7 +315,10 @@ namespace OpenMS double best_MZ = cluster_representative.getMZ(); double overlap_MZ = overlap.getMZ(); - // are the features the same? (@TODO: use "Math::approximatelyEqual"?) + // are the features the same? (@TODO: use "OpenMS::Math::approximatelyEqual(overlap_MZ, best_MZ, tol?)"?) + //"OpenMS::Math::approximatelyEqual(overlap_RT, best_RT, tol?)" + // if (OpenMS::Math::approximatelyEqual(overlap_MZ, best_MZ, tol?) && OpenMS::Math::approximatelyEqual(overlap_RT, best_RT, tol?)) + // tol = |best_MZ - observed_MZ| oder |theoretical_MZ - observed_MZ| if ((overlap_MZ == best_MZ) && (overlap_RT == best_RT)) { // update annotations: @@ -388,7 +391,7 @@ namespace OpenMS /// Add a target (from the input file) to the assay library void FeatureFinderAlgorithmMetaboIdent::addTargetToLibrary_(const String& name, const String& formula, double mass, const vector& charges, - const vector& rts, + const vector& rts, // retention times vector rt_ranges, const vector& iso_distrib) { @@ -405,6 +408,14 @@ namespace OpenMS return; } // @TODO: detect entries with same RT and m/z ("collisions") + /* + if () + { + OPENMS_LOG_ERROR << "Error: Collision. Already found an entry with the same RT and m/z '" + << name << "' - skipping this target." << endl; + return; + } + */ TargetedExperiment::Compound target; target.setMetaValue("name", name); target.molecular_formula = formula; @@ -424,9 +435,11 @@ namespace OpenMS { if (formula.empty()) { - OPENMS_LOG_ERROR << "Error: No sum formula given for target '" << name + /* + OPENMS_LOG_ERROR << "Warning: No sum formula given for target '" << name << "'; cannot calculate isotope distribution" << " - using estimation method for peptides." << endl; + */ iso_dist = iso_gen_.estimateFromPeptideWeight(mass); } else @@ -513,6 +526,7 @@ namespace OpenMS { // go through different isotopes: Size counter = 0; + //vector mass = iso_dist.MassAbundance(); for (const Peak1D& iso : iso_dist) { ReactionMonitoringTransition transition; @@ -524,6 +538,7 @@ namespace OpenMS // @TODO: use accurate masses from the isotope distribution here? transition.setProductMZ(mz + abs(Constants::C13C12_MASSDIFF_U * float(counter) / charge)); + //(mass * charge)? where counter? transition.setLibraryIntensity(iso.getIntensity()); // transition.setMetaValue("annotation", annotation); // ??? transition.setCompoundRef(target_id); From afc2f9983a7c78fd2017bb65e80476c8bdf7fe72 Mon Sep 17 00:00:00 2001 From: solvejlilienthal Date: Mon, 24 Apr 2023 15:35:41 +0200 Subject: [PATCH 2/3] FFMI convolve --- .../OPENSWATH/MRMTransitionGroupPicker.h | 76 +++++---- .../SMOOTHING/GaussFilterAlgorithm.h | 144 ++++++++++++++---- .../ANALYSIS/OPENSWATH/PeakPickerMRM.cpp | 8 +- .../SMOOTHING/GaussFilterAlgorithm.cpp | 12 +- .../RAW2PEAK/PeakPickerHiRes.cpp | 10 +- .../src/Convolution/fft_convolve.hpp | 2 - .../evergreen/src/Tensor/Tensor.hpp | 2 +- src/topp/NoiseFilterGaussian.cpp | 2 + 8 files changed, 174 insertions(+), 82 deletions(-) diff --git a/src/openms/include/OpenMS/ANALYSIS/OPENSWATH/MRMTransitionGroupPicker.h b/src/openms/include/OpenMS/ANALYSIS/OPENSWATH/MRMTransitionGroupPicker.h index cdf21361962..3413cab6a65 100644 --- a/src/openms/include/OpenMS/ANALYSIS/OPENSWATH/MRMTransitionGroupPicker.h +++ b/src/openms/include/OpenMS/ANALYSIS/OPENSWATH/MRMTransitionGroupPicker.h @@ -122,57 +122,51 @@ namespace OpenMS picked_chroms.resize(transition_group.getChromatograms().size()); smoothed_chroms.resize(transition_group.getChromatograms().size()); - // double timer_start = omp_get_wtime(); - #pragma omp parallel + // Pick precursor chromatograms + if (use_precursors_) { - PeakPickerMRM picker_temp(picker_); - #pragma omp for - for (Size k = 0; k < transition_group.getChromatograms().size(); k++) // Pick fragment ion chromatograms + #pragma omp parallel num_threads(transition_group.getPrecursorChromatograms().size()) { - MSChromatogram& chromatogram = transition_group.getChromatograms()[k]; - String native_id = chromatogram.getNativeID(); - - // only pick detecting transitions (skip all others) - if (transition_group.getTransitions().size() > 0 && - transition_group.hasTransition(native_id) && - !transition_group.getTransition(native_id).isDetectingTransition() ) + PeakPickerMRM picker_temp(picker_); + #pragma omp for + for (Size k = 0; k < transition_group.getPrecursorChromatograms().size(); k++) { - continue; - } + SpectrumT& picked_chrom = picked_chroms[k]; + SpectrumT& smoothed_chrom = smoothed_chroms[k]; + SpectrumT& chromatogram = transition_group.getPrecursorChromatograms()[k]; - MSChromatogram picked_chrom, smoothed_chrom; - smoothed_chrom.setNativeID(native_id); - picker_temp.pickChromatogram(chromatogram, picked_chrom, smoothed_chrom); - picked_chrom.sortByIntensity(); - picked_chroms[k] = std::move(picked_chrom); - smoothed_chroms[k] = std::move(smoothed_chrom); + picker_temp.pickChromatogram(chromatogram, picked_chrom, smoothed_chrom); + picked_chrom.sortByIntensity(); + } } - } - // double timer_end = omp_get_wtime(); - // std::cout << timer_end - timer_start << std::endl; - - // Pick precursor chromatograms - if (use_precursors_) + } + else { - #ifdef _OPENMP - int in_parallel = omp_in_parallel(); - #endif - #pragma omp parallel for if (in_parallel == 0) - for (Size k = 0; k < transition_group.getPrecursorChromatograms().size(); k++) + #pragma omp parallel num_threads(transition_group.getChromatograms().size()) { - SpectrumT picked_chrom, smoothed_chrom; - picked_chrom.reserve(transition_group.getPrecursorChromatograms().size()); - smoothed_chrom.reserve(transition_group.getPrecursorChromatograms().size()); + PeakPickerMRM picker_temp(picker_); + #pragma omp for + for (Size k = 0; k < transition_group.getChromatograms().size(); k++) // Pick fragment ion chromatograms + { + MSChromatogram& chromatogram = transition_group.getChromatograms()[k]; + String native_id = chromatogram.getNativeID(); - SpectrumT& chromatogram = transition_group.getPrecursorChromatograms()[k]; - PeakPickerMRM picker_temp = picker_; + // only pick detecting transitions (skip all others) + if (transition_group.getTransitions().size() > 0 && + transition_group.hasTransition(native_id) && + !transition_group.getTransition(native_id).isDetectingTransition() ) + { + continue; + } - picker_temp.pickChromatogram(chromatogram, picked_chrom, smoothed_chrom); - picked_chrom.sortByIntensity(); - picked_chroms[k] = picked_chrom; - smoothed_chroms[k] = smoothed_chrom; + MSChromatogram& picked_chrom = picked_chroms[k]; + MSChromatogram& smoothed_chrom = smoothed_chroms[k]; + smoothed_chrom.setNativeID(native_id); + picker_temp.pickChromatogram(chromatogram, picked_chrom, smoothed_chrom); + picked_chrom.sortByIntensity(); + } } - } + } // Find features (peak groups) in this group of transitions. // While there are still peaks left, one will be picked and used to create diff --git a/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilterAlgorithm.h b/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilterAlgorithm.h index 36db33a30f9..8bd8a5e128e 100644 --- a/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilterAlgorithm.h +++ b/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilterAlgorithm.h @@ -37,12 +37,11 @@ #include #include #include +#include #include #include -#include -#include +#include // Reihenfolge TODO -using namespace std; namespace OpenMS { /** @@ -83,6 +82,7 @@ namespace OpenMS */ bool filter(OpenMS::Interfaces::SpectrumPtr spectrum) { + std::cout << "spectrum filter" << std::endl; // create new arrays for mz / intensity data and set their size OpenMS::Interfaces::BinaryDataArrayPtr intensity_array(new OpenMS::Interfaces::BinaryDataArray); OpenMS::Interfaces::BinaryDataArrayPtr mz_array(new OpenMS::Interfaces::BinaryDataArray); @@ -107,6 +107,7 @@ namespace OpenMS */ bool filter(OpenMS::Interfaces::ChromatogramPtr chromatogram) { + std::cout << "chromatogram filter" << std::endl; // create new arrays for rt / intensity data and set their size OpenMS::Interfaces::BinaryDataArrayPtr intensity_array(new OpenMS::Interfaces::BinaryDataArray); OpenMS::Interfaces::BinaryDataArrayPtr rt_array(new OpenMS::Interfaces::BinaryDataArray); @@ -129,56 +130,137 @@ namespace OpenMS /** @brief Smoothes an two data arrays containing data. - Convolutes the filter and the profile data and writes the results into the output iterators mz_out and int_out. + Convolutes the filter and the profile data and writes the results into the output iterators mz_out and int_out. */ template bool filter( - ConstIterT mz_in_start, + ConstIterT mz_in_start, // rt oder mz --> in die Irre führende Benennung ConstIterT mz_in_end, ConstIterT int_in_start, IterT mz_out, IterT int_out) const { bool found_signal = false; - - ConstIterT mz_it; + ConstIterT int_it = int_in_start; - GaussFilterAlgorithm g = *this; + ConstIterT mz_it = mz_in_start; - for (mz_it = mz_in_start; mz_it != mz_in_end; mz_it++) + evergreen::Tensor gaussian_data({coeffs_.size()}); // Problem: gaussian_data.size() != intensities_data.size() --> zu groß!!! + // normalize the gaussian coefficients to scale the intensities correctly + bool divide_by_sum = false; + for (unsigned i = 0; i < coeffs_.size() - 1; i++) + { + if (coeffs_[i] >= 1 && coeffs_[i + 1] != 0) + { + divide_by_sum = true; + break; + } + } + + if (divide_by_sum) + { + double sum = std::accumulate(coeffs_.begin(), coeffs_.end(), 0); + // mapping function + for (long unsigned i = 0; i < coeffs_.size(); i++) + { + gaussian_data[i] = coeffs_[i]/ sum; + } + } + else { - // if ppm tolerance is used, calculate a reasonable width value for this m/z - if (use_ppm_tolerance_) + for (long unsigned i = 0; i < coeffs_.size(); i++) { - g.initialize((*mz_it) * ppm_tolerance_ * 10e-6, spacing_, ppm_tolerance_, use_ppm_tolerance_ ); + gaussian_data[i] = coeffs_[i]; } + } - double new_int = g.integrate_(mz_it, int_it, mz_in_start, mz_in_end); - - // store new intensity and m/z into output iterator + // Die zu glättenden Daten + evergreen::Tensor intensities_data({mz_in_end - mz_in_start}); + /* + if ((mz_in_end - mz_in_start) < coeffs_.size()) + { + evergreen::Tensor intensities_data_temp({coeffs_.size()}); + for (long int i = 0; i < coeffs_.size(); i++) + { + if (i <= ((coeffs_.size() - 1)/ 4) || i >= (coeffs_.size() - ((coeffs_.size() - 1)/ 4))) + { + intensities_data_temp[i] = 0; + } + else + { + intensities_data_temp[i] = *int_it; + int_it++; + } + intensities_data = intensities_data_temp; + } + } + else + { + */ + for (long int i = 0; i < (mz_in_end - mz_in_start); i++, int_it++) // cursed an einigen Stellen??? --> nach convolve noch da + { + intensities_data[i] = *int_it; + } + //} + + /* + std::vector a = {0.25, 0.5, 0.25}; + evergreen::Tensor gaussian_data({a.size()}); + for (int i = 0; i < a.size(); i++) + { + gaussian_data[i] = a[i]; + } + + std::vector b = {0.0, 0.0, 1.0, 0.0, 0.0}; + evergreen::Tensor intensities_data({b.size()}); + for (int i = 0; i < b.size(); i++) + { + intensities_data[i] = b[i]; + }*/ + + mz_it = mz_in_start; + int_it = int_in_start; + + //Fast Fourier Transformation from evergreen + evergreen::Tensor out_fft = evergreen::fft_convolve(intensities_data, gaussian_data); // size() = i_data.size() + g_data.size() - 1 + // - (out_fft.size() - 1)/ 2 + // --> (i.size() + g.size() - 2)/ 2 + // --> i.size() - 1 + + + for (int i = ((out_fft.flat_size() - 1)/ ((out_fft.flat_size() - (mz_in_end - mz_in_start) - 1))) + 1; mz_it != mz_in_end; mz_it++, int_it++, i++) // erase (N-1)/2 Enden am Anfang und am Ende --> size() = i.size() - 1 + // --> i.size() (- 1) = mz_in_end - mz_in_start (- 1) + // --> mz_it (mz_in_start) <= mz_in_end (- 1) + { + // if (i >= (out_fft.flat_size() - (out_fft.flat_size() - 1)/ ((out_fft.flat_size() - (mz_in_end - mz_in_start) - 1)/ 2))) break; // geht sobald | gilt ... tut es nicht... :/ *mz_out = *mz_it; - *int_out = new_int; + if (out_fft[i] < 0) out_fft[i] = 0; + *int_out = out_fft[i]; ++mz_out; ++int_out; - if (new_int != 0) found_signal = true; - int_it++; + if (out_fft[i] != 0) found_signal = true; + } + + //i luv u pls work + /* + for (int i = ((out_fft.flat_size() - 1)/ 4); i < (out_fft.flat_size() - (out_fft.flat_size() - 1)/ 4); i++) + { + if (out_fft[i] != 0) found_signal = true; } + */ return found_signal; } + void initialize(double gaussian_width, double spacing, double ppm_tolerance, bool use_ppm_tolerance); - // TODO - /* - Testdateien anpassen (Signaturen) - for-Schleife parallelisieren -X - */ protected: - ///Coefficients - std::vector coeffs_; - /// The standard derivation \f$ \sigma \f$. + /// Coefficients // Variablendeklaration am Ende (Codingconvention) + std::vector coeffs_; // Gaussian numbers for FFT + //evergreen::Tensor gaussian_data_; + /// The standard derivation \f$ \sigma \f$. double sigma_; /// The spacing of the pre-tabulated kernel coefficients double spacing_; @@ -191,13 +273,13 @@ namespace OpenMS template double integrate_(InputPeakIterator x /* mz */, InputPeakIterator y /* int */, InputPeakIterator first, InputPeakIterator last) const { - double v = 0.; + double v = 0.; // was bedeutet v? -> unpassende variablen Benennung // Fläche unter der (f*g) = h-Funktion // norm the gaussian kernel area to one double norm = 0.; - Size middle = coeffs_.size(); + Size middle = coeffs_.size(); // unpassende variablen Benennung - double start_pos = (( (*x) - (middle * spacing_)) > (*first)) ? ((*x) - (middle * spacing_)) : (*first); - double end_pos = (( (*x) + (middle * spacing_)) < (*(last - 1))) ? ((*x) + (middle * spacing_)) : (*(last - 1)); + double start_pos = (((*x) - (middle * spacing_)) > (*first)) ? ((*x) - (middle * spacing_)) : (*first); + double end_pos = (((*x) + (middle * spacing_)) < (*(last - 1))) ? ((*x) + (middle * spacing_)) : (*(last - 1)); InputPeakIterator help_x = x; InputPeakIterator help_y = y; @@ -214,7 +296,7 @@ namespace OpenMS Size left_position = (Size)floor(distance_in_gaussian / spacing_); // search for the true left adjacent data point (because of rounding errors) - for (UInt j = 0; ((j < 3) && (distance(first, help_x - j) >= 0)); ++j) + for (UInt j = 0; ((j < 3) && (distance(first, help_x - j) >= 0)); ++j) { if (((left_position - j) * spacing_ <= distance_in_gaussian) && ((left_position - j + 1) * spacing_ >= distance_in_gaussian)) { diff --git a/src/openms/source/ANALYSIS/OPENSWATH/PeakPickerMRM.cpp b/src/openms/source/ANALYSIS/OPENSWATH/PeakPickerMRM.cpp index 5bf62415f76..bbad886df0f 100644 --- a/src/openms/source/ANALYSIS/OPENSWATH/PeakPickerMRM.cpp +++ b/src/openms/source/ANALYSIS/OPENSWATH/PeakPickerMRM.cpp @@ -125,6 +125,8 @@ namespace OpenMS gauss_.filter(smoothed_chrom); } + // läuft top + // Find initial seeds (peak picking) pp_.pick(smoothed_chrom, picked_chrom); OPENMS_LOG_DEBUG << "Picked " << picked_chrom.size() << " chromatographic peaks." << std::endl; @@ -165,9 +167,9 @@ namespace OpenMS picked_chrom.getFloatDataArrays()[IDX_RIGHTBORDER].reserve(picked_chrom.size()); for (Size i = 0; i < picked_chrom.size(); i++) { - picked_chrom.getFloatDataArrays()[IDX_ABUNDANCE].push_back(integrated_intensities_[i]); - picked_chrom.getFloatDataArrays()[IDX_LEFTBORDER].push_back((float)chromatogram[left_width_[i]].getRT()); - picked_chrom.getFloatDataArrays()[IDX_RIGHTBORDER].push_back((float)chromatogram[right_width_[i]].getRT()); + picked_chrom.getFloatDataArrays()[IDX_ABUNDANCE][i] = integrated_intensities_[i]; + picked_chrom.getFloatDataArrays()[IDX_LEFTBORDER][i] = (float)chromatogram[left_width_[i]].getRT(); + picked_chrom.getFloatDataArrays()[IDX_RIGHTBORDER][i] = (float)chromatogram[right_width_[i]].getRT(); } } diff --git a/src/openms/source/FILTERING/SMOOTHING/GaussFilterAlgorithm.cpp b/src/openms/source/FILTERING/SMOOTHING/GaussFilterAlgorithm.cpp index 9f35a10f914..7f96612b1cb 100644 --- a/src/openms/source/FILTERING/SMOOTHING/GaussFilterAlgorithm.cpp +++ b/src/openms/source/FILTERING/SMOOTHING/GaussFilterAlgorithm.cpp @@ -33,6 +33,7 @@ // -------------------------------------------------------------------------- #include +#include namespace OpenMS { @@ -61,8 +62,9 @@ namespace OpenMS for (Size i = 1; i < number_of_points_right; i++) { - coeffs_[i] = 1.0 / (sigma_ * sqrt(2.0 * Constants::PI)) * exp(-((i * spacing_) * (i * spacing_)) / (2 * sigma_ * sigma_)); + coeffs_[i] = (1.0 / (sigma_ * sqrt(2.0 * Constants::PI))) * exp(-((i * spacing_) * (i * spacing_)) / (2 * sigma_ * sigma_)); } + #ifdef DEBUG_FILTERING std::cout << "Coeffs: " << std::endl; for (Size i = 0; i < number_of_points_right; i++) @@ -70,7 +72,13 @@ namespace OpenMS std::cout << i * spacing_ << ' ' << coeffs_[i] << std::endl; } #endif - + if(!use_ppm_tolerance) + { + std::vector temp = coeffs_; + std::reverse(coeffs_.begin(), coeffs_.end()); + coeffs_.insert(coeffs_.end(), temp.begin(), temp.end()); + // member? + } } } diff --git a/src/openms/source/TRANSFORMATIONS/RAW2PEAK/PeakPickerHiRes.cpp b/src/openms/source/TRANSFORMATIONS/RAW2PEAK/PeakPickerHiRes.cpp index c8a91ab25bb..0c317c53f77 100644 --- a/src/openms/source/TRANSFORMATIONS/RAW2PEAK/PeakPickerHiRes.cpp +++ b/src/openms/source/TRANSFORMATIONS/RAW2PEAK/PeakPickerHiRes.cpp @@ -203,6 +203,11 @@ namespace OpenMS act_snt_r1 = snt.getSignalToNoise(i + 1); } + std::cout << "central: " << central_peak_int << ", left: " << left_neighbor_int << ", right: " << right_neighbor_int << std::endl; // fast nie + // std::cout << "signal:" << signal_to_noise_ /* = 1 */ << ", snt:" << act_snt << ", left:" << act_snt_l1 << ", right:" << act_snt_r1 << std::endl; // meist ganz gut + // std::cout << check_spacings /* = 0 */ << std::endl; + // std::cout << "peak_int: " << ((central_peak_int > left_neighbor_int) && (central_peak_int > right_neighbor_int)) << " "; + // std::cout << "act_snt: " << ((act_snt >= signal_to_noise_) && (act_snt_l1 >= signal_to_noise_) && (act_snt_r1 >= signal_to_noise_)) << std::endl; // look for peak cores meeting MZ and intensity/SNT criteria if ((central_peak_int > left_neighbor_int) && (central_peak_int > right_neighbor_int) && @@ -216,7 +221,7 @@ namespace OpenMS // special case: if a peak core is surrounded by more intense // satellite peaks (indicates oscillation rather than // real peaks) -> remove - + std::cout << "peak core searching..." << std::endl; double act_snt_l2 = 0.0, act_snt_r2 = 0.0; if (signal_to_noise_ > 0.0) @@ -255,6 +260,7 @@ namespace OpenMS } // peak core found, now extend it + std::cout << "peak core found --> extending..." << std::endl; // to the left Size k = 2; @@ -298,7 +304,6 @@ namespace OpenMS left_boundary = i - k; ++k; } - // to the right k = 2; @@ -341,6 +346,7 @@ namespace OpenMS right_boundary = i + k; ++k; } + std::cout << "extending done" << std::endl; // skip if the minimal number of 3 points for fitting is not reached if (peak_raw_data.size() < 3) diff --git a/src/openms/thirdparty/evergreen/src/Convolution/fft_convolve.hpp b/src/openms/thirdparty/evergreen/src/Convolution/fft_convolve.hpp index 4ae0fe4a068..2ee4da7b0a8 100644 --- a/src/openms/thirdparty/evergreen/src/Convolution/fft_convolve.hpp +++ b/src/openms/thirdparty/evergreen/src/Convolution/fft_convolve.hpp @@ -76,7 +76,6 @@ inline Tensor fft_convolve_already_padded_rvalue(Tensor && lhs_p Tensor lhs_padded = Tensor::create_reinterpreted(std::move(lhs_padded_doubles)); Tensor rhs_padded = Tensor::create_reinterpreted(std::move(rhs_padded_doubles)); - apply_real_fft_packed(lhs_padded); apply_real_fft_packed(rhs_padded); @@ -90,7 +89,6 @@ inline Tensor fft_convolve_already_padded_rvalue(Tensor && lhs_p // Unpack: Tensor result = Tensor::create_reinterpreted(std::move(lhs_padded)); - result.shrink(result_shape); return result; } diff --git a/src/openms/thirdparty/evergreen/src/Tensor/Tensor.hpp b/src/openms/thirdparty/evergreen/src/Tensor/Tensor.hpp index 54e28d8aecd..38107cc3ecb 100644 --- a/src/openms/thirdparty/evergreen/src/Tensor/Tensor.hpp +++ b/src/openms/thirdparty/evergreen/src/Tensor/Tensor.hpp @@ -213,7 +213,7 @@ class Tensor : public WritableTensorLike { const Vector & data_shape() const { return _data_shape; } - const Vector & view_shape() const { + const Vector & view_shape() const { return data_shape(); } unsigned long flat_size() const { diff --git a/src/topp/NoiseFilterGaussian.cpp b/src/topp/NoiseFilterGaussian.cpp index debe74cf57c..4606e6a6c2d 100644 --- a/src/topp/NoiseFilterGaussian.cpp +++ b/src/topp/NoiseFilterGaussian.cpp @@ -116,11 +116,13 @@ class TOPPNoiseFilterGaussian : void processSpectrum_(MapType::SpectrumType& s) override { + std::cout << "spectrum filter" << std::endl; gf_.filter(s); } void processChromatogram_(MapType::ChromatogramType& c) override { + std::cout << "chromatogram filter" << std::endl; gf_.filter(c); } From 5e67e9ca7557c758c6b65b8bfdd060ee08f4777d Mon Sep 17 00:00:00 2001 From: solvejlilienthal Date: Thu, 4 May 2023 11:23:58 +0200 Subject: [PATCH 3/3] ffft convolve + binning --- .../OpenMS/FILTERING/SMOOTHING/GaussFilter.h | 2 +- .../SMOOTHING/GaussFilterAlgorithm.h | 233 ++++++++++-------- .../FILTERING/SMOOTHING/GaussFilter.cpp | 2 +- .../SMOOTHING/GaussFilterAlgorithm.cpp | 2 +- .../RAW2PEAK/PeakPickerHiRes.cpp | 7 - 5 files changed, 127 insertions(+), 119 deletions(-) diff --git a/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilter.h b/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilter.h index 1b7f3c33ff9..6ef23ec07ab 100644 --- a/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilter.h +++ b/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilter.h @@ -87,7 +87,7 @@ namespace OpenMS */ void filter(MSSpectrum & spectrum); - void filter(MSChromatogram & chromatogram) const; + void filter(MSChromatogram & chromatogram); /** @brief Smoothes an MSExperiment containing profile data. diff --git a/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilterAlgorithm.h b/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilterAlgorithm.h index 8bd8a5e128e..a58ea7b7326 100644 --- a/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilterAlgorithm.h +++ b/src/openms/include/OpenMS/FILTERING/SMOOTHING/GaussFilterAlgorithm.h @@ -41,6 +41,7 @@ #include #include #include // Reihenfolge TODO +#include namespace OpenMS { @@ -82,7 +83,6 @@ namespace OpenMS */ bool filter(OpenMS::Interfaces::SpectrumPtr spectrum) { - std::cout << "spectrum filter" << std::endl; // create new arrays for mz / intensity data and set their size OpenMS::Interfaces::BinaryDataArrayPtr intensity_array(new OpenMS::Interfaces::BinaryDataArray); OpenMS::Interfaces::BinaryDataArrayPtr mz_array(new OpenMS::Interfaces::BinaryDataArray); @@ -107,7 +107,6 @@ namespace OpenMS */ bool filter(OpenMS::Interfaces::ChromatogramPtr chromatogram) { - std::cout << "chromatogram filter" << std::endl; // create new arrays for rt / intensity data and set their size OpenMS::Interfaces::BinaryDataArrayPtr intensity_array(new OpenMS::Interfaces::BinaryDataArray); OpenMS::Interfaces::BinaryDataArrayPtr rt_array(new OpenMS::Interfaces::BinaryDataArray); @@ -134,149 +133,154 @@ namespace OpenMS */ template bool filter( - ConstIterT mz_in_start, // rt oder mz --> in die Irre führende Benennung + ConstIterT mz_in_start, ConstIterT mz_in_end, ConstIterT int_in_start, IterT mz_out, - IterT int_out) const + IterT int_out) { bool found_signal = false; ConstIterT int_it = int_in_start; ConstIterT mz_it = mz_in_start; - - evergreen::Tensor gaussian_data({coeffs_.size()}); // Problem: gaussian_data.size() != intensities_data.size() --> zu groß!!! - // normalize the gaussian coefficients to scale the intensities correctly - bool divide_by_sum = false; - for (unsigned i = 0; i < coeffs_.size() - 1; i++) - { - if (coeffs_[i] >= 1 && coeffs_[i + 1] != 0) - { - divide_by_sum = true; - break; + // if ppm tolerance is used, calculate a reasonable width value for this m/z + if (use_ppm_tolerance_) + { + for (; mz_it != mz_in_end; mz_it++, int_it++) + { + initialize((*mz_it) * ppm_tolerance_ * 10e-6, spacing_, ppm_tolerance_, use_ppm_tolerance_ ); + + double new_int = integrate_(mz_it, int_it, mz_in_start, mz_in_end); + + // store new intensity and m/z into output iterator + *mz_out = *mz_it; + *int_out = new_int; + ++mz_out; + ++int_out; + + if (new_int != 0) found_signal = true; + } } - } - - if (divide_by_sum) - { - double sum = std::accumulate(coeffs_.begin(), coeffs_.end(), 0); - // mapping function - for (long unsigned i = 0; i < coeffs_.size(); i++) + else { - gaussian_data[i] = coeffs_[i]/ sum; - } - } - else - { - for (long unsigned i = 0; i < coeffs_.size(); i++) - { - gaussian_data[i] = coeffs_[i]; - } - } + evergreen::Tensor gaussian_data({coeffs_.size()}); - // Die zu glättenden Daten - evergreen::Tensor intensities_data({mz_in_end - mz_in_start}); - /* - if ((mz_in_end - mz_in_start) < coeffs_.size()) - { - evergreen::Tensor intensities_data_temp({coeffs_.size()}); - for (long int i = 0; i < coeffs_.size(); i++) - { - if (i <= ((coeffs_.size() - 1)/ 4) || i >= (coeffs_.size() - ((coeffs_.size() - 1)/ 4))) + // normalize the gaussian coefficients to scale the intensities correctly + double sum = std::accumulate(coeffs_.begin(), coeffs_.end(), 0.0); + if (sum != 1.0) { - intensities_data_temp[i] = 0; - } - else + for (long unsigned i = 0; i < coeffs_.size(); i++) + { + gaussian_data[i] = coeffs_[i] / sum; + } + } + else { - intensities_data_temp[i] = *int_it; - int_it++; + for (long unsigned i = 0; i < coeffs_.size(); i++) + { + gaussian_data[i] = coeffs_[i]; + } } - intensities_data = intensities_data_temp; - } - } - else - { - */ - for (long int i = 0; i < (mz_in_end - mz_in_start); i++, int_it++) // cursed an einigen Stellen??? --> nach convolve noch da - { - intensities_data[i] = *int_it; - } - //} - /* - std::vector a = {0.25, 0.5, 0.25}; - evergreen::Tensor gaussian_data({a.size()}); - for (int i = 0; i < a.size(); i++) - { - gaussian_data[i] = a[i]; - } + // saving the spacing_ nearest mz values in the same bin (binning) + std::vector bin_numbers = {}; + evergreen::Tensor bins({(double(*(mz_in_end - 1) - *mz_in_start) / spacing_) + 1.0}); + binning(bins, bin_numbers, mz_in_start, mz_in_end, int_it); - std::vector b = {0.0, 0.0, 1.0, 0.0, 0.0}; - evergreen::Tensor intensities_data({b.size()}); - for (int i = 0; i < b.size(); i++) - { - intensities_data[i] = b[i]; - }*/ + //Fast Fourier Transformation from evergreen + evergreen::Tensor out_fft = evergreen::fft_convolve(bins, gaussian_data); + + mz_it = mz_in_start; + int_it = int_in_start; - mz_it = mz_in_start; - int_it = int_in_start; + out_fft = debinning(out_fft, bin_numbers, mz_in_start, mz_in_end, int_it); - //Fast Fourier Transformation from evergreen - evergreen::Tensor out_fft = evergreen::fft_convolve(intensities_data, gaussian_data); // size() = i_data.size() + g_data.size() - 1 - // - (out_fft.size() - 1)/ 2 - // --> (i.size() + g.size() - 2)/ 2 - // --> i.size() - 1 + mz_it = mz_in_start; + int_it = int_in_start; - - for (int i = ((out_fft.flat_size() - 1)/ ((out_fft.flat_size() - (mz_in_end - mz_in_start) - 1))) + 1; mz_it != mz_in_end; mz_it++, int_it++, i++) // erase (N-1)/2 Enden am Anfang und am Ende --> size() = i.size() - 1 - // --> i.size() (- 1) = mz_in_end - mz_in_start (- 1) - // --> mz_it (mz_in_start) <= mz_in_end (- 1) - { - // if (i >= (out_fft.flat_size() - (out_fft.flat_size() - 1)/ ((out_fft.flat_size() - (mz_in_end - mz_in_start) - 1)/ 2))) break; // geht sobald | gilt ... tut es nicht... :/ - *mz_out = *mz_it; - if (out_fft[i] < 0) out_fft[i] = 0; - *int_out = out_fft[i]; - ++mz_out; - ++int_out; - - if (out_fft[i] != 0) found_signal = true; - } + //cutting off the access data that was calculated by convolve + for (int i = ((out_fft.flat_size() - bins.flat_size())/ 2); mz_it != mz_in_end; mz_it++, int_it++, i++) + { + *mz_out = *mz_it; + *int_out = out_fft[i]; + ++mz_out; + ++int_out; - //i luv u pls work - /* - for (int i = ((out_fft.flat_size() - 1)/ 4); i < (out_fft.flat_size() - (out_fft.flat_size() - 1)/ 4); i++) - { - if (out_fft[i] != 0) found_signal = true; + if (out_fft[i] != 0) found_signal = true; + } } - */ return found_signal; } void initialize(double gaussian_width, double spacing, double ppm_tolerance, bool use_ppm_tolerance); -protected: + template + void binning(DataPackage& bins, BinPosPackage& bin_numbers, ConstIterT mz_it, ConstIterT mz_end, ConstIterT int_it) const + { + double start = *mz_it; + unsigned j = 0; + for (unsigned i = 0; mz_it != mz_end; j++) + { + if (*mz_it < (start + (i + 1) * spacing_)) + { + bins[i] += *int_it; + int_it++; + mz_it++; + bin_numbers.push_back(1); - /// Coefficients // Variablendeklaration am Ende (Codingconvention) - std::vector coeffs_; // Gaussian numbers for FFT - //evergreen::Tensor gaussian_data_; - /// The standard derivation \f$ \sigma \f$. - double sigma_; - /// The spacing of the pre-tabulated kernel coefficients - double spacing_; + continue; + } - // tolerance in ppm - bool use_ppm_tolerance_; - double ppm_tolerance_; + i++; + bin_numbers.push_back(0); + } + } + + + template + DataPackage debinning(DataPackage& out_fft, BinPosPackage& bin_numbers, ConstIterT mz_it, ConstIterT mz_end, ConstIterT int_it) const + { + unsigned start_bin = 0; + unsigned end_bin = 0; + for (unsigned i = 0; i < out_fft.flat_size() - 1; i++) + { + // search for bin with original data + if (bin_numbers[i] != 0) + { + end_bin = i; + } + else + { + end_bin++; + continue; + } + // adding the values in the [start_bin, end_bin] interval (while considering the distance to the start_bin and end_bin peaks) + unsigned j = start_bin + 1; + while (j != end_bin) + { + out_fft[end_bin] += out_fft[j] * ((1.0 - double(end_bin - j)) / double(end_bin - start_bin)); + out_fft[start_bin] += out_fft[j] * ((1.0 - double(j - start_bin)) / double(end_bin - start_bin)); + + out_fft[j] = 0.0; + j++; + } + start_bin = end_bin; + } + + return out_fft; + } + +protected: /// Computes the convolution of the raw data at position x and the gaussian kernel template double integrate_(InputPeakIterator x /* mz */, InputPeakIterator y /* int */, InputPeakIterator first, InputPeakIterator last) const { - double v = 0.; // was bedeutet v? -> unpassende variablen Benennung // Fläche unter der (f*g) = h-Funktion + double v = 0.; // norm the gaussian kernel area to one double norm = 0.; - Size middle = coeffs_.size(); // unpassende variablen Benennung + Size middle = coeffs_.size(); double start_pos = (((*x) - (middle * spacing_)) > (*first)) ? ((*x) - (middle * spacing_)) : (*first); double end_pos = (((*x) + (middle * spacing_)) < (*(last - 1))) ? ((*x) + (middle * spacing_)) : (*(last - 1)); @@ -473,6 +477,17 @@ namespace OpenMS } } + /// Coefficients + std::vector coeffs_; // Gaussian numbers for FFT + /// The standard derivation \f$ \sigma \f$. + double sigma_; + /// The spacing of the pre-tabulated kernel coefficients + double spacing_; + + // tolerance in ppm + bool use_ppm_tolerance_; + double ppm_tolerance_; + }; } // namespace OpenMS diff --git a/src/openms/source/FILTERING/SMOOTHING/GaussFilter.cpp b/src/openms/source/FILTERING/SMOOTHING/GaussFilter.cpp index 17f0a856beb..ae4a7e7f6be 100644 --- a/src/openms/source/FILTERING/SMOOTHING/GaussFilter.cpp +++ b/src/openms/source/FILTERING/SMOOTHING/GaussFilter.cpp @@ -115,7 +115,7 @@ namespace OpenMS } } - void GaussFilter::filter(MSChromatogram & chromatogram) const + void GaussFilter::filter(MSChromatogram & chromatogram) { if (param_.getValue("use_ppm_tolerance").toBool()) { diff --git a/src/openms/source/FILTERING/SMOOTHING/GaussFilterAlgorithm.cpp b/src/openms/source/FILTERING/SMOOTHING/GaussFilterAlgorithm.cpp index 7f96612b1cb..d7bdc3c72c1 100644 --- a/src/openms/source/FILTERING/SMOOTHING/GaussFilterAlgorithm.cpp +++ b/src/openms/source/FILTERING/SMOOTHING/GaussFilterAlgorithm.cpp @@ -77,7 +77,7 @@ namespace OpenMS std::vector temp = coeffs_; std::reverse(coeffs_.begin(), coeffs_.end()); coeffs_.insert(coeffs_.end(), temp.begin(), temp.end()); - // member? + // member? } } diff --git a/src/openms/source/TRANSFORMATIONS/RAW2PEAK/PeakPickerHiRes.cpp b/src/openms/source/TRANSFORMATIONS/RAW2PEAK/PeakPickerHiRes.cpp index 0c317c53f77..adef836a259 100644 --- a/src/openms/source/TRANSFORMATIONS/RAW2PEAK/PeakPickerHiRes.cpp +++ b/src/openms/source/TRANSFORMATIONS/RAW2PEAK/PeakPickerHiRes.cpp @@ -203,11 +203,6 @@ namespace OpenMS act_snt_r1 = snt.getSignalToNoise(i + 1); } - std::cout << "central: " << central_peak_int << ", left: " << left_neighbor_int << ", right: " << right_neighbor_int << std::endl; // fast nie - // std::cout << "signal:" << signal_to_noise_ /* = 1 */ << ", snt:" << act_snt << ", left:" << act_snt_l1 << ", right:" << act_snt_r1 << std::endl; // meist ganz gut - // std::cout << check_spacings /* = 0 */ << std::endl; - // std::cout << "peak_int: " << ((central_peak_int > left_neighbor_int) && (central_peak_int > right_neighbor_int)) << " "; - // std::cout << "act_snt: " << ((act_snt >= signal_to_noise_) && (act_snt_l1 >= signal_to_noise_) && (act_snt_r1 >= signal_to_noise_)) << std::endl; // look for peak cores meeting MZ and intensity/SNT criteria if ((central_peak_int > left_neighbor_int) && (central_peak_int > right_neighbor_int) && @@ -260,7 +255,6 @@ namespace OpenMS } // peak core found, now extend it - std::cout << "peak core found --> extending..." << std::endl; // to the left Size k = 2; @@ -346,7 +340,6 @@ namespace OpenMS right_boundary = i + k; ++k; } - std::cout << "extending done" << std::endl; // skip if the minimal number of 3 points for fitting is not reached if (peak_raw_data.size() < 3)