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 *, GrpSubGroupSet > | m_mapPeptideToSubGroupSet

## Detailed Description

Definition at line 36 of file grpmappeptidetosubgroupset.h.

## Constructor & Destructor Documentation

## GrpMapPeptideToSubGroupSet() [1/2]

pappso::GrpMapPeptideToSubGroupSet::GrpMapPeptideToSubGroupSet | ( |  | ) |

Definition at line 33 of file grpmappeptidetosubgroupset.cpp.

{
}

## GrpMapPeptideToSubGroupSet() [2/2]

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

Definition at line 41 of file grpmappeptidetosubgroupset.cpp.

: m_mapPeptideToSubGroupSet(other.m_mapPeptideToSubGroupSet)
{
}
pappso::GrpMapPeptideToSubGroupSet::m_mapPeptideToSubGroupSet
std::map< GrpPeptide *, GrpSubGroupSet > m_mapPeptideToSubGroupSet
Definition: grpmappeptidetosubgroupset.h:39

## ~GrpMapPeptideToSubGroupSet()

pappso::GrpMapPeptideToSubGroupSet::~GrpMapPeptideToSubGroupSet | ( |  | ) |

Definition at line 37 of file grpmappeptidetosubgroupset.cpp.

{
}

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

{
qDebug()
<< "GrpMapPeptideToSubGroupSet::add begin m_mapPeptideToSubGroupSet.size()"
<< m_mapPeptideToSubGroupSet.size();
const GrpPeptideSet &peptide_set_in = p_add_sub_group->getPeptideSet();
auto it_peptide_end = peptide_set_in.m_peptidePtrList.end();
for(auto it_peptide = peptide_set_in.m_peptidePtrList.begin();
it_peptide != it_peptide_end;
it_peptide++)
{
std::pair<std::map<GrpPeptide *, GrpSubGroupSet>::iterator, bool> ret =
m_mapPeptideToSubGroupSet.insert(
std::pair<GrpPeptide *, GrpSubGroupSet>(*it_peptide,
GrpSubGroupSet()));
// if (ret.second==false) { => key already exists
ret.first->second.add(p_add_sub_group);
}
qDebug() << "GrpMapPeptideToSubGroupSet::add end";
}

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

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

## check()

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

check function only usefull for testing purpose

Definition at line 76 of file grpmappeptidetosubgroupset.cpp.

{
qDebug() << "GrpMapPeptideToSubGroupSet::std begin ";
GrpMapPeptideToSubGroupSet test(*this);
qDebug() << "GrpMapPeptideToSubGroupSet::std before test.size() "
<< test.size();
for(auto pair : m_mapPeptideToSubGroupSet)
{
qDebug() << "GrpMapPeptideToSubGroupSet::std before peptide "
<< pair.first->getSequence() << " " << pair.first;
}
for(GrpSubGroupSp &sub_group_sp : m_grpSubGroupSpList)
{
test.remove(sub_group_sp.get());
}
qDebug() << "GrpMapPeptideToSubGroupSet::std after test.size() "
<< test.size();
qDebug() << "GrpMapPeptideToSubGroupSet::std begin ";
}
pappso::GrpMapPeptideToSubGroupSet::GrpMapPeptideToSubGroupSet
GrpMapPeptideToSubGroupSet()
Definition: grpmappeptidetosubgroupset.cpp:33
pappso::GrpSubGroupSp
std::shared_ptr< GrpSubGroup > GrpSubGroupSp
Definition: grpsubgroup.h:39

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

{
qDebug() << "GrpMapPeptideToSubGroupSet::getSubGroupSet begin ";
auto it_peptide_end = peptide_set_in.m_peptidePtrList.end();
std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map_end =
m_mapPeptideToSubGroupSet.end();
for(auto it_peptide = peptide_set_in.m_peptidePtrList.begin();
it_peptide != it_peptide_end;
it_peptide++)
{
std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map =
m_mapPeptideToSubGroupSet.find(*it_peptide);
if(it_map != it_map_end)
{
impacted_subgroup_set.addAll(it_map->second);
}
}
qDebug() << "GrpMapPeptideToSubGroupSet::getSubGroupSet end ";
}

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

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

{
qDebug() << "GrpMapPeptideToSubGroupSet::hasSpecificPeptide begin";
const GrpPeptideSet &peptide_set_in = p_sub_group->getPeptideSet();
auto it_peptide_end = peptide_set_in.m_peptidePtrList.end();
std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map_end =
m_mapPeptideToSubGroupSet.end();
for(auto it_peptide = peptide_set_in.m_peptidePtrList.begin();
it_peptide != it_peptide_end;
it_peptide++)
{
std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map =
m_mapPeptideToSubGroupSet.find(*it_peptide);
if(it_map != it_map_end)
{
if(it_map->second.size() == 1)
{
return true;
}
}
else
{
throw PappsoException(
QObject::tr("hasSpecificPeptide ERROR, peptide %1 from subgroup %2 "
"not referenced in GrpMapPeptideToSubGroupSet")
.arg((*it_peptide)->getSequence())
.arg(p_sub_group->getFirstAccession()));
}
}
qDebug() << "GrpMapPeptideToSubGroupSet::hasSpecificPeptide end";
return false;
}

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

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

## printInfos()

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

Definition at line 208 of file grpmappeptidetosubgroupset.cpp.

{
QString infos;
auto itMap = m_mapPeptideToSubGroupSet.begin();
auto itMapEnd = m_mapPeptideToSubGroupSet.end();
while(itMap != itMapEnd)
{
infos.append(
itMap->first->getSequence() + " " +
QString("0x%1").arg(
(quintptr)itMap->first, QT_POINTER_SIZE * 2, 16, QChar('0')) +
"\n");
itMap++;
}
return infos;
}

References m_mapPeptideToSubGroupSet.

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

{
qDebug() << "GrpMapPeptideToSubGroupSet::remove begin "
<< p_remove_sub_group->getFirstAccession();
// std::list<std::pair<GrpPeptide*, GrpSubGroupSet>>
// m_mapPeptideToSubGroupSet;
const GrpPeptideSet &peptide_set_in = p_remove_sub_group->getPeptideSet();
auto it_peptide_end = peptide_set_in.m_peptidePtrList.end();
std::map<GrpPeptide *, GrpSubGroupSet>::const_iterator it_map_end =
m_mapPeptideToSubGroupSet.end();
for(auto it_peptide = peptide_set_in.m_peptidePtrList.begin();
it_peptide != it_peptide_end;
it_peptide++)
{
std::map<GrpPeptide *, GrpSubGroupSet>::iterator it_map =
m_mapPeptideToSubGroupSet.find(*it_peptide);
if(it_map != it_map_end)
{
it_map->second.remove(p_remove_sub_group);
if(it_map->second.size() == 0)
{
m_mapPeptideToSubGroupSet.erase(it_map);
}
}
else
{
throw PappsoException(
QObject::tr("remove ERROR, peptide %1 from subgroup %2 not "
"referenced in GrpMapPeptideToSubGroupSet")
.arg((*it_peptide)->getSequence())
.arg(p_remove_sub_group->getFirstAccession()));
}
}
qDebug() << "GrpMapPeptideToSubGroupSet::remove end "
<< p_remove_sub_group->getFirstAccession();
}

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

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

## size()

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

Referenced by check().

## Member Data Documentation

## m_mapPeptideToSubGroupSet

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

private

Definition at line 39 of file grpmappeptidetosubgroupset.h.

Referenced by add(), check(), getSubGroupSet(), hasSpecificPeptide(), printInfos(), and remove().

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

- pappsomspp/grouping/grpmappeptidetosubgroupset.h
- pappsomspp/grouping/grpmappeptidetosubgroupset.cpp