libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
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)
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
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 85 of file peptidemodificatorbase.cpp.

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

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) && (position_list.back() == (unsigned int)pos))
71 {
72 pos = match_pattern.capturedStart(0) + 1;
73 }
74 else
75 {
76 position_list.push_back(pos);
77 pos = match_pattern.capturedStart(0) + 1;
78 }
79 }
80 match_pattern = m_pattern.match(peptide_str, pos);
81 }
82}

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: