pappsomspp
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_accession(other.m_accession),
41  m_description(other.m_description),
42  m_grpPeptidePtrList(other.m_grpPeptidePtrList)
43 {
44 }
45 
47 {
48 }
49 
50 unsigned int
52 {
53  return m_count;
54 }
55 void
57 {
58  m_count++;
59 }
60 void
61 GrpProtein::setSubGroupNumber(unsigned int i)
62 {
63  m_subGroupNumber = i;
64 }
65 
66 unsigned int
68 {
69  return m_groupNumber;
70 }
71 
72 unsigned int
74 {
75  return m_subGroupNumber;
76 }
77 unsigned int
78 GrpProtein::getRank() const
79 {
80  return m_rank;
81 }
82 const QString
84 {
85  if(m_groupNumber == 0)
86  {
87  return "";
88  }
89  return QString("%1.%2.%3")
93 }
94 bool
95 GrpProtein::operator==(const GrpProtein &other) const
96 {
97  return (m_accession == other.m_accession);
98 }
99 
100 
101 const QString &
103 {
104  return m_accession;
105 }
106 const QString &
108 {
109  return m_description;
110 }
111 void
112 GrpProtein::push_back(GrpPeptide *p_grpPeptide)
113 {
114  // p_grpPeptide->push_back(this);
115  m_grpPeptidePtrList.push_back(p_grpPeptide);
116 }
117 
118 void
120 {
121  qDebug() << "GrpProtein::strip begin " << this->m_accession;
122  // m_grpPeptidePtrList.sort();
123  std::sort(m_grpPeptidePtrList.begin(), m_grpPeptidePtrList.end());
124  // m_grpPeptidePtrList.unique();
125  m_grpPeptidePtrList.erase(
126  std::unique(m_grpPeptidePtrList.begin(), m_grpPeptidePtrList.end()),
127  m_grpPeptidePtrList.end());
128  qDebug() << "GrpProtein::strip end";
129 }
130 
131 void
132 GrpProtein::setRank(unsigned int i)
133 {
134  m_rank = i;
135 }
136 void
137 GrpProtein::setGroupNumber(unsigned int i)
138 {
139  m_groupNumber = i;
140 }
pappso::GrpProtein::strip
void strip()
ensure that each peptide in peptide list is unique and sorted by pointer adress
Definition: grpprotein.cpp:118
pappso::GrpProtein::m_groupNumber
unsigned int m_groupNumber
Definition: grpprotein.h:63
pappso::GrpProtein::getRank
unsigned int getRank() const
Definition: grpprotein.cpp:77
pappso::GrpProtein::getGroupingId
const QString getGroupingId() const
Definition: grpprotein.cpp:82
pappso::GrpProtein::~GrpProtein
~GrpProtein()
Definition: grpprotein.cpp:45
pappso
Definition: aa.cpp:38
grppeptide.h
pappso::GrpProtein::getCount
unsigned int getCount() const
Definition: grpprotein.cpp:50
pappso::GrpProtein::getSubGroupNumber
unsigned int getSubGroupNumber() const
Definition: grpprotein.cpp:72
pappso::GrpPeptide
Definition: grppeptide.h:61
pappso::GrpProtein::GrpProtein
GrpProtein(const QString &accession, const QString &description)
Definition: grpprotein.cpp:32
pappso::GrpProtein::getAccession
const QString & getAccession() const
Definition: grpprotein.cpp:101
pappso::GrpProtein::m_grpPeptidePtrList
std::vector< GrpPeptide * > m_grpPeptidePtrList
Definition: grpprotein.h:82
pappso::GrpProtein::getGroupNumber
unsigned int getGroupNumber() const
Definition: grpprotein.cpp:66
pappso::GrpProtein::getDescription
const QString & getDescription() const
Definition: grpprotein.cpp:106
pappso::GrpProtein::m_rank
unsigned int m_rank
Definition: grpprotein.h:65
grpexperiment.h
pappso::GrpProtein
Definition: grpprotein.h:58
pappso::GrpProtein::m_subGroupNumber
unsigned int m_subGroupNumber
Definition: grpprotein.h:64
pappso::GrpProtein::countPlus
void countPlus()
Definition: grpprotein.cpp:55
pappso::GrpProtein::setGroupNumber
void setGroupNumber(unsigned int i)
Definition: grpprotein.cpp:136
pappso::GrpProtein::operator==
bool operator==(const GrpProtein &other) const
Definition: grpprotein.cpp:94
pappso::GrpProtein::m_accession
const QString m_accession
Definition: grpprotein.h:68
pappso::GrpProtein::m_description
const QString m_description
Definition: grpprotein.h:69
grpprotein.h
pappso::GrpProtein::setRank
void setRank(unsigned int i)
Definition: grpprotein.cpp:131
pappso::GrpProtein::push_back
void push_back(GrpPeptide *p_grpPeptide)
Definition: grpprotein.cpp:111
pappso::GrpProtein::m_count
unsigned int m_count
Definition: grpprotein.h:66
pappso::Utils::getLexicalOrderedString
static const QString getLexicalOrderedString(unsigned int num)
Definition: utils.cpp:71
pappso::GrpProtein::setSubGroupNumber
void setSubGroupNumber(unsigned int i)
Definition: grpprotein.cpp:60