libpappsomspp
Library for mass spectrometry
pappso::GrpMapPeptideToSubGroupSet Class Reference

#include <grpmappeptidetosubgroupset.h>

Public Member Functions

 GrpMapPeptideToSubGroupSet ()
 
 GrpMapPeptideToSubGroupSet (const GrpMapPeptideToSubGroupSet &other)
 
 ~GrpMapPeptideToSubGroupSet ()
 
void getSubGroupSet (const GrpPeptideSet &peptide_set_in, GrpSubGroupSet &impacted_subgroup_set) const
 get all subgroups concerned by a list of peptides More...
 
void remove (GrpSubGroup *p_remove_sub_group)
 removes in the map all references of the group to remove (p_remove_sub_group) More...
 
void add (GrpSubGroup *p_add_sub_group)
 add in the map all peptides of the subgroup to add More...
 
bool hasSpecificPeptide (const GrpSubGroup *get) const
 tells if this subgroup contains a specific peptide More...
 
void check (std::list< GrpSubGroupSp > &m_grpSubGroupSpList) const
 check function only usefull for testing purpose More...
 
unsigned int size () const
 
const QString printInfos () const
 

Private Attributes

std::map< GrpPeptide *, GrpSubGroupSetm_mapPeptideToSubGroupSet
 

Detailed Description

Definition at line 57 of file grpmappeptidetosubgroupset.h.

Constructor & Destructor Documentation

◆ GrpMapPeptideToSubGroupSet() [1/2]

pappso::GrpMapPeptideToSubGroupSet::GrpMapPeptideToSubGroupSet ( )

Definition at line 54 of file grpmappeptidetosubgroupset.cpp.

56 {

◆ GrpMapPeptideToSubGroupSet() [2/2]

pappso::GrpMapPeptideToSubGroupSet::GrpMapPeptideToSubGroupSet ( const GrpMapPeptideToSubGroupSet other)

Definition at line 62 of file grpmappeptidetosubgroupset.cpp.

65  {
66  std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map =

References pappso::GrpSubGroupSet::addAll(), and m_mapPeptideToSubGroupSet.

◆ ~GrpMapPeptideToSubGroupSet()

pappso::GrpMapPeptideToSubGroupSet::~GrpMapPeptideToSubGroupSet ( )

Definition at line 58 of file grpmappeptidetosubgroupset.cpp.

65  {

Member Function Documentation

◆ add()

void pappso::GrpMapPeptideToSubGroupSet::add ( GrpSubGroup p_add_sub_group)

add in the map all peptides of the subgroup to add

Definition at line 162 of file grpmappeptidetosubgroupset.cpp.

171 {
172  qDebug() << "GrpMapPeptideToSubGroupSet::hasSpecificPeptide begin";
173 
174  const GrpPeptideSet &peptide_set_in = p_sub_group->getPeptideSet();
175 
176  auto it_peptide_end = peptide_set_in.m_peptidePtrList.end();
177  std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map_end =
179 
180  for(auto it_peptide = peptide_set_in.m_peptidePtrList.begin();
181  it_peptide != it_peptide_end;
182  it_peptide++)
183  {
184  std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map =
185  m_mapPeptideToSubGroupSet.find(*it_peptide);
186  if(it_map != it_map_end)

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

◆ check()

void pappso::GrpMapPeptideToSubGroupSet::check ( std::list< GrpSubGroupSp > &  m_grpSubGroupSpList) const

check function only usefull for testing purpose

Definition at line 97 of file grpmappeptidetosubgroupset.cpp.

102 {
103  qDebug() << "GrpMapPeptideToSubGroupSet::remove begin "
104  << p_remove_sub_group->getFirstAccession();
105  // std::list<std::pair<GrpPeptide*, GrpSubGroupSet>>
106  // m_mapPeptideToSubGroupSet;
107  const GrpPeptideSet &peptide_set_in = p_remove_sub_group->getPeptideSet();
108 
109  auto it_peptide_end = peptide_set_in.m_peptidePtrList.end();
110  std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map_end =
112 
113  for(auto it_peptide = peptide_set_in.m_peptidePtrList.begin();
114  it_peptide != it_peptide_end;
115  it_peptide++)
116  {
117  std::map<GrpPeptide *, GrpSubGroupSet>::iterator it_map =
118  m_mapPeptideToSubGroupSet.find(*it_peptide);
119  if(it_map != it_map_end)

◆ getSubGroupSet()

void pappso::GrpMapPeptideToSubGroupSet::getSubGroupSet ( const GrpPeptideSet peptide_set_in,
GrpSubGroupSet impacted_subgroup_set 
) const

get all subgroups concerned by a list of peptides

Definition at line 74 of file grpmappeptidetosubgroupset.cpp.

78 {
79  qDebug() << "GrpMapPeptideToSubGroupSet::std begin ";
80  GrpMapPeptideToSubGroupSet test(*this);
81  qDebug() << "GrpMapPeptideToSubGroupSet::std before test.size() "
82  << test.size();
83 
84  for(auto pair : m_mapPeptideToSubGroupSet)
85  {
86  qDebug() << "GrpMapPeptideToSubGroupSet::std before peptide "
87  << pair.first->getSequence() << " " << pair.first;
88  }
89 
90  for(GrpSubGroupSp &sub_group_sp : m_grpSubGroupSpList)
91  {
92  test.remove(sub_group_sp.get());
93  }
94  qDebug() << "GrpMapPeptideToSubGroupSet::std after test.size() "
95  << test.size();

Referenced by pappso::GrpGroup::addSubGroupSp(), and pappso::GrpGroup::check().

◆ hasSpecificPeptide()

bool pappso::GrpMapPeptideToSubGroupSet::hasSpecificPeptide ( const GrpSubGroup get) const

tells if this subgroup contains a specific peptide

Definition at line 190 of file grpmappeptidetosubgroupset.cpp.

194  {
195  throw PappsoException(
196  QObject::tr("hasSpecificPeptide ERROR, peptide %1 from subgroup %2 "
197  "not referenced in GrpMapPeptideToSubGroupSet")
198  .arg((*it_peptide)->getSequence())
199  .arg(p_sub_group->getFirstAccession()));
200  }
201  }
202 
203  qDebug() << "GrpMapPeptideToSubGroupSet::hasSpecificPeptide end";
204  return false;
205 }
206 
207 const QString
209 {
210  QString infos;
211  auto itMap = m_mapPeptideToSubGroupSet.begin();
212  auto itMapEnd = m_mapPeptideToSubGroupSet.end();
213 
214  while(itMap != itMapEnd)
215  {
216  infos.append(
217  itMap->first->getSequence() + " " +
218  QString("0x%1").arg(
219  (quintptr)itMap->first, QT_POINTER_SIZE * 2, 16, QChar('0')) +
220  "\n");
221  itMap++;
222  }
223 
224  return infos;
225 }
226 

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

◆ printInfos()

const QString pappso::GrpMapPeptideToSubGroupSet::printInfos ( ) const

Definition at line 229 of file grpmappeptidetosubgroupset.cpp.

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

◆ remove()

void pappso::GrpMapPeptideToSubGroupSet::remove ( GrpSubGroup p_remove_sub_group)

removes in the map all references of the group to remove (p_remove_sub_group)

Definition at line 122 of file grpmappeptidetosubgroupset.cpp.

123  {
124  m_mapPeptideToSubGroupSet.erase(it_map);
125  }
126  }
127  else
128  {
129  throw PappsoException(
130  QObject::tr("remove ERROR, peptide %1 from subgroup %2 not "
131  "referenced in GrpMapPeptideToSubGroupSet")
132  .arg((*it_peptide)->getSequence())
133  .arg(p_remove_sub_group->getFirstAccession()));
134  }
135  }
136 
137  qDebug() << "GrpMapPeptideToSubGroupSet::remove end "
138  << p_remove_sub_group->getFirstAccession();
139 }
140 void
141 GrpMapPeptideToSubGroupSet::add(GrpSubGroup *p_add_sub_group)
142 {
143  qDebug()
144  << "GrpMapPeptideToSubGroupSet::add begin m_mapPeptideToSubGroupSet.size()"
145  << m_mapPeptideToSubGroupSet.size();
146 
147 
148  const GrpPeptideSet &peptide_set_in = p_add_sub_group->getPeptideSet();
149 
150  auto it_peptide_end = peptide_set_in.m_peptidePtrList.end();
151 
152  for(auto it_peptide = peptide_set_in.m_peptidePtrList.begin();
153  it_peptide != it_peptide_end;
154  it_peptide++)
155  {
156  std::pair<std::map<GrpPeptide *, GrpSubGroupSet>::iterator, bool> ret =
158  std::pair<GrpPeptide *, GrpSubGroupSet>(*it_peptide,
159  GrpSubGroupSet()));
160  // if (ret.second==false) { => key already exists

References m_mapPeptideToSubGroupSet.

Referenced by pappso::GrpGroup::addSubGroupSp(), and pappso::GrpGroup::removeFirstNonInformativeSubGroup().

◆ size()

unsigned int pappso::GrpMapPeptideToSubGroupSet::size ( ) const

Member Data Documentation

◆ m_mapPeptideToSubGroupSet

std::map<GrpPeptide *, GrpSubGroupSet> pappso::GrpMapPeptideToSubGroupSet::m_mapPeptideToSubGroupSet
private

Definition at line 81 of file grpmappeptidetosubgroupset.h.

Referenced by GrpMapPeptideToSubGroupSet(), and remove().


The documentation for this class was generated from the following files:
pappso::GrpSubGroupSp
std::shared_ptr< GrpSubGroup > GrpSubGroupSp
Definition: grpsubgroup.h:60
pappso::GrpMapPeptideToSubGroupSet::GrpMapPeptideToSubGroupSet
GrpMapPeptideToSubGroupSet()
Definition: grpmappeptidetosubgroupset.cpp:54
pappso::GrpMapPeptideToSubGroupSet::m_mapPeptideToSubGroupSet
std::map< GrpPeptide *, GrpSubGroupSet > m_mapPeptideToSubGroupSet
Definition: grpmappeptidetosubgroupset.h:81
pappso::GrpMapPeptideToSubGroupSet::printInfos
const QString printInfos() const
Definition: grpmappeptidetosubgroupset.cpp:229
pappso::GrpMapPeptideToSubGroupSet::add
void add(GrpSubGroup *p_add_sub_group)
add in the map all peptides of the subgroup to add
Definition: grpmappeptidetosubgroupset.cpp:162