libpappsomspp
Library for mass spectrometry
pappso::PeptideVariableModificationBuilder Class Reference

Modify a peptide shared pointer with a variable modification on one AA. More...

#include <peptidevariablemodificationbuilder.h>

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

Public Member Functions

 PeptideVariableModificationBuilder (AaModificationP mod)
 
virtual ~PeptideVariableModificationBuilder ()
 
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 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 ()
 

Static Protected Member Functions

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

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
 

Private Attributes

QString m_aaModificationList
 

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)
 

Detailed Description

Modify a peptide shared pointer with a variable modification on one AA.

Definition at line 36 of file peptidevariablemodificationbuilder.h.

Constructor & Destructor Documentation

◆ PeptideVariableModificationBuilder()

pappso::PeptideVariableModificationBuilder::PeptideVariableModificationBuilder ( AaModificationP  mod)

Definition at line 72 of file peptidevariablemodificationbuilder.cpp.

◆ ~PeptideVariableModificationBuilder()

pappso::PeptideVariableModificationBuilder::~PeptideVariableModificationBuilder ( )
virtual

Definition at line 78 of file peptidevariablemodificationbuilder.cpp.

79 {
80 }

Member Function Documentation

◆ addAa()

void pappso::PeptideVariableModificationBuilder::addAa ( char  aa)

◆ next_combination()

bool pappso::PeptideVariableModificationBuilder::next_combination ( const std::vector< unsigned int >::iterator  first,
std::vector< unsigned int >::iterator  k,
const std::vector< unsigned int >::iterator  last 
)
staticprotected

Definition at line 30 of file peptidevariablemodificationbuilder.cpp.

34 {
35  /* Credits: Mark Nelson http://marknelson.us */
36  if((first == last) || (first == k) || (last == k))
37  return false;
38  std::vector<unsigned int>::iterator i1 = first;
39  std::vector<unsigned int>::iterator i2 = last;
40  ++i1;
41  if(last == i1)
42  return false;
43  i1 = last;
44  --i1;
45  i1 = k;
46  --i2;
47  while(first != i1)
48  {
49  if(*--i1 < *i2)
50  {
51  std::vector<unsigned int>::iterator j = k;
52  while(!(*i1 < *j))
53  ++j;
54  std::iter_swap(i1, j);
55  ++i1;
56  ++j;
57  i2 = k;
58  std::rotate(i1, j, last);
59  while(last != j)
60  {
61  ++j;
62  ++i2;
63  }
64  std::rotate(k, i2, last);
65  return true;
66  }
67  }
68  std::rotate(first, k, last);
69  return false;
70 }

References pappso::last.

Referenced by setPeptideSp(), and pappso::PeptideVariableModificationReplacement::setPeptideSp().

◆ setMaxNumberMod()

void pappso::PeptideVariableModificationBuilder::setMaxNumberMod ( unsigned int  max_num)
inline

◆ setMinNumberMod()

void pappso::PeptideVariableModificationBuilder::setMinNumberMod ( unsigned int  min_num)
inline

◆ setModificationCounter()

void pappso::PeptideVariableModificationBuilder::setModificationCounter ( unsigned int  counter)
inline

◆ setPeptideSp()

void pappso::PeptideVariableModificationBuilder::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.

Reimplemented in pappso::PeptideVariableModificationReplacement.

Definition at line 92 of file peptidevariablemodificationbuilder.cpp.

101 {
102  // QString s = "Banana";
103 
104 
105  bool modify_this_peptide = true;
107  {
108  modify_this_peptide = false;
109  if((m_isProtNterMod) && (is_nter))
110  {
111  // this an Nter peptide
112  modify_this_peptide = true;
113  }
114  else if((m_isProtCterMod) &&
115  (protein_sp.get()->size() ==
116  (start + peptide_sp_original.get()->size())))
117  {
118  // this is a Cter peptide
119  modify_this_peptide = true;
120  }
121  else if(m_isProtElseMod)
122  {
123  modify_this_peptide = true;
124  }
125  }
126 
127  if(modify_this_peptide)
128  {
129 
130  std::vector<unsigned int> position_list;
132  position_list, peptide_sp_original.get(), mp_mod, m_modificationCount);
133 
134 
135  // std::vector< unsigned int > position_list =
136  // peptide_sp_original.get()->getAaPositionList(m_aaModificationList);
137  // std::string s = "12345";
138  // no AA modification :
139  if(m_minNumberMod == 0)
140  {
141  m_sink->setPeptideSp(sequence_database_id,
142  protein_sp,
143  is_decoy,
144  peptide_sp_original,
145  start,
146  is_nter,
147  missed_cleavage_number,
148  semi_enzyme);
149  }
150 
151  unsigned int nb_pos = position_list.size();
152  if(nb_pos > 0)
153  {
154  // loop to find 1 to n-1 AA modification combinations
155  unsigned int comb_size = 1;
156  while((comb_size < nb_pos) && (comb_size <= m_maxNumberMod))
157  {
158  do
159  {
160  // std::cout << std::string(being,begin + comb_size) <<
161  // std::endl;
162  Peptide new_peptide(*(peptide_sp_original.get()));
163  for(unsigned int i = 0; i < comb_size; i++)
164  {
165  new_peptide.addAaModification(mp_mod, position_list[i]);
166  }
167  PeptideSp new_peptide_sp = new_peptide.makePeptideSp();
168  m_sink->setPeptideSp(sequence_database_id,
169  protein_sp,
170  is_decoy,
171  new_peptide_sp,
172  start,
173  is_nter,
174  missed_cleavage_number,
175  semi_enzyme);
176  }
177  while(next_combination(position_list.begin(),
178  position_list.begin() + comb_size,
179  position_list.end()));
180  comb_size++;
181  }
182 
183  if(nb_pos <= m_maxNumberMod)
184  {
185  // the last combination : all aa are modified :
186  Peptide new_peptide(*(peptide_sp_original.get()));
187  for(unsigned int i = 0; i < nb_pos; i++)
188  {
189  new_peptide.addAaModification(mp_mod, position_list[i]);
190  }
191  PeptideSp new_peptide_sp = new_peptide.makePeptideSp();
192  m_sink->setPeptideSp(sequence_database_id,
193  protein_sp,
194  is_decoy,
195  new_peptide_sp,
196  start,
197  is_nter,
198  missed_cleavage_number,
199  semi_enzyme);
200  }
201  }
202  }
203  else
204  {
205  // no modification
206  m_sink->setPeptideSp(sequence_database_id,
207  protein_sp,
208  is_decoy,
209  peptide_sp_original,
210  start,
211  is_nter,
212  missed_cleavage_number,
213  semi_enzyme);
214  }
215 }
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)
std::shared_ptr< const Peptide > PeptideSp

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

◆ setProtCter()

void pappso::PeptideVariableModificationBuilder::setProtCter ( bool  arg1)
inline

this modification concerns the Cter peptide

Definition at line 86 of file peptidevariablemodificationbuilder.h.

87  {
88  m_isProtCterMod = arg1;
89  };

Referenced by pappso::PeptideModificatorPipeline::parsePotentialModification().

◆ setProtElse()

void pappso::PeptideVariableModificationBuilder::setProtElse ( bool  arg1)
inline

this modification concerns all peptides between Nter and Cter

Definition at line 93 of file peptidevariablemodificationbuilder.h.

94  {
95  m_isProtElseMod = arg1;
96  };

Referenced by pappso::PeptideModificatorPipeline::parsePotentialModification().

◆ setProtNter()

void pappso::PeptideVariableModificationBuilder::setProtNter ( bool  arg1)
inline

this modification concerns the Nter peptide

Definition at line 79 of file peptidevariablemodificationbuilder.h.

80  {
81  m_isProtNterMod = arg1;
82  };

Referenced by pappso::PeptideModificatorPipeline::parsePotentialModification().

◆ setSink()

void pappso::PeptideVariableModificationBuilder::setSink ( PeptideModificatorInterface sink)
inlineoverridevirtual

Member Data Documentation

◆ m_aaModificationList

QString pappso::PeptideVariableModificationBuilder::m_aaModificationList
private

Definition at line 121 of file peptidevariablemodificationbuilder.h.

Referenced by addAa().

◆ m_isProtCterMod

bool pappso::PeptideVariableModificationBuilder::m_isProtCterMod = true
protected

◆ m_isProtElseMod

bool pappso::PeptideVariableModificationBuilder::m_isProtElseMod = true
protected

◆ m_isProtNterMod

bool pappso::PeptideVariableModificationBuilder::m_isProtNterMod = true
protected

◆ m_maxNumberMod

unsigned int pappso::PeptideVariableModificationBuilder::m_maxNumberMod = 30000
protected

◆ m_minNumberMod

unsigned int pappso::PeptideVariableModificationBuilder::m_minNumberMod = 0
protected

◆ m_modificationCount

◆ m_sink

PeptideModificatorInterface* pappso::PeptideVariableModificationBuilder::m_sink = nullptr
protected

◆ mp_mod


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