libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
msrunretentiontime.h
Go to the documentation of this file.
1
2/*******************************************************************************
3 * Copyright (c) 2019 Olivier Langella <Olivier.Langella@u-psud.fr>.
4 *
5 * This file is part of the PAPPSOms++ library.
6 *
7 * PAPPSOms++ is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * PAPPSOms++ is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
19 *
20 ******************************************************************************/
21
22#pragma once
23
24#include "../msrunid.h"
25#include "../msrunreader.h"
26#include <vector>
28
29namespace pappso
30{
31
32template <class T>
39
40
41template <class T>
43{
44 private:
51
58
59 public:
60 MsRunRetentionTime(const std::vector<double> &msrun_retention_time_line);
63
64 void setMs2MedianFilter(const FilterMorphoMedian &ms2MedianFilter);
65 void setMs2MeanFilter(const FilterMorphoMean &ms2MeanFilter);
66 void setMs1MeanFilter(const FilterMorphoMean &ms1MeanFilter);
67
68 const FilterMorphoMedian &getMs2MedianFilter() const;
69 const FilterMorphoMean &getMs2MeanFilter() const;
70 const FilterMorphoMean &getMs1MeanFilter() const;
71
72 Trace
73 getCommonDeltaRt(const std::vector<MsRunRetentionTimeSeamarkPoint<T>> &other_seamarks) const;
74
75 /** @brief collects all peptide evidences of a given MSrun
76 * seamarks has to be converted to peptide retention time using
77 * computePeptideRetentionTimes
78 *
79 * @param peptide_id unique identifier (whichever type) of a peptide
80 * @param retentionTime retention time of this peptide observation
81 * @param precursorIntensity MS2 precursorIntensity of this peptide
82 */
83 void addPeptideAsSeamark(const T &peptide_id, double retentionTime, double precursorIntensity);
84
85
86 std::size_t getNumberOfCorrectedValues() const;
87
88 /** @brief align the current msrunretentiontime object using the given
89 * reference
90 * @param msrun_retention_time_reference the reference
91 * @return a trace containing aligned MS1 retention times
92 */
93 Trace align(const MsRunRetentionTime<T> &msrun_retention_time_reference);
94
95 /** @brief get common seamarks between msrunretentiontime objects and their
96 * deltart
97 * @param msrun_retention_time_reference the reference
98 * @return a trace containing MS2 common points and their deltart
99 */
100 Trace getCommonSeamarksDeltaRt(const MsRunRetentionTime<T> &msrun_retention_time_reference) const;
101
102 const std::vector<MsRunRetentionTimeSeamarkPoint<T>> &getSeamarks() const;
103
104 /** @brief get aligned retention time vector
105 * @return vector of seconds (as double)
106 */
107 const std::vector<double> &getAlignedRetentionTimeVector() const;
108
109 void setAlignedRetentionTimeVector(const std::vector<double> &aligned_times);
110
111 /** @brief get orginal retention time vector (not aligned)
112 * @return vector of seconds (as double)
113 */
114 const std::vector<double> &getMs1RetentionTimeVector() const;
115
116 bool isAligned() const;
117
118 double translateOriginal2AlignedRetentionTime(double original_retention_time) const;
119
120
121 double translateAligned2OriginalRetentionTime(double aligned_retention_time) const;
122
123 /** @brief convert PeptideMs2Point into Peptide seamarks
124 * this is required before computing alignment
125 */
126 void computeSeamarks();
127
128 protected:
129 double getFrontRetentionTimeReference() const;
130 double getBackRetentionTimeReference() const;
131 const std::vector<MsRunRetentionTimeSeamarkPoint<T>> getSeamarksReferences() const;
132
133 private:
134 /** @brief get a trace of common MS2 retention times (x values) by their
135 * deltart (y values)
136 * @param delta_rt the trace result (common MS2 retention times vs counter
137 * part deltart)
138 * @param other_seamarks seamarks of the counter part (reference)
139 */
140 void getCommonDeltaRt(Trace &delta_rt,
141 const std::vector<MsRunRetentionTimeSeamarkPoint<T>> &other_seamarks) const;
142 void correctNewTimeValues(Trace &ms1_aligned_points, double correction_parameter);
143
144 void linearRegressionMs2toMs1(Trace &ms1_aligned_points, const Trace &common_points);
145
146 private:
150 std::vector<double> m_ms1RetentionTimeVector;
151 std::vector<double> m_alignedRetentionTimeVector;
152
153 std::vector<MsRunRetentionTimeSeamarkPoint<T>> m_seamarks;
154 std::size_t m_valuesCorrected = 0;
155
156 std::vector<PeptideMs2Point> m_allMs2Points;
157
160};
161
162} // namespace pappso
mean filter apply mean of y values inside the window : this results in a kind of smoothing
median filter apply median of y values inside the window
std::vector< double > m_alignedRetentionTimeVector
std::vector< PeptideMs2Point > m_allMs2Points
MsRunRetentionTime(const std::vector< double > &msrun_retention_time_line)
std::vector< MsRunRetentionTimeSeamarkPoint< T > > m_seamarks
ComputeRetentionTimeReference m_retentionTimeReferenceMethod
std::vector< double > m_ms1RetentionTimeVector
FilterMorphoMedian m_ms2MedianFilter
A simple container of DataPoint instances.
Definition trace.h:148
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39