libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::PeptideModificatorPipeline Class Reference

#include <peptidemodificatorpipeline.h>

Inheritance diagram for pappso::PeptideModificatorPipeline:
pappso::PeptideModificatorInterface pappso::PeptideSpSinkInterface pappso::EnzymeProductInterface

Public Member Functions

 PeptideModificatorPipeline ()
 PeptideModificatorPipeline (const PeptideModificatorPipeline &other)
virtual ~PeptideModificatorPipeline ()
void addFixedModificationString (const QString &mod_str)
void addFixedNterModificationString (const QString &mod_str)
void addFixedCterModificationString (const QString &mod_str)
void addPotentialModificationString (const QString &mod_str)
void addPotentialNterModificationString (const QString &mod_str)
void addPotentialCterModificationString (const QString &mod_str)
void setSink (PeptideModificatorInterface *sink) override
void setPeptideSp (std::int8_t sequence_database_id, const ProteinSp &protein_sp, bool is_decoy, const PeptideSp &peptide_sp_original, unsigned int start, bool is_nter, unsigned int missed_cleavage_number, bool semi_enzyme) override
 function to give the products of modifications for a digested peptide
void setPeptide (std::int8_t sequence_database_id, const ProteinSp &protein_sp, bool is_decoy, const QString &peptide_str, unsigned int start, bool is_nter, unsigned int missed_cleavage_number, bool semi_enzyme) override
 function to give the products of a protein digestion by an enzyme
void addLabeledModificationString (const QString &mod_str)
Public Member Functions inherited from pappso::PeptideModificatorInterface
virtual ~PeptideModificatorInterface ()

Private Member Functions

void parseFixedModification (const QString &mod_str, bool Nter, bool Cter, bool else_prot)
void privAddFixedModificationString (const QString &mod_str, bool Nter, bool Cter, bool else_prot)
void parsePotentialModification (const QString &mod_str, bool Nter, bool Cter, bool else_prot)
void privAddPotentialModificationString (const QString &mod_str, bool Nter, bool Cter, bool else_prot)
void parseLabeledModification (const QString &mod_str, bool Nter, bool Cter, bool else_prot)

Private Attributes

PeptideModificatorTeemp_peptideModificatorTee = nullptr
PeptideModificatorInterfacem_sink = nullptr
PeptideSpSinkInterfacemp_lastPeptideSinkInterface
PeptideModificatorInterfacemp_firstModificator = nullptr
std::vector< PeptideModificatorInterface * > m_pepModificatorPtrList

Detailed Description

Definition at line 33 of file peptidemodificatorpipeline.h.

Constructor & Destructor Documentation

◆ PeptideModificatorPipeline() [1/2]

PeptideModificatorPipeline::PeptideModificatorPipeline ( )

Definition at line 36 of file peptidemodificatorpipeline.cpp.

37{
38}

Referenced by PeptideModificatorPipeline().

◆ PeptideModificatorPipeline() [2/2]

PeptideModificatorPipeline::PeptideModificatorPipeline ( const PeptideModificatorPipeline & other)

Definition at line 40 of file peptidemodificatorpipeline.cpp.

41{
42 throw PappsoException(QObject::tr("unable to copy PeptideModificatorPipeline object"));
43 if(other.mp_peptideModificatorTee != nullptr)
44 {
45 // mp_peptideModificatorTee = new
46 // PeptideModificatorTee(other.mp_peptideModificatorTee);
47 }
48
50 mp_firstModificator = nullptr;
51 for(auto p_mod : other.m_pepModificatorPtrList)
52 {
53 delete(p_mod);
54 }
55
56
57 m_sink = other.m_sink;
58
60
62
64}
std::vector< PeptideModificatorInterface * > m_pepModificatorPtrList
PeptideModificatorInterface * mp_firstModificator
PeptideSpSinkInterface * mp_lastPeptideSinkInterface

References PeptideModificatorPipeline(), m_pepModificatorPtrList, m_sink, mp_firstModificator, mp_lastPeptideSinkInterface, and mp_peptideModificatorTee.

◆ ~PeptideModificatorPipeline()

PeptideModificatorPipeline::~PeptideModificatorPipeline ( )
virtual

Definition at line 66 of file peptidemodificatorpipeline.cpp.

67{
68
69 for(auto p_mod : m_pepModificatorPtrList)
70 {
71 delete(p_mod);
72 }
73 if(mp_peptideModificatorTee == nullptr)
74 {
76 }
77}

References m_pepModificatorPtrList, and mp_peptideModificatorTee.

Member Function Documentation

◆ addFixedCterModificationString()

void PeptideModificatorPipeline::addFixedCterModificationString ( const QString & mod_str)

Definition at line 106 of file peptidemodificatorpipeline.cpp.

107{
108 privAddFixedModificationString(mod_str, false, true, false);
109}
void privAddFixedModificationString(const QString &mod_str, bool Nter, bool Cter, bool else_prot)

References privAddFixedModificationString().

◆ addFixedModificationString()

void PeptideModificatorPipeline::addFixedModificationString ( const QString & mod_str)

Definition at line 96 of file peptidemodificatorpipeline.cpp.

97{
98 privAddFixedModificationString(mod_str, true, true, true);
99}

References privAddFixedModificationString().

◆ addFixedNterModificationString()

void PeptideModificatorPipeline::addFixedNterModificationString ( const QString & mod_str)

Definition at line 101 of file peptidemodificatorpipeline.cpp.

102{
103 privAddFixedModificationString(mod_str, true, false, false);
104}

References privAddFixedModificationString().

◆ addLabeledModificationString()

void PeptideModificatorPipeline::addLabeledModificationString ( const QString & mod_str)

Definition at line 254 of file peptidemodificatorpipeline.cpp.

255{
256
257 if(m_sink == nullptr)
258 {
259 throw PappsoException(
260 QObject::tr("Please use setSink before addLabeledModificationString function"));
261 }
262 if(mp_peptideModificatorTee == nullptr)
263 {
264 mp_peptideModificatorTee = new PeptideModificatorTee;
265 }
266 if(mp_firstModificator == nullptr)
267 {
269 }
270
271 // backup pointers
272 PeptideModificatorInterface *backup_sink = m_sink;
273
274 PeptideSpSinkInterface *backup_p_last_peptide_sink_interface = mp_lastPeptideSinkInterface;
275
276 PeptideModificatorInterface *backup_p_first_modificator = mp_firstModificator;
277
278
279 QStringList mod_list_str = mod_str.simplified().replace(" ", "").split(",", Qt::SkipEmptyParts);
280 for(auto i = 0; i < mod_list_str.size(); ++i)
281 {
282 parseLabeledModification(mod_list_str[i], true, true, true);
283
284 if(i == 0)
285 {
287 }
288 }
289
290 m_sink = backup_sink;
291 mp_lastPeptideSinkInterface = backup_p_last_peptide_sink_interface;
292 mp_firstModificator = backup_p_first_modificator;
293
295}
void parseLabeledModification(const QString &mod_str, bool Nter, bool Cter, bool else_prot)

References m_sink, mp_firstModificator, mp_lastPeptideSinkInterface, mp_peptideModificatorTee, and parseLabeledModification().

◆ addPotentialCterModificationString()

void PeptideModificatorPipeline::addPotentialCterModificationString ( const QString & mod_str)

Definition at line 176 of file peptidemodificatorpipeline.cpp.

177{
178 privAddPotentialModificationString(mod_str, false, true, false);
179}
void privAddPotentialModificationString(const QString &mod_str, bool Nter, bool Cter, bool else_prot)

References privAddPotentialModificationString().

◆ addPotentialModificationString()

void PeptideModificatorPipeline::addPotentialModificationString ( const QString & mod_str)

Definition at line 164 of file peptidemodificatorpipeline.cpp.

165{
166 privAddPotentialModificationString(mod_str, true, true, true);
167}

References privAddPotentialModificationString().

◆ addPotentialNterModificationString()

void PeptideModificatorPipeline::addPotentialNterModificationString ( const QString & mod_str)

Definition at line 170 of file peptidemodificatorpipeline.cpp.

171{
172 privAddPotentialModificationString(mod_str, true, false, false);
173}

References privAddPotentialModificationString().

◆ parseFixedModification()

void PeptideModificatorPipeline::parseFixedModification ( const QString & mod_str,
bool Nter,
bool Cter,
bool else_prot )
private

Definition at line 133 of file peptidemodificatorpipeline.cpp.

137{
138
139 QStringList str_split = mod_str.split("@", Qt::SkipEmptyParts);
140
142
143 PeptideFixedModificationBuilder *mod = new PeptideFixedModificationBuilder(aa_mod);
144 mod->setModificationPattern(str_split[1]);
145 mod->setSink(m_sink);
146 mod->setProtNter(Nter);
147 mod->setProtCter(Cter);
148 mod->setProtElse(else_prot);
149
150 m_pepModificatorPtrList.push_back(mod);
151
152 if(mp_firstModificator == nullptr)
153 {
155 }
156 else
157 {
158 mp_lastPeptideSinkInterface->setSink(mod);
159 }
161}
static AaModificationP getInstance(const QString &accession)
void setProtElse(bool arg1)
this modification concerns all peptides between Nter and Cter
void setProtCter(bool arg1)
this modification concerns the Cter peptide
void setSink(PeptideModificatorInterface *sink) override
void setProtNter(bool arg1)
this modification concerns the Nter peptide
virtual void setModificationPattern(QString &pattern) final
set the pattern on which the modification will be applied (usually the list of concerned AA)
const AaModification * AaModificationP

References pappso::Cter, pappso::AaModification::getInstance(), m_pepModificatorPtrList, m_sink, mp_firstModificator, mp_lastPeptideSinkInterface, pappso::Nter, pappso::PeptideModificatorBase::setModificationPattern(), pappso::PeptideFixedModificationBuilder::setProtCter(), pappso::PeptideFixedModificationBuilder::setProtElse(), pappso::PeptideFixedModificationBuilder::setProtNter(), and pappso::PeptideFixedModificationBuilder::setSink().

Referenced by privAddFixedModificationString().

◆ parseLabeledModification()

void PeptideModificatorPipeline::parseLabeledModification ( const QString & mod_str,
bool Nter,
bool Cter,
bool else_prot )
private

Definition at line 299 of file peptidemodificatorpipeline.cpp.

303{
304
305 QStringList str_split = mod_str.split("@", Qt::SkipEmptyParts);
307
308 PeptideFixedModificationBuilder *mod = new PeptideFixedModificationBuilder(aa_mod);
309 mod->setModificationPattern(str_split[1]);
310 mod->setSink(m_sink);
311 mod->setProtNter(Nter);
312 mod->setProtCter(Cter);
313 mod->setProtCter(else_prot);
314
315 m_pepModificatorPtrList.push_back(mod);
316
317 mp_lastPeptideSinkInterface->setSink(mod);
320}

References pappso::Cter, pappso::AaModification::getInstance(), m_pepModificatorPtrList, m_sink, mp_firstModificator, mp_lastPeptideSinkInterface, pappso::Nter, pappso::PeptideModificatorBase::setModificationPattern(), pappso::PeptideFixedModificationBuilder::setProtCter(), pappso::PeptideFixedModificationBuilder::setProtNter(), and pappso::PeptideFixedModificationBuilder::setSink().

Referenced by addLabeledModificationString().

◆ parsePotentialModification()

void PeptideModificatorPipeline::parsePotentialModification ( const QString & mod_str,
bool Nter,
bool Cter,
bool else_prot )
private

Definition at line 204 of file peptidemodificatorpipeline.cpp.

208{
209
210 QStringList str_split = mod_str.split("@", Qt::SkipEmptyParts);
211
212 QString mod_acc_str = str_split[0];
213 QStringList str_acc_split = mod_acc_str.split("(", Qt::SkipEmptyParts);
214 pappso::AaModificationP aa_mod = AaModification::getInstance(str_acc_split[0]);
215
216 PeptideVariableModificationBuilder *mod = new PeptideVariableModificationBuilder(aa_mod);
217
218 // qDebug() << "PeptideModificatorPipeline::parsePotentialModification " << ;
219 if(str_acc_split.length() == 2)
220 {
221 QStringList max_num_str_list =
222 str_acc_split[1].replace(")", "").split("-", Qt::SkipEmptyParts);
223 if(max_num_str_list.length() == 1)
224 {
225 mod->setModificationCounter(max_num_str_list[0].toUInt());
226 }
227 else if(max_num_str_list.length() == 2)
228 {
229 mod->setMinNumberMod(max_num_str_list[0].toUInt());
230 mod->setMaxNumberMod(max_num_str_list[1].toUInt());
231 }
232 }
233 mod->setModificationPattern(str_split[1]);
234 mod->setSink(m_sink);
235 mod->setProtNter(Nter);
236 mod->setProtCter(Cter);
237 mod->setProtElse(else_prot);
238
239 m_pepModificatorPtrList.push_back(mod);
240
241 if(mp_firstModificator == nullptr)
242 {
244 }
245 else
246 {
247 mp_lastPeptideSinkInterface->setSink(mod);
248 }
250}
void setSink(PeptideModificatorInterface *sink) override
void setProtNter(bool arg1)
this modification concerns the Nter peptide
void setProtElse(bool arg1)
this modification concerns all peptides between Nter and Cter
void setProtCter(bool arg1)
this modification concerns the Cter peptide

References pappso::Cter, pappso::AaModification::getInstance(), m_pepModificatorPtrList, m_sink, mp_firstModificator, mp_lastPeptideSinkInterface, pappso::Nter, pappso::PeptideVariableModificationBuilder::setMaxNumberMod(), pappso::PeptideVariableModificationBuilder::setMinNumberMod(), pappso::PeptideVariableModificationBuilder::setModificationCounter(), pappso::PeptideModificatorBase::setModificationPattern(), pappso::PeptideVariableModificationBuilder::setProtCter(), pappso::PeptideVariableModificationBuilder::setProtElse(), pappso::PeptideVariableModificationBuilder::setProtNter(), and pappso::PeptideVariableModificationBuilder::setSink().

Referenced by privAddPotentialModificationString().

◆ privAddFixedModificationString()

void PeptideModificatorPipeline::privAddFixedModificationString ( const QString & mod_str,
bool Nter,
bool Cter,
bool else_prot )
private

Definition at line 112 of file peptidemodificatorpipeline.cpp.

116{
117 //"MOD:00397@C, MOD:00398@R"
118 if(mp_peptideModificatorTee != nullptr)
119 {
120 throw PappsoException(
121 QObject::tr("Unable to add fixed modification string after "
122 "addLabeledModificationString function"));
123 }
124 QStringList mod_list_str = mod_str.simplified().replace(" ", "").split(",", Qt::SkipEmptyParts);
125 for(auto i = 0; i < mod_list_str.size(); ++i)
126 {
127 parseFixedModification(mod_list_str[i], Nter, Cter, else_prot);
128 }
129}
void parseFixedModification(const QString &mod_str, bool Nter, bool Cter, bool else_prot)

References pappso::Cter, mp_peptideModificatorTee, pappso::Nter, and parseFixedModification().

Referenced by addFixedCterModificationString(), addFixedModificationString(), and addFixedNterModificationString().

◆ privAddPotentialModificationString()

void PeptideModificatorPipeline::privAddPotentialModificationString ( const QString & mod_str,
bool Nter,
bool Cter,
bool else_prot )
private

Definition at line 182 of file peptidemodificatorpipeline.cpp.

186{
187 //"MOD:00397@C, MOD:00398@R"
188 if(mp_peptideModificatorTee != nullptr)
189 {
190 throw PappsoException(
191 QObject::tr("Unable to add potential modification string after "
192 "addLabeledModificationString function"));
193 }
194
195 QStringList mod_list_str = mod_str.simplified().replace(" ", "").split(",", Qt::SkipEmptyParts);
196 for(auto i = 0; i < mod_list_str.size(); ++i)
197 {
198 parsePotentialModification(mod_list_str[i], Nter, Cter, else_prot);
199 }
200}
void parsePotentialModification(const QString &mod_str, bool Nter, bool Cter, bool else_prot)

References pappso::Cter, mp_peptideModificatorTee, pappso::Nter, and parsePotentialModification().

Referenced by addPotentialCterModificationString(), addPotentialModificationString(), and addPotentialNterModificationString().

◆ setPeptide()

void PeptideModificatorPipeline::setPeptide ( std::int8_t sequence_database_id,
const ProteinSp & protein_sp,
bool is_decoy,
const QString & peptide,
unsigned int start,
bool is_nter,
unsigned int missed_cleavage_number,
bool semi_enzyme )
overridevirtual

function to give the products of a protein digestion by an enzyme

Parameters
sequence_database_idinteger that references the sequence fatabase (file, stream, url...)
protein_spshared pointer on the protein that was digested
is_decoytell if the current protein is a decoy (true) or normal (false) protein
peptideamino acid sequence of the peptide (string) produced by the digestion
startthe position of the first amino acid of the peptide in the original protein sequence. the first amino acid of the protein is at position 1.
is_nterboolean to tell if the peptide is an Nter peptide (to allow Methionin Nter removal)
missed_cleavage_numbernumber of missed cleavage sites (that the enzyme has not cut) fot the product
semi_enzymeboolean that tells if this peptide is the produce of a semi enzymatic lysis

Implements pappso::EnzymeProductInterface.

Definition at line 359 of file peptidemodificatorpipeline.cpp.

367{
368
369 qDebug() << "PeptideModificatorPipeline::setPeptide begin";
370
371 Peptide peptide(peptide_str);
372
373 PeptideSp peptide_sp = peptide.makePeptideSp();
374
375 qDebug() << "PeptideModificatorPipeline::setPeptide m_sink->setPeptideSp";
376 setPeptideSp(sequence_database_id,
377 protein_sp,
378 is_decoy,
379 peptide_sp,
380 start,
381 is_nter,
382 missed_cleavage_number,
383 semi_enzyme);
384 qDebug() << "PeptideModificatorPipeline::setPeptide end";
385}
void setPeptideSp(std::int8_t sequence_database_id, const ProteinSp &protein_sp, bool is_decoy, const PeptideSp &peptide_sp_original, unsigned int start, bool is_nter, unsigned int missed_cleavage_number, bool semi_enzyme) override
function to give the products of modifications for a digested peptide
std::shared_ptr< const Peptide > PeptideSp

References pappso::Peptide::makePeptideSp(), and setPeptideSp().

◆ setPeptideSp()

void PeptideModificatorPipeline::setPeptideSp ( std::int8_t sequence_database_id,
const ProteinSp & protein_sp,
bool is_decoy,
const PeptideSp & peptide_sp,
unsigned int start,
bool is_nter,
unsigned int missed_cleavage_number,
bool semi_enzyme )
overridevirtual

function to give the products of modifications for a digested peptide

Parameters
sequence_database_idinteger that references the sequence fatabase (file, stream, url...)
protein_spshared pointer on the protein that was initialy digested
is_decoytell if the current protein is a decoy (true) or normal (false) protein
peptidePeptide object containing sequence and possible modifications
startthe position of the first amino acid of the peptide in the original protein sequence. the first amino acid of the protein is at position 1.
is_nterboolean to tell if the peptide is an Nter peptide (to allow Methionin Nter removal)
missed_cleavage_numbernumber of missed cleavage sites (that the enzyme has not cut) fot the product
semi_enzymeboolean that tells if this peptide is the produce of a semi enzymatic lysis

Implements pappso::PeptideModificatorInterface.

Definition at line 324 of file peptidemodificatorpipeline.cpp.

332{
333 if(mp_firstModificator == nullptr)
334 {
335 m_sink->setPeptideSp(sequence_database_id,
336 protein_sp,
337 is_decoy,
338 peptide_sp_original,
339 start,
340 is_nter,
341 missed_cleavage_number,
342 semi_enzyme);
343 }
344 else
345 {
346 mp_firstModificator->setPeptideSp(sequence_database_id,
347 protein_sp,
348 is_decoy,
349 peptide_sp_original,
350 start,
351 is_nter,
352 missed_cleavage_number,
353 semi_enzyme);
354 }
355}

References m_sink, and mp_firstModificator.

Referenced by setPeptide().

◆ setSink()

void PeptideModificatorPipeline::setSink ( PeptideModificatorInterface * sink)
overridevirtual

Implements pappso::PeptideSpSinkInterface.

Definition at line 80 of file peptidemodificatorpipeline.cpp.

81{
82 if(mp_peptideModificatorTee != nullptr)
83 {
84 throw PappsoException(
85 QObject::tr("Please use setSink before addLabeledModificationString function"));
86 }
87
88 m_sink = sink;
89 if(mp_firstModificator != nullptr)
90 {
92 }
93};

References m_sink, mp_firstModificator, mp_lastPeptideSinkInterface, and mp_peptideModificatorTee.

Member Data Documentation

◆ m_pepModificatorPtrList

std::vector<PeptideModificatorInterface *> pappso::PeptideModificatorPipeline::m_pepModificatorPtrList
private

◆ m_sink

◆ mp_firstModificator

◆ mp_lastPeptideSinkInterface

PeptideSpSinkInterface* pappso::PeptideModificatorPipeline::mp_lastPeptideSinkInterface
private

◆ mp_peptideModificatorTee


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