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 ()
 
- Public Member Functions inherited from pappso::PeptideSpSinkInterface

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