Loading...
Searching...
No Matches
pappso::GrpGroup Class Reference

`#include <grpgroup.h>`

## Public Member Functions

| GrpGroup (const GrpGroup &grpGroupSp)
| ~GrpGroup ()
bool | operator< (const GrpGroup &other) const
bool | containsAny (const GrpPeptideSet &peptideSet) const
void | addSubGroupSp (const GrpSubGroupSp &grpSubGroupSp)
void | addGroup (GrpGroup *p_group_to_add)
void | numbering ()
void | setGroupNumber (unsigned int i)
bool | removeNonInformativeSubGroups ()
const QString | getGroupingId () const
unsigned int | getGroupNumber () const
const GrpPeptideSet & | getGrpPeptideSet () const
std::vector< GrpSubGroupSpConst > | getGrpSubGroupSpList () const

## Protected Member Functions

const std::list< GrpSubGroupSp > & | getSubGroupSpList () const
| GrpGroup (GrpSubGroupSp &grpSubGroupSp)
GrpGroupSp | makeGrpGroupSp ()
bool | removeFirstNonInformativeSubGroup ()
void | check () const

## Private Attributes

std::list< GrpSubGroupSp > | m_subGroupList
unsigned int | m_groupNumber = 0
GrpPeptideSet | m_peptideSet
GrpMapPeptideToSubGroupSet | m_mapPeptideToSubGroupSet

## Friends

class | GrpExperiment

## Detailed Description

Definition at line 43 of file grpgroup.h.

## Constructor & Destructor Documentation

## GrpGroup() [1/2]

GrpGroup::GrpGroup | ( | GrpSubGroupSp & | grpSubGroupSp | ) |

protected

Definition at line 37 of file grpgroup.cpp.

{
m_peptideSet.addAll(grpSubGroupSp.get()->getPeptideSet());
m_subGroupList.push_back(grpSubGroupSp);
m_mapPeptideToSubGroupSet.add(grpSubGroupSp.get());
}
pappso::GrpGroup::m_subGroupList
std::list< GrpSubGroupSp > m_subGroupList
Definition grpgroup.h:48
pappso::GrpGroup::m_mapPeptideToSubGroupSet
GrpMapPeptideToSubGroupSet m_mapPeptideToSubGroupSet
Definition grpgroup.h:52
pappso::GrpGroup::m_peptideSet
GrpPeptideSet m_peptideSet
Definition grpgroup.h:50
pappso::GrpSubGroup::getPeptideSet
const GrpPeptideSet & getPeptideSet() const
Definition grpsubgroup.cpp:132

References pappso::GrpSubGroup::getPeptideSet(), m_mapPeptideToSubGroupSet, m_peptideSet, and m_subGroupList.

Referenced by GrpGroup(), addGroup(), and operator<().

## GrpGroup() [2/2]

GrpGroup::GrpGroup | ( | const GrpGroup & | grpGroupSp | ) |

Definition at line 43 of file grpgroup.cpp.

: m_subGroupList(other.m_subGroupList),
m_peptideSet(other.m_peptideSet),
m_mapPeptideToSubGroupSet(other.m_mapPeptideToSubGroupSet)
{
}

References GrpGroup(), m_mapPeptideToSubGroupSet, m_peptideSet, and m_subGroupList.

## ~GrpGroup()

GrpGroup::~GrpGroup | ( |  | ) |

Definition at line 50 of file grpgroup.cpp.

{
}

## Member Function Documentation

## addGroup()

void GrpGroup::addGroup | ( | GrpGroup * | p_group_to_add | ) |

Definition at line 110 of file grpgroup.cpp.

{
if(this == p_group_to_add)
{
throw PappsoException(QObject::tr("addGroup ERROR, this == p_group_to_add"));
}
for(GrpSubGroupSp &sgToAdd : p_group_to_add->m_subGroupList)
{
addSubGroupSp(sgToAdd);
}
}
pappso::GrpGroup::addSubGroupSp
void addSubGroupSp(const GrpSubGroupSp &grpSubGroupSp)
Definition grpgroup.cpp:147
pappso::GrpSubGroupSp
std::shared_ptr< GrpSubGroup > GrpSubGroupSp
Definition grpsubgroup.h:39

References GrpGroup(), addSubGroupSp(), and m_subGroupList.

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

## addSubGroupSp()

void GrpGroup::addSubGroupSp | ( | const GrpSubGroupSp & | grpSubGroupSp | ) |

Definition at line 147 of file grpgroup.cpp.

{
qDebug() << "GrpGroup::addSubGroupSp begin " << grpSubGroupSp.get()->getFirstAccession();
// look for impacted subgroups (containing peptides alsoe present in incoming
// subgroup
GrpSubGroupSet impacted_subgroup_list;
m_mapPeptideToSubGroupSet.getSubGroupSet(grpSubGroupSp.get()->getPeptideSet(),
impacted_subgroup_list);
if(impacted_subgroup_list.contains(grpSubGroupSp.get()))
{
throw PappsoException(QObject::tr("addSubGroupSp ERROR, subgroup %1 is already in group")
.arg(grpSubGroupSp.get()->getFirstAccession()));
}
// look for impacted subgroup equal to incoming subgroup and merge it and exit
qDebug() << "GrpGroup::addSubGroupSp look for impacted subgroup equal to "
"incoming subgroup and merge it and exit";
auto it_impacted_sg = impacted_subgroup_list.m_grpSubGroupPtrList.begin();
auto it_impacted_sg_end = impacted_subgroup_list.m_grpSubGroupPtrList.end();
while(it_impacted_sg != it_impacted_sg_end)
{
if((*it_impacted_sg)->merge(grpSubGroupSp.get()))
{
qDebug() << "GrpGroup::addSubGroupSp merge";
return;
}
it_impacted_sg++;
}
// look for impacted subgroup including totally the incoming subgroup and exit
qDebug() << "GrpGroup::addSubGroupSp look for impacted subgroup including "
"totally the incoming subgroup and exit";
it_impacted_sg = impacted_subgroup_list.m_grpSubGroupPtrList.begin();
while(it_impacted_sg != it_impacted_sg_end)
{
if((*it_impacted_sg)->includes(grpSubGroupSp.get()))
{
qDebug() << "GrpGroup::addSubGroupSp includes";
return;
}
it_impacted_sg++;
}
// look for impacted subgroup totally included in incoming subgroup and remove
// it
qDebug() << "GrpGroup::addSubGroupSp look for impacted subgroup totally "
"included in incoming subgroup and remove it";
it_impacted_sg = impacted_subgroup_list.m_grpSubGroupPtrList.begin();
while(it_impacted_sg != it_impacted_sg_end)
{
if(grpSubGroupSp.get()->includes((*it_impacted_sg)))
{
// this->removeSubGroup(*it_impacted_sg);
// it_impacted_sg = impacted_subgroup_list.erase(it_impacted_sg);
GrpSubGroup *sg_to_remove = *it_impacted_sg;
it_impacted_sg = impacted_subgroup_list.erase(it_impacted_sg);
m_mapPeptideToSubGroupSet.remove(sg_to_remove);
m_subGroupList.remove_if([sg_to_remove](GrpSubGroupSp &sub_groupSp) {
return (sg_to_remove == sub_groupSp.get());
});
// m_mapPeptideToSubGroupSet.check(m_subGroupList);
}
else
{
it_impacted_sg++;
}
}
qDebug() << "GrpGroup::addSubGroupSp finally add the new subgroup to current group";
// finally add the new subgroup to current group
m_subGroupList.push_back(grpSubGroupSp);
m_mapPeptideToSubGroupSet.add(grpSubGroupSp.get());
m_peptideSet.addAll(grpSubGroupSp.get()->getPeptideSet());
// check();
// m_mapPeptideToSubGroupSet.check(m_subGroupList);
qDebug() << "GrpGroup::addSubGroupSp end";
}
pappso::GrpSubGroupSet::contains
bool contains(GrpSubGroup *get) const
Definition grpsubgroupset.cpp:87
pappso::GrpSubGroupSet::erase
std::list< GrpSubGroup * >::iterator erase(std::list< GrpSubGroup * >::iterator it)
Definition grpsubgroupset.h:53
pappso::GrpSubGroupSet::m_grpSubGroupPtrList
std::list< GrpSubGroup * > m_grpSubGroupPtrList
Definition grpsubgroupset.h:38
pappso::GrpSubGroup::includes
bool includes(const GrpSubGroup *p_subgroup) const
Definition grpsubgroup.cpp:163
pappso::GrpSubGroup::getFirstAccession
const QString & getFirstAccession() const
Definition grpsubgroup.cpp:223

References pappso::GrpSubGroupSet::contains(), pappso::GrpSubGroupSet::erase(), pappso::GrpSubGroup::getFirstAccession(), pappso::GrpSubGroup::getPeptideSet(), pappso::GrpSubGroup::includes(), pappso::GrpSubGroupSet::m_grpSubGroupPtrList, m_mapPeptideToSubGroupSet, m_peptideSet, and m_subGroupList.

Referenced by addGroup(), and pappso::GrpExperiment::addSubGroupSp().

## check()

void GrpGroup::check | ( |  | ) | const

protected

Definition at line 124 of file grpgroup.cpp.

{
qDebug() << "GrpGroup::check begin ";
GrpSubGroupSet impacted_subgroup_list;
m_mapPeptideToSubGroupSet.getSubGroupSet(this->m_peptideSet, impacted_subgroup_list);
// if (impacted_subgroup_list.size() != this->m_subGroupList.size()) {
qDebug() << "GrpGroup::check impacted_subgroup_list.size() != "
"this->m_subGroupList.size()";
qDebug() << impacted_subgroup_list.printInfos();
for(auto sg : m_subGroupList)
{
qDebug() << sg->getFirstAccession() << " " << sg.get();
}
//}
qDebug() << m_mapPeptideToSubGroupSet.printInfos();
qDebug() << m_peptideSet.printInfos();
qDebug() << "GrpGroup::check end ";
}
pappso::GrpSubGroupSet::printInfos
const QString printInfos() const
Definition grpsubgroupset.cpp:136

References m_mapPeptideToSubGroupSet, m_peptideSet, m_subGroupList, and pappso::GrpSubGroupSet::printInfos().

## containsAny()

bool GrpGroup::containsAny | ( | const GrpPeptideSet & | peptideSet | ) | const

Definition at line 103 of file grpgroup.cpp.

{
return m_peptideSet.containsAny(peptideSet);
}

References m_peptideSet.

Referenced by ContainsAny::operator()(), and pappso::GrpExperiment::startGrouping().

## getGroupingId()

const QString GrpGroup::getGroupingId | ( |  | ) | const

Definition at line 82 of file grpgroup.cpp.

{
if(m_groupNumber == 0)
{
return "";
}
return QString("%1").arg(Utils::getLexicalOrderedString(m_groupNumber));
}
pappso::GrpGroup::m_groupNumber
unsigned int m_groupNumber
Definition grpgroup.h:49
pappso::Utils::getLexicalOrderedString
static const QString getLexicalOrderedString(unsigned int num)
Definition utils.cpp:72

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

## getGroupNumber()

unsigned int GrpGroup::getGroupNumber | ( |  | ) | const

Definition at line 77 of file grpgroup.cpp.

{
return m_groupNumber;
}

References m_groupNumber.

## getGrpPeptideSet()

const GrpPeptideSet & GrpGroup::getGrpPeptideSet | ( |  | ) | const

Definition at line 72 of file grpgroup.cpp.

{
return m_peptideSet;
}

References m_peptideSet.

## getGrpSubGroupSpList()

std::vector< GrpSubGroupSpConst > GrpGroup::getGrpSubGroupSpList | ( |  | ) | const

Definition at line 55 of file grpgroup.cpp.

{
std::vector<GrpSubGroupSpConst> subgroup_list;
for(GrpSubGroupSp subgroup : m_subGroupList)
{
subgroup_list.push_back(subgroup);
}
return subgroup_list;
};

References m_subGroupList.

## getSubGroupSpList()

const std::list< GrpSubGroupSp > & GrpGroup::getSubGroupSpList | ( |  | ) | const

protected

Definition at line 66 of file grpgroup.cpp.

{
return m_subGroupList;
}

References m_subGroupList.

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

## makeGrpGroupSp()

GrpGroupSp GrpGroup::makeGrpGroupSp | ( |  | ) |

protected

Definition at line 97 of file grpgroup.cpp.

{
return std::make_shared<GrpGroup>(*this);
}

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

## numbering()

void GrpGroup::numbering | ( |  | ) |

Definition at line 248 of file grpgroup.cpp.

{
qDebug() << "GrpGroup::numbering begin";
for(auto &&sub_group_sp : m_subGroupList)
{
sub_group_sp.get()->numbering();
}
m_subGroupList.sort(
[](GrpSubGroupSp &first, GrpSubGroupSp &second) { return ((*first.get()) < (*second.get())); });
unsigned int i = 1;
for(auto &&sub_group_sp : m_subGroupList)
{
sub_group_sp.get()->setSubGroupNumber(i);
i++;
}
m_peptideSet.numbering();
qDebug() << "GrpGroup::numbering end";
}

References m_peptideSet, and m_subGroupList.

## operator<()

bool GrpGroup::operator< | ( | const GrpGroup & | other | ) | const

Definition at line 90 of file grpgroup.cpp.

{
return ((*(m_subGroupList.begin()->get())) < (*(other.m_subGroupList.begin()->get())));
}

References GrpGroup(), and m_subGroupList.

## removeFirstNonInformativeSubGroup()

bool GrpGroup::removeFirstNonInformativeSubGroup | ( |  | ) |

protected

Definition at line 271 of file grpgroup.cpp.

{
qDebug() << "GrpGroup::removeFirstNonInformativeSubGroup begin";
std::list<GrpSubGroup *> subgroup_list_to_remove;
for(auto &&sub_group_sp : m_subGroupList)
{
if(m_mapPeptideToSubGroupSet.hasSpecificPeptide(sub_group_sp.get()))
{
}
else
{
subgroup_list_to_remove.push_back(sub_group_sp.get());
}
}
if(subgroup_list_to_remove.size() == 0)
{
qDebug() << "GrpGroup::removeFirstNonInformativeSubGroup end false";
return false;
}
// sort subgroup to remove
subgroup_list_to_remove.sort(
[](GrpSubGroup *first, GrpSubGroup *second) { return ((*first) < (*second)); });
// remove the last one
qDebug() << "GrpGroup::removeFirstNonInformativeSubGroup "
"subgroup_list_to_remove.front()->peptideListSize() "
<< subgroup_list_to_remove.front()->peptideListSize();
qDebug() << "GrpGroup::removeFirstNonInformativeSubGroup "
"subgroup_list_to_remove.back()->peptideListSize() "
<< subgroup_list_to_remove.back()->peptideListSize();
// the first subgroup is weaker (less peptides or less protein than others)
GrpSubGroup *sg_to_remove = subgroup_list_to_remove.front();
m_mapPeptideToSubGroupSet.remove(sg_to_remove);
qDebug() << "GrpGroup::removeFirstNonInformativeSubGroup m_subGroupList.size() "
<< m_subGroupList.size();
m_subGroupList.remove_if(
[sg_to_remove](GrpSubGroupSp &sub_groupSp) { return (sg_to_remove == sub_groupSp.get()); });
qDebug() << "GrpGroup::removeFirstNonInformativeSubGroup after remove if "
"m_subGroupList.size() "
<< m_subGroupList.size();
qDebug() << "GrpGroup::removeFirstNonInformativeSubGroup end true";
return true;
}

References m_mapPeptideToSubGroupSet, and m_subGroupList.

Referenced by removeNonInformativeSubGroups().

## removeNonInformativeSubGroups()

bool GrpGroup::removeNonInformativeSubGroups | ( |  | ) |

Definition at line 319 of file grpgroup.cpp.

{
qDebug() << "GrpGroup::removeNonInformativeSubGroups begin";
if(removeFirstNonInformativeSubGroup())
{
while(removeFirstNonInformativeSubGroup())
{
qDebug() << "GrpGroup::removeNonInformativeSubGroups while";
}
}
else
{
return false;
}
return true;
}
pappso::GrpGroup::removeFirstNonInformativeSubGroup
bool removeFirstNonInformativeSubGroup()
Definition grpgroup.cpp:271

References removeFirstNonInformativeSubGroup().

## setGroupNumber()

void GrpGroup::setGroupNumber | ( | unsigned int | i | ) |

Definition at line 234 of file grpgroup.cpp.

{
qDebug() << "GrpGroup::setGroupNumber begin";
m_groupNumber = i;
for(auto &&sub_group_sp : m_subGroupList)
{
sub_group_sp->setGroupNumber(i);
}
m_peptideSet.setGroupNumber(i);
qDebug() << "GrpGroup::setGroupNumber end";
}

References m_groupNumber, m_peptideSet, and m_subGroupList.

## Friends And Related Symbol Documentation

## GrpExperiment

friend class GrpExperiment

friend

Definition at line 45 of file grpgroup.h.

References GrpExperiment.

Referenced by GrpExperiment.

## Member Data Documentation

## m_groupNumber

unsigned int pappso::GrpGroup::m_groupNumber = 0

private

Definition at line 49 of file grpgroup.h.

Referenced by getGroupingId(), getGroupNumber(), and setGroupNumber().

## m_mapPeptideToSubGroupSet

GrpMapPeptideToSubGroupSet pappso::GrpGroup::m_mapPeptideToSubGroupSet

private

Definition at line 52 of file grpgroup.h.

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

## m_peptideSet

GrpPeptideSet pappso::GrpGroup::m_peptideSet

private

Definition at line 50 of file grpgroup.h.

Referenced by GrpGroup(), GrpGroup(), addSubGroupSp(), check(), containsAny(), getGrpPeptideSet(), numbering(), and setGroupNumber().

## m_subGroupList

std::list<GrpSubGroupSp> pappso::GrpGroup::m_subGroupList

private

Definition at line 48 of file grpgroup.h.

Referenced by GrpGroup(), GrpGroup(), addGroup(), addSubGroupSp(), check(), getGrpSubGroupSpList(), getSubGroupSpList(), numbering(), operator<(), removeFirstNonInformativeSubGroup(), and setGroupNumber().

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

- pappsomspp/core/grouping/grpgroup.h
- pappsomspp/core/grouping/grpgroup.cpp