libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
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
void remove (GrpSubGroup *p_remove_sub_group)
 removes in the map all references of the group to remove (p_remove_sub_group)
void add (GrpSubGroup *p_add_sub_group)
 add in the map all peptides of the subgroup to add
bool hasSpecificPeptide (const GrpSubGroup *get) const
 tells if this subgroup contains a specific peptide
void check (std::list< GrpSubGroupSp > &m_grpSubGroupSpList) const
 check function only usefull for testing purpose
unsigned int size () const
const QString printInfos () const

Private Attributes

std::map< GrpPeptide *, GrpSubGroupSetm_mapPeptideToSubGroupSet

Detailed Description

Definition at line 36 of file grpmappeptidetosubgroupset.h.

Constructor & Destructor Documentation

◆ GrpMapPeptideToSubGroupSet() [1/2]

pappso::GrpMapPeptideToSubGroupSet::GrpMapPeptideToSubGroupSet ( )

Definition at line 35 of file grpmappeptidetosubgroupset.cpp.

36{
37}

Referenced by GrpMapPeptideToSubGroupSet(), and check().

◆ GrpMapPeptideToSubGroupSet() [2/2]

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

Definition at line 43 of file grpmappeptidetosubgroupset.cpp.

44 : m_mapPeptideToSubGroupSet(other.m_mapPeptideToSubGroupSet)
45{
46}
std::map< GrpPeptide *, GrpSubGroupSet > m_mapPeptideToSubGroupSet

References GrpMapPeptideToSubGroupSet(), and m_mapPeptideToSubGroupSet.

◆ ~GrpMapPeptideToSubGroupSet()

pappso::GrpMapPeptideToSubGroupSet::~GrpMapPeptideToSubGroupSet ( )

Definition at line 39 of file grpmappeptidetosubgroupset.cpp.

40{
41}

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 134 of file grpmappeptidetosubgroupset.cpp.

135{
136 qDebug() << "GrpMapPeptideToSubGroupSet::add begin m_mapPeptideToSubGroupSet.size()"
138
139
140 const GrpPeptideSet &peptide_set_in = p_add_sub_group->getPeptideSet();
141
142 auto it_peptide_end = peptide_set_in.m_peptidePtrList.end();
143
144 for(auto it_peptide = peptide_set_in.m_peptidePtrList.begin(); it_peptide != it_peptide_end;
145 it_peptide++)
146 {
147 std::pair<std::map<GrpPeptide *, GrpSubGroupSet>::iterator, bool> ret =
149 std::pair<GrpPeptide *, GrpSubGroupSet>(*it_peptide, GrpSubGroupSet()));
150 // if (ret.second==false) { => key already exists
151 ret.first->second.add(p_add_sub_group);
152 }
153
154 qDebug() << "GrpMapPeptideToSubGroupSet::add end";
155}

References pappso::GrpSubGroup::getPeptideSet(), m_mapPeptideToSubGroupSet, and pappso::GrpPeptideSet::m_peptidePtrList.

◆ check()

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

check function only usefull for testing purpose

Definition at line 75 of file grpmappeptidetosubgroupset.cpp.

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

References GrpMapPeptideToSubGroupSet(), m_mapPeptideToSubGroupSet, remove(), and size().

◆ 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 54 of file grpmappeptidetosubgroupset.cpp.

56{
57 qDebug() << "GrpMapPeptideToSubGroupSet::getSubGroupSet begin ";
58 auto it_peptide_end = peptide_set_in.m_peptidePtrList.end();
59 std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map_end =
61
62 for(auto it_peptide = peptide_set_in.m_peptidePtrList.begin(); it_peptide != it_peptide_end;
63 it_peptide++)
64 {
65 std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map =
66 m_mapPeptideToSubGroupSet.find(*it_peptide);
67 if(it_map != it_map_end)
68 {
69 impacted_subgroup_set.addAll(it_map->second);
70 }
71 }
72 qDebug() << "GrpMapPeptideToSubGroupSet::getSubGroupSet end ";
73}

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

◆ hasSpecificPeptide()

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

tells if this subgroup contains a specific peptide

Definition at line 159 of file grpmappeptidetosubgroupset.cpp.

160{
161 qDebug() << "GrpMapPeptideToSubGroupSet::hasSpecificPeptide begin";
162
163 const GrpPeptideSet &peptide_set_in = p_sub_group->getPeptideSet();
164
165 auto it_peptide_end = peptide_set_in.m_peptidePtrList.end();
166 std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map_end =
168
169 for(auto it_peptide = peptide_set_in.m_peptidePtrList.begin(); it_peptide != it_peptide_end;
170 it_peptide++)
171 {
172 std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map =
173 m_mapPeptideToSubGroupSet.find(*it_peptide);
174 if(it_map != it_map_end)
175 {
176 if(it_map->second.size() == 1)
177 {
178 return true;
179 }
180 }
181 else
182 {
183 throw PappsoException(QObject::tr("hasSpecificPeptide ERROR, peptide %1 from subgroup %2 "
184 "not referenced in GrpMapPeptideToSubGroupSet")
185 .arg((*it_peptide)->getSequence())
186 .arg(p_sub_group->getFirstAccession()));
187 }
188 }
189
190 qDebug() << "GrpMapPeptideToSubGroupSet::hasSpecificPeptide end";
191 return false;
192}

References pappso::GrpSubGroup::getFirstAccession(), pappso::GrpSubGroup::getPeptideSet(), m_mapPeptideToSubGroupSet, and pappso::GrpPeptideSet::m_peptidePtrList.

◆ printInfos()

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

Definition at line 195 of file grpmappeptidetosubgroupset.cpp.

196{
197 QString infos;
198 auto itMap = m_mapPeptideToSubGroupSet.begin();
199 auto itMapEnd = m_mapPeptideToSubGroupSet.end();
200
201 while(itMap != itMapEnd)
202 {
203 infos.append(
204 itMap->first->getSequence() + " " +
205 QString("0x%1").arg((quintptr)itMap->first, QT_POINTER_SIZE * 2, 16, QChar('0')) + "\n");
206 itMap++;
207 }
208
209 return infos;
210}

References m_mapPeptideToSubGroupSet.

◆ 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 97 of file grpmappeptidetosubgroupset.cpp.

98{
99 qDebug() << "GrpMapPeptideToSubGroupSet::remove begin "
100 << p_remove_sub_group->getFirstAccession();
101 // std::list<std::pair<GrpPeptide*, GrpSubGroupSet>>
102 // m_mapPeptideToSubGroupSet;
103 const GrpPeptideSet &peptide_set_in = p_remove_sub_group->getPeptideSet();
104
105 auto it_peptide_end = peptide_set_in.m_peptidePtrList.end();
106 std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map_end =
108
109 for(auto it_peptide = peptide_set_in.m_peptidePtrList.begin(); it_peptide != it_peptide_end;
110 it_peptide++)
111 {
112 std::map<GrpPeptide *, GrpSubGroupSet>::iterator it_map =
113 m_mapPeptideToSubGroupSet.find(*it_peptide);
114 if(it_map != it_map_end)
115 {
116 it_map->second.remove(p_remove_sub_group);
117 if(it_map->second.size() == 0)
118 {
119 m_mapPeptideToSubGroupSet.erase(it_map);
120 }
121 }
122 else
123 {
124 throw PappsoException(QObject::tr("remove ERROR, peptide %1 from subgroup %2 not "
125 "referenced in GrpMapPeptideToSubGroupSet")
126 .arg((*it_peptide)->getSequence())
127 .arg(p_remove_sub_group->getFirstAccession()));
128 }
129 }
130
131 qDebug() << "GrpMapPeptideToSubGroupSet::remove end " << p_remove_sub_group->getFirstAccession();
132}

References pappso::GrpSubGroup::getFirstAccession(), pappso::GrpSubGroup::getPeptideSet(), m_mapPeptideToSubGroupSet, and pappso::GrpPeptideSet::m_peptidePtrList.

Referenced by check().

◆ size()

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

Referenced by check().

Member Data Documentation

◆ m_mapPeptideToSubGroupSet

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

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