libpappsomspp
Library for mass spectrometry
peptidefixedmodificationbuilder.cpp
Go to the documentation of this file.
1 
2 /*******************************************************************************
3  * Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
4  *
5  * This file is part of the PAPPSOms++ library.
6  *
7  * PAPPSOms++ is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * PAPPSOms++ is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
19  *
20  * Contributors:
21  * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
22  *implementation
23  ******************************************************************************/
24 
26 
27 using namespace pappso;
28 
30  AaModificationP p_mod)
31  : mp_mod(p_mod)
32 {
33 }
34 
36 {
37 }
38 
39 void
41 {
42 
43 
44  m_aaModificationList.append(aa);
45 
46  m_pattern.setPattern(QString("[%1]").arg(m_aaModificationList));
47 }
48 
49 
50 void
52  std::int8_t sequence_database_id,
53  const ProteinSp &protein_sp,
54  bool is_decoy,
55  const PeptideSp &peptide_sp_original,
56  unsigned int start,
57  bool is_nter,
58  unsigned int missed_cleavage_number,
59  bool semi_enzyme)
60 {
61 
62  qDebug() << "PeptideFixedModificationBuilder::setPeptide begin";
63 
64  std::vector<unsigned int> position_list;
65  getModificationPositionList(position_list,
66  peptide_sp_original.get()->getSequence());
67 
68  Peptide peptide(*peptide_sp_original.get());
69  unsigned int size = peptide.size();
70 
71  for(unsigned int pos : position_list)
72  {
73  if((m_isProtNterMod) && (is_nter))
74  {
75  peptide.addAaModification(mp_mod, pos);
76  }
77  else if((m_isProtCterMod) && (protein_sp.get()->size() == (start + size)))
78  {
79  peptide.addAaModification(mp_mod, pos);
80  }
81  else if(m_isProtElseMod)
82  {
83  peptide.addAaModification(mp_mod, pos);
84  }
85  }
86 
87  PeptideSp peptide_sp = peptide.makePeptideSp();
88  // set fixed modifications
89  m_sink->setPeptideSp(sequence_database_id,
90  protein_sp,
91  is_decoy,
92  peptide_sp,
93  start,
94  is_nter,
95  missed_cleavage_number,
96  semi_enzyme);
97  qDebug() << "PeptideFixedModificationBuilder::setPeptide end";
98 }
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
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
PeptideSp makePeptideSp() const
Definition: peptide.cpp:125
unsigned int size() const override
Definition: peptide.h:185
void addAaModification(AaModificationP aaModification, unsigned int position)
adds a modification to amino acid sequence
Definition: peptide.cpp:137
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
std::shared_ptr< const Peptide > PeptideSp
std::shared_ptr< const Protein > ProteinSp
shared pointer on a Protein object
Definition: protein.h:43