libpappsomspp
Library for mass spectrometry
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 More...
 
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 More...
 
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 54 of file peptidemodificatorpipeline.h.

Constructor & Destructor Documentation

◆ PeptideModificatorPipeline() [1/2]

PeptideModificatorPipeline::PeptideModificatorPipeline ( )

Definition at line 35 of file peptidemodificatorpipeline.cpp.

36 {
37 }

◆ PeptideModificatorPipeline() [2/2]

PeptideModificatorPipeline::PeptideModificatorPipeline ( const PeptideModificatorPipeline other)

Definition at line 39 of file peptidemodificatorpipeline.cpp.

41 {
42  throw PappsoException(
43  QObject::tr("unable to copy PeptideModificatorPipeline object"));
44  if(other.mp_peptideModificatorTee != nullptr)
45  {
46  // mp_peptideModificatorTee = new
47  // PeptideModificatorTee(other.mp_peptideModificatorTee);
48  }
49 
51  mp_firstModificator = nullptr;
52  for(auto p_mod : other.m_pepModificatorPtrList)
53  {
54  delete(p_mod);
55  }
56 
57 
58  m_sink = other.m_sink;
59 
61 
63 
65 }

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

◆ ~PeptideModificatorPipeline()

PeptideModificatorPipeline::~PeptideModificatorPipeline ( )
virtual

Definition at line 67 of file peptidemodificatorpipeline.cpp.

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

References m_pepModificatorPtrList, and mp_peptideModificatorTee.

Member Function Documentation

◆ addFixedCterModificationString()

void PeptideModificatorPipeline::addFixedCterModificationString ( const QString &  mod_str)

Definition at line 108 of file peptidemodificatorpipeline.cpp.

110 {
111  privAddFixedModificationString(mod_str, false, true, false);
112 }

References privAddFixedModificationString().

◆ addFixedModificationString()

void PeptideModificatorPipeline::addFixedModificationString ( const QString &  mod_str)

Definition at line 97 of file peptidemodificatorpipeline.cpp.

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

References privAddFixedModificationString().

◆ addFixedNterModificationString()

void PeptideModificatorPipeline::addFixedNterModificationString ( const QString &  mod_str)

Definition at line 102 of file peptidemodificatorpipeline.cpp.

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

References privAddFixedModificationString().

◆ addLabeledModificationString()

void PeptideModificatorPipeline::addLabeledModificationString ( const QString &  mod_str)

Definition at line 260 of file peptidemodificatorpipeline.cpp.

261 {
262 
263  if(m_sink == nullptr)
264  {
265  throw PappsoException(QObject::tr(
266  "Please use setSink before addLabeledModificationString function"));
267  }
268  if(mp_peptideModificatorTee == nullptr)
269  {
271  }
272  if(mp_firstModificator == nullptr)
273  {
275  }
276 
277  // backup pointers
278  PeptideModificatorInterface *backup_sink = m_sink;
279 
280  PeptideSpSinkInterface *backup_p_last_peptide_sink_interface =
282 
283  PeptideModificatorInterface *backup_p_first_modificator = mp_firstModificator;
284 
285 
286  QStringList mod_list_str =
287  mod_str.simplified().replace(" ", "").split(",", QString::SkipEmptyParts);
288  for(auto i = 0; i < mod_list_str.size(); ++i)
289  {
290  parseLabeledModification(mod_list_str[i], true, true, true);
291 
292  if(i == 0)
293  {
295  }
296  }
297 
298  m_sink = backup_sink;
299  mp_lastPeptideSinkInterface = backup_p_last_peptide_sink_interface;
300  mp_firstModificator = backup_p_first_modificator;
301 
303 }

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 180 of file peptidemodificatorpipeline.cpp.

182 {
183  privAddPotentialModificationString(mod_str, false, true, false);
184 }

References privAddPotentialModificationString().

◆ addPotentialModificationString()

void PeptideModificatorPipeline::addPotentialModificationString ( const QString &  mod_str)

Definition at line 166 of file peptidemodificatorpipeline.cpp.

168 {
169  privAddPotentialModificationString(mod_str, true, true, true);
170 }

References privAddPotentialModificationString().

◆ addPotentialNterModificationString()

void PeptideModificatorPipeline::addPotentialNterModificationString ( const QString &  mod_str)

Definition at line 173 of file peptidemodificatorpipeline.cpp.

175 {
176  privAddPotentialModificationString(mod_str, true, false, false);
177 }

References privAddPotentialModificationString().

◆ parseFixedModification()

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

◆ 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 208 of file peptidemodificatorpipeline.cpp.

212 {
213 
214  QStringList str_split = mod_str.split("@", QString::SkipEmptyParts);
215 
216  QString mod_acc_str = str_split[0];
217  QStringList str_acc_split = mod_acc_str.split("(", QString::SkipEmptyParts);
218  pappso::AaModificationP aa_mod =
219  AaModification::getInstance(str_acc_split[0]);
220 
223 
224  // qDebug() << "PeptideModificatorPipeline::parsePotentialModification " << ;
225  if(str_acc_split.length() == 2)
226  {
227  QStringList max_num_str_list =
228  str_acc_split[1].replace(")", "").split("-", QString::SkipEmptyParts);
229  if(max_num_str_list.length() == 1)
230  {
231  mod->setModificationCounter(max_num_str_list[0].toUInt());
232  }
233  else if(max_num_str_list.length() == 2)
234  {
235  mod->setMinNumberMod(max_num_str_list[0].toUInt());
236  mod->setMaxNumberMod(max_num_str_list[1].toUInt());
237  }
238  }
239  mod->setModificationPattern(str_split[1]);
240  mod->setSink(m_sink);
241  mod->setProtNter(Nter);
242  mod->setProtCter(Cter);
243  mod->setProtElse(else_prot);
244 
245  m_pepModificatorPtrList.push_back(mod);
246 
247  if(mp_firstModificator == nullptr)
248  {
249  mp_firstModificator = mod;
250  }
251  else
252  {
254  }
256 }

References pappso::AaModificationP, 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 115 of file peptidemodificatorpipeline.cpp.

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

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 187 of file peptidemodificatorpipeline.cpp.

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

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 354 of file peptidemodificatorpipeline.cpp.

362 {
363 
364  qDebug() << "PeptideModificatorPipeline::setPeptide begin";
365 
366  Peptide peptide(peptide_str);
367 
368  PeptideSp peptide_sp = peptide.makePeptideSp();
369 
370  qDebug() << "PeptideModificatorPipeline::setPeptide m_sink->setPeptideSp";
371  setPeptideSp(sequence_database_id,
372  protein_sp,
373  is_decoy,
374  peptide_sp,
375  start,
376  is_nter,
377  missed_cleavage_number,
378  semi_enzyme);
379  qDebug() << "PeptideModificatorPipeline::setPeptide end";
380 }

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 333 of file peptidemodificatorpipeline.cpp.

341 {
342  mp_firstModificator->setPeptideSp(sequence_database_id,
343  protein_sp,
344  is_decoy,
345  peptide_sp_original,
346  start,
347  is_nter,
348  missed_cleavage_number,
349  semi_enzyme);
350 }

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

Referenced by setPeptide().

◆ setSink()

void PeptideModificatorPipeline::setSink ( PeptideModificatorInterface sink)
overridevirtual

Implements pappso::PeptideSpSinkInterface.

Definition at line 81 of file peptidemodificatorpipeline.cpp.

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

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:
pappso::PeptideVariableModificationBuilder::setProtNter
void setProtNter(bool arg1)
this modification concerns the Nter peptide
Definition: peptidevariablemodificationbuilder.h:121
pappso::PeptideFixedModificationBuilder::setProtNter
void setProtNter(bool arg1)
this modification concerns the Nter peptide
Definition: peptidefixedmodificationbuilder.h:100
pappso::PeptideModificatorTee
Definition: peptidemodificatortee.h:55
pappso::PeptideModificatorPipeline::privAddPotentialModificationString
void privAddPotentialModificationString(const QString &mod_str, bool Nter, bool Cter, bool else_prot)
Definition: peptidemodificatorpipeline.cpp:187
pappso::PeptideModificatorPipeline::setPeptideSp
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
Definition: peptidemodificatorpipeline.cpp:333
pappso::PeptideModificatorPipeline::parseLabeledModification
void parseLabeledModification(const QString &mod_str, bool Nter, bool Cter, bool else_prot)
Definition: peptidemodificatorpipeline.cpp:307
pappso::PeptideVariableModificationBuilder::setMaxNumberMod
void setMaxNumberMod(unsigned int max_num)
Definition: peptidevariablemodificationbuilder.h:96
pappso::PeptideSpSinkInterface
Definition: enzymeproductinterface.h:128
pappso::PeptideFixedModificationBuilder::setSink
void setSink(PeptideModificatorInterface *sink) override
Definition: peptidefixedmodificationbuilder.h:93
pappso::PeptideModificatorPipeline::privAddFixedModificationString
void privAddFixedModificationString(const QString &mod_str, bool Nter, bool Cter, bool else_prot)
Definition: peptidemodificatorpipeline.cpp:115
pappso::PeptideFixedModificationBuilder::setProtElse
void setProtElse(bool arg1)
this modification concerns all peptides between Nter and Cter
Definition: peptidefixedmodificationbuilder.h:114
pappso::PeptideFixedModificationBuilder
Definition: peptidefixedmodificationbuilder.h:54
pappso::Peptide
Definition: peptide.h:113
pappso::PeptideVariableModificationBuilder::setModificationCounter
void setModificationCounter(unsigned int counter)
Definition: peptidevariablemodificationbuilder.h:106
pappso::PeptideModificatorPipeline::parseFixedModification
void parseFixedModification(const QString &mod_str, bool Nter, bool Cter, bool else_prot)
Definition: peptidemodificatorpipeline.cpp:135
pappso::PeptideVariableModificationBuilder::setMinNumberMod
void setMinNumberMod(unsigned int min_num)
Definition: peptidevariablemodificationbuilder.h:101
pappso::PeptideModificatorBase::setModificationPattern
virtual void setModificationPattern(QString &pattern) final
set the pattern on which the modification will be applied (usually the list of concerned AA)
Definition: peptidemodificatorbase.cpp:65
pappso::PeptideVariableModificationBuilder::setProtCter
void setProtCter(bool arg1)
this modification concerns the Cter peptide
Definition: peptidevariablemodificationbuilder.h:128
pappso::PeptideModificatorInterface
Definition: enzymeproductinterface.h:85
pappso::PeptideVariableModificationBuilder::setProtElse
void setProtElse(bool arg1)
this modification concerns all peptides between Nter and Cter
Definition: peptidevariablemodificationbuilder.h:135
pappso::PeptideModificatorPipeline::m_pepModificatorPtrList
std::vector< PeptideModificatorInterface * > m_pepModificatorPtrList
Definition: peptidemodificatorpipeline.h:128
pappso::AaModification::getInstance
static AaModificationP getInstance(const QString &accession)
Definition: aamodification.cpp:388
pappso::AaModificationP
const typedef AaModification * AaModificationP
Definition: aamodification.h:73
pappso::PeptideSpSinkInterface::setSink
virtual void setSink(PeptideModificatorInterface *sink)=0
pappso::PeptideVariableModificationBuilder
Modify a peptide shared pointer with a variable modification on one AA.
Definition: peptidevariablemodificationbuilder.h:57
pappso::PeptideSp
std::shared_ptr< const Peptide > PeptideSp
Definition: aamodification.h:68
pappso::PeptideModificatorInterface::setPeptideSp
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
pappso::PeptideModificatorTee::addModificator
void addModificator(PeptideModificatorInterface *p_peptide_mod)
Definition: peptidemodificatortee.cpp:43
pappso::PeptideVariableModificationBuilder::setSink
void setSink(PeptideModificatorInterface *sink) override
Definition: peptidevariablemodificationbuilder.h:112
pappso::PeptideFixedModificationBuilder::setProtCter
void setProtCter(bool arg1)
this modification concerns the Cter peptide
Definition: peptidefixedmodificationbuilder.h:107
pappso::PeptideModificatorPipeline::m_sink
PeptideModificatorInterface * m_sink
Definition: peptidemodificatorpipeline.h:122
pappso::PeptideModificatorPipeline::mp_firstModificator
PeptideModificatorInterface * mp_firstModificator
Definition: peptidemodificatorpipeline.h:126
pappso::PappsoException
Definition: pappsoexception.h:62
pappso::PeptideModificatorPipeline::mp_peptideModificatorTee
PeptideModificatorTee * mp_peptideModificatorTee
Definition: peptidemodificatorpipeline.h:120
pappso::PeptideModificatorPipeline::mp_lastPeptideSinkInterface
PeptideSpSinkInterface * mp_lastPeptideSinkInterface
Definition: peptidemodificatorpipeline.h:124
pappso::PeptideModificatorPipeline::parsePotentialModification
void parsePotentialModification(const QString &mod_str, bool Nter, bool Cter, bool else_prot)
Definition: peptidemodificatorpipeline.cpp:208