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 33 of file peptidemodificatorpipeline.h.

Constructor & Destructor Documentation

◆ PeptideModificatorPipeline() [1/2]

PeptideModificatorPipeline::PeptideModificatorPipeline ( )

Definition at line 33 of file peptidemodificatorpipeline.cpp.

34 {
35 }

◆ PeptideModificatorPipeline() [2/2]

PeptideModificatorPipeline::PeptideModificatorPipeline ( const PeptideModificatorPipeline other)

Definition at line 37 of file peptidemodificatorpipeline.cpp.

39 {
40  throw PappsoException(
41  QObject::tr("unable to copy PeptideModificatorPipeline object"));
42  if(other.mp_peptideModificatorTee != nullptr)
43  {
44  // mp_peptideModificatorTee = new
45  // PeptideModificatorTee(other.mp_peptideModificatorTee);
46  }
47 
49  mp_firstModificator = nullptr;
50  for(auto p_mod : other.m_pepModificatorPtrList)
51  {
52  delete(p_mod);
53  }
54 
55 
56  m_sink = other.m_sink;
57 
59 
61 
63 }
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 65 of file peptidemodificatorpipeline.cpp.

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

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.

108 {
109  privAddFixedModificationString(mod_str, false, true, false);
110 }
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 95 of file peptidemodificatorpipeline.cpp.

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

References privAddFixedModificationString().

◆ addFixedNterModificationString()

void PeptideModificatorPipeline::addFixedNterModificationString ( const QString &  mod_str)

Definition at line 100 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 259 of file peptidemodificatorpipeline.cpp.

260 {
261 
262  if(m_sink == nullptr)
263  {
264  throw PappsoException(QObject::tr(
265  "Please use setSink before addLabeledModificationString function"));
266  }
267  if(mp_peptideModificatorTee == nullptr)
268  {
270  }
271  if(mp_firstModificator == nullptr)
272  {
274  }
275 
276  // backup pointers
277  PeptideModificatorInterface *backup_sink = m_sink;
278 
279  PeptideSpSinkInterface *backup_p_last_peptide_sink_interface =
281 
282  PeptideModificatorInterface *backup_p_first_modificator = mp_firstModificator;
283 
284 
285  QStringList mod_list_str =
286  mod_str.simplified().replace(" ", "").split(",", Qt::SkipEmptyParts);
287  for(auto i = 0; i < mod_list_str.size(); ++i)
288  {
289  parseLabeledModification(mod_list_str[i], true, true, true);
290 
291  if(i == 0)
292  {
294  }
295  }
296 
297  m_sink = backup_sink;
298  mp_lastPeptideSinkInterface = backup_p_last_peptide_sink_interface;
299  mp_firstModificator = backup_p_first_modificator;
300 
302 }
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 179 of file peptidemodificatorpipeline.cpp.

181 {
182  privAddPotentialModificationString(mod_str, false, true, false);
183 }
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 165 of file peptidemodificatorpipeline.cpp.

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

References privAddPotentialModificationString().

◆ addPotentialNterModificationString()

void PeptideModificatorPipeline::addPotentialNterModificationString ( const QString &  mod_str)

Definition at line 172 of file peptidemodificatorpipeline.cpp.

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

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 
145  mod->setModificationPattern(str_split[1]);
146  mod->setSink(m_sink);
147  mod->setProtNter(Nter);
148  mod->setProtCter(Cter);
149  mod->setProtElse(else_prot);
150 
151  m_pepModificatorPtrList.push_back(mod);
152 
153  if(mp_firstModificator == nullptr)
154  {
155  mp_firstModificator = mod;
156  }
157  else
158  {
160  }
162 }
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 207 of file peptidemodificatorpipeline.cpp.

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

115 {
116  //"MOD:00397@C, MOD:00398@R"
117  if(mp_peptideModificatorTee != nullptr)
118  {
119  throw PappsoException(
120  QObject::tr("Unable to add fixed modification string after "
121  "addLabeledModificationString function"));
122  }
123  QStringList mod_list_str =
124  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 186 of file peptidemodificatorpipeline.cpp.

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

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

340 {
341  if(mp_firstModificator == nullptr)
342  {
343  m_sink->setPeptideSp(sequence_database_id,
344  protein_sp,
345  is_decoy,
346  peptide_sp_original,
347  start,
348  is_nter,
349  missed_cleavage_number,
350  semi_enzyme);
351  }
352  else
353  {
354  mp_firstModificator->setPeptideSp(sequence_database_id,
355  protein_sp,
356  is_decoy,
357  peptide_sp_original,
358  start,
359  is_nter,
360  missed_cleavage_number,
361  semi_enzyme);
362  }
363 }
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 79 of file peptidemodificatorpipeline.cpp.

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

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: