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

QRegExp 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 82 of file peptidemodificatorbase.cpp.

87 {
88 
89  int pos = 0;
90  const QString peptide_str = p_peptide->getSequence();
91  while((pos = m_pattern.indexIn(peptide_str, pos)) != -1)
92  {
93  if(m_pattern.pos(1) == -1)
94  {
95  // no motif, just push position
96  if(p_peptide->getConstAa(pos).getNumberOfModification(mod) ==
97  modification_counter)
98  {
99  position_list.push_back(pos);
100  }
101  pos++;
102  }
103  else
104  {
105  // there is a motif : target this position
106  pos = m_pattern.pos(1);
107  if((position_list.size() > 0) &&
108  (position_list.back() == (unsigned int)pos))
109  {
110  pos = m_pattern.pos(0) + 1;
111  }
112  else
113  {
114  if(p_peptide->getConstAa(pos).getNumberOfModification(mod) ==
115  modification_counter)
116  {
117  position_list.push_back(pos);
118  }
119  pos = m_pattern.pos(0) + 1;
120  }
121  }
122  }
123 }

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  while((pos = m_pattern.indexIn(peptide_str, pos)) != -1)
56  {
57  if(m_pattern.pos(1) == -1)
58  {
59  // no motif, just push position
60  position_list.push_back(pos);
61  pos++;
62  }
63  else
64  {
65  // there is a motif : target this position
66  pos = m_pattern.pos(1);
67  if((position_list.size() > 0) &&
68  (position_list.back() == (unsigned int)pos))
69  {
70  pos = m_pattern.pos(0) + 1;
71  }
72  else
73  {
74  position_list.push_back(pos);
75  pos = m_pattern.pos(0) + 1;
76  }
77  }
78  }
79 }

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


The documentation for this class was generated from the following files:
pappso::PeptideModificatorBase::m_pattern
QRegExp m_pattern
Definition: peptidemodificatorbase.h:66