libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::GrpSubGroup Class Reference

#include <grpsubgroup.h>

Public Member Functions

 GrpSubGroup (GrpProtein *p_protein)
 GrpSubGroup (const GrpSubGroup &other)
bool operator< (const GrpSubGroup &other) const
 sort subgroups between each other a subgroup containing less peptides is weaker (less) than the other
 ~GrpSubGroup ()
GrpSubGroupSp makeGrpSubGroupSp ()
const GrpPeptideSetgetPeptideSet () const
bool merge (GrpSubGroup *p_subgroup)
bool includes (const GrpSubGroup *p_subgroup) const
void numbering ()
void setSubGroupNumber (unsigned int i)
void setGroupNumber (unsigned int i)
const QString & getFirstAccession () const
std::size_t peptideListSize () const
unsigned int maxCount () const
const QString getGroupingId () const
unsigned int getGroupNumber () const
unsigned int getSubGroupNumber () const
const std::vector< GrpProtein * > & getGrpProteinList () const

Private Attributes

std::vector< GrpProtein * > m_grpProteinPtrList
GrpPeptideSet m_peptidePtrList
unsigned int m_subGroupNumber = 0
unsigned int m_groupNumber = 0

Detailed Description

Definition at line 42 of file grpsubgroup.h.

Constructor & Destructor Documentation

◆ GrpSubGroup() [1/2]

pappso::GrpSubGroup::GrpSubGroup ( GrpProtein * p_protein)

Definition at line 36 of file grpsubgroup.cpp.

36 : m_peptidePtrList(p_protein)
37{
38 m_grpProteinPtrList.push_back(p_protein);
39}
std::vector< GrpProtein * > m_grpProteinPtrList
Definition grpsubgroup.h:45
GrpPeptideSet m_peptidePtrList
Definition grpsubgroup.h:46

References m_grpProteinPtrList, and m_peptidePtrList.

Referenced by GrpSubGroup(), includes(), merge(), and operator<().

◆ GrpSubGroup() [2/2]

pappso::GrpSubGroup::GrpSubGroup ( const GrpSubGroup & other)

Definition at line 41 of file grpsubgroup.cpp.

42 : m_grpProteinPtrList(other.m_grpProteinPtrList), m_peptidePtrList(other.m_peptidePtrList)
43{
44}

References GrpSubGroup(), m_grpProteinPtrList, and m_peptidePtrList.

◆ ~GrpSubGroup()

pappso::GrpSubGroup::~GrpSubGroup ( )

Definition at line 122 of file grpsubgroup.cpp.

123{
124}

Member Function Documentation

◆ getFirstAccession()

const QString & pappso::GrpSubGroup::getFirstAccession ( ) const

Definition at line 223 of file grpsubgroup.cpp.

224{
225 auto it = m_grpProteinPtrList.begin();
226 if(it == m_grpProteinPtrList.end())
227 {
228 throw PappsoException(QObject::tr("m_grpProteinPtrList is empty"));
229 }
230 else
231 {
232 return (*it)->getAccession();
233 }
234}

References m_grpProteinPtrList.

Referenced by pappso::GrpExperiment::addSubGroupSp(), pappso::GrpGroup::addSubGroupSp(), pappso::GrpMapPeptideToSubGroupSet::hasSpecificPeptide(), merge(), and pappso::GrpMapPeptideToSubGroupSet::remove().

◆ getGroupingId()

const QString pappso::GrpSubGroup::getGroupingId ( ) const

Definition at line 62 of file grpsubgroup.cpp.

63{
64 if(m_groupNumber == 0)
65 {
66 return "";
67 }
68 return QString("%1.%2")
71}
unsigned int m_groupNumber
Definition grpsubgroup.h:48
unsigned int m_subGroupNumber
Definition grpsubgroup.h:47
static const QString getLexicalOrderedString(unsigned int num)
Definition utils.cpp:72

References pappso::Utils::getLexicalOrderedString(), m_groupNumber, and m_subGroupNumber.

◆ getGroupNumber()

unsigned int pappso::GrpSubGroup::getGroupNumber ( ) const

Definition at line 47 of file grpsubgroup.cpp.

48{
49 return m_groupNumber;
50}

References m_groupNumber.

◆ getGrpProteinList()

const std::vector< GrpProtein * > & pappso::GrpSubGroup::getGrpProteinList ( ) const

Definition at line 57 of file grpsubgroup.cpp.

58{
60}

References m_grpProteinPtrList.

◆ getPeptideSet()

◆ getSubGroupNumber()

unsigned int pappso::GrpSubGroup::getSubGroupNumber ( ) const

Definition at line 52 of file grpsubgroup.cpp.

53{
54 return m_subGroupNumber;
55}

References m_subGroupNumber.

◆ includes()

bool pappso::GrpSubGroup::includes ( const GrpSubGroup * p_subgroup) const

Definition at line 163 of file grpsubgroup.cpp.

164{
165 if(m_peptidePtrList.biggerAndContainsAll(p_subgroup->getPeptideSet()))
166 {
167 return true;
168 }
169 else
170 {
171 return false;
172 }
173}

References GrpSubGroup(), getPeptideSet(), and m_peptidePtrList.

Referenced by pappso::GrpGroup::addSubGroupSp().

◆ makeGrpSubGroupSp()

GrpSubGroupSp pappso::GrpSubGroup::makeGrpSubGroupSp ( )

Definition at line 126 of file grpsubgroup.cpp.

127{
128 return std::make_shared<GrpSubGroup>(*this);
129}

Referenced by pappso::GrpExperiment::startGrouping().

◆ maxCount()

unsigned int pappso::GrpSubGroup::maxCount ( ) const

Definition at line 73 of file grpsubgroup.cpp.

74{
75 unsigned int max = 0;
76 for(GrpProtein *p_protein : m_grpProteinPtrList)
77 {
78 if(max < p_protein->getCount())
79 {
80 max = p_protein->getCount();
81 }
82 }
83 return max;
84}
@ max
maximum of intensities
Definition types.h:280

References m_grpProteinPtrList.

Referenced by operator<().

◆ merge()

bool pappso::GrpSubGroup::merge ( GrpSubGroup * p_subgroup)

Definition at line 138 of file grpsubgroup.cpp.

139{
140 qDebug() << "GrpSubGroup::merge begin " << m_grpProteinPtrList.size() << " "
141 << this->getFirstAccession() << " " << p_subgroup->getFirstAccession();
142 // if (this == p_subgroup) {
143 // return true;
144 //}
145 if(p_subgroup->m_peptidePtrList == m_peptidePtrList)
146 {
147 // m_grpProteinPtrList.splice (m_grpProteinPtrList.end(),
148 // p_subgroup->m_grpProteinPtrList);
150 p_subgroup->m_grpProteinPtrList.begin(),
151 p_subgroup->m_grpProteinPtrList.end());
152 // m_grpProteinPtrList.insert (m_grpProteinPtrList.end(),
153 // p_subgroup->m_grpProteinPtrList.begin(),p_subgroup->m_grpProteinPtrList.end());
154 return true;
155 }
156 else
157 {
158 return false;
159 }
160}
const QString & getFirstAccession() const

References GrpSubGroup(), getFirstAccession(), m_grpProteinPtrList, and m_peptidePtrList.

◆ numbering()

void pappso::GrpSubGroup::numbering ( )

Definition at line 196 of file grpsubgroup.cpp.

197{
198 qDebug() << "GrpSubGroup::numbering begin";
199
200 // sort proteins by accession numbers :
201 // m_grpProteinPtrList.sort([](GrpProtein * first, GrpProtein * second) {
202 // return (first->getAccession() < second->getAccession()) ;
203 //});
204 std::sort(m_grpProteinPtrList.begin(),
206 [](GrpProtein *first, GrpProtein *second) {
207 return (first->getAccession() < second->getAccession());
208 });
209 // list unique removes all but the first element from every consecutive group
210 // of equal elements in the container
211 // m_grpProteinPtrList.unique();
212
213
214 unsigned int i = 1;
215 for(auto &&p_protein : m_grpProteinPtrList)
216 {
217 p_protein->setRank(i);
218 i++;
219 }
220 qDebug() << "GrpSubGroup::numbering end";
221}

References m_grpProteinPtrList.

◆ operator<()

bool pappso::GrpSubGroup::operator< ( const GrpSubGroup & other) const

sort subgroups between each other a subgroup containing less peptides is weaker (less) than the other

Definition at line 85 of file grpsubgroup.cpp.

87{
88 if(m_peptidePtrList.size() == other.m_peptidePtrList.size())
89 {
90 if(maxCount() == other.maxCount())
91 {
92 if(m_grpProteinPtrList.size() == other.m_grpProteinPtrList.size())
93 {
94 // compare peptide set surface ?
95 // alphabetic order taken into account
96 return ((*(m_grpProteinPtrList.begin()))->getAccession() <
97 (*(other.m_grpProteinPtrList.begin()))->getAccession());
98 }
99 else
100 {
101 // if there is same peptide size evidence, then perhaps it's
102 // better to consider that
103 // the best group is the one that include more proteins
104 return (m_grpProteinPtrList.size() > other.m_grpProteinPtrList.size());
105 }
106 }
107 else
108 {
109 // counts are evidences of the presence of a subgroup
110 // the fewer is the count, the weaker is the subgroup
111 return (maxCount() > other.maxCount());
112 }
113 }
114 else
115 {
116 // peptides are evidences of the presence of a subgroup
117 // the fewer is the peptide list, the weaker is the subgroup
118 return (m_peptidePtrList.size() > other.m_peptidePtrList.size());
119 }
120}
unsigned int maxCount() const

References GrpSubGroup(), m_grpProteinPtrList, m_peptidePtrList, maxCount(), and pappso::GrpPeptideSet::size().

◆ peptideListSize()

std::size_t pappso::GrpSubGroup::peptideListSize ( ) const

Definition at line 237 of file grpsubgroup.cpp.

238{
239 return m_peptidePtrList.size();
240}

References m_peptidePtrList.

◆ setGroupNumber()

void pappso::GrpSubGroup::setGroupNumber ( unsigned int i)

Definition at line 176 of file grpsubgroup.cpp.

177{
178 m_groupNumber = i;
179 for(auto &&p_protein : m_grpProteinPtrList)
180 {
181 p_protein->setGroupNumber(i);
182 }
183}

References m_groupNumber, and m_grpProteinPtrList.

◆ setSubGroupNumber()

void pappso::GrpSubGroup::setSubGroupNumber ( unsigned int i)

Definition at line 186 of file grpsubgroup.cpp.

187{
189 for(auto &&p_protein : m_grpProteinPtrList)
190 {
191 p_protein->setSubGroupNumber(i);
192 }
193}

References m_grpProteinPtrList, and m_subGroupNumber.

Member Data Documentation

◆ m_groupNumber

unsigned int pappso::GrpSubGroup::m_groupNumber = 0
private

Definition at line 48 of file grpsubgroup.h.

Referenced by getGroupingId(), getGroupNumber(), and setGroupNumber().

◆ m_grpProteinPtrList

std::vector<GrpProtein *> pappso::GrpSubGroup::m_grpProteinPtrList
private

◆ m_peptidePtrList

GrpPeptideSet pappso::GrpSubGroup::m_peptidePtrList
private

◆ m_subGroupNumber

unsigned int pappso::GrpSubGroup::m_subGroupNumber = 0
private

Definition at line 47 of file grpsubgroup.h.

Referenced by getGroupingId(), getSubGroupNumber(), and setSubGroupNumber().


The documentation for this class was generated from the following files: