45 [](
const double &
a,
const double &
b) { return (a < b); });
114const std::vector<MsRunRetentionTimeSeamarkPoint<T>> &
122const std::vector<double> &
135const std::vector<double> &
148 return common_points;
154 double retentionTime,
155 double precursorIntensity)
184 if(a.entityHash == b.entityHash)
186 return (a.precursorIntensity > b.precursorIntensity);
188 return (
a.entityHash <
b.entityHash);
194 return (a.entityHash == b.entityHash);
200 m_seamarks.push_back({it->entityHash, it->retentionTime, it->precursorIntensity});
204 m_allMs2Points.clear();
210 return (a.entityHash < b.entityHash);
222 auto it = other_seamarks.begin();
226 while((it != other_seamarks.end()) && (it->entityHash < seamark.entityHash))
230 if(it == other_seamarks.end())
232 if(it->entityHash == seamark.entityHash)
235 DataPoint(seamark.retentionTime, seamark.retentionTime - it->retentionTime));
243 "\ntoo few MS2 points (%1) in common")
244 .arg(delta_rt.size()));
251 "\ntoo few MS2 points (%1) in common")
252 .arg(delta_rt.size()));
293 "retention time (%1)")
299 "m_ms1RetentionTimeVector.size()")
305 [original_retention_time](
const double &rt_point) {
306 return original_retention_time < rt_point;
308 double rt1_a, rt2_a, rt1_b, rt2_b;
317 auto it_minus = it_plus - 1;
322 double ratio = (original_retention_time - rt1_a) / (rt2_a - rt1_a);
331 return (((rt2_b - rt1_b) * ratio) + rt1_b);
341 "retention time (%1)")
347 "m_ms1RetentionTimeVector.size()")
351 auto it_plus = std::find_if(
354 [aligned_retention_time](
const double &rt_point) { return aligned_retention_time < rt_point; });
355 double rt1_a, rt2_a, rt1_b, rt2_b;
364 auto it_minus = it_plus - 1;
369 double ratio = (aligned_retention_time - rt1_a) / (rt2_a - rt1_a);
378 return (((rt2_b - rt1_b) * ratio) + rt1_b);
382const std::vector<MsRunRetentionTimeSeamarkPoint<T>>
385 std::vector<MsRunRetentionTimeSeamarkPoint<T>> other_seamarks =
m_seamarks;
386 for(
auto &seamark : other_seamarks)
390 return other_seamarks;
405 std::vector<MsRunRetentionTimeSeamarkPoint<T>> other_seamarks;
406 if(msrun_retention_time_reference.
isAligned())
412 other_seamarks = msrun_retention_time_reference.
getSeamarks();
418 "\ntoo few MS1 points (%1)")
423 << other_seamarks[0].entityHash << other_seamarks[0].retentionTime <<
" ";
430 qDebug() << common_points.front().x <<
" " << common_points.front().y;
436 qDebug() << common_points.front().x <<
" " << common_points.front().y;
442 if(first_point.
x < 0)
449 common_points.push_back(first_point);
455 common_points.push_back(last_point);
456 common_points.
sortX();
462 qDebug() << common_points.front().x <<
" " << common_points.front().y;
464 Trace ms1_aligned_points;
476 for(
DataPoint &data_point : ms1_aligned_points)
478 data_point.y = (data_point.x - data_point.y);
484 double correction_parameter =
486 (ms1_aligned_points.size());
488 correction_parameter = correction_parameter / (double)4;
494 return ms1_aligned_points;
501 const Trace &common_points)
505 std::vector<DataPoint>::const_iterator itms2 = common_points.begin();
506 std::vector<DataPoint>::const_iterator itms2next = itms2 + 1;
507 if(itms2next == common_points.end())
511 "\ntoo few common points (%1)")
512 .arg(common_points.size()));
514 qDebug() <<
"() itms2->x=" << itms2->x <<
" itms2->y=" << itms2->y;
519 ms1_point.
x = original_rt_point;
521 while(ms1_point.
x > itms2next->x)
527 double ratio = (itms2next->x - itms2->x);
530 ratio = (ms1_point.
x - itms2->x) / ratio;
540 ms1_point.
y = itms2->y + ((itms2next->y - itms2->y) * ratio);
544 ms1_aligned_points.push_back(ms1_point);
554 auto new_it(ms1_aligned_points.begin());
555 auto new_nextit(ms1_aligned_points.begin());
557 for(; new_nextit != ms1_aligned_points.end(); ++new_nextit, ++new_it)
559 if(new_nextit->y < new_it->y)
562 new_nextit->y = new_it->y + correction_parameter;
570 const std::vector<double> &aligned_times)
587 QObject::tr(
"ERROR : aligned_times (size=%1) vector does not have "
588 "required size (size=%2)")
589 .arg(aligned_times.size())
598 QObject::tr(
"ERROR : aligned_times (size=%1) vector does not have "
599 "required size (size=%2)")
600 .arg(aligned_times.size())
613 std::vector<MsRunRetentionTimeSeamarkPoint<T>> other_seamarks;
614 if(msrun_retention_time_reference.
isAligned())
620 other_seamarks = msrun_retention_time_reference.
getSeamarks();
625 << other_seamarks[0].entityHash << other_seamarks[0].retentionTime <<
" ";
629 return common_points;
mean filter apply mean of y values inside the window : this results in a kind of smoothing
void setMs2MedianFilter(const FilterMorphoMedian &ms2MedianFilter)
std::vector< double > m_alignedRetentionTimeVector
std::vector< PeptideMs2Point > m_allMs2Points
const FilterMorphoMean & getMs1MeanFilter() const
const FilterMorphoMedian & getMs2MedianFilter() const
std::size_t m_valuesCorrected
void computeSeamarks()
convert PeptideMs2Point into Peptide seamarks this is required before computing alignment
Trace getCommonSeamarksDeltaRt(const MsRunRetentionTime< T > &msrun_retention_time_reference) const
get common seamarks between msrunretentiontime objects and their deltart
MsRunRetentionTime(const std::vector< double > &msrun_retention_time_line)
void setMs1MeanFilter(const FilterMorphoMean &ms1MeanFilter)
FilterMorphoMean m_ms1MeanFilter
void linearRegressionMs2toMs1(Trace &ms1_aligned_points, const Trace &common_points)
FilterMorphoMean m_ms2MeanFilter
void setMs2MeanFilter(const FilterMorphoMean &ms2MeanFilter)
double getFrontRetentionTimeReference() const
const std::vector< double > & getAlignedRetentionTimeVector() const
get aligned retention time vector
void setAlignedRetentionTimeVector(const std::vector< double > &aligned_times)
std::vector< MsRunRetentionTimeSeamarkPoint< T > > m_seamarks
Trace align(const MsRunRetentionTime< T > &msrun_retention_time_reference)
align the current msrunretentiontime object using the given reference
double translateAligned2OriginalRetentionTime(double aligned_retention_time) const
double translateOriginal2AlignedRetentionTime(double original_retention_time) const
const std::vector< double > & getMs1RetentionTimeVector() const
get orginal retention time vector (not aligned)
void correctNewTimeValues(Trace &ms1_aligned_points, double correction_parameter)
const std::vector< MsRunRetentionTimeSeamarkPoint< T > > & getSeamarks() const
Trace getCommonDeltaRt(const std::vector< MsRunRetentionTimeSeamarkPoint< T > > &other_seamarks) const
ComputeRetentionTimeReference m_retentionTimeReferenceMethod
const std::vector< MsRunRetentionTimeSeamarkPoint< T > > getSeamarksReferences() const
std::vector< double > m_ms1RetentionTimeVector
void addPeptideAsSeamark(const T &peptide_id, double retentionTime, double precursorIntensity)
collects all peptide evidences of a given MSrun seamarks has to be converted to peptide retention tim...
FilterMorphoMedian m_ms2MedianFilter
const FilterMorphoMean & getMs2MeanFilter() const
double getBackRetentionTimeReference() const
std::size_t getNumberOfCorrectedValues() const
A simple container of DataPoint instances.
std::vector< pappso_double > yValues() const
void sortX(Enums::SortOrder sort_order=Enums::SortOrder::ascending)
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
double precursorIntensity