35 #ifndef OPENMS_TRANSFORMATIONS_RAW2PEAK_TWODOPTIMIZATION_H 36 #define OPENMS_TRANSFORMATIONS_RAW2PEAK_TWODOPTIMIZATION_H 63 #include <unsupported/Eigen/NonLinearOptimization> 65 #ifndef OPENMS_SYSTEM_STOPWATCH_H 68 #include <boost/math/special_functions/acosh.hpp> 112 tolerance_mz_ = tolerance_mz;
113 param_.setValue(
"2d:tolerance_mz", tolerance_mz);
121 max_peak_distance_ = max_peak_distance;
122 param_.setValue(
"2d:max_peak_distance", max_peak_distance);
130 max_iteration_ = max_iteration;
131 param_.setValue(
"iterations", max_iteration);
139 penalties_ = penalties;
140 param_.setValue(
"penalties:position", penalties.
pos);
141 param_.setValue(
"penalties:height", penalties.
height);
142 param_.setValue(
"penalties:left_width", penalties.
lWidth);
143 param_.setValue(
"penalties:right_width", penalties.
rWidth);
162 template <
typename InputSpectrumIterator>
163 void optimize(InputSpectrumIterator first,
164 InputSpectrumIterator last,
165 PeakMap& ms_exp,
bool real2D =
true);
172 std::vector<std::pair<SignedSize, SignedSize> >
signal2D;
190 : m_inputs(dimensions), m_values(num_data_points), m_data(data) {}
192 int operator()(
const Eigen::VectorXd &x, Eigen::VectorXd &fvec);
194 int df(
const Eigen::VectorXd &x, Eigen::MatrixXd &J);
234 std::vector<double>::iterator searchInScan_(std::vector<double>::iterator scan_begin,
235 std::vector<double>::iterator scan_end,
239 template <
typename InputSpectrumIterator>
240 void optimizeRegions_(InputSpectrumIterator& first,
241 InputSpectrumIterator& last,
245 template <
typename InputSpectrumIterator>
246 void optimizeRegionsScanwise_(InputSpectrumIterator& first,
247 InputSpectrumIterator& last,
252 template <
typename InputSpectrumIterator>
253 void getRegionEndpoints_(
PeakMap& exp,
254 InputSpectrumIterator& first,
255 InputSpectrumIterator& last,
261 void findMatchingPeaks_(std::multimap<double, IsotopeCluster>::iterator& it,
267 void updateMembers_();
271 template <
typename InputSpectrumIterator>
276 if ((
UInt)distance(first, last) != ms_exp.
size())
278 throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"Error in Two2Optimization: Raw and peak map do not have the same number of spectra");
286 for (
Size i = 0; i < ms_exp.
size(); ++i)
289 if (ms_exp[i].getFloatDataArrays().
size() < 6)
291 throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"Error in Two2Optimization: Not enough meta data arrays present (1:area, 5:shape, 3:left width, 4:right width)");
293 bool area = ms_exp[i].getFloatDataArrays()[1].getName() ==
"maximumIntensity";
294 bool wleft = ms_exp[i].getFloatDataArrays()[3].getName() ==
"leftWidth";
295 bool wright = ms_exp[i].getFloatDataArrays()[4].getName() ==
"rightWidth";
296 bool shape = ms_exp[i].getFloatDataArrays()[5].getName() ==
"peakShape";
298 if (!area || !wleft || !wright || !shape)
300 throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"Error in Two2Optimization: One or several meta data arrays missing (1:intensity, 5:shape, 3:left width, 4:right width)");
313 std::vector<double> iso_last_scan;
314 std::vector<double> iso_curr_scan;
315 std::vector<std::multimap<double, IsotopeCluster>::iterator> clusters_last_scan;
316 std::vector<std::multimap<double, IsotopeCluster>::iterator> clusters_curr_scan;
317 std::multimap<double, IsotopeCluster>::iterator cluster_iter;
318 double current_rt = ms_exp_it->getRT(), last_rt = 0;
321 max_peak_distance_ = param_.getValue(
"2d:max_peak_distance");
322 double tolerance_mz = param_.getValue(
"2d:tolerance_mz");
324 UInt current_charge = 0;
325 double mz_in_hash = 0;
328 for (
UInt curr_scan = 0; ms_exp_it + curr_scan != ms_exp_it_end; ++curr_scan)
330 Size nr_peaks_in_scan = (ms_exp_it + curr_scan)->size();
331 if (nr_peaks_in_scan == 0)
335 current_rt = (ms_exp_it + curr_scan)->getRT();
339 iso_last_scan = iso_curr_scan;
340 iso_curr_scan.clear();
341 clusters_last_scan = clusters_curr_scan;
342 clusters_curr_scan.clear();
345 std::cout <<
"Next scan with rt: " << current_rt << std::endl;
346 std::cout <<
"Next scan, rt = " << current_rt <<
" last_rt: " << last_rt << std::endl;
347 std::cout <<
"---------------------------------------------------------------------------" << std::endl;
357 for (
UInt curr_peak = 0; curr_peak < (ms_exp_it + curr_scan)->size() - 1; ++curr_peak)
361 double curr_mz = (peak_it + curr_peak)->getMZ();
362 double dist2nextpeak = (peak_it + curr_peak + 1)->getMZ() - curr_mz;
364 if (dist2nextpeak <= max_peak_distance_)
367 std::cout <<
"Isotopic pattern found ! " << std::endl;
368 std::cout <<
"We are at: " << (peak_it + curr_peak)->getMZ() <<
" " << curr_mz << std::endl;
370 if (!iso_last_scan.empty())
372 std::sort(iso_last_scan.begin(), iso_last_scan.end());
374 std::vector<double>::iterator it =
375 searchInScan_(iso_last_scan.begin(), iso_last_scan.end(), curr_mz);
377 double delta_mz = fabs(*it - curr_mz);
379 if (delta_mz > tolerance_mz)
381 mz_in_hash = curr_mz;
389 new_cluster.
scans.push_back(curr_scan);
390 cluster_iter = iso_map_.insert(std::pair<double, IsotopeCluster>(mz_in_hash, new_cluster));
398 cluster_iter = clusters_last_scan[distance(iso_last_scan.begin(), it)];
401 if (find(cluster_iter->second.scans.begin(), cluster_iter->second.scans.end(), curr_scan)
402 == cluster_iter->second.scans.end())
404 cluster_iter->second.scans.push_back(curr_scan);
421 mz_in_hash = curr_mz;
426 new_cluster.
scans.push_back(curr_scan);
427 cluster_iter = iso_map_.insert(std::pair<double, IsotopeCluster>(mz_in_hash, new_cluster));
437 cluster_iter->second.peaks.insert(std::pair<UInt, UInt>(curr_scan, curr_peak));
439 iso_curr_scan.push_back(mz_in_hash);
440 clusters_curr_scan.push_back(cluster_iter);
443 cluster_iter->second.peaks.insert(std::pair<UInt, UInt>(curr_scan, curr_peak));
444 iso_curr_scan.push_back((peak_it + curr_peak)->getMZ());
445 clusters_curr_scan.push_back(cluster_iter);
448 if ((curr_peak + 1) >= nr_peaks_in_scan)
450 dist2nextpeak = (peak_it + curr_peak + 1)->getMZ() - (peak_it + curr_peak)->getMZ();
454 while (dist2nextpeak <= max_peak_distance_
455 && curr_peak < (nr_peaks_in_scan - 1))
457 cluster_iter->second.peaks.insert(std::pair<UInt, UInt>(curr_scan, curr_peak + 1));
458 iso_curr_scan.push_back((peak_it + curr_peak + 1)->getMZ());
459 clusters_curr_scan.push_back(cluster_iter);
462 if (curr_peak >= nr_peaks_in_scan - 1)
464 dist2nextpeak = (peak_it + curr_peak + 1)->getMZ() - (peak_it + curr_peak)->getMZ();
474 if (!iso_last_scan.empty())
476 std::sort(iso_last_scan.begin(), iso_last_scan.end());
478 std::vector<double>::iterator it =
479 searchInScan_(iso_last_scan.begin(), iso_last_scan.end(), curr_mz);
481 double delta_mz = fabs(*it - curr_mz);
483 if (delta_mz > tolerance_mz)
485 mz_in_hash = curr_mz;
493 new_cluster.
scans.push_back(curr_scan);
494 cluster_iter = iso_map_.insert(std::pair<double, IsotopeCluster>(mz_in_hash, new_cluster));
502 cluster_iter = clusters_last_scan[distance(iso_last_scan.begin(), it)];
505 if (find(cluster_iter->second.scans.begin(), cluster_iter->second.scans.end(), curr_scan)
506 == cluster_iter->second.scans.end())
508 cluster_iter->second.scans.push_back(curr_scan);
525 mz_in_hash = curr_mz;
530 new_cluster.
scans.push_back(curr_scan);
531 cluster_iter = iso_map_.insert(std::pair<double, IsotopeCluster>(mz_in_hash, new_cluster));
541 cluster_iter->second.peaks.insert(std::pair<UInt, UInt>(curr_scan, curr_peak));
543 iso_curr_scan.push_back(mz_in_hash);
544 clusters_curr_scan.push_back(cluster_iter);
552 last_rt = current_rt;
554 curr_region_ = iso_map_.begin();
556 std::cout << iso_map_.size() <<
" isotopic clusters were found ! " << std::endl;
560 optimizeRegions_(first, last, ms_exp);
562 optimizeRegionsScanwise_(first, last, ms_exp);
568 template <
typename InputSpectrumIterator>
570 InputSpectrumIterator& last,
575 for (std::multimap<double, IsotopeCluster>::iterator it = iso_map_.begin();
576 it != iso_map_.end();
580 std::cout <<
"element: " << counter << std::endl;
581 std::cout <<
"mz: " << it->first << std::endl <<
"rts: ";
583 std::cout << std::endl <<
"peaks: ";
584 IsotopeCluster::IndexSet::const_iterator iter = it->second.peaks.begin();
585 for (; iter != it->second.peaks.end(); ++iter)
586 std::cout << ms_exp[iter->first].getRT() <<
" " << (ms_exp[iter->first][iter->second]).getMZ() << std::endl;
589 std::cout << std::endl << std::endl;
595 matching_peaks_.
clear();
596 findMatchingPeaks_(it, ms_exp);
601 getRegionEndpoints_(ms_exp, first, last, counter, 400, twoD_data);
609 Size nr_diff_peaks = matching_peaks_.size();
615 Eigen::VectorXd x_init (nr_parameters);
618 std::map<Int, std::vector<PeakIndex> >::iterator m_peaks_it = twoD_data.
matching_peaks.begin();
619 Int peak_counter = 0;
620 Int diff_peak_counter = 0;
622 for (; m_peaks_it != twoD_data.
matching_peaks.end(); ++m_peaks_it)
624 double av_mz = 0, av_lw = 0, av_rw = 0, avr_height = 0, height;
625 std::vector<PeakIndex>::iterator iter_iter = (m_peaks_it)->second.begin();
626 for (; iter_iter != m_peaks_it->second.end(); ++iter_iter)
628 height = ms_exp[(iter_iter)->spectrum].getFloatDataArrays()[1][(iter_iter)->peak];
629 avr_height += height;
630 av_mz += (iter_iter)->getPeak(ms_exp).getMZ() * height;
631 av_lw += ms_exp[(iter_iter)->spectrum].getFloatDataArrays()[3][(iter_iter)->peak] * height;
632 av_rw += ms_exp[(iter_iter)->spectrum].getFloatDataArrays()[4][(iter_iter)->peak] * height;
633 x_init(peak_counter) = height;
636 x_init(twoD_data.
total_nr_peaks + 3 * diff_peak_counter) = av_mz / avr_height;
637 x_init(twoD_data.
total_nr_peaks + 3 * diff_peak_counter + 1) = av_lw / avr_height;
638 x_init(twoD_data.
total_nr_peaks + 3 * diff_peak_counter + 2) = av_rw / avr_height;
643 std::cout <<
"----------------------------\n\nstart_value: " << std::endl;
644 for (
Size k = 0;
k < start_value->size; ++
k)
646 std::cout << x_init(
k) << std::endl;
649 Int num_positions = 0;
652 num_positions += (twoD_data.
signal2D[i + 1].second - twoD_data.
signal2D[i].second + 1);
654 std::cout << twoD_data.
signal2D[i + 1].second <<
" - " << twoD_data.
signal2D[i].second <<
" +1 " << std::endl;
659 std::cout <<
"num_positions : " << num_positions << std::endl;
662 TwoDOptFunctor functor (nr_parameters, std::max(num_positions + 1, (
Int)(nr_parameters)), &twoD_data);
663 Eigen::LevenbergMarquardt<TwoDOptFunctor> lmSolver (functor);
664 Eigen::LevenbergMarquardtSpace::Status status = lmSolver.minimize(x_init);
669 if (status <= Eigen::LevenbergMarquardtSpace::ImproperInputParameters)
671 throw Exception::UnableToFit(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"UnableToFit-TwoDOptimization:",
"Could not fit the data: Error " +
String(status));
675 std::map<Int, std::vector<PeakIndex> >::iterator itv
680 for (
Size j = 0; j < itv->second.size(); ++j)
684 std::cout <<
"pos: " << itv->second[j].getPeak(ms_exp).getMZ() <<
"\nint: " << itv->second[j].getSpectrum(ms_exp).getFloatDataArrays()[1][itv->second[j].peak]
685 <<
"\nlw: " << itv->second[j].getSpectrum(ms_exp).getFloatDataArrays()[3][itv->second[j].peak]
686 <<
"\nrw: " << itv->second[j].getSpectrum(ms_exp).getFloatDataArrays()[4][itv->second[j].peak] <<
"\n";
690 ms_exp[itv->second[j].spectrum][itv->second[j].peak].setMZ(mz);
691 double height = x_init(peak_idx);
692 ms_exp[itv->second[j].spectrum].getFloatDataArrays()[1][itv->second[j].peak] = height;
694 ms_exp[itv->second[j].spectrum].getFloatDataArrays()[3][itv->second[j].peak] = left_width;
695 double right_width = x_init(twoD_data.
total_nr_peaks + 3 * i + 2);
697 ms_exp[itv->second[j].spectrum].getFloatDataArrays()[4][itv->second[j].peak] = right_width;
701 double x_left_endpoint = mz - 1 / left_width* sqrt(height / 1 - 1);
702 double x_right_endpoint = mz + 1 / right_width* sqrt(height / 1 - 1);
703 double area_left = -height / left_width* atan(left_width * (x_left_endpoint - mz));
704 double area_right = -height / right_width* atan(right_width * (mz - x_right_endpoint));
705 ms_exp[itv->second[j].spectrum][itv->second[j].peak].setIntensity(area_left + area_right);
709 double x_left_endpoint = mz - 1 / left_width* boost::math::acosh(sqrt(height / 0.001));
710 double x_right_endpoint = mz + 1 / right_width* boost::math::acosh(sqrt(height / 0.001));
711 double area_left = -height / left_width * (sinh(left_width * (mz - x_left_endpoint)) / cosh(left_width * (mz - x_left_endpoint)));
712 double area_right = -height / right_width * (sinh(right_width * (mz - x_right_endpoint)) / cosh(right_width * (mz - x_right_endpoint)));
713 ms_exp[itv->second[j].spectrum][itv->second[j].peak].setIntensity(area_left + area_right);
718 std::cout <<
"pos: " << itv->second[j].getPeak(ms_exp).getMZ() <<
"\nint: " << itv->second[j].getSpectrum(ms_exp).getFloatDataArrays()[1][itv->second[j].peak]
719 <<
"\nlw: " << itv->second[j].getSpectrum(ms_exp).getFloatDataArrays()[3][itv->second[j].peak]
720 <<
"\nrw: " << itv->second[j].getSpectrum(ms_exp).getFloatDataArrays()[4][itv->second[j].peak] <<
"\n";
734 template <
typename InputSpectrumIterator>
736 InputSpectrumIterator& last,
748 DataValue dv = param_.getValue(
"penalties:position");
749 if (dv.isEmpty() || dv.toString() ==
"")
752 penalties.
pos = (
float)dv;
754 dv = param_.getValue(
"penalties:left_width");
755 if (dv.isEmpty() || dv.toString() ==
"")
758 penalties.
lWidth = (
float)dv;
760 dv = param_.getValue(
"penalties:right_width");
761 if (dv.isEmpty() || dv.toString() ==
"")
764 penalties.
rWidth = (
float)dv;
766 std::cout << penalties.
pos <<
" " 767 << penalties.
rWidth <<
" " 768 << penalties.
lWidth << std::endl;
780 dv = param_.getValue(
"iterations");
781 if (dv.isEmpty() || dv.toString() ==
"")
784 max_iteration = (
UInt)dv;
786 std::vector<PeakShape> peak_shapes;
790 for (std::multimap<double, IsotopeCluster>::iterator it = iso_map_.begin();
791 it != iso_map_.end();
796 std::cerr <<
"element: " << counter << std::endl;
797 std::cerr <<
"mz: " << it->first << std::endl <<
"rts: ";
798 for (
Size i = 0; i < it->second.scans.size(); ++i)
799 std::cerr << it->second.scans[i] <<
"\n";
800 std::cerr << std::endl <<
"peaks: ";
801 IsotopeCluster::IndexSet::const_iterator iter = it->second.peaks.begin();
802 for (; iter != it->second.peaks.end(); ++iter)
803 std::cerr << ms_exp[iter->first].getRT() <<
" " << (ms_exp[iter->first][iter->second]).getMZ() << std::endl;
805 std::cerr << std::endl << std::endl;
812 getRegionEndpoints_(ms_exp, first, last, counter, 400, d);
826 data.
signal.reserve(size);
830 data.
positions.push_back(ms_it->getMZ());
831 data.
signal.push_back(ms_it->getIntensity());
837 pair.first = d.
iso_map_iter->second.peaks.begin()->first + idx;
839 IsotopeCluster::IndexSet::const_iterator set_iter = lower_bound(d.
iso_map_iter->second.peaks.begin(),
846 IsotopeCluster::IndexSet::const_iterator set_iter2 = lower_bound(d.
iso_map_iter->second.peaks.begin(),
850 while (set_iter != set_iter2)
852 const Size peak_index = set_iter->second;
853 const MSSpectrum& spec = ms_exp[set_iter->first];
855 spec[peak_index].getMZ(),
858 spec[peak_index].getIntensity(),
860 peak_shapes.push_back(shape);
870 std::cout <<
"vorher\n";
872 for (
Size p = 0; p < peak_shapes.size(); ++p)
874 std::cout << peak_shapes[p].mz_position <<
"\t" << peak_shapes[p].height
875 <<
"\t" << peak_shapes[p].left_width <<
"\t" << peak_shapes[p].right_width << std::endl;
880 std::cout <<
"nachher\n";
881 for (
Size p = 0; p < peak_shapes.size(); ++p)
883 std::cout << peak_shapes[p].mz_position <<
"\t" << peak_shapes[p].height
884 <<
"\t" << peak_shapes[p].left_width <<
"\t" << peak_shapes[p].right_width << std::endl;
888 pair.first = d.
iso_map_iter->second.peaks.begin()->first + idx;
890 set_iter = lower_bound(d.
iso_map_iter->second.peaks.begin(),
894 while (p < peak_shapes.size())
897 spec[set_iter->second].setMZ(peak_shapes[p].mz_position);
909 spec[set_iter->second].setIntensity(area_left + area_right);
918 spec[set_iter->second].setIntensity(area_left + area_right);
931 template <
typename InputSpectrumIterator>
933 InputSpectrumIterator& first,
934 InputSpectrumIterator& last,
940 typedef typename InputSpectrumIterator::value_type InputExperimentType;
941 typedef typename InputExperimentType::value_type InputPeakType;
942 typedef std::multimap<double, IsotopeCluster>
MapType;
944 double rt, first_peak_mz, last_peak_mz;
950 for (
Size i = 0; i < iso_map_idx; ++i)
954 std::cout <<
"rt begin: " << exp[iso_map_iter->second.scans[0]].getRT()
955 <<
"\trt end: " << exp[iso_map_iter->second.scans[iso_map_iter->second.scans.size() - 1]].getRT()
956 <<
" \t" << iso_map_iter->second.scans.
size() <<
" scans" 961 for (
Size i = 0; i < iso_map_iter->second.scans.size(); ++i)
966 rt = exp[iso_map_iter->second.scans[i]].getRT();
972 std::cout << exp_it->getRT() <<
" vs " << iter->getRT() << std::endl;
976 pair.first = iso_map_iter->second.peaks.begin()->first + i;
978 IsotopeCluster::IndexSet::const_iterator set_iter = lower_bound(iso_map_iter->second.peaks.begin(),
979 iso_map_iter->second.peaks.end(),
983 first_peak_mz = (exp_it->begin() + set_iter->second)->getMZ() - 1;
987 IsotopeCluster::IndexSet::const_iterator set_iter2 = lower_bound(iso_map_iter->second.peaks.begin(),
988 iso_map_iter->second.peaks.end(),
991 if (i == iso_map_iter->second.scans.size() - 1)
993 set_iter2 = iso_map_iter->second.peaks.end();
996 else if (set_iter2 != iso_map_iter->second.peaks.begin())
999 last_peak_mz = (exp_it->begin() + set_iter2->second)->getMZ() + 1;
1002 peak.setPosition(first_peak_mz);
1004 = lower_bound(iter->begin(), iter->end(), peak,
typename InputPeakType::PositionLess());
1005 if (raw_data_iter != iter->begin())
1009 double intensity = raw_data_iter->getIntensity();
1011 while (raw_data_iter != iter->begin() && (raw_data_iter - 1)->getIntensity() < intensity &&
1012 (raw_data_iter - 1)->getIntensity() > noise_level)
1015 intensity = raw_data_iter->getIntensity();
1019 left.first = distance(first, iter);
1020 left.second = raw_data_iter - iter->begin();
1022 std::cout <<
"left: " << iter->getRT() <<
"\t" << raw_data_iter->getMZ() << std::endl;
1025 peak.setPosition(last_peak_mz + 1);
1027 = upper_bound(iter->begin(), iter->end(), peak,
typename InputPeakType::PositionLess());
1028 if (raw_data_iter == iter->end())
1030 intensity = raw_data_iter->getIntensity();
1032 while (raw_data_iter + 1 != iter->end() && (raw_data_iter + 1)->getIntensity() < intensity)
1035 intensity = raw_data_iter->getIntensity();
1036 if ((raw_data_iter + 1 != iter->end()) && (raw_data_iter + 1)->getIntensity() > noise_level)
1039 right.first = left.first;
1040 right.second = raw_data_iter - iter->begin();
1042 std::cout <<
"right: " << iter->getRT() <<
"\t" << raw_data_iter->getMZ() << std::endl;
1050 std::cout << first_peak_mz <<
"\t" << last_peak_mz << std::endl;
1056 #endif //OPENMS_TRANSFORMATIONS_RAW2PEAK_TWODOPTIMIZATION_H std::vector< double > positions
Positions and intensity values of the raw data.
Definition: OptimizePick.h:103
const int m_values
Definition: TwoDOptimization.h:197
ConstIterator RTBegin(CoordinateType rt) const
Fast search for spectrum range begin.
Definition: MSExperiment.h:423
double left_width
Left width parameter.
Definition: PeakShape.h:122
Definition: OptimizePick.h:100
void setMaxPeakDistance(double max_peak_distance)
Mutable access to the maximal peak distance in a cluster.
Definition: TwoDOptimization.h:119
A more convenient string class.
Definition: String.h:57
std::map< Int, std::vector< PeakIndex > > matching_peaks_
Indices of peaks in the adjacent scans matching peaks in the scan with no. ref_scan.
Definition: TwoDOptimization.h:216
std::pair< Size, Size > IndexPair
An index e.g. in an MSExperiment.
Definition: IsotopeCluster.h:48
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:116
void getRegionEndpoints_(PeakMap &exp, InputSpectrumIterator &first, InputSpectrumIterator &last, Size iso_map_idx, double noise_level, TwoDOptimization::Data &d)
Get the indices of the first and last raw data point of this region.
Definition: TwoDOptimization.h:932
Type
Peak shape type (asymmetric Lorentzian or asymmetric hyperbolic secans squared).
Definition: PeakShape.h:69
Comparison of mz_positions.
Definition: PeakShape.h:141
void setMZTolerance(double tolerance_mz)
Mutable access to the matching epsilon.
Definition: TwoDOptimization.h:110
Comparator for the retention time.
Definition: MSSpectrum.h:75
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
Helper struct (contains the size of an area and a raw data container)
Definition: TwoDOptimization.h:170
Iterator begin()
Definition: MSExperiment.h:162
Base::const_iterator const_iterator
Definition: MSExperiment.h:130
virtual ~TwoDOptimization()
Destructor.
Definition: TwoDOptimization.h:101
void optimizeRegionsScanwise_(InputSpectrumIterator &first, InputSpectrumIterator &last, PeakMap &ms_exp)
Definition: TwoDOptimization.h:735
Size size() const
Definition: MSExperiment.h:132
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
std::multimap< double, IsotopeCluster >::iterator iso_map_iter
Definition: TwoDOptimization.h:173
double lWidth
Penalty factor for the peak shape's left width parameter.
Definition: OptimizePick.h:83
int inputs() const
Definition: TwoDOptimization.h:186
int values() const
Definition: TwoDOptimization.h:187
const FloatDataArrays & getFloatDataArrays() const
Returns a const reference to the float meta data arrays.
const TwoDOptimization::Data * m_data
Definition: TwoDOptimization.h:198
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:57
double getMZTolerance() const
Non-mutable access to the matching epsilon.
Definition: TwoDOptimization.h:108
OptimizationFunctions::PenaltyFactorsIntensity penalties
Definition: TwoDOptimization.h:178
Iterator end()
Definition: MSExperiment.h:172
Base::iterator iterator
Definition: MSExperiment.h:129
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
Internal representation of a peak shape (used by the PeakPickerCWT)
Definition: PeakShape.h:51
void setPenalties(OptimizationFunctions::PenaltyFactorsIntensity &penalties)
Mutable access to the minimal number of adjacent scans.
Definition: TwoDOptimization.h:137
PeakMap::ConstIterator raw_data_first
Definition: TwoDOptimization.h:177
A method or algorithm argument contains illegal values.
Definition: Exception.h:649
void optimize(InputSpectrumIterator first, InputSpectrumIterator last, PeakMap &ms_exp, bool real2D=true)
Find two dimensional peak clusters and optimize their peak parameters.
Definition: TwoDOptimization.h:272
ChargedIndexSet peaks
peaks in this cluster
Definition: IsotopeCluster.h:72
double max_peak_distance_
upper bound for distance between two peaks belonging to the same region
Definition: TwoDOptimization.h:209
TwoDOptFunctor(unsigned dimensions, unsigned num_data_points, const TwoDOptimization::Data *data)
Definition: TwoDOptimization.h:189
void optimize(std::vector< PeakShape > &peaks, Data &data)
Start the optimization of the peak shapes peaks. The original peak shapes will be substituted by the ...
bool real_2D_
Optimization considering all scans of a cluster or optimization of each scan separately.
Definition: TwoDOptimization.h:223
PeakMap picked_peaks
Definition: TwoDOptimization.h:176
PeakMap MapType
Definition: PeakPickerIterative.cpp:84
double height
Maximum intensity of the peak shape.
Definition: PeakShape.h:118
double tolerance_mz_
threshold for the difference in the peak position of two matching peaks
Definition: TwoDOptimization.h:212
Size total_nr_peaks
Definition: TwoDOptimization.h:174
std::multimap< double, IsotopeCluster >::const_iterator curr_region_
Pointer to the current region.
Definition: TwoDOptimization.h:206
OptimizationFunctions::PenaltyFactorsIntensity penalties_
Penalty factors for some parameters in the optimization.
Definition: TwoDOptimization.h:227
const OptimizationFunctions::PenaltyFactorsIntensity & getPenalties() const
Non-mutable access to the minimal number of adjacent scans.
Definition: TwoDOptimization.h:135
std::vector< std::pair< SignedSize, SignedSize > > signal2D
Definition: TwoDOptimization.h:172
bool empty() const
Definition: MSExperiment.h:142
void setRT(double rt)
Sets the absolute retention time (in seconds)
double pos
Penalty factor for the peak shape's position.
Definition: OptimizePick.h:81
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:82
std::vector< SpectrumType >::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSExperiment.h:118
Exception used if an error occurred while fitting a model to a given dataset.
Definition: Exception.h:677
void optimizeRegions_(InputSpectrumIterator &first, InputSpectrumIterator &last, PeakMap &ms_exp)
Definition: TwoDOptimization.h:569
std::vector< double > positions
Definition: TwoDOptimization.h:179
double rWidth
Penalty factor for the peak shape's right width parameter.
Definition: OptimizePick.h:85
std::vector< Size > scans
the scans of this cluster
Definition: IsotopeCluster.h:75
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
void clear(bool clear_meta_data)
Clears all data and meta data.
Definition: MSExperiment.h:929
std::vector< double > signal
Definition: TwoDOptimization.h:180
void setMaxIterations(UInt max_iteration)
Mutable access to the maximal number of iterations.
Definition: TwoDOptimization.h:128
double right_width
Right width parameter.
Definition: PeakShape.h:124
Stores information about an isotopic cluster (i.e. potential peptide charge variants) ...
Definition: IsotopeCluster.h:45
Class for the penalty factors used during the optimization.
Definition: OptimizePick.h:63
double getMaxPeakDistance() const
Non-mutable access to the maximal peak distance in a cluster.
Definition: TwoDOptimization.h:117
Int charge
charge estimate (convention: zero means "no charge estimate")
Definition: IsotopeCluster.h:62
std::multimap< double, IsotopeCluster > iso_map_
stores the retention time of each isotopic cluster
Definition: TwoDOptimization.h:203
UInt max_iteration_
Convergence Parameter: Maximal number of iterations.
Definition: TwoDOptimization.h:220
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
std::vector< double > signal
Definition: OptimizePick.h:104
std::map< Int, std::vector< PeakIndex > > matching_peaks
Definition: TwoDOptimization.h:175
Class for comparison of std::pair using first ONLY e.g. for use with std::sort.
Definition: ComparatorUtils.h:326
Definition: PeakShape.h:71
int Int
Signed integer type.
Definition: Types.h:103
double mz_position
Centroid position.
Definition: PeakShape.h:120
double height
Definition: OptimizePeakDeconvolution.h:77
Definition: TwoDOptimization.h:183
This class provides the non-linear optimization of the peak parameters.
Definition: OptimizePick.h:96
This class provides the two-dimensional optimization of the picked peak parameters.
Definition: TwoDOptimization.h:89
MSSpectrum SpectrumType
Definition: MzDataHandler.h:62
Class for the penalty factors used during the optimization.
Definition: OptimizePeakDeconvolution.h:58
UInt getMaxIterations() const
Non-mutable access to the maximal number of iterations.
Definition: TwoDOptimization.h:126