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

`#include <grpexperiment.h>`

## Public Member Functions

GrpProteinSp & | getGrpProteinSp (const QString &acc, const QString &description)
GrpPeptideSp & | setGrpPeptide (const GrpProteinSp &proteinSp, const QString &sequence, pappso_double mass)
| GrpExperiment (GrpGroupingMonitorInterface *p_monitor)
virtual | ~GrpExperiment ()
void | startGrouping ()
std::vector< GrpProteinSpConst > | getGrpProteinSpList () const
void | setRemoveNonInformativeSubgroups (bool ok)
void | addPostGroupingGrpProteinSpRemoval (GrpProteinSp sp_protein)
| protein to remove with its entire group after grouping is completed typically : to use with protein contaminants if you want to ignore any group containing one contaminant protein
void | addPreGroupingGrpProteinSpRemoval (GrpProteinSp sp_protein)
| protein peptides to remove before grouping typically : remove protein contaminants in special metaproteomics cases
std::vector< GrpGroupSpConst > | getGrpGroupSpList () const

## Private Member Functions

void | addSubGroupSp (GrpMapPeptideToGroup &grp_map_peptide_to_group, GrpSubGroupSp &grpSubGroupSp) const
void | numbering ()
void | removeNonInformativeSubGroups ()

## Private Attributes

GrpGroupingMonitorInterface * | mp_monitor = nullptr
bool | m_isRemoveNonInformativeSubgroups = true
std::map< QString, GrpProteinSp > | m_mapProteins
std::map< QString, std::map< unsigned long, GrpPeptideSp > > | m_mapPeptides
std::list< GrpPeptideSp > | m_grpPeptideList
std::list< GrpProteinSp > | m_grpProteinList
bool | m_isGroupingStarted = false
std::list< GrpProtein * > | m_remainingGrpProteinList
GrpPeptideSet | m_grpPostGroupingProteinListRemoval
GrpPeptideSet | m_grpPreGroupingProteinListRemoval
std::list< GrpGroupSp > | m_grpGroupSpList

## Detailed Description

Definition at line 41 of file grpexperiment.h.

## Constructor & Destructor Documentation

## GrpExperiment()

GrpExperiment::GrpExperiment | ( | GrpGroupingMonitorInterface * | p_monitor | ) |

Definition at line 37 of file grpexperiment.cpp.

{
mp_monitor = p_monitor;
}
pappso::GrpExperiment::mp_monitor
GrpGroupingMonitorInterface * mp_monitor
Definition grpexperiment.h:44

References mp_monitor.

## ~GrpExperiment()

GrpExperiment::~GrpExperiment | ( |  | ) |

virtual

Definition at line 42 of file grpexperiment.cpp.

{
}

## Member Function Documentation

## addPostGroupingGrpProteinSpRemoval()

void GrpExperiment::addPostGroupingGrpProteinSpRemoval | ( | GrpProteinSp | sp_protein | ) |

protein to remove with its entire group after grouping is completed typically : to use with protein contaminants if you want to ignore any group containing one contaminant protein

Definition at line 52 of file grpexperiment.cpp.

{
GrpPeptideSet peptide_set(sp_protein.get());
m_grpPostGroupingProteinListRemoval.addAll(peptide_set);
}
pappso::GrpExperiment::m_grpPostGroupingProteinListRemoval
GrpPeptideSet m_grpPostGroupingProteinListRemoval
Definition grpexperiment.h:54

References m_grpPostGroupingProteinListRemoval.

## addPreGroupingGrpProteinSpRemoval()

void GrpExperiment::addPreGroupingGrpProteinSpRemoval | ( | GrpProteinSp | sp_protein | ) |

protein peptides to remove before grouping typically : remove protein contaminants in special metaproteomics cases

Definition at line 60 of file grpexperiment.cpp.

{
GrpPeptideSet peptide_set(sp_protein.get());
m_grpPreGroupingProteinListRemoval.addAll(peptide_set);
}
pappso::GrpExperiment::m_grpPreGroupingProteinListRemoval
GrpPeptideSet m_grpPreGroupingProteinListRemoval
Definition grpexperiment.h:56

References m_grpPreGroupingProteinListRemoval.

## addSubGroupSp()

void GrpExperiment::addSubGroupSp | ( | GrpMapPeptideToGroup & | grp_map_peptide_to_group,
|  | GrpSubGroupSp & | grpSubGroupSp ) const

private

Definition at line 196 of file grpexperiment.cpp.

{
qDebug() << "GrpExperiment::addSubGroupSp begin " << grpSubGroupSp.get()->getFirstAccession();
std::list<GrpGroupSp> new_group_list;
grp_map_peptide_to_group.getGroupList(grpSubGroupSp.get()->getPeptideSet(), new_group_list);
if(new_group_list.size() == 0)
{
qDebug() << "GrpExperiment::addSubGroupSp create a new group";
// create a new group
GrpGroupSp sp_group = GrpGroup(grpSubGroupSp).makeGrpGroupSp();
// m_grpGroupSpList.push_back(sp_group);
grp_map_peptide_to_group.set(grpSubGroupSp.get()->getPeptideSet(), sp_group);
}
else
{
qDebug() << "GrpExperiment::addSubGroupSp fusion groupList.size() " << new_group_list.size();
// fusion group and add the subgroup
auto itGroup = new_group_list.begin();
GrpGroupSp p_keepGroup = *itGroup;
qDebug() << "GrpExperiment::addSubGroupSp "
"p_keepGroup->addSubGroupSp(grpSubGroupSp) "
<< p_keepGroup.get();
p_keepGroup->addSubGroupSp(grpSubGroupSp);
grp_map_peptide_to_group.set(grpSubGroupSp.get()->getPeptideSet(), p_keepGroup);
itGroup++;
while(itGroup != new_group_list.end())
{
qDebug() << "GrpExperiment::addSubGroupSp p_keepGroup->addGroup(*itGroup) "
<< itGroup->get();
p_keepGroup->addGroup(itGroup->get());
grp_map_peptide_to_group.set((*itGroup)->getGrpPeptideSet(), p_keepGroup);
// m_grpGroupSpList.remove_if([itGroup](GrpGroupSp & groupSp) {
// return (itGroup->get() == groupSp.get()) ;
//});
itGroup++;
}
}
qDebug() << "GrpExperiment::addSubGroupSp end";
}
pappso::GrpGroup::addSubGroupSp
void addSubGroupSp(const GrpSubGroupSp &grpSubGroupSp)
Definition grpgroup.cpp:147
pappso::GrpGroup::addGroup
void addGroup(GrpGroup *p_group_to_add)
Definition grpgroup.cpp:110
pappso::GrpMapPeptideToGroup::getGroupList
void getGroupList(const GrpPeptideSet &peptide_set_in, std::list< GrpGroupSp > &impacted_group_list) const
get all groups concerned by a list of peptides
Definition grpmappeptidetogroup.cpp:50
pappso::GrpMapPeptideToGroup::set
void set(const GrpPeptideSet &peptide_set_in, GrpGroupSp grp_group)
set peptide keys pointing on the group
Definition grpmappeptidetogroup.cpp:71
pappso::GrpSubGroup::getPeptideSet
const GrpPeptideSet & getPeptideSet() const
Definition grpsubgroup.cpp:132
pappso::GrpSubGroup::getFirstAccession
const QString & getFirstAccession() const
Definition grpsubgroup.cpp:223
pappso::GrpGroupSp
std::shared_ptr< GrpGroup > GrpGroupSp
Definition grpgroup.h:39

References pappso::GrpGroup::addGroup(), pappso::GrpGroup::addSubGroupSp(), pappso::GrpSubGroup::getFirstAccession(), pappso::GrpMapPeptideToGroup::getGroupList(), pappso::GrpSubGroup::getPeptideSet(), pappso::GrpGroup::makeGrpGroupSp(), and pappso::GrpMapPeptideToGroup::set().

Referenced by removeNonInformativeSubGroups(), and startGrouping().

## getGrpGroupSpList()

std::vector< GrpGroupSpConst > GrpExperiment::getGrpGroupSpList | ( |  | ) | const

Definition at line 67 of file grpexperiment.cpp.

{
std::vector<GrpGroupSpConst> grp_list;
for(GrpGroupSp group : m_grpGroupSpList)
{
grp_list.push_back(group);
}
return grp_list;
}
pappso::GrpExperiment::m_grpGroupSpList
std::list< GrpGroupSp > m_grpGroupSpList
Definition grpexperiment.h:58

References m_grpGroupSpList.

## getGrpProteinSp()

GrpProteinSp & GrpExperiment::getGrpProteinSp | ( | const QString & | acc,
|  | const QString & | description )

Definition at line 78 of file grpexperiment.cpp.

{
GrpProtein grpProtein(accession, description);
auto insertedPair = m_mapProteins.insert(
std::pair<QString, GrpProteinSp>(accession, std::make_shared<GrpProtein>(grpProtein)));
if(insertedPair.second)
{
m_grpProteinList.push_back(insertedPair.first->second);
m_remainingGrpProteinList.push_back(insertedPair.first->second.get());
}
return (insertedPair.first->second);
}
pappso::GrpExperiment::m_grpProteinList
std::list< GrpProteinSp > m_grpProteinList
Definition grpexperiment.h:50
pappso::GrpExperiment::m_remainingGrpProteinList
std::list< GrpProtein * > m_remainingGrpProteinList
Definition grpexperiment.h:52
pappso::GrpExperiment::m_mapProteins
std::map< QString, GrpProteinSp > m_mapProteins
Definition grpexperiment.h:46

References m_grpProteinList, m_mapProteins, and m_remainingGrpProteinList.

## getGrpProteinSpList()

std::vector< GrpProteinSpConst > GrpExperiment::getGrpProteinSpList | ( |  | ) | const

Definition at line 266 of file grpexperiment.cpp.

{
std::vector<GrpProteinSpConst> grouped_protein_list;
if(!m_isGroupingStarted)
{
throw PappsoException(QObject::tr("unable to get grouped protein list before grouping"));
}
for(auto &&protein_sp : m_grpProteinList)
{
if(protein_sp.get()->getGroupNumber() > 0)
{
grouped_protein_list.push_back(protein_sp);
}
}
return grouped_protein_list;
}
pappso::GrpExperiment::m_isGroupingStarted
bool m_isGroupingStarted
Definition grpexperiment.h:51

References m_grpProteinList, and m_isGroupingStarted.

## numbering()

void GrpExperiment::numbering | ( |  | ) |

private

Definition at line 244 of file grpexperiment.cpp.

{
qDebug() << "GrpExperiment::numbering begin";
if(mp_monitor != nullptr)
mp_monitor->startNumberingAllGroups(m_grpGroupSpList.size());
for(auto &&group_sp : m_grpGroupSpList)
{
group_sp.get()->numbering();
}
m_grpGroupSpList.sort(
[](GrpGroupSp &first, GrpGroupSp &second) { return ((*first.get()) < (*second.get())); });
unsigned int i = 1;
for(auto &&group_sp : m_grpGroupSpList)
{
group_sp.get()->setGroupNumber(i);
i++;
}
qDebug() << "GrpExperiment::numbering end";
}

References m_grpGroupSpList, and mp_monitor.

Referenced by startGrouping().

## removeNonInformativeSubGroups()

void GrpExperiment::removeNonInformativeSubGroups | ( |  | ) |

private

Definition at line 284 of file grpexperiment.cpp.

{
qDebug() << "GrpExperiment::removeNonInformativeSubGroups begin";
if(mp_monitor != nullptr)
mp_monitor->startRemovingNonInformativeSubGroupsInAllGroups(m_grpGroupSpList.size());
std::list<GrpGroupSp> old_grp_group_sp_list(m_grpGroupSpList);
m_grpGroupSpList.clear();
auto it_group = old_grp_group_sp_list.begin();
while(it_group != old_grp_group_sp_list.end())
{
if(mp_monitor != nullptr)
mp_monitor->removingNonInformativeSubGroupsInGroup();
if(it_group->get()->removeNonInformativeSubGroups())
{
// need to regroup it
GrpGroupSp old_group_sp = *it_group;
GrpMapPeptideToGroup grp_map_peptide_to_group;
std::list<GrpSubGroupSp> dispatch_sub_group_set = old_group_sp.get()->getSubGroupSpList();
for(GrpSubGroupSp &grp_subgroup : dispatch_sub_group_set)
{
addSubGroupSp(grp_map_peptide_to_group, grp_subgroup);
}
grp_map_peptide_to_group.clear(m_grpGroupSpList);
}
else
{
qDebug() << "GrpExperiment::removeNonInformativeSubGroups no "
"removeNonInformativeSubGroups";
m_grpGroupSpList.push_back(*it_group);
}
it_group++;
}
if(mp_monitor != nullptr)
mp_monitor->stopRemovingNonInformativeSubGroupsInAllGroups(m_grpGroupSpList.size());
qDebug() << "GrpExperiment::removeNonInformativeSubGroups end";
}
pappso::GrpExperiment::addSubGroupSp
void addSubGroupSp(GrpMapPeptideToGroup &grp_map_peptide_to_group, GrpSubGroupSp &grpSubGroupSp) const
Definition grpexperiment.cpp:196
pappso::GrpGroup::getSubGroupSpList
const std::list< GrpSubGroupSp > & getSubGroupSpList() const
Definition grpgroup.cpp:66
pappso::GrpMapPeptideToGroup::clear
void clear(std::list< GrpGroupSp > &grp_group_list)
Definition grpmappeptidetogroup.cpp:88
pappso::GrpSubGroupSp
std::shared_ptr< GrpSubGroup > GrpSubGroupSp
Definition grpsubgroup.h:39

References addSubGroupSp(), pappso::GrpMapPeptideToGroup::clear(), pappso::GrpGroup::getSubGroupSpList(), m_grpGroupSpList, and mp_monitor.

Referenced by startGrouping().

## setGrpPeptide()

GrpPeptideSp & GrpExperiment::setGrpPeptide | ( | const GrpProteinSp & | proteinSp,
|  | const QString & | sequence,
|  | pappso_double | mass )

Definition at line 92 of file grpexperiment.cpp.

{
proteinSp.get()->countPlus();
GrpPeptideSp sp_grppeptide = std::make_shared<GrpPeptide>(GrpPeptide(sequence, mass));
auto insertedPair =
m_mapPeptides.insert(std::pair<QString, std::map<unsigned long, GrpPeptideSp>>(
sp_grppeptide.get()->m_sequence, std::map<unsigned long, GrpPeptideSp>()));
auto secondInsertedPair = insertedPair.first->second.insert(
std::pair<unsigned long, GrpPeptideSp>((unsigned long)(mass * 100), sp_grppeptide));
if(secondInsertedPair.second)
{
m_grpPeptideList.push_back(secondInsertedPair.first->second);
}
proteinSp.get()->push_back(secondInsertedPair.first->second.get());
return (secondInsertedPair.first->second);
}
pappso::GrpExperiment::m_grpPeptideList
std::list< GrpPeptideSp > m_grpPeptideList
Definition grpexperiment.h:49
pappso::GrpExperiment::m_mapPeptides
std::map< QString, std::map< unsigned long, GrpPeptideSp > > m_mapPeptides
Definition grpexperiment.h:47
pappso::GrpPeptide::m_sequence
const QString m_sequence
Definition grppeptide.h:50
pappso::GrpProtein::countPlus
void countPlus()
Definition grpprotein.cpp:73
pappso::GrpProtein::push_back
void push_back(GrpPeptide *p_grpPeptide)
Definition grpprotein.cpp:129
pappso::GrpPeptideSp
std::shared_ptr< GrpPeptide > GrpPeptideSp
Definition grppeptide.h:40

References pappso::GrpProtein::countPlus(), m_grpPeptideList, m_mapPeptides, pappso::GrpPeptide::m_sequence, and pappso::GrpProtein::push_back().

## setRemoveNonInformativeSubgroups()

void GrpExperiment::setRemoveNonInformativeSubgroups | ( | bool | ok | ) |

Definition at line 46 of file grpexperiment.cpp.

{
m_isRemoveNonInformativeSubgroups = ok;
}
pappso::GrpExperiment::m_isRemoveNonInformativeSubgroups
bool m_isRemoveNonInformativeSubgroups
Definition grpexperiment.h:45

References m_isRemoveNonInformativeSubgroups.

## startGrouping()

void GrpExperiment::startGrouping | ( |  | ) |

Definition at line 113 of file grpexperiment.cpp.

{
qDebug() << "GrpExperiment::startGrouping begin";
if(mp_monitor != nullptr)
mp_monitor->startGrouping(m_remainingGrpProteinList.size(), m_grpPeptideList.size());
m_isGroupingStarted = true;
m_mapPeptides.clear();
m_mapProteins.clear();
qDebug() << "GrpExperiment::startGrouping sort protein list "
"m_remainingGrpProteinList.size() "
<< m_remainingGrpProteinList.size();
// m_remainingGrpProteinList.sort();
// m_remainingGrpProteinList.unique();
if(m_grpPreGroupingProteinListRemoval.size() > 0)
{
// TODO clean protein list to remove contaminant peptides before grouping
}
GrpMapPeptideToGroup grp_map_peptide_to_group;
qDebug() << "GrpExperiment::startGrouping grouping begin";
for(auto p_grpProtein : m_remainingGrpProteinList)
{
p_grpProtein->strip();
if(p_grpProtein->m_count == 0)
{
// no peptides : do not group this protein
}
else
{
GrpSubGroupSp grpSubGroupSp = GrpSubGroup(p_grpProtein).makeGrpSubGroupSp();
if(mp_monitor != nullptr)
mp_monitor->groupingProtein();
this->addSubGroupSp(grp_map_peptide_to_group, grpSubGroupSp);
}
}
grp_map_peptide_to_group.clear(m_grpGroupSpList);
qDebug() << "GrpExperiment::startGrouping grouping end";
qDebug() << "GrpExperiment::startGrouping grouping m_grpGroupSpList.size() "
<< m_grpGroupSpList.size();
if(m_isRemoveNonInformativeSubgroups)
{
this->removeNonInformativeSubGroups();
}
// post grouping protein group removal
// remove any group containing contaminants
m_grpGroupSpList.remove_if([this](GrpGroupSp &groupSp) {
return (groupSp.get()->containsAny(this->m_grpPostGroupingProteinListRemoval));
});
numbering();
if(mp_monitor != nullptr)
mp_monitor->stopGrouping();
// GrpGroup(this, *m_remainingGrpProteinList.begin());
qDebug() << "GrpExperiment::startGrouping end";
}
pappso::GrpExperiment::removeNonInformativeSubGroups
void removeNonInformativeSubGroups()
Definition grpexperiment.cpp:284
pappso::GrpExperiment::numbering
void numbering()
Definition grpexperiment.cpp:244
pappso::GrpGroup::containsAny
bool containsAny(const GrpPeptideSet &peptideSet) const
Definition grpgroup.cpp:103

References addSubGroupSp(), pappso::GrpMapPeptideToGroup::clear(), pappso::GrpGroup::containsAny(), m_grpGroupSpList, m_grpPeptideList, m_grpPreGroupingProteinListRemoval, m_isGroupingStarted, m_isRemoveNonInformativeSubgroups, m_mapPeptides, m_mapProteins, m_remainingGrpProteinList, pappso::GrpSubGroup::makeGrpSubGroupSp(), mp_monitor, numbering(), and removeNonInformativeSubGroups().

## Member Data Documentation

## m_grpGroupSpList

std::list<GrpGroupSp> pappso::GrpExperiment::m_grpGroupSpList

private

Definition at line 58 of file grpexperiment.h.

Referenced by getGrpGroupSpList(), numbering(), removeNonInformativeSubGroups(), and startGrouping().

## m_grpPeptideList

std::list<GrpPeptideSp> pappso::GrpExperiment::m_grpPeptideList

private

Definition at line 49 of file grpexperiment.h.

Referenced by setGrpPeptide(), and startGrouping().

## m_grpPostGroupingProteinListRemoval

GrpPeptideSet pappso::GrpExperiment::m_grpPostGroupingProteinListRemoval

private

Definition at line 54 of file grpexperiment.h.

Referenced by addPostGroupingGrpProteinSpRemoval().

## m_grpPreGroupingProteinListRemoval

GrpPeptideSet pappso::GrpExperiment::m_grpPreGroupingProteinListRemoval

private

Definition at line 56 of file grpexperiment.h.

Referenced by addPreGroupingGrpProteinSpRemoval(), and startGrouping().

## m_grpProteinList

std::list<GrpProteinSp> pappso::GrpExperiment::m_grpProteinList

private

Definition at line 50 of file grpexperiment.h.

Referenced by getGrpProteinSp(), and getGrpProteinSpList().

## m_isGroupingStarted

bool pappso::GrpExperiment::m_isGroupingStarted = false

private

Definition at line 51 of file grpexperiment.h.

Referenced by getGrpProteinSpList(), and startGrouping().

## m_isRemoveNonInformativeSubgroups

bool pappso::GrpExperiment::m_isRemoveNonInformativeSubgroups = true

private

Definition at line 45 of file grpexperiment.h.

Referenced by setRemoveNonInformativeSubgroups(), and startGrouping().

## m_mapPeptides

std::map<QString, std::map<unsigned long, GrpPeptideSp> > pappso::GrpExperiment::m_mapPeptides

private

Definition at line 47 of file grpexperiment.h.

Referenced by setGrpPeptide(), and startGrouping().

## m_mapProteins

std::map<QString, GrpProteinSp> pappso::GrpExperiment::m_mapProteins

private

Definition at line 46 of file grpexperiment.h.

Referenced by getGrpProteinSp(), and startGrouping().

## m_remainingGrpProteinList

std::list<GrpProtein *> pappso::GrpExperiment::m_remainingGrpProteinList

private

Definition at line 52 of file grpexperiment.h.

Referenced by getGrpProteinSp(), and startGrouping().

## mp_monitor

GrpGroupingMonitorInterface* pappso::GrpExperiment::mp_monitor = nullptr

private

Definition at line 44 of file grpexperiment.h.

Referenced by GrpExperiment(), numbering(), removeNonInformativeSubGroups(), and startGrouping().

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

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