libpappsomspp
Library for mass spectrometry
pappso::PeptideModificatorBase Class Reference

#include <peptidemodificatorbase.h>

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

Public Member Functions

 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 ()
 
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 More...
 
- Public Member Functions inherited from pappso::PeptideSpSinkInterface
virtual void setSink (PeptideModificatorInterface *sink)=0
 

Protected Member Functions

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)
 

Protected Attributes

QRegularExpression m_pattern
 

Detailed Description

Definition at line 40 of file peptidemodificatorbase.h.

Constructor & Destructor Documentation

◆ PeptideModificatorBase()

pappso::PeptideModificatorBase::PeptideModificatorBase ( )

Definition at line 35 of file peptidemodificatorbase.cpp.

36 {
37 }

◆ ~PeptideModificatorBase()

pappso::PeptideModificatorBase::~PeptideModificatorBase ( )
virtual

Definition at line 39 of file peptidemodificatorbase.cpp.

40 {
41 }

Member Function Documentation

◆ getModificationPositionList() [1/2]

void pappso::PeptideModificatorBase::getModificationPositionList ( std::vector< unsigned int > &  position_list,
const Peptide p_peptide,
AaModificationP  mod,
unsigned int  modification_counter 
)
protectedvirtual

Definition at line 86 of file peptidemodificatorbase.cpp.

91 {
92 
93  int pos = 0;
94  const QString peptide_str = p_peptide->getSequence();
95  QRegularExpressionMatch match_pattern = m_pattern.match(peptide_str, pos);
96 
97  while(match_pattern.hasMatch())
98  {
99  pos = match_pattern.capturedStart(0);
100  if(match_pattern.lastCapturedIndex() == 0)
101  {
102  // no motif, just push position
103  if(p_peptide->getConstAa(pos).getNumberOfModification(mod) ==
104  modification_counter)
105  {
106  position_list.push_back(pos);
107  }
108  pos++;
109  }
110  else
111  {
112  // there is a motif : target this position
113  pos = match_pattern.capturedStart(1);
114  if((position_list.size() > 0) &&
115  (position_list.back() == (unsigned int)pos))
116  {
117  pos = match_pattern.capturedStart(0) + 1;
118  }
119  else
120  {
121  if(p_peptide->getConstAa(pos).getNumberOfModification(mod) ==
122  modification_counter)
123  {
124  position_list.push_back(pos);
125  }
126  pos = match_pattern.capturedStart(0) + 1;
127  }
128  }
129  match_pattern = m_pattern.match(peptide_str, pos);
130  }
131 }

References pappso::Peptide::getConstAa(), pappso::Aa::getNumberOfModification(), pappso::Peptide::getSequence(), and m_pattern.

◆ getModificationPositionList() [2/2]

void pappso::PeptideModificatorBase::getModificationPositionList ( std::vector< unsigned int > &  position_list,
const QString &  peptide_str 
)
finalprotectedvirtual

Definition at line 50 of file peptidemodificatorbase.cpp.

52 {
53 
54  int pos = 0;
55  QRegularExpressionMatch match_pattern = m_pattern.match(peptide_str, pos);
56 
57  while(match_pattern.hasMatch())
58  {
59  pos = match_pattern.capturedStart(0);
60  if(match_pattern.lastCapturedIndex() == 0)
61  {
62  // no motif, just push position
63  position_list.push_back(pos);
64  pos++;
65  }
66  else
67  {
68  // there is a motif : target this position
69  pos = match_pattern.capturedStart(1);
70  if((position_list.size() > 0) &&
71  (position_list.back() == (unsigned int)pos))
72  {
73  pos = match_pattern.capturedStart(0) + 1;
74  }
75  else
76  {
77  position_list.push_back(pos);
78  pos = match_pattern.capturedStart(0) + 1;
79  }
80  }
81  match_pattern = m_pattern.match(peptide_str, pos);
82  }
83 }

References m_pattern.

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

◆ setModificationPattern()

void pappso::PeptideModificatorBase::setModificationPattern ( QString &  pattern)
finalvirtual

set the pattern on which the modification will be applied (usually the list of concerned AA)

the pattern is a standard regular expression : it describes the target site to modify. This standard regular expression is used to make a replacement of all motifs describes by an underscore ("_") The underscore is taken as a landmark to apply the modification.

Parameters
patternthe regular expression pattern ( [YST] to replace Y, S and T with _ and modify it ). The pattern can also contain the / separator to eventually specify the replacement motif. This can be used to described very complex modification patterns

Definition at line 44 of file peptidemodificatorbase.cpp.

45 {
46  m_pattern.setPattern(pattern);
47 }

References m_pattern.

Referenced by pappso::PeptideModificatorPipeline::parseFixedModification(), pappso::PeptideModificatorPipeline::parseLabeledModification(), and pappso::PeptideModificatorPipeline::parsePotentialModification().

Member Data Documentation

◆ m_pattern

QRegularExpression pappso::PeptideModificatorBase::m_pattern
protected

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