libpappsomspp
Library for mass spectrometry
pappso::PeptideVariableModificationReplacement Class Reference

#include <peptidevariablemodificationreplacement.h>

Inheritance diagram for pappso::PeptideVariableModificationReplacement:
pappso::PeptideVariableModificationBuilder pappso::PeptideModificatorBase pappso::PeptideModificatorInterface pappso::PeptideSpSinkInterface

Public Member Functions

 PeptideVariableModificationReplacement (AaModificationP mod_before, AaModificationP mod_after)
 
virtual ~PeptideVariableModificationReplacement ()
 
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...
 
- Public Member Functions inherited from pappso::PeptideVariableModificationBuilder
 PeptideVariableModificationBuilder (AaModificationP mod)
 
virtual ~PeptideVariableModificationBuilder ()
 
void addAa (char aa)
 
void setMaxNumberMod (unsigned int max_num)
 
void setMinNumberMod (unsigned int min_num)
 
void setModificationCounter (unsigned int counter)
 
void setSink (PeptideModificatorInterface *sink) override
 
void setProtNter (bool arg1)
 this modification concerns the Nter peptide More...
 
void setProtCter (bool arg1)
 this modification concerns the Cter peptide More...
 
void setProtElse (bool arg1)
 this modification concerns all peptides between Nter and Cter More...
 
- Public Member Functions inherited from pappso::PeptideModificatorBase
 PeptideModificatorBase ()
 
virtual ~PeptideModificatorBase ()
 
virtual void setModificationPattern (QString &pattern) final
 set the pattern on which the modification will be applied (usually the list of concerned AA) More...
 
- Public Member Functions inherited from pappso::PeptideModificatorInterface
virtual ~PeptideModificatorInterface ()
 

Private Member Functions

void replaceModificationsAtPosition (Peptide &new_peptide, unsigned int position)
 

Private Attributes

AaModificationP mp_modAfter
 

Additional Inherited Members

- Protected Member Functions inherited from pappso::PeptideModificatorBase
virtual void getModificationPositionList (std::vector< unsigned int > &position_list, const QString &peptide_str) final
 
virtual void getModificationPositionList (std::vector< unsigned int > &position_list, const Peptide *p_peptide, AaModificationP mod, unsigned int modification_counter)
 
- Static Protected Member Functions inherited from pappso::PeptideVariableModificationBuilder
static bool next_combination (const std::vector< unsigned int >::iterator first, std::vector< unsigned int >::iterator k, const std::vector< unsigned int >::iterator last)
 
- Protected Attributes inherited from pappso::PeptideVariableModificationBuilder
PeptideModificatorInterfacem_sink = nullptr
 
AaModificationP mp_mod
 
unsigned int m_minNumberMod = 0
 
unsigned int m_maxNumberMod = 30000
 
unsigned int m_modificationCount = 0
 
bool m_isProtNterMod = true
 
bool m_isProtCterMod = true
 
bool m_isProtElseMod = true
 
- Protected Attributes inherited from pappso::PeptideModificatorBase
QRegularExpression m_pattern
 

Detailed Description

Definition at line 39 of file peptidevariablemodificationreplacement.h.

Constructor & Destructor Documentation

◆ PeptideVariableModificationReplacement()

pappso::PeptideVariableModificationReplacement::PeptideVariableModificationReplacement ( AaModificationP  mod_before,
AaModificationP  mod_after 
)

this forces to check that the targetted modified sites really has the mod_before

Definition at line 35 of file peptidevariablemodificationreplacement.cpp.

38 {
39  mp_modAfter = mod_after;
40  /** this forces to check that the targetted modified sites really has the
41  * mod_before */
43 }

References pappso::PeptideVariableModificationBuilder::m_modificationCount, and mp_modAfter.

◆ ~PeptideVariableModificationReplacement()

pappso::PeptideVariableModificationReplacement::~PeptideVariableModificationReplacement ( )
virtual

Definition at line 45 of file peptidevariablemodificationreplacement.cpp.

47 {
48 }

Member Function Documentation

◆ replaceModificationsAtPosition()

void pappso::PeptideVariableModificationReplacement::replaceModificationsAtPosition ( Peptide new_peptide,
unsigned int  position 
)
private

Definition at line 52 of file peptidevariablemodificationreplacement.cpp.

54 {
55  // replace all mod_before by mod_after :
56  Aa &aa = new_peptide.getAa(position);
57  aa.removeAaModification(mp_mod);
58  unsigned int i = 0;
59  while(i < m_modificationCount)
60  {
61  aa.addAaModification(mp_modAfter);
62  i++;
63  }
64 }

References pappso::Aa::addAaModification(), pappso::Peptide::getAa(), pappso::PeptideVariableModificationBuilder::m_modificationCount, pappso::PeptideVariableModificationBuilder::mp_mod, mp_modAfter, and pappso::Aa::removeAaModification().

Referenced by setPeptideSp().

◆ setPeptideSp()

void pappso::PeptideVariableModificationReplacement::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

Reimplemented from pappso::PeptideVariableModificationBuilder.

Definition at line 68 of file peptidevariablemodificationreplacement.cpp.

77 {
78  // QString s = "Banana";
79 
80 
81  bool modify_this_peptide = true;
83  {
84  modify_this_peptide = false;
85  if((m_isProtNterMod) && (is_nter))
86  {
87  // this an Nter peptide
88  modify_this_peptide = true;
89  }
90  else if((m_isProtCterMod) &&
91  (protein_sp.get()->size() ==
92  (start + peptide_sp_original.get()->size())))
93  {
94  // this is a Cter peptide
95  modify_this_peptide = true;
96  }
97  else if(m_isProtElseMod)
98  {
99  modify_this_peptide = true;
100  }
101  }
102 
103  if(modify_this_peptide)
104  {
105  std::vector<unsigned int> position_list;
107  position_list, peptide_sp_original.get(), mp_mod, m_modificationCount);
108 
109  // std::vector< unsigned int > position_list =
110  // peptide_sp_original.get()->getAaPositionList(_aamp_modification_list);
111  // std::string s = "12345";
112  // no AA modification :
113  if(m_minNumberMod == 0)
114  {
115  m_sink->setPeptideSp(sequence_database_id,
116  protein_sp,
117  is_decoy,
118  peptide_sp_original,
119  start,
120  is_nter,
121  missed_cleavage_number,
122  semi_enzyme);
123  }
124 
125  unsigned int nb_pos = position_list.size();
126  if(nb_pos > 0)
127  {
128  // loop to find 1 to n-1 AA modification combinations
129  unsigned int comb_size = 1;
130  while((comb_size < nb_pos) && (comb_size <= m_maxNumberMod))
131  {
132  do
133  {
134  // std::cout << std::string(being,begin + comb_size) <<
135  // std::endl;
136  Peptide new_peptide(*(peptide_sp_original.get()));
137  for(unsigned int i = 0; i < comb_size; i++)
138  {
139  // new_peptide.addAaModification(mp_mod,position_list[i]);
140  this->replaceModificationsAtPosition(new_peptide,
141  position_list[i]);
142  }
143  PeptideSp new_peptide_sp = new_peptide.makePeptideSp();
144  m_sink->setPeptideSp(sequence_database_id,
145  protein_sp,
146  is_decoy,
147  new_peptide_sp,
148  start,
149  is_nter,
150  missed_cleavage_number,
151  semi_enzyme);
152  }
153  while(next_combination(position_list.begin(),
154  position_list.begin() + comb_size,
155  position_list.end()));
156  comb_size++;
157  }
158 
159  if(nb_pos <= m_maxNumberMod)
160  {
161  // the last combination : all aa are modified :
162  Peptide new_peptide(*(peptide_sp_original.get()));
163  for(unsigned int i = 0; i < nb_pos; i++)
164  {
165  // new_peptide.addAaModification(mp_mod,position_list[i]);
166 
167  this->replaceModificationsAtPosition(new_peptide,
168  position_list[i]);
169  }
170  PeptideSp new_peptide_sp = new_peptide.makePeptideSp();
171  m_sink->setPeptideSp(sequence_database_id,
172  protein_sp,
173  is_decoy,
174  new_peptide_sp,
175  start,
176  is_nter,
177  missed_cleavage_number,
178  semi_enzyme);
179  }
180  }
181  }
182  else
183  {
184  // no modification
185  m_sink->setPeptideSp(sequence_database_id,
186  protein_sp,
187  is_decoy,
188  peptide_sp_original,
189  start,
190  is_nter,
191  missed_cleavage_number,
192  semi_enzyme);
193  }
194 }
virtual void getModificationPositionList(std::vector< unsigned int > &position_list, const QString &peptide_str) final
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
static bool next_combination(const std::vector< unsigned int >::iterator first, std::vector< unsigned int >::iterator k, const std::vector< unsigned int >::iterator last)
void replaceModificationsAtPosition(Peptide &new_peptide, unsigned int position)
std::shared_ptr< const Peptide > PeptideSp

References pappso::PeptideModificatorBase::getModificationPositionList(), pappso::PeptideVariableModificationBuilder::m_isProtCterMod, pappso::PeptideVariableModificationBuilder::m_isProtElseMod, pappso::PeptideVariableModificationBuilder::m_isProtNterMod, pappso::PeptideVariableModificationBuilder::m_maxNumberMod, pappso::PeptideVariableModificationBuilder::m_minNumberMod, pappso::PeptideVariableModificationBuilder::m_modificationCount, pappso::PeptideVariableModificationBuilder::m_sink, pappso::Peptide::makePeptideSp(), pappso::PeptideVariableModificationBuilder::mp_mod, pappso::PeptideVariableModificationBuilder::next_combination(), replaceModificationsAtPosition(), and pappso::PeptideModificatorInterface::setPeptideSp().

Member Data Documentation

◆ mp_modAfter

AaModificationP pappso::PeptideVariableModificationReplacement::mp_modAfter
private

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