libpappsomspp
Library for mass spectrometry
peptidebuilder.cpp
Go to the documentation of this file.
1 
2 /*******************************************************************************
3  * Copyright (c) 2015 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 #include "peptidebuilder.h"
25 #include <QDebug>
26 
27 namespace pappso
28 {
30 {
31 }
32 
34 {
35 }
36 void
38 {
39 
40  m_fixedModificationList.push_back(
41  std::pair<char, AaModificationP>(aa, modification));
42 }
43 
44 void
45 PeptideBuilder::setPeptide(std::int8_t sequence_database_id,
46  const ProteinSp &protein_sp,
47  bool is_decoy,
48  const QString &peptide_str,
49  unsigned int start,
50  bool is_nter,
51  unsigned int missed_cleavage_number,
52  bool semi_enzyme)
53 {
54 
55  qDebug() << "PeptideBuilder::setPeptide begin";
56 
57  Peptide peptide(peptide_str);
58 
59  for(auto &&aamod_pair : m_fixedModificationList)
60  {
61  std::vector<unsigned int> position_list =
62  peptide.getAaPositionList(aamod_pair.first);
63  for(auto &&position : position_list)
64  {
65  peptide.addAaModification(aamod_pair.second, position);
66  }
67  }
68 
69  PeptideSp peptide_sp = peptide.makePeptideSp();
70  // set fixed modifications
71 
72  qDebug() << "PeptideBuilder::setPeptide m_sink->setPeptideSp";
73  m_sink->setPeptideSp(sequence_database_id,
74  protein_sp,
75  is_decoy,
76  peptide_sp,
77  start,
78  is_nter,
79  missed_cleavage_number,
80  semi_enzyme);
81  qDebug() << "PeptideBuilder::setPeptide end";
82 }
83 
84 } // namespace pappso
std::list< std::pair< char, AaModificationP > > m_fixedModificationList
void setPeptide(std::int8_t sequence_database_id, const ProteinSp &protein_sp, bool is_decoy, const QString &peptide_str, unsigned int start, bool is_nter, unsigned int missed_cleavage_number, bool semi_enzyme) override
function to give the products of a protein digestion by an enzyme
PeptideModificatorInterface * m_sink
void addFixedAaModification(char aa, AaModificationP modification)
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
std::vector< unsigned int > getAaPositionList(char aa) const
get positions of one amino acid in peptide
Definition: peptide.cpp:360
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