libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
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
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
void setProtCter (bool arg1)
 this modification concerns the Cter peptide
void setProtElse (bool arg1)
 this modification concerns all peptides between Nter and Cter
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)
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)

◆ ~PeptideVariableModificationBuilder()

pappso::PeptideVariableModificationBuilder::~PeptideVariableModificationBuilder ( )
virtual

Definition at line 77 of file peptidevariablemodificationbuilder.cpp.

78{
79}

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 91 of file peptidevariablemodificationbuilder.cpp.

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

◆ 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 };

References m_isProtCterMod.

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 };

References m_isProtElseMod.

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 };

References m_isProtNterMod.

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

◆ setSink()

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

Implements pappso::PeptideSpSinkInterface.

Definition at line 70 of file peptidevariablemodificationbuilder.h.

71 {
72 m_sink = sink;
73 };

References m_sink.

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

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: