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}

◆ PeptideModificatorPipeline() [2/2]

PeptideModificatorPipeline::PeptideModificatorPipeline ( const PeptideModificatorPipeline other)

Definition at line 40 of file peptidemodificatorpipeline.cpp.

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

References m_pepModificatorPtrList, m_sink, mp_firstModificator, mp_lastPeptideSinkInterface, and mp_peptideModificatorTee.

◆ ~PeptideModificatorPipeline()

PeptideModificatorPipeline::~PeptideModificatorPipeline ( )
virtual

Definition at line 68 of file peptidemodificatorpipeline.cpp.

69{
70
71 for(auto p_mod : m_pepModificatorPtrList)
72 {
73 delete(p_mod);
74 }
75 if(mp_peptideModificatorTee == nullptr)
76 {
78 }
79}

References m_pepModificatorPtrList, and mp_peptideModificatorTee.

Member Function Documentation

◆ addFixedCterModificationString()

void PeptideModificatorPipeline::addFixedCterModificationString ( const QString &  mod_str)

Definition at line 109 of file peptidemodificatorpipeline.cpp.

111{
112 privAddFixedModificationString(mod_str, false, true, false);
113}
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 98 of file peptidemodificatorpipeline.cpp.

99{
100 privAddFixedModificationString(mod_str, true, true, true);
101}

References privAddFixedModificationString().

◆ addFixedNterModificationString()

void PeptideModificatorPipeline::addFixedNterModificationString ( const QString &  mod_str)

Definition at line 103 of file peptidemodificatorpipeline.cpp.

105{
106 privAddFixedModificationString(mod_str, true, false, false);
107}

References privAddFixedModificationString().

◆ addLabeledModificationString()

void PeptideModificatorPipeline::addLabeledModificationString ( const QString &  mod_str)

Definition at line 262 of file peptidemodificatorpipeline.cpp.

263{
264
265 if(m_sink == nullptr)
266 {
267 throw PappsoException(QObject::tr(
268 "Please use setSink before addLabeledModificationString function"));
269 }
270 if(mp_peptideModificatorTee == nullptr)
271 {
273 }
274 if(mp_firstModificator == nullptr)
275 {
277 }
278
279 // backup pointers
280 PeptideModificatorInterface *backup_sink = m_sink;
281
282 PeptideSpSinkInterface *backup_p_last_peptide_sink_interface =
284
285 PeptideModificatorInterface *backup_p_first_modificator = mp_firstModificator;
286
287
288 QStringList mod_list_str =
289 mod_str.simplified().replace(" ", "").split(",", Qt::SkipEmptyParts);
290 for(auto i = 0; i < mod_list_str.size(); ++i)
291 {
292 parseLabeledModification(mod_list_str[i], true, true, true);
293
294 if(i == 0)
295 {
297 }
298 }
299
300 m_sink = backup_sink;
301 mp_lastPeptideSinkInterface = backup_p_last_peptide_sink_interface;
302 mp_firstModificator = backup_p_first_modificator;
303
305}
void parseLabeledModification(const QString &mod_str, bool Nter, bool Cter, bool else_prot)
void addModificator(PeptideModificatorInterface *p_peptide_mod)
virtual void setSink(PeptideModificatorInterface *sink)=0

References pappso::PeptideModificatorTee::addModificator(), m_sink, mp_firstModificator, mp_lastPeptideSinkInterface, mp_peptideModificatorTee, parseLabeledModification(), and pappso::PeptideSpSinkInterface::setSink().

◆ addPotentialCterModificationString()

void PeptideModificatorPipeline::addPotentialCterModificationString ( const QString &  mod_str)

Definition at line 182 of file peptidemodificatorpipeline.cpp.

184{
185 privAddPotentialModificationString(mod_str, false, true, false);
186}
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 168 of file peptidemodificatorpipeline.cpp.

170{
171 privAddPotentialModificationString(mod_str, true, true, true);
172}

References privAddPotentialModificationString().

◆ addPotentialNterModificationString()

void PeptideModificatorPipeline::addPotentialNterModificationString ( const QString &  mod_str)

Definition at line 175 of file peptidemodificatorpipeline.cpp.

177{
178 privAddPotentialModificationString(mod_str, true, false, false);
179}

References privAddPotentialModificationString().

◆ parseFixedModification()

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

Definition at line 136 of file peptidemodificatorpipeline.cpp.

140{
141
142 QStringList str_split = mod_str.split("@", Qt::SkipEmptyParts);
143
145
148 mod->setModificationPattern(str_split[1]);
149 mod->setSink(m_sink);
150 mod->setProtNter(Nter);
151 mod->setProtCter(Cter);
152 mod->setProtElse(else_prot);
153
154 m_pepModificatorPtrList.push_back(mod);
155
156 if(mp_firstModificator == nullptr)
157 {
159 }
160 else
161 {
163 }
165}
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)

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(), pappso::PeptideFixedModificationBuilder::setSink(), and pappso::PeptideSpSinkInterface::setSink().

Referenced by privAddFixedModificationString().

◆ parseLabeledModification()

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

◆ parsePotentialModification()

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

Definition at line 210 of file peptidemodificatorpipeline.cpp.

214{
215
216 QStringList str_split = mod_str.split("@", Qt::SkipEmptyParts);
217
218 QString mod_acc_str = str_split[0];
219 QStringList str_acc_split = mod_acc_str.split("(", Qt::SkipEmptyParts);
221 AaModification::getInstance(str_acc_split[0]);
222
225
226 // qDebug() << "PeptideModificatorPipeline::parsePotentialModification " << ;
227 if(str_acc_split.length() == 2)
228 {
229 QStringList max_num_str_list =
230 str_acc_split[1].replace(")", "").split("-", Qt::SkipEmptyParts);
231 if(max_num_str_list.length() == 1)
232 {
233 mod->setModificationCounter(max_num_str_list[0].toUInt());
234 }
235 else if(max_num_str_list.length() == 2)
236 {
237 mod->setMinNumberMod(max_num_str_list[0].toUInt());
238 mod->setMaxNumberMod(max_num_str_list[1].toUInt());
239 }
240 }
241 mod->setModificationPattern(str_split[1]);
242 mod->setSink(m_sink);
243 mod->setProtNter(Nter);
244 mod->setProtCter(Cter);
245 mod->setProtElse(else_prot);
246
247 m_pepModificatorPtrList.push_back(mod);
248
249 if(mp_firstModificator == nullptr)
250 {
252 }
253 else
254 {
256 }
258}
Modify a peptide shared pointer with a variable modification on one AA.
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(), pappso::PeptideVariableModificationBuilder::setSink(), and pappso::PeptideSpSinkInterface::setSink().

Referenced by privAddPotentialModificationString().

◆ privAddFixedModificationString()

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

Definition at line 116 of file peptidemodificatorpipeline.cpp.

118{
119 //"MOD:00397@C, MOD:00398@R"
120 if(mp_peptideModificatorTee != nullptr)
121 {
122 throw PappsoException(
123 QObject::tr("Unable to add fixed modification string after "
124 "addLabeledModificationString function"));
125 }
126 QStringList mod_list_str =
127 mod_str.simplified().replace(" ", "").split(",", Qt::SkipEmptyParts);
128 for(auto i = 0; i < mod_list_str.size(); ++i)
129 {
130 parseFixedModification(mod_list_str[i], Nter, Cter, else_prot);
131 }
132}
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 189 of file peptidemodificatorpipeline.cpp.

191{
192 //"MOD:00397@C, MOD:00398@R"
193 if(mp_peptideModificatorTee != nullptr)
194 {
195 throw PappsoException(
196 QObject::tr("Unable to add potential modification string after "
197 "addLabeledModificationString function"));
198 }
199
200 QStringList mod_list_str =
201 mod_str.simplified().replace(" ", "").split(",", Qt::SkipEmptyParts);
202 for(auto i = 0; i < mod_list_str.size(); ++i)
203 {
204 parsePotentialModification(mod_list_str[i], Nter, Cter, else_prot);
205 }
206}
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 370 of file peptidemodificatorpipeline.cpp.

378{
379
380 qDebug() << "PeptideModificatorPipeline::setPeptide begin";
381
382 Peptide peptide(peptide_str);
383
384 PeptideSp peptide_sp = peptide.makePeptideSp();
385
386 qDebug() << "PeptideModificatorPipeline::setPeptide m_sink->setPeptideSp";
387 setPeptideSp(sequence_database_id,
388 protein_sp,
389 is_decoy,
390 peptide_sp,
391 start,
392 is_nter,
393 missed_cleavage_number,
394 semi_enzyme);
395 qDebug() << "PeptideModificatorPipeline::setPeptide end";
396}
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 335 of file peptidemodificatorpipeline.cpp.

343{
344 if(mp_firstModificator == nullptr)
345 {
346 m_sink->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 else
356 {
357 mp_firstModificator->setPeptideSp(sequence_database_id,
358 protein_sp,
359 is_decoy,
360 peptide_sp_original,
361 start,
362 is_nter,
363 missed_cleavage_number,
364 semi_enzyme);
365 }
366}
virtual void 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)=0
function to give the products of modifications for a digested peptide

References m_sink, mp_firstModificator, and pappso::PeptideModificatorInterface::setPeptideSp().

Referenced by setPeptide().

◆ setSink()

void PeptideModificatorPipeline::setSink ( PeptideModificatorInterface sink)
overridevirtual

Implements pappso::PeptideSpSinkInterface.

Definition at line 82 of file peptidemodificatorpipeline.cpp.

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

References m_sink, mp_firstModificator, mp_lastPeptideSinkInterface, mp_peptideModificatorTee, and pappso::PeptideSpSinkInterface::setSink().

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: