libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
spectralalignment.h
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/processing/specglob/spectraalignment.h
3
* \date 08/11/2023
4
* \author Olivier Langella
5
* \brief petide to spectrum alignment
6
*
7
* C++ implementation of the SpecGlob algorithm described in :
8
* 1. Prunier, G. et al. Fast alignment of mass spectra in large proteomics
9
* datasets, capturing dissimilarities arising from multiple complex
10
* modifications of peptides. BMC Bioinformatics 24, 421 (2023).
11
*
12
* HAL Id : hal-04296170 , version 1
13
* Mot de passe : hxo20cl
14
* DOI : 10.1186/s12859-023-05555-y
15
*/
16
17
18
/*
19
* SpecGlobTool, Spectra to peptide alignment tool
20
* Copyright (C) 2023 Olivier Langella
21
* <olivier.langella@universite-paris-saclay.fr>
22
*
23
* This program is free software: you can redistribute it and/or modify
24
* it under the terms of the GNU General Public License as published by
25
* the Free Software Foundation, either version 3 of the License, or
26
* (at your option) any later version.
27
*
28
* This program is distributed in the hope that it will be useful,
29
* but WITHOUT ANY WARRANTY; without even the implied warranty of
30
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31
* GNU General Public License for more details.
32
*
33
* You should have received a copy of the GNU General Public License
34
* along with this program. If not, see <http://www.gnu.org/licenses/>.
35
*
36
*/
37
38
#pragma once
39
#include <boost/numeric/ublas/matrix.hpp>
40
#include "
experimentalspectrum.h
"
41
#include "
peptidespectrum.h
"
42
#include "
scorevalues.h
"
43
#include "
peptidemodel.h
"
44
#include "
pappsomspp/export-import-config.h
"
45
46
using namespace
boost::numeric::ublas;
47
48
49
namespace
pappso
50
{
51
namespace
specglob
52
{
53
struct
SpectralAlignmentDataPoint
54
{
55
double
mass_difference
;
56
int
score
;
57
std::size_t
origin_column_indices
;
58
SpectralAlignmentType
alignment_type
;
59
};
60
61
/**
62
* @todo write docs
63
*/
64
class
PMSPP_LIB_DECL
SpectralAlignment
65
{
66
public
:
67
/**
68
* Default constructor
69
*/
70
SpectralAlignment
(
ScoreValues
score_values,
71
pappso::PrecisionPtr
precision_ptr);
72
73
/**
74
* Destructor
75
*/
76
~SpectralAlignment
();
77
78
79
/** @brief build the alignment matrix between a peptide sequence and an
80
* experimental spectrum
81
*
82
* @param peptide_spectrum the peptide sequence
83
* @param experimental_spectrum the experimental spectrum
84
*/
85
void
align
(
PeptideSpectraCsp
peptide_spectrum,
86
ExperimentalSpectrumCsp
experimental_spectrum);
87
88
/** @brief trim the current peptide to get a minimal alignment score
89
*/
90
PeptideModel
rtrim
(
PrecisionPtr
precision_ptr);
91
92
const
matrix<SpectralAlignmentDataPoint> &
getMatrix
()
const
;
93
std::vector<int>
getScoreRow
(std::size_t row_indice)
const
;
94
95
int
getMaxScore
()
const
;
96
97
boost::numeric::ublas::matrix<SpectralAlignmentDataPoint>::iterator2
98
getMaxPosIterator
()
const
;
99
100
double
getPrecursorMzDelta
()
const
;
101
102
103
/**
104
* Backtrack is here to get the HitModified Sequence during the backtrack of
105
* score calculation. It start from best score align case in matrix and use
106
* origin matrix to go back to the start of the alignment
107
*
108
* @param row : the row indices of the best score
109
* @param column : the column indices of the best score
110
* @param precision : the precision of measures
111
*/
112
113
QString
backTrack
()
const
;
114
115
116
PeptideModel
buildPeptideModel
()
const
;
117
118
ExperimentalSpectrumCsp
getExperimentalSpectrumCsp
()
const
;
119
120
PeptideSpectraCsp
getPeptideSpectraCsp
()
const
;
121
122
private
:
123
const
ExperimentalSpectrumDataPoint
&
getExperimentalSpectrumDataPoint
(
124
const
boost::numeric::ublas::matrix<SpectralAlignmentDataPoint>::iterator2
125
&itpos)
const
;
126
127
void
fillMassDelta
(
const
PeptideSpectrum
&peptide_spectrum,
128
const
ExperimentalSpectrum
&experimental_spectrum);
129
130
131
/**
132
* This method do the alignment of the 2 Spectra and fill matrices at actual
133
* coordinates i(row - theoretical) and j(column - experimental)
134
*
135
* @param theoIndiceI : The actual theoretical peak indices
136
* @param expeIndiceJ : The actual experimental peak indices
137
*
138
*/
139
void
fillMatricesWithScores
(
140
const
boost::numeric::ublas::matrix<SpectralAlignmentDataPoint>::iterator2
141
&it_pos,
142
const
PeptideSpectrum
&peptide_spectrum,
143
const
ExperimentalSpectrum
&experimental_spectrum);
144
145
146
/**
147
* Method to get a realigned j value of where come from the realignment and
148
* get the associated realigned score
149
*
150
* @param theoIndicesI : The row where we are actually
151
* @param expeIndicesK : The founded k indices
152
* @param expeIndicesJ : The column where we are actually
153
* @param reAlignScore : Score to add if it is needed to add offset to
154
* realign
155
* @param alignScoreToAdd : Score to add if there is an alignment with peak k
156
* @param precision : Precision of measures
157
* @return an int[] where int[0] is the origin column (m) where come from the
158
* re-alignment and int[1] is the calculated re-aligned score and
159
* int[3] is the alignment type code
160
*
161
*/
162
SpectralAlignmentDataPoint
getBestRealignScore
(
163
const
boost::numeric::ublas::matrix<SpectralAlignmentDataPoint>::iterator2
164
&it_pos,
165
std::size_t expeIndicesK,
166
int
reAlignScore,
167
int
alignScoreToAdd);
168
169
170
private
:
171
ExperimentalSpectrumCsp
mcsp_experimentalSpectrum
;
172
PeptideSpectraCsp
mcsp_peptideSpectrum
;
173
matrix<SpectralAlignmentDataPoint>
m_matrix
;
// x <= peptide, y <= spectrum
174
pappso::PrecisionPtr
m_precisionPtr
;
175
ScoreValues
m_scoreValues
;
176
int
m_maxScore
;
177
boost::numeric::ublas::matrix<SpectralAlignmentDataPoint>::iterator2
178
m_itPosMax
;
179
180
double
m_precursorMassDelta
=
181
0;
// diffference between precursor ion and theoretical peptide ion
182
183
/**
184
* modifies the score on the last amino acid alignment (RA score
185
* rather than NA
186
* Not documented anyMore in the interface
187
*/
188
189
bool
m_BETTER_END_RA
=
false
;
190
};
191
}
// namespace specglob
192
}
// namespace pappso
pappso::specglob::ExperimentalSpectrum
Definition
experimentalspectrum.h:64
pappso::specglob::PeptideModel
Definition
peptidemodel.h:73
pappso::specglob::PeptideSpectrum
Definition
peptidespectrum.h:63
pappso::specglob::ScoreValues
Definition
scorevalues.h:54
pappso::specglob::SpectralAlignment::mcsp_peptideSpectrum
PeptideSpectraCsp mcsp_peptideSpectrum
Definition
spectralalignment.h:172
pappso::specglob::SpectralAlignment::m_maxScore
int m_maxScore
Definition
spectralalignment.h:176
pappso::specglob::SpectralAlignment::SpectralAlignment
SpectralAlignment(ScoreValues score_values, pappso::PrecisionPtr precision_ptr)
Definition
spectralalignment.cpp:47
pappso::specglob::SpectralAlignment::getBestRealignScore
SpectralAlignmentDataPoint getBestRealignScore(const boost::numeric::ublas::matrix< SpectralAlignmentDataPoint >::iterator2 &it_pos, std::size_t expeIndicesK, int reAlignScore, int alignScoreToAdd)
Definition
spectralalignment.cpp:282
pappso::specglob::SpectralAlignment::getMaxPosIterator
boost::numeric::ublas::matrix< SpectralAlignmentDataPoint >::iterator2 getMaxPosIterator() const
Definition
spectralalignment.cpp:394
pappso::specglob::SpectralAlignment::m_BETTER_END_RA
bool m_BETTER_END_RA
Definition
spectralalignment.h:189
pappso::specglob::SpectralAlignment::getScoreRow
std::vector< int > getScoreRow(std::size_t row_indice) const
Definition
spectralalignment.cpp:374
pappso::specglob::SpectralAlignment::m_precursorMassDelta
double m_precursorMassDelta
Definition
spectralalignment.h:180
pappso::specglob::SpectralAlignment::m_scoreValues
ScoreValues m_scoreValues
Definition
spectralalignment.h:175
pappso::specglob::SpectralAlignment::m_precisionPtr
pappso::PrecisionPtr m_precisionPtr
Definition
spectralalignment.h:174
pappso::specglob::SpectralAlignment::fillMassDelta
void fillMassDelta(const PeptideSpectrum &peptide_spectrum, const ExperimentalSpectrum &experimental_spectrum)
Definition
spectralalignment.cpp:344
pappso::specglob::SpectralAlignment::backTrack
QString backTrack() const
Definition
spectralalignment.cpp:414
pappso::specglob::SpectralAlignment::getMaxScore
int getMaxScore() const
Definition
spectralalignment.cpp:388
pappso::specglob::SpectralAlignment::getPrecursorMzDelta
double getPrecursorMzDelta() const
Definition
spectralalignment.cpp:407
pappso::specglob::SpectralAlignment::buildPeptideModel
PeptideModel buildPeptideModel() const
Definition
spectralalignment.cpp:552
pappso::specglob::SpectralAlignment::getExperimentalSpectrumDataPoint
const ExperimentalSpectrumDataPoint & getExperimentalSpectrumDataPoint(const boost::numeric::ublas::matrix< SpectralAlignmentDataPoint >::iterator2 &itpos) const
Definition
spectralalignment.cpp:400
pappso::specglob::SpectralAlignment::mcsp_experimentalSpectrum
ExperimentalSpectrumCsp mcsp_experimentalSpectrum
Definition
spectralalignment.h:171
pappso::specglob::SpectralAlignment::getPeptideSpectraCsp
PeptideSpectraCsp getPeptideSpectraCsp() const
Definition
spectralalignment.cpp:65
pappso::specglob::SpectralAlignment::rtrim
PeptideModel rtrim(PrecisionPtr precision_ptr)
trim the current peptide to get a minimal alignment score
Definition
spectralalignment.cpp:110
pappso::specglob::SpectralAlignment::getExperimentalSpectrumCsp
ExperimentalSpectrumCsp getExperimentalSpectrumCsp() const
Definition
spectralalignment.cpp:59
pappso::specglob::SpectralAlignment::getMatrix
const matrix< SpectralAlignmentDataPoint > & getMatrix() const
Definition
spectralalignment.cpp:368
pappso::specglob::SpectralAlignment::m_itPosMax
boost::numeric::ublas::matrix< SpectralAlignmentDataPoint >::iterator2 m_itPosMax
Definition
spectralalignment.h:178
pappso::specglob::SpectralAlignment::m_matrix
matrix< SpectralAlignmentDataPoint > m_matrix
Definition
spectralalignment.h:173
pappso::specglob::SpectralAlignment::fillMatricesWithScores
void fillMatricesWithScores(const boost::numeric::ublas::matrix< SpectralAlignmentDataPoint >::iterator2 &it_pos, const PeptideSpectrum &peptide_spectrum, const ExperimentalSpectrum &experimental_spectrum)
Definition
spectralalignment.cpp:154
pappso::specglob::SpectralAlignment::align
void align(PeptideSpectraCsp peptide_spectrum, ExperimentalSpectrumCsp experimental_spectrum)
build the alignment matrix between a peptide sequence and an experimental spectrum
Definition
spectralalignment.cpp:70
experimentalspectrum.h
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition
export-import-config.h:14
pappso::specglob
Definition
experimentalspectrum.cpp:44
pappso::specglob::PeptideSpectraCsp
std::shared_ptr< const PeptideSpectrum > PeptideSpectraCsp
Definition
peptidespectrum.h:58
pappso::specglob::ExperimentalSpectrumCsp
std::shared_ptr< const ExperimentalSpectrum > ExperimentalSpectrumCsp
Definition
experimentalspectrum.h:59
pappso::specglob::SpectralAlignmentType
SpectralAlignmentType
Definition
types.h:48
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::PrecisionPtr
const PrecisionBase * PrecisionPtr
Definition
precision.h:122
peptidespectrum.h
peptidemodel.h
scorevalues.h
pappso::specglob::ExperimentalSpectrumDataPoint
Definition
experimentalspectrum.h:51
pappso::specglob::SpectralAlignmentDataPoint
Definition
spectralalignment.h:54
pappso::specglob::SpectralAlignmentDataPoint::alignment_type
SpectralAlignmentType alignment_type
Definition
spectralalignment.h:58
pappso::specglob::SpectralAlignmentDataPoint::origin_column_indices
std::size_t origin_column_indices
Definition
spectralalignment.h:57
pappso::specglob::SpectralAlignmentDataPoint::score
int score
Definition
spectralalignment.h:56
pappso::specglob::SpectralAlignmentDataPoint::mass_difference
double mass_difference
Definition
spectralalignment.h:55
pappsomspp
core
processing
specglob
spectralalignment.h
Generated on
for libpappsomspp by
1.17.0