libpappsomspp
Library for mass spectrometry
pappso::GrpPeptideSet Class Reference

#include <grppeptideset.h>

Public Member Functions

 GrpPeptideSet ()
 
 GrpPeptideSet (const GrpPeptideSet &other)
 
 GrpPeptideSet (const GrpProtein *p_protein)
 
 ~GrpPeptideSet ()
 
GrpPeptideSetoperator= (const GrpPeptideSet &other)
 
bool operator== (const GrpPeptideSet &other) const
 
unsigned int size () const
 
bool biggerAndContainsAll (const GrpPeptideSet &peptideSet) const
 
bool contains (const GrpPeptide *p_grp_peptide) const
 
bool containsAll (const GrpPeptideSet &peptideSet) const
 
bool containsAny (const GrpPeptideSet &peptideSet) const
 
void addAll (const GrpPeptideSet &peptideSet)
 
const QString printInfos () const
 
void numbering ()
 
void setGroupNumber (unsigned int i)
 
std::vector< const GrpPeptide * > getGrpPeptideList () const
 

Private Member Functions

bool privContainsAll (const GrpPeptideSet &peptideSetIn) const
 

Private Attributes

std::list< GrpPeptide * > m_peptidePtrList
 

Friends

class GrpMapPeptideToSubGroupSet
 
class GrpMapPeptideToGroup
 

Detailed Description

Definition at line 35 of file grppeptideset.h.

Constructor & Destructor Documentation

◆ GrpPeptideSet() [1/3]

GrpPeptideSet::GrpPeptideSet ( )

Definition at line 29 of file grppeptideset.cpp.

30 {
31 }

◆ GrpPeptideSet() [2/3]

GrpPeptideSet::GrpPeptideSet ( const GrpPeptideSet other)

Definition at line 41 of file grppeptideset.cpp.

43 {
44 }
std::list< GrpPeptide * > m_peptidePtrList
Definition: grppeptideset.h:41

◆ GrpPeptideSet() [3/3]

GrpPeptideSet::GrpPeptideSet ( const GrpProtein p_protein)

Definition at line 32 of file grppeptideset.cpp.

33 {
34  auto it = p_protein->begin();
35  while(it != p_protein->end())
36  {
37  m_peptidePtrList.push_back(*it);
38  it++;
39  }
40 }
const_iterator end() const
Definition: grpprotein.cpp:62
const_iterator begin() const
Definition: grpprotein.cpp:57

References pappso::GrpProtein::begin(), pappso::GrpProtein::end(), and m_peptidePtrList.

◆ ~GrpPeptideSet()

GrpPeptideSet::~GrpPeptideSet ( )

Definition at line 46 of file grppeptideset.cpp.

47 {
48 }

Member Function Documentation

◆ addAll()

void GrpPeptideSet::addAll ( const GrpPeptideSet peptideSet)

Definition at line 165 of file grppeptideset.cpp.

166 {
167 
168  qDebug() << "GrpPeptideSet::addAll begin";
169  std::list<GrpPeptide *>::iterator it(m_peptidePtrList.begin());
170  std::list<GrpPeptide *>::iterator itEnd(m_peptidePtrList.end());
171  std::list<GrpPeptide *>::const_iterator itIn(
172  peptideSetIn.m_peptidePtrList.begin());
173  std::list<GrpPeptide *>::const_iterator itInEnd(
174  peptideSetIn.m_peptidePtrList.end());
175 
176  while((itIn != itInEnd) && (it != itEnd))
177  {
178  if(*itIn > *it)
179  {
180  it++;
181  continue;
182  }
183  if(*itIn < *it)
184  {
185  it = m_peptidePtrList.insert(it, *itIn);
186  it++;
187  itIn++;
188  continue;
189  }
190  if(*itIn == *it)
191  {
192  itIn++;
193  it++;
194  }
195  }
196  while(itIn != itInEnd)
197  {
198  m_peptidePtrList.push_back(*itIn);
199  itIn++;
200  }
201  qDebug() << "GrpPeptideSet::addAll end";
202 }

References m_peptidePtrList.

Referenced by pappso::GrpGroup::GrpGroup(), pappso::GrpExperiment::addPostGroupingGrpProteinSpRemoval(), pappso::GrpExperiment::addPreGroupingGrpProteinSpRemoval(), and pappso::GrpGroup::addSubGroupSp().

◆ biggerAndContainsAll()

bool GrpPeptideSet::biggerAndContainsAll ( const GrpPeptideSet peptideSet) const

Definition at line 90 of file grppeptideset.cpp.

91 {
92  if(m_peptidePtrList.size() > peptideSetIn.m_peptidePtrList.size())
93  {
94  return privContainsAll(peptideSetIn);
95  }
96  return false;
97 }
bool privContainsAll(const GrpPeptideSet &peptideSetIn) const

References m_peptidePtrList, and privContainsAll().

Referenced by pappso::GrpSubGroup::includes().

◆ contains()

bool GrpPeptideSet::contains ( const GrpPeptide p_grp_peptide) const

Definition at line 68 of file grppeptideset.cpp.

69 {
70  if(std::find(m_peptidePtrList.begin(),
71  m_peptidePtrList.end(),
72  p_grp_peptide) == m_peptidePtrList.end())
73  {
74  return false;
75  }
76  return true;
77 }

References m_peptidePtrList.

◆ containsAll()

bool GrpPeptideSet::containsAll ( const GrpPeptideSet peptideSet) const

Definition at line 80 of file grppeptideset.cpp.

81 {
82  if(m_peptidePtrList.size() < peptideSetIn.m_peptidePtrList.size())
83  {
84  return false;
85  }
86  return privContainsAll(peptideSetIn);
87 }

References m_peptidePtrList, and privContainsAll().

◆ containsAny()

bool GrpPeptideSet::containsAny ( const GrpPeptideSet peptideSet) const

Definition at line 134 of file grppeptideset.cpp.

135 {
136  std::list<GrpPeptide *>::const_iterator innerIt, outerIt, innerEnd, outerEnd;
137 
138  innerIt = peptideSetIn.m_peptidePtrList.begin();
139  innerEnd = peptideSetIn.m_peptidePtrList.end();
140  outerIt = m_peptidePtrList.begin();
141  outerEnd = m_peptidePtrList.end();
142 
143 
144  while((innerIt != innerEnd) && (outerIt != outerEnd))
145  {
146  if(*innerIt > *outerIt)
147  {
148  outerIt++;
149  continue;
150  }
151  if(*innerIt < *outerIt)
152  {
153  innerIt++;
154  continue;
155  }
156  if(*innerIt == *outerIt)
157  {
158  return true;
159  }
160  }
161  return false;
162 }

References m_peptidePtrList.

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

◆ getGrpPeptideList()

std::vector< const GrpPeptide * > GrpPeptideSet::getGrpPeptideList ( ) const

Definition at line 237 of file grppeptideset.cpp.

238 {
239  std::vector<const GrpPeptide *> peptide_list;
240  for(GrpPeptide *peptide : m_peptidePtrList)
241  {
242  peptide_list.push_back(peptide);
243  }
244  return peptide_list;
245 }

References m_peptidePtrList.

◆ numbering()

void GrpPeptideSet::numbering ( )

Definition at line 206 of file grppeptideset.cpp.

207 {
208  qDebug() << "GrpPeptideSet::numbering begin";
209 
210  m_peptidePtrList.sort([](GrpPeptide *first, GrpPeptide *second) {
211  return ((*first) < (*second));
212  });
213  unsigned int i = 1;
214  for(auto &&p_grp_peptide : m_peptidePtrList)
215  {
216  p_grp_peptide->setRank(i);
217  i++;
218  }
219 
220  qDebug() << "GrpPeptideSet::numbering end";
221 }

References m_peptidePtrList.

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

◆ operator=()

GrpPeptideSet & GrpPeptideSet::operator= ( const GrpPeptideSet other)

Definition at line 51 of file grppeptideset.cpp.

52 {
54  return *this;
55 }

References m_peptidePtrList.

◆ operator==()

bool GrpPeptideSet::operator== ( const GrpPeptideSet other) const

Definition at line 58 of file grppeptideset.cpp.

59 {
60  if(m_peptidePtrList.size() != other.m_peptidePtrList.size())
61  {
62  return false;
63  }
64  return privContainsAll(other);
65 }

References m_peptidePtrList, and privContainsAll().

◆ printInfos()

const QString GrpPeptideSet::printInfos ( ) const

Definition at line 248 of file grppeptideset.cpp.

249 {
250  QString infos;
251  std::list<GrpPeptide *>::const_iterator it(m_peptidePtrList.begin()),
252  itEnd(m_peptidePtrList.end());
253 
254 
255  while(it != itEnd)
256  {
257  infos.append((*it)->getSequence() + " " +
258  QString("0x%1").arg(
259  (quintptr)*it, QT_POINTER_SIZE * 2, 16, QChar('0')) +
260  "\n");
261  it++;
262  }
263 
264  return infos;
265 }

References m_peptidePtrList.

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

◆ privContainsAll()

bool GrpPeptideSet::privContainsAll ( const GrpPeptideSet peptideSetIn) const
private

Definition at line 100 of file grppeptideset.cpp.

101 {
102  std::list<GrpPeptide *>::const_iterator innerIt, outerIt, innerEnd, outerEnd;
103  innerIt = peptideSetIn.m_peptidePtrList.begin();
104  innerEnd = peptideSetIn.m_peptidePtrList.end();
105  outerIt = m_peptidePtrList.begin();
106  outerEnd = m_peptidePtrList.end();
107 
108 
109  while((innerIt != innerEnd) && (outerIt != outerEnd))
110  {
111  if(*innerIt > *outerIt)
112  {
113  outerIt++;
114  continue;
115  }
116  if(*innerIt < *outerIt)
117  {
118  return false;
119  }
120  if(*innerIt == *outerIt)
121  {
122  innerIt++;
123  outerIt++;
124  }
125  }
126  if(innerIt == innerEnd)
127  {
128  return true;
129  }
130  return false;
131 }

References m_peptidePtrList.

Referenced by biggerAndContainsAll(), containsAll(), and operator==().

◆ setGroupNumber()

void GrpPeptideSet::setGroupNumber ( unsigned int  i)

Definition at line 225 of file grppeptideset.cpp.

226 {
227  qDebug() << "GrpPeptideSet::setGroupNumber begin";
228  for(auto &&p_grp_peptide : m_peptidePtrList)
229  {
230  p_grp_peptide->setGroupNumber(i);
231  }
232 
233  qDebug() << "GrpPeptideSet::setGroupNumber end";
234 }

References m_peptidePtrList.

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

◆ size()

unsigned int pappso::GrpPeptideSet::size ( ) const
inline

Friends And Related Function Documentation

◆ GrpMapPeptideToGroup

friend class GrpMapPeptideToGroup
friend

Definition at line 38 of file grppeptideset.h.

◆ GrpMapPeptideToSubGroupSet

friend class GrpMapPeptideToSubGroupSet
friend

Definition at line 37 of file grppeptideset.h.

Member Data Documentation

◆ m_peptidePtrList


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