libpappsomspp
Library for mass spectrometry
grpprotein.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 
25 #include "grpprotein.h"
26 
27 
28 #include "grpexperiment.h"
29 #include "grppeptide.h"
30 #include "../utils.h"
31 
32 using namespace pappso;
33 GrpProtein::GrpProtein(const QString &accession, const QString &description)
34  : m_accession(accession.simplified()), m_description(description.simplified())
35 {
36 }
37 
38 
40  : m_grpPeptidePtrList(other.m_grpPeptidePtrList),
41  m_accession(other.m_accession),
42  m_description(other.m_description)
43 
44 {
45 
48  m_rank = other.m_rank;
49  m_count = other.m_count;
50 }
51 
53 {
54 }
55 
58 {
59  return m_grpPeptidePtrList.begin();
60 }
63 {
64  return m_grpPeptidePtrList.end();
65 }
66 
67 unsigned int
69 {
70  return m_count;
71 }
72 void
74 {
75  m_count++;
76 }
77 void
79 {
80  m_subGroupNumber = i;
81 }
82 
83 unsigned int
85 {
86  return m_groupNumber;
87 }
88 
89 unsigned int
91 {
92  return m_subGroupNumber;
93 }
94 unsigned int
96 {
97  return m_rank;
98 }
99 const QString
101 {
102  if(m_groupNumber == 0)
103  {
104  return "";
105  }
106  return QString("%1.%2.%3")
110 }
111 bool
113 {
114  return (m_accession == other.m_accession);
115 }
116 
117 
118 const QString &
120 {
121  return m_accession;
122 }
123 const QString &
125 {
126  return m_description;
127 }
128 void
130 {
131  // p_grpPeptide->push_back(this);
132  m_grpPeptidePtrList.push_back(p_grpPeptide);
133 }
134 
135 void
137 {
138  qDebug() << "GrpProtein::strip begin " << this->m_accession;
139  // m_grpPeptidePtrList.sort();
140  std::sort(m_grpPeptidePtrList.begin(), m_grpPeptidePtrList.end());
141  // m_grpPeptidePtrList.unique();
142  m_grpPeptidePtrList.erase(
143  std::unique(m_grpPeptidePtrList.begin(), m_grpPeptidePtrList.end()),
144  m_grpPeptidePtrList.end());
145  qDebug() << "GrpProtein::strip end";
146 }
147 
148 void
149 GrpProtein::setRank(unsigned int i)
150 {
151  m_rank = i;
152 }
153 void
155 {
156  m_groupNumber = i;
157 }
pappso::GrpProtein::strip
void strip()
ensure that each peptide in peptide list is unique and sorted by pointer adress
Definition: grpprotein.cpp:136
pappso::GrpProtein::m_groupNumber
unsigned int m_groupNumber
Definition: grpprotein.h:82
pappso::GrpProtein::getRank
unsigned int getRank() const
Definition: grpprotein.cpp:95
pappso::GrpProtein::getGroupingId
const QString getGroupingId() const
Definition: grpprotein.cpp:100
pappso::GrpProtein::~GrpProtein
~GrpProtein()
Definition: grpprotein.cpp:52
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
grppeptide.h
pappso::GrpProtein::getCount
unsigned int getCount() const
Definition: grpprotein.cpp:68
pappso::GrpProtein::getSubGroupNumber
unsigned int getSubGroupNumber() const
Definition: grpprotein.cpp:90
pappso::GrpPeptide
Definition: grppeptide.h:43
pappso::GrpProtein::getAccession
const QString & getAccession() const
Definition: grpprotein.cpp:119
pappso::GrpProtein::begin
const_iterator begin() const
Definition: grpprotein.cpp:57
pappso::GrpProtein::m_grpPeptidePtrList
std::vector< GrpPeptide * > m_grpPeptidePtrList
Definition: grpprotein.h:77
pappso::GrpProtein::getGroupNumber
unsigned int getGroupNumber() const
Definition: grpprotein.cpp:84
pappso::GrpProtein::getDescription
const QString & getDescription() const
Definition: grpprotein.cpp:124
pappso::GrpProtein::m_rank
unsigned int m_rank
Definition: grpprotein.h:84
grpexperiment.h
pappso::GrpProtein
Definition: grpprotein.h:40
pappso::GrpProtein::m_subGroupNumber
unsigned int m_subGroupNumber
Definition: grpprotein.h:83
pappso::GrpProtein::countPlus
void countPlus()
Definition: grpprotein.cpp:73
pappso::GrpProtein::setGroupNumber
void setGroupNumber(unsigned int i)
Definition: grpprotein.cpp:154
pappso::GrpProtein::operator==
bool operator==(const GrpProtein &other) const
Definition: grpprotein.cpp:112
pappso::GrpProtein::end
const_iterator end() const
Definition: grpprotein.cpp:62
pappso::GrpProtein::m_accession
const QString m_accession
Definition: grpprotein.h:80
pappso::GrpProtein::const_iterator
std::vector< GrpPeptide * >::const_iterator const_iterator
Definition: grpprotein.h:54
pappso::GrpProtein::m_description
const QString m_description
Definition: grpprotein.h:81
pappso::GrpProtein::GrpProtein
GrpProtein(const GrpProtein &other)
Definition: grpprotein.cpp:39
grpprotein.h
pappso::GrpProtein::setRank
void setRank(unsigned int i)
Definition: grpprotein.cpp:149
pappso::GrpProtein::push_back
void push_back(GrpPeptide *p_grpPeptide)
Definition: grpprotein.cpp:129
pappso::GrpProtein::m_count
unsigned int m_count
Definition: grpprotein.h:85
pappso::Utils::getLexicalOrderedString
static const QString getLexicalOrderedString(unsigned int num)
Definition: utils.cpp:52
pappso::GrpProtein::setSubGroupNumber
void setSubGroupNumber(unsigned int i)
Definition: grpprotein.cpp:78