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.

◆ GrpSubGroup() [2/2]

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

Definition at line 41 of file grpsubgroup.cpp.

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

◆ ~GrpSubGroup()

pappso::GrpSubGroup::~GrpSubGroup ( )

Definition at line 124 of file grpsubgroup.cpp.

125{
126}

Member Function Documentation

◆ getFirstAccession()

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

Definition at line 226 of file grpsubgroup.cpp.

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

References m_grpProteinPtrList.

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

◆ getGroupingId()

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

Definition at line 63 of file grpsubgroup.cpp.

64{
65 if(m_groupNumber == 0)
66 {
67 return "";
68 }
69 return QString("%1.%2")
72}
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:52

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

◆ getGroupNumber()

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

Definition at line 48 of file grpsubgroup.cpp.

49{
50 return m_groupNumber;
51}

References m_groupNumber.

◆ getGrpProteinList()

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

Definition at line 58 of file grpsubgroup.cpp.

59{
61}

References m_grpProteinPtrList.

◆ getPeptideSet()

const GrpPeptideSet & pappso::GrpSubGroup::getPeptideSet ( ) const

◆ getSubGroupNumber()

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

Definition at line 53 of file grpsubgroup.cpp.

54{
55 return m_subGroupNumber;
56}

References m_subGroupNumber.

◆ includes()

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

Definition at line 166 of file grpsubgroup.cpp.

167{
168 if(m_peptidePtrList.biggerAndContainsAll(p_subgroup->getPeptideSet()))
169 {
170 return true;
171 }
172 else
173 {
174 return false;
175 }
176}
bool biggerAndContainsAll(const GrpPeptideSet &peptideSet) const

References pappso::GrpPeptideSet::biggerAndContainsAll(), getPeptideSet(), and m_peptidePtrList.

◆ makeGrpSubGroupSp()

GrpSubGroupSp pappso::GrpSubGroup::makeGrpSubGroupSp ( )

Definition at line 128 of file grpsubgroup.cpp.

129{
130 return std::make_shared<GrpSubGroup>(*this);
131}

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

◆ maxCount()

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

Definition at line 74 of file grpsubgroup.cpp.

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

References m_grpProteinPtrList, and pappso::max.

Referenced by operator<().

◆ merge()

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

Definition at line 140 of file grpsubgroup.cpp.

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

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

◆ numbering()

void pappso::GrpSubGroup::numbering ( )

Definition at line 199 of file grpsubgroup.cpp.

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

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 86 of file grpsubgroup.cpp.

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

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

◆ peptideListSize()

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

Definition at line 240 of file grpsubgroup.cpp.

241{
242 return m_peptidePtrList.size();
243}

References m_peptidePtrList, and pappso::GrpPeptideSet::size().

◆ setGroupNumber()

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

Definition at line 179 of file grpsubgroup.cpp.

180{
181 m_groupNumber = i;
182 for(auto &&p_protein : m_grpProteinPtrList)
183 {
184 p_protein->setGroupNumber(i);
185 }
186}

References m_groupNumber, and m_grpProteinPtrList.

◆ setSubGroupNumber()

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

Definition at line 189 of file grpsubgroup.cpp.

190{
192 for(auto &&p_protein : m_grpProteinPtrList)
193 {
194 p_protein->setSubGroupNumber(i);
195 }
196}

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

Definition at line 46 of file grpsubgroup.h.

Referenced by getPeptideSet(), includes(), merge(), operator<(), and peptideListSize().

◆ 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: