Loading...
Searching...
No Matches
pappso::MsRunRetentionTime< T > Class Template Reference

`#include <msrunretentiontime.h>`

## Classes

struct | PeptideMs2Point

## Public Member Functions

| MsRunRetentionTime (const std::vector< double > &msrun_retention_time_line)
| MsRunRetentionTime (const MsRunRetentionTime< T > &other)
| ~MsRunRetentionTime ()
void | setMs2MedianFilter (const FilterMorphoMedian &ms2MedianFilter)
void | setMs2MeanFilter (const FilterMorphoMean &ms2MeanFilter)
void | setMs1MeanFilter (const FilterMorphoMean &ms1MeanFilter)
const FilterMorphoMedian & | getMs2MedianFilter () const
const FilterMorphoMean & | getMs2MeanFilter () const
const FilterMorphoMean & | getMs1MeanFilter () const
Trace | getCommonDeltaRt (const std::vector< MsRunRetentionTimeSeamarkPoint< T > > &other_seamarks) const
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 time using computePeptideRetentionTimes
std::size_t | getNumberOfCorrectedValues () const
Trace | align (const MsRunRetentionTime< T > &msrun_retention_time_reference)
| align the current msrunretentiontime object using the given reference
Trace | getCommonSeamarksDeltaRt (const MsRunRetentionTime< T > &msrun_retention_time_reference) const
| get common seamarks between msrunretentiontime objects and their deltart
const std::vector< MsRunRetentionTimeSeamarkPoint< T > > & | getSeamarks () const
const std::vector< double > & | getAlignedRetentionTimeVector () const
| get aligned retention time vector
void | setAlignedRetentionTimeVector (const std::vector< double > &aligned_times)
const std::vector< double > & | getMs1RetentionTimeVector () const
| get orginal retention time vector (not aligned)
bool | isAligned () const
double | translateOriginal2AlignedRetentionTime (double original_retention_time) const
double | translateAligned2OriginalRetentionTime (double aligned_retention_time) const
void | computeSeamarks ()
| convert PeptideMs2Point into Peptide seamarks this is required before computing alignment

## Protected Member Functions

double | getFrontRetentionTimeReference () const
double | getBackRetentionTimeReference () const
const std::vector< MsRunRetentionTimeSeamarkPoint< T > > | getSeamarksReferences () const

## Private Types

enum class | ComputeRetentionTimeReference { maximum_intensity , weighted_intensity , last }

## Private Member Functions

void | getCommonDeltaRt (Trace &delta_rt, const std::vector< MsRunRetentionTimeSeamarkPoint< T > > &other_seamarks) const
| get a trace of common MS2 retention times (x values) by their deltart (y values)
void | correctNewTimeValues (Trace &ms1_aligned_points, double correction_parameter)
void | linearRegressionMs2toMs1 (Trace &ms1_aligned_points, const Trace &common_points)

## Private Attributes

FilterMorphoMedian | m_ms2MedianFilter
FilterMorphoMean | m_ms2MeanFilter
FilterMorphoMean | m_ms1MeanFilter
std::vector< double > | m_ms1RetentionTimeVector
std::vector< double > | m_alignedRetentionTimeVector
std::vector< MsRunRetentionTimeSeamarkPoint< T > > | m_seamarks
std::size_t | m_valuesCorrected = 0
std::vector< PeptideMs2Point > | m_allMs2Points
ComputeRetentionTimeReference | m_retentionTimeReferenceMethod

## Detailed Description

template<class T>
class pappso::MsRunRetentionTime< T >

Definition at line 42 of file msrunretentiontime.h.

## Member Enumeration Documentation

## ComputeRetentionTimeReference

template<class T>

enum class pappso::MsRunRetentionTime::ComputeRetentionTimeReference

strong private

Enumerator
maximum_intensity |
weighted_intensity |
last |

Definition at line 52 of file msrunretentiontime.h.

{
maximum_intensity,
weighted_intensity,
last
};
pappso::masschroq::PeakQualityCategory::last
@ last
Definition types.h:61

## Constructor & Destructor Documentation

## MsRunRetentionTime() [1/2]

template<class T>

MsRunRetentionTime::MsRunRetentionTime | ( | const std::vector< double > & | msrun_retention_time_line | ) |

Definition at line 37 of file msrunretentiontime.cpp.

: m_ms2MedianFilter(10), m_ms2MeanFilter(15), m_ms1MeanFilter(1)
{
m_ms1RetentionTimeVector = msrun_retention_time_line;
std::sort(m_ms1RetentionTimeVector.begin(),
m_ms1RetentionTimeVector.end(),
[](const double &a, const double &b) { return (a < b); });
}
pappso::MsRunRetentionTime
Definition msrunretentiontime.h:43
pappso::MsRunRetentionTime::m_ms1MeanFilter
FilterMorphoMean m_ms1MeanFilter
Definition msrunretentiontime.h:149
pappso::MsRunRetentionTime::m_ms2MeanFilter
FilterMorphoMean m_ms2MeanFilter
Definition msrunretentiontime.h:148
pappso::MsRunRetentionTime::m_ms1RetentionTimeVector
std::vector< double > m_ms1RetentionTimeVector
Definition msrunretentiontime.h:150
pappso::MsRunRetentionTime::m_ms2MedianFilter
FilterMorphoMedian m_ms2MedianFilter
Definition msrunretentiontime.h:147

References pappso::a, pappso::b, m_ms1MeanFilter, m_ms1RetentionTimeVector, m_ms2MeanFilter, and m_ms2MedianFilter.

Referenced by MsRunRetentionTime(), align(), and getCommonSeamarksDeltaRt().

## MsRunRetentionTime() [2/2]

template<class T>

MsRunRetentionTime::MsRunRetentionTime | ( | const MsRunRetentionTime< T > & | other | ) |

Definition at line 49 of file msrunretentiontime.cpp.

: m_ms2MedianFilter(other.m_ms2MedianFilter),
m_ms2MeanFilter(other.m_ms2MeanFilter),
m_ms1MeanFilter(other.m_ms1MeanFilter)
{
m_ms1RetentionTimeVector = other.m_ms1RetentionTimeVector;
m_alignedRetentionTimeVector = other.m_alignedRetentionTimeVector;
m_seamarks = other.m_seamarks;
m_valuesCorrected = other.m_valuesCorrected;
m_allMs2Points = other.m_allMs2Points;
m_retentionTimeReferenceMethod = other.m_retentionTimeReferenceMethod;
}
pappso::MsRunRetentionTime::m_alignedRetentionTimeVector
std::vector< double > m_alignedRetentionTimeVector
Definition msrunretentiontime.h:151
pappso::MsRunRetentionTime::m_allMs2Points
std::vector< PeptideMs2Point > m_allMs2Points
Definition msrunretentiontime.h:156
pappso::MsRunRetentionTime::m_valuesCorrected
std::size_t m_valuesCorrected
Definition msrunretentiontime.h:154
pappso::MsRunRetentionTime::m_seamarks
std::vector< MsRunRetentionTimeSeamarkPoint< T > > m_seamarks
Definition msrunretentiontime.h:153
pappso::MsRunRetentionTime::m_retentionTimeReferenceMethod
ComputeRetentionTimeReference m_retentionTimeReferenceMethod
Definition msrunretentiontime.h:158

References MsRunRetentionTime(), m_alignedRetentionTimeVector, m_ms1MeanFilter, m_ms1RetentionTimeVector, m_ms2MeanFilter, m_ms2MedianFilter, m_seamarks, and m_valuesCorrected.

## ~MsRunRetentionTime()

template<class T>

MsRunRetentionTime::~MsRunRetentionTime | ( |  | ) |

Definition at line 66 of file msrunretentiontime.cpp.

{
}

## Member Function Documentation

## addPeptideAsSeamark()

template<class T>

void MsRunRetentionTime::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 time using computePeptideRetentionTimes

Parameters

  peptide_id | unique identifier (whichever type) of a peptide
  retentionTime | retention time of this peptide observation
  precursorIntensity | MS2 precursorIntensity of this peptide

Definition at line 153 of file msrunretentiontime.cpp.

{
PeptideMs2Point ms2point;
ms2point.entityHash = peptide_id;
ms2point.precursorIntensity = precursorIntensity;
ms2point.retentionTime = retentionTime;
m_allMs2Points.push_back(ms2point);
}
pappso::MsRunRetentionTime::PeptideMs2Point
Definition msrunretentiontime.h:46

References pappso::MsRunRetentionTime< T >::PeptideMs2Point::entityHash, m_allMs2Points, pappso::MsRunRetentionTime< T >::PeptideMs2Point::precursorIntensity, and pappso::MsRunRetentionTime< T >::PeptideMs2Point::retentionTime.

## align()

template<class T>

Trace MsRunRetentionTime::align | ( | const MsRunRetentionTime< T > & | msrun_retention_time_reference | ) |

align the current msrunretentiontime object using the given reference

Parameters

  msrun_retention_time_reference | the reference

Returns
  a trace containing aligned MS1 retention times

Definition at line 402 of file msrunretentiontime.cpp.

{
computeSeamarks();
std::vector<MsRunRetentionTimeSeamarkPoint<T>> other_seamarks;
if(msrun_retention_time_reference.isAligned())
{
other_seamarks = msrun_retention_time_reference.getSeamarksReferences();
}
else
{
other_seamarks = msrun_retention_time_reference.getSeamarks();
}
qDebug();
if((m_ms1MeanFilter.getHalfWindowSize() * 2 + 1) >= m_ms1RetentionTimeVector.size())
{
throw ExceptionNotPossible(QObject::tr("ERROR : MS1 alignment not possible : "
"\ntoo few MS1 points (%1)")
.arg(m_ms1RetentionTimeVector.size()));
}
qDebug() << m_seamarks[0].entityHash << " " << m_seamarks[0].retentionTime << " "
<< other_seamarks[0].entityHash << other_seamarks[0].retentionTime << " ";
// both seamarks has to be ordered
Trace common_points;
getCommonDeltaRt(common_points, other_seamarks);
// writeTrace("lib_ms2_delta_rt.ods", common_points);
qDebug() << common_points.front().x << " " << common_points.front().y;
m_ms2MedianFilter.filter(common_points);
// writeTrace("lib_ms2_delta_rt_median.ods", common_points);
m_ms2MeanFilter.filter(common_points);
// writeTrace("lib_ms2_delta_rt_mean.ods", common_points);
// convert common delta rt to real retention times (for convenience)
qDebug() << common_points.front().x << " " << common_points.front().y;
// add a first point to ensure coherence:
DataPoint first_point;
first_point.x = m_ms1RetentionTimeVector.front() - (double)1;
if(first_point.x < 0)
{
first_point.x = 0;
}
first_point.y = m_ms1RetentionTimeVector.front() -
msrun_retention_time_reference.getFrontRetentionTimeReference();
common_points.push_back(first_point);
// add a last point to ensure coherence:
DataPoint last_point;
last_point.x = m_ms1RetentionTimeVector.back() + 1;
last_point.y = m_ms1RetentionTimeVector.back() -
msrun_retention_time_reference.getBackRetentionTimeReference();
common_points.push_back(last_point);
common_points.sortX();
// now, it is possible for each time range to give a new MS1 time using a
// linear regression on MS2 corrected times
m_alignedRetentionTimeVector.clear();
qDebug() << common_points.front().x << " " << common_points.front().y;
Trace ms1_aligned_points;
linearRegressionMs2toMs1(ms1_aligned_points, common_points);
// writeTrace("lib_ms1_map_rt.ods", ms1_aligned_points);
qDebug();
// smoothing on MS1 points
m_ms1MeanFilter.filter(ms1_aligned_points);
// writeTrace("lib_ms1_map_rt_mean.ods", ms1_aligned_points);
// final aligned retentionTime vector
for(DataPoint &data_point : ms1_aligned_points)
{
data_point.y = (data_point.x - data_point.y);
}
qDebug();
// Here, the correction parameter is the slope of old rt points curve
// (divided by 4 to get a finer correction).
double correction_parameter =
(m_ms1RetentionTimeVector.back() - m_ms1RetentionTimeVector.front()) /
(ms1_aligned_points.size());
// set_correction_parameter(correction_parameter / 4);
correction_parameter = correction_parameter / (double)4;
correctNewTimeValues(ms1_aligned_points, correction_parameter);
m_alignedRetentionTimeVector = ms1_aligned_points.yValues();
qDebug();
return ms1_aligned_points;
}
pappso::MsRunRetentionTime::isAligned
bool isAligned() const
Definition msrunretentiontime.cpp:395
pappso::MsRunRetentionTime::computeSeamarks
void computeSeamarks()
convert PeptideMs2Point into Peptide seamarks this is required before computing alignment
Definition msrunretentiontime.cpp:167
pappso::MsRunRetentionTime::linearRegressionMs2toMs1
void linearRegressionMs2toMs1(Trace &ms1_aligned_points, const Trace &common_points)
Definition msrunretentiontime.cpp:500
pappso::MsRunRetentionTime::getFrontRetentionTimeReference
double getFrontRetentionTimeReference() const
Definition msrunretentiontime.cpp:266
pappso::MsRunRetentionTime::correctNewTimeValues
void correctNewTimeValues(Trace &ms1_aligned_points, double correction_parameter)
Definition msrunretentiontime.cpp:550
pappso::MsRunRetentionTime::getSeamarks
const std::vector< MsRunRetentionTimeSeamarkPoint< T > > & getSeamarks() const
Definition msrunretentiontime.cpp:115
pappso::MsRunRetentionTime::getCommonDeltaRt
Trace getCommonDeltaRt(const std::vector< MsRunRetentionTimeSeamarkPoint< T > > &other_seamarks) const
Definition msrunretentiontime.cpp:143
pappso::MsRunRetentionTime::getSeamarksReferences
const std::vector< MsRunRetentionTimeSeamarkPoint< T > > getSeamarksReferences() const
Definition msrunretentiontime.cpp:383
pappso::MsRunRetentionTime::getBackRetentionTimeReference
double getBackRetentionTimeReference() const
Definition msrunretentiontime.cpp:276

References MsRunRetentionTime(), computeSeamarks(), correctNewTimeValues(), getBackRetentionTimeReference(), getCommonDeltaRt(), getFrontRetentionTimeReference(), getSeamarks(), getSeamarksReferences(), isAligned(), linearRegressionMs2toMs1(), m_alignedRetentionTimeVector, m_ms1MeanFilter, m_ms1RetentionTimeVector, m_ms2MeanFilter, m_ms2MedianFilter, m_seamarks, pappso::Trace::sortX(), pappso::DataPoint::x, pappso::DataPoint::y, and pappso::Trace::yValues().

## computeSeamarks()

template<class T>

void MsRunRetentionTime::computeSeamarks | ( |  | ) |

convert PeptideMs2Point into Peptide seamarks this is required before computing alignment

Definition at line 167 of file msrunretentiontime.cpp.

{
qDebug();
if(m_allMs2Points.size() == 0)
{
// already computed
return;
}
m_seamarks.clear();
if(m_retentionTimeReferenceMethod == ComputeRetentionTimeReference::maximum_intensity)
{
std::sort(m_allMs2Points.begin(),
m_allMs2Points.end(),
[](const PeptideMs2Point &a, const PeptideMs2Point &b) {
if(a.entityHash == b.entityHash)
{
return (a.precursorIntensity > b.precursorIntensity);
}
return (a.entityHash < b.entityHash);
});
auto itend = std::unique(m_allMs2Points.begin(),
m_allMs2Points.end(),
[](const PeptideMs2Point &a, const PeptideMs2Point &b) {
return (a.entityHash == b.entityHash);
});
auto it = m_allMs2Points.begin();
while(it != itend)
{
m_seamarks.push_back({it->entityHash, it->retentionTime, it->precursorIntensity});
it++;
}
}
m_allMs2Points.clear();
std::sort(
m_seamarks.begin(),
m_seamarks.end(),
[](const MsRunRetentionTimeSeamarkPoint<T> &a, const MsRunRetentionTimeSeamarkPoint<T> &b) {
return (a.entityHash < b.entityHash);
});
qDebug();
}
pappso::MsRunRetentionTime::ComputeRetentionTimeReference::maximum_intensity
@ maximum_intensity
Definition msrunretentiontime.h:54

References pappso::a, pappso::b, m_allMs2Points, m_retentionTimeReferenceMethod, m_seamarks, and maximum_intensity.

Referenced by align().

## correctNewTimeValues()

template<class T>

void MsRunRetentionTime::correctNewTimeValues | ( | Trace & | ms1_aligned_points,
|  | double | correction_parameter )

private

Definition at line 550 of file msrunretentiontime.cpp.

{
m_valuesCorrected = 0;
auto new_it(ms1_aligned_points.begin());
auto new_nextit(ms1_aligned_points.begin());
new_nextit++;
for(; new_nextit != ms1_aligned_points.end(); ++new_nextit, ++new_it)
{
if(new_nextit->y < new_it->y)
{
++m_valuesCorrected;
new_nextit->y = new_it->y + correction_parameter;
}
}
}

References m_valuesCorrected.

Referenced by align().

## getAlignedRetentionTimeVector()

template<class T>

const std::vector< double > & MsRunRetentionTime::getAlignedRetentionTimeVector | ( |  | ) | const

get aligned retention time vector

Returns
  vector of seconds (as double)

Definition at line 123 of file msrunretentiontime.cpp.

{
return m_alignedRetentionTimeVector;
}

References m_alignedRetentionTimeVector.

Referenced by pappso::masschroq::CborOutputStream::writeMsRunRetentionTime().

## getBackRetentionTimeReference()

template<class T>

double MsRunRetentionTime::getBackRetentionTimeReference | ( |  | ) | const

protected

Definition at line 276 of file msrunretentiontime.cpp.

{
if(isAligned())
{
return m_alignedRetentionTimeVector.back();
}
return m_ms1RetentionTimeVector.back();
}

References isAligned(), m_alignedRetentionTimeVector, and m_ms1RetentionTimeVector.

Referenced by align().

## getCommonDeltaRt() [1/2]

template<class T>

Trace MsRunRetentionTime::getCommonDeltaRt | ( | const std::vector< MsRunRetentionTimeSeamarkPoint< T > > & | other_seamarks | ) | const

Definition at line 143 of file msrunretentiontime.cpp.

{
Trace common_points;
getCommonDeltaRt(common_points, other_seamarks);
return common_points;
}

Referenced by align(), and getCommonSeamarksDeltaRt().

## getCommonDeltaRt() [2/2]

template<class T>

void MsRunRetentionTime::getCommonDeltaRt | ( | Trace & | delta_rt,
|  | const std::vector< MsRunRetentionTimeSeamarkPoint< T > > & | other_seamarks ) const

private

get a trace of common MS2 retention times (x values) by their deltart (y values)

Parameters

  delta_rt | the trace result (common MS2 retention times vs counter part deltart)
  other_seamarks | seamarks of the counter part (reference)

Definition at line 217 of file msrunretentiontime.cpp.

{
qDebug();
auto it = other_seamarks.begin();
for(const MsRunRetentionTimeSeamarkPoint<T> &seamark : m_seamarks)
{
while((it != other_seamarks.end()) && (it->entityHash < seamark.entityHash))
{
it++;
}
if(it == other_seamarks.end())
break;
if(it->entityHash == seamark.entityHash)
{
delta_rt.push_back(
DataPoint(seamark.retentionTime, seamark.retentionTime - it->retentionTime));
}
}
qDebug();
if((m_ms2MedianFilter.getHalfWindowSize() * 2 + 1) >= delta_rt.size())
{
throw ExceptionNotPossible(QObject::tr("ERROR : MS2 alignment not possible : "
"\ntoo few MS2 points (%1) in common")
.arg(delta_rt.size()));
}
qDebug();
if((m_ms2MeanFilter.getHalfWindowSize() * 2 + 1) >= delta_rt.size())
{
throw ExceptionNotPossible(QObject::tr("ERROR : MS2 alignment not possible : "
"\ntoo few MS2 points (%1) in common")
.arg(delta_rt.size()));
}
delta_rt.sortX();
// there can be multiple entities (peptides) at one retention time
// in this case, avoid retention time redundancy by applying unique on trace :
delta_rt.unique();
qDebug();
}

References m_ms2MeanFilter, m_ms2MedianFilter, m_seamarks, pappso::Trace::sortX(), and pappso::Trace::unique().

## getCommonSeamarksDeltaRt()

template<class T>

Trace MsRunRetentionTime::getCommonSeamarksDeltaRt | ( | const MsRunRetentionTime< T > & | msrun_retention_time_reference | ) | const

get common seamarks between msrunretentiontime objects and their deltart

Parameters

  msrun_retention_time_reference | the reference

Returns
  a trace containing MS2 common points and their deltart

Definition at line 609 of file msrunretentiontime.cpp.

{
// computeSeamarks();
std::vector<MsRunRetentionTimeSeamarkPoint<T>> other_seamarks;
if(msrun_retention_time_reference.isAligned())
{
other_seamarks = msrun_retention_time_reference.getSeamarksReferences();
}
else
{
other_seamarks = msrun_retention_time_reference.getSeamarks();
}
qDebug();
qDebug() << m_seamarks[0].entityHash << " " << m_seamarks[0].retentionTime << " "
<< other_seamarks[0].entityHash << other_seamarks[0].retentionTime << " ";
// both seamarks has to be ordered
Trace common_points;
getCommonDeltaRt(common_points, other_seamarks);
return common_points;
}

References MsRunRetentionTime(), getCommonDeltaRt(), getSeamarks(), getSeamarksReferences(), isAligned(), and m_seamarks.

## getFrontRetentionTimeReference()

template<class T>

double MsRunRetentionTime::getFrontRetentionTimeReference | ( |  | ) | const

protected

Definition at line 266 of file msrunretentiontime.cpp.

{
if(isAligned())
{
return m_alignedRetentionTimeVector.front();
}
return m_ms1RetentionTimeVector.front();
}

References isAligned(), m_alignedRetentionTimeVector, and m_ms1RetentionTimeVector.

Referenced by align().

## getMs1MeanFilter()

template<typename T>

const pappso::FilterMorphoMean & pappso::MsRunRetentionTime< T >::getMs1MeanFilter | ( |  | ) | const

Definition at line 101 of file msrunretentiontime.cpp.

{
return m_ms1MeanFilter;
}

## getMs1RetentionTimeVector()

template<class T>

const std::vector< double > & MsRunRetentionTime::getMs1RetentionTimeVector | ( |  | ) | const

get orginal retention time vector (not aligned)

Returns
  vector of seconds (as double)

Definition at line 136 of file msrunretentiontime.cpp.

{
return m_ms1RetentionTimeVector;
}

References m_ms1RetentionTimeVector.

Referenced by pappso::masschroq::CborOutputStream::writeMsRunRetentionTime().

## getMs2MeanFilter()

template<typename T>

const pappso::FilterMorphoMean & pappso::MsRunRetentionTime< T >::getMs2MeanFilter | ( |  | ) | const

Definition at line 86 of file msrunretentiontime.cpp.

{
return m_ms2MeanFilter;
}

References m_ms2MeanFilter.

Referenced by pappso::masschroq::CborOutputStream::writeMsRunRetentionTime().

## getMs2MedianFilter()

template<typename T>

const pappso::FilterMorphoMedian & pappso::MsRunRetentionTime< T >::getMs2MedianFilter | ( |  | ) | const

Definition at line 72 of file msrunretentiontime.cpp.

{
return m_ms2MedianFilter;
}

Referenced by pappso::masschroq::CborOutputStream::writeMsRunRetentionTime().

## getNumberOfCorrectedValues()

template<class T>

std::size_t MsRunRetentionTime::getNumberOfCorrectedValues | ( |  | ) | const

Definition at line 130 of file msrunretentiontime.cpp.

{
return m_valuesCorrected;
}

## getSeamarks()

template<class T>

const std::vector< MsRunRetentionTimeSeamarkPoint< T > > & MsRunRetentionTime::getSeamarks | ( |  | ) | const

Definition at line 115 of file msrunretentiontime.cpp.

{
qDebug();
return m_seamarks;
}

Referenced by align(), pappso::masschroq::MsRunGroup::alignRetentionTimeBetweenMsRuns(), and getCommonSeamarksDeltaRt().

## getSeamarksReferences()

template<class T>

const std::vector< MsRunRetentionTimeSeamarkPoint< T > > MsRunRetentionTime::getSeamarksReferences | ( |  | ) | const

protected

Definition at line 383 of file msrunretentiontime.cpp.

{
std::vector<MsRunRetentionTimeSeamarkPoint<T>> other_seamarks = m_seamarks;
for(auto &seamark : other_seamarks)
{
seamark.retentionTime = translateOriginal2AlignedRetentionTime(seamark.retentionTime);
}
return other_seamarks;
}
pappso::MsRunRetentionTime::translateOriginal2AlignedRetentionTime
double translateOriginal2AlignedRetentionTime(double original_retention_time) const
Definition msrunretentiontime.cpp:288

References m_seamarks, and translateOriginal2AlignedRetentionTime().

Referenced by align(), and getCommonSeamarksDeltaRt().

## isAligned()

template<class T>

bool MsRunRetentionTime::isAligned | ( |  | ) | const

Definition at line 395 of file msrunretentiontime.cpp.

{
return (m_alignedRetentionTimeVector.size() > 0);
}

References m_alignedRetentionTimeVector.

Referenced by pappso::masschroq::Peptide::addAlignedPeakMeasurement(), pappso::masschroq::Peptide::addAlignedPeptideObservation(), align(), getBackRetentionTimeReference(), getCommonSeamarksDeltaRt(), getFrontRetentionTimeReference(), pappso::masschroq::MbrPeptideMeasurements::prepareMeasurements(), pappso::masschroq::MsRunGroup::quantify(), and pappso::masschroq::CborOutputStream::writeTracePeak().

## linearRegressionMs2toMs1()

template<class T>

void MsRunRetentionTime::linearRegressionMs2toMs1 | ( | Trace & | ms1_aligned_points,
|  | const Trace & | common_points )

private

Definition at line 500 of file msrunretentiontime.cpp.

{
// first slope :
std::vector<DataPoint>::const_iterator itms2 = common_points.begin();
std::vector<DataPoint>::const_iterator itms2next = itms2 + 1;
if(itms2next == common_points.end())
{
// error
throw ExceptionNotPossible(QObject::tr("ERROR : MS1 alignment not possible : "
"\ntoo few common points (%1)")
.arg(common_points.size()));
}
qDebug() << "() itms2->x=" << itms2->x << " itms2->y=" << itms2->y;
for(double &original_rt_point : m_ms1RetentionTimeVector)
{
DataPoint ms1_point;
ms1_point.x = original_rt_point;
while(ms1_point.x > itms2next->x)
{
itms2++;
itms2next++;
}
double ratio = (itms2next->x - itms2->x);
if(ratio != 0)
{
ratio = (ms1_point.x - itms2->x) / ratio;
}
else
{
// avoid division by zero
ratio = 1;
}
// qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "() " <<
// ratio;
ms1_point.y = itms2->y + ((itms2next->y - itms2->y) * ratio);
// qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "() "
// << ms1_point.y;
ms1_aligned_points.push_back(ms1_point);
}
}

References m_ms1RetentionTimeVector, pappso::DataPoint::x, and pappso::DataPoint::y.

Referenced by align().

## setAlignedRetentionTimeVector()

template<class T>

void pappso::MsRunRetentionTime< T >::setAlignedRetentionTimeVector | ( | const std::vector< double > & | aligned_times | ) |

Definition at line 569 of file msrunretentiontime.cpp.

{
if(aligned_times.size() == m_ms1RetentionTimeVector.size())
{
m_alignedRetentionTimeVector = aligned_times;
}
else
{
if(aligned_times.size() == m_ms1RetentionTimeVector.size() * 2)
{
m_alignedRetentionTimeVector = m_ms1RetentionTimeVector;
for(std::size_t i = 0; i < m_ms1RetentionTimeVector.size(); i++)
{
if(aligned_times[2 * i] != m_ms1RetentionTimeVector[i])
{
throw pappso::PappsoException(
QObject::tr("ERROR : aligned_times (size=%1) vector does not have "
"required size (size=%2)")
.arg(aligned_times.size())
.arg(m_ms1RetentionTimeVector.size()));
}
m_alignedRetentionTimeVector[i] = aligned_times[(2 * i) + 1];
}
}
else
{
throw ExceptionNotPossible(
QObject::tr("ERROR : aligned_times (size=%1) vector does not have "
"required size (size=%2)")
.arg(aligned_times.size())
.arg(m_ms1RetentionTimeVector.size()));
}
}
}

References m_alignedRetentionTimeVector, and m_ms1RetentionTimeVector.

## setMs1MeanFilter()

template<class T>

void MsRunRetentionTime::setMs1MeanFilter | ( | const FilterMorphoMean & | ms1MeanFilter | ) |

Definition at line 108 of file msrunretentiontime.cpp.

{
m_ms1MeanFilter = ms1MeanFilter;
}

## setMs2MeanFilter()

template<class T>

void MsRunRetentionTime::setMs2MeanFilter | ( | const FilterMorphoMean & | ms2MeanFilter | ) |

Definition at line 94 of file msrunretentiontime.cpp.

{
m_ms2MeanFilter = ms2MeanFilter;
}

References m_ms2MeanFilter.

## setMs2MedianFilter()

template<class T>

void MsRunRetentionTime::setMs2MedianFilter | ( | const FilterMorphoMedian & | ms2MedianFilter | ) |

Definition at line 79 of file msrunretentiontime.cpp.

{
m_ms2MedianFilter = ms2MedianFilter;
}

References m_ms2MedianFilter.

## translateAligned2OriginalRetentionTime()

template<class T>

double MsRunRetentionTime::translateAligned2OriginalRetentionTime | ( | double | aligned_retention_time | ) | const

Definition at line 336 of file msrunretentiontime.cpp.

{
if(m_alignedRetentionTimeVector.size() < 3)
{
throw ExceptionNotPossible(QObject::tr("ERROR : too few aligned points to compute aligned "
"retention time (%1)")
.arg(m_ms1RetentionTimeVector.size()));
}
if(m_alignedRetentionTimeVector.size() != m_ms1RetentionTimeVector.size())
{
throw ExceptionNotPossible(QObject::tr("ERROR : m_alignedRetentionTimeVector.size() %1 != %2 "
"m_ms1RetentionTimeVector.size()")
.arg(m_alignedRetentionTimeVector.size())
.arg(m_ms1RetentionTimeVector.size()));
}
auto it_plus = std::find_if(
m_alignedRetentionTimeVector.begin(),
m_alignedRetentionTimeVector.end(),
[aligned_retention_time](const double &rt_point) { return aligned_retention_time < rt_point; });
double rt1_a, rt2_a, rt1_b, rt2_b;
if(it_plus == m_alignedRetentionTimeVector.end())
{
it_plus--;
}
if(it_plus == m_alignedRetentionTimeVector.begin())
{
it_plus++;
}
auto it_minus = it_plus - 1;
rt1_a = *it_minus;
rt2_a = *it_plus;
double ratio = (aligned_retention_time - rt1_a) / (rt2_a - rt1_a);
auto itref = m_ms1RetentionTimeVector.begin() +
std::distance(m_alignedRetentionTimeVector.begin(), it_minus);
rt1_b = *itref;
itref++;
rt2_b = *itref;
return (((rt2_b - rt1_b) * ratio) + rt1_b);
}

References m_alignedRetentionTimeVector, and m_ms1RetentionTimeVector.

Referenced by pappso::masschroq::MbrPeptideMeasurements::prepareMeasurements().

## translateOriginal2AlignedRetentionTime()

template<class T>

double MsRunRetentionTime::translateOriginal2AlignedRetentionTime | ( | double | original_retention_time | ) | const

Definition at line 288 of file msrunretentiontime.cpp.

{
if(m_alignedRetentionTimeVector.size() < 3)
{
throw ExceptionNotPossible(QObject::tr("ERROR : too few aligned points to compute aligned "
"retention time (%1)")
.arg(m_ms1RetentionTimeVector.size()));
}
if(m_alignedRetentionTimeVector.size() != m_ms1RetentionTimeVector.size())
{
throw ExceptionNotPossible(QObject::tr("ERROR : m_alignedRetentionTimeVector.size() %1 != %2 "
"m_ms1RetentionTimeVector.size()")
.arg(m_alignedRetentionTimeVector.size())
.arg(m_ms1RetentionTimeVector.size()));
}
auto it_plus = std::find_if(m_ms1RetentionTimeVector.begin(),
m_ms1RetentionTimeVector.end(),
[original_retention_time](const double &rt_point) {
return original_retention_time < rt_point;
});
double rt1_a, rt2_a, rt1_b, rt2_b;
if(it_plus == m_ms1RetentionTimeVector.end())
{
it_plus--;
}
if(it_plus == m_ms1RetentionTimeVector.begin())
{
it_plus++;
}
auto it_minus = it_plus - 1;
rt1_a = *it_minus;
rt2_a = *it_plus;
double ratio = (original_retention_time - rt1_a) / (rt2_a - rt1_a);
auto itref = m_alignedRetentionTimeVector.begin() +
std::distance(m_ms1RetentionTimeVector.begin(), it_minus);
rt1_b = *itref;
itref++;
rt2_b = *itref;
return (((rt2_b - rt1_b) * ratio) + rt1_b);
}

References m_alignedRetentionTimeVector, and m_ms1RetentionTimeVector.

Referenced by pappso::masschroq::Peptide::addAlignedPeakMeasurement(), pappso::masschroq::Peptide::addAlignedPeptideObservation(), getSeamarksReferences(), and pappso::masschroq::CborOutputStream::writeTracePeak().

## Member Data Documentation

## m_alignedRetentionTimeVector

template<class T>

std::vector<double> pappso::MsRunRetentionTime< T >::m_alignedRetentionTimeVector

private

Definition at line 151 of file msrunretentiontime.h.

Referenced by MsRunRetentionTime(), align(), getAlignedRetentionTimeVector(), getBackRetentionTimeReference(), getFrontRetentionTimeReference(), isAligned(), setAlignedRetentionTimeVector(), translateAligned2OriginalRetentionTime(), and translateOriginal2AlignedRetentionTime().

## m_allMs2Points

template<class T>

std::vector<PeptideMs2Point> pappso::MsRunRetentionTime< T >::m_allMs2Points

private

Definition at line 156 of file msrunretentiontime.h.

Referenced by addPeptideAsSeamark(), and computeSeamarks().

## m_ms1MeanFilter

template<class T>

FilterMorphoMean pappso::MsRunRetentionTime< T >::m_ms1MeanFilter

private

Definition at line 149 of file msrunretentiontime.h.

Referenced by MsRunRetentionTime(), MsRunRetentionTime(), and align().

## m_ms1RetentionTimeVector

template<class T>

std::vector<double> pappso::MsRunRetentionTime< T >::m_ms1RetentionTimeVector

private

Definition at line 150 of file msrunretentiontime.h.

Referenced by MsRunRetentionTime(), MsRunRetentionTime(), align(), getBackRetentionTimeReference(), getFrontRetentionTimeReference(), getMs1RetentionTimeVector(), linearRegressionMs2toMs1(), setAlignedRetentionTimeVector(), translateAligned2OriginalRetentionTime(), and translateOriginal2AlignedRetentionTime().

## m_ms2MeanFilter

template<class T>

FilterMorphoMean pappso::MsRunRetentionTime< T >::m_ms2MeanFilter

private

Definition at line 148 of file msrunretentiontime.h.

Referenced by MsRunRetentionTime(), MsRunRetentionTime(), align(), getCommonDeltaRt(), getMs2MeanFilter(), and setMs2MeanFilter().

## m_ms2MedianFilter

template<class T>

FilterMorphoMedian pappso::MsRunRetentionTime< T >::m_ms2MedianFilter

private

Definition at line 147 of file msrunretentiontime.h.

Referenced by MsRunRetentionTime(), MsRunRetentionTime(), align(), getCommonDeltaRt(), and setMs2MedianFilter().

## m_retentionTimeReferenceMethod

template<class T>

ComputeRetentionTimeReference pappso::MsRunRetentionTime< T >::m_retentionTimeReferenceMethod

private

Initial value:
=
ComputeRetentionTimeReference::maximum_intensity

Definition at line 158 of file msrunretentiontime.h.

Referenced by computeSeamarks().

## m_seamarks

template<class T>

std::vector<MsRunRetentionTimeSeamarkPoint<T> > pappso::MsRunRetentionTime< T >::m_seamarks

private

Definition at line 153 of file msrunretentiontime.h.

Referenced by MsRunRetentionTime(), align(), computeSeamarks(), getCommonDeltaRt(), getCommonSeamarksDeltaRt(), and getSeamarksReferences().

## m_valuesCorrected

template<class T>

std::size_t pappso::MsRunRetentionTime< T >::m_valuesCorrected = 0

private

Definition at line 154 of file msrunretentiontime.h.

Referenced by MsRunRetentionTime(), and correctNewTimeValues().

The documentation for this class was generated from the following files:

- pappsomspp/core/msrun/alignment/msrunretentiontime.h
- pappsomspp/core/msrun/alignment/msrunretentiontime.cpp