Skip to content
Snippets Groups Projects
Commit 7e5372d2 authored by Olivier Langella's avatar Olivier Langella
Browse files

count factorisation

parent b7c9c59e
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@ unsigned int IdentificationGroup::countDecoyPeptideMatch(ValidationState state)
}
return i;
}
unsigned int IdentificationGroup::countDecoyProtein(ValidationState state) const {
unsigned int IdentificationGroup::countDecoyProteinMatch(ValidationState state) const {
return std::count_if (_protein_match_list.begin(), _protein_match_list.end(), [state](const ProteinMatch * p_protein_match) {
if ((p_protein_match->getProteinXtpSp().get()->isDecoy()) && (p_protein_match->getValidationState() >= state)) {
return true;
......@@ -74,7 +74,7 @@ unsigned int IdentificationGroup::countPeptideMatch(ValidationState state) const
return i;
}
unsigned int IdentificationGroup::countProtein(ValidationState state) const {
unsigned int IdentificationGroup::countProteinMatch(ValidationState state) const {
return std::count_if (_protein_match_list.begin(), _protein_match_list.end(), [state](const ProteinMatch * p_protein_match) {
if (p_protein_match->getValidationState() >= state) {
return true;
......@@ -134,36 +134,6 @@ std::vector<ProteinMatch *> & IdentificationGroup::getProteinMatchList() {
return _protein_match_list;
}
size_t IdentificationGroup::countGrouped()const {
size_t i=0;
for (auto & p_protein_match : _protein_match_list) {
if (p_protein_match->isGrouped()) {
i++;
}
}
return i;
}
size_t IdentificationGroup::countValidAndChecked()const {
size_t i=0;
for (auto & p_protein_match : _protein_match_list) {
if (p_protein_match->isValidAndChecked()) {
i++;
}
}
return i;
}
size_t IdentificationGroup::countValid()const {
size_t i=0;
for (auto & p_protein_match : _protein_match_list) {
if (p_protein_match->isValid()) {
i++;
}
}
return i;
}
std::size_t IdentificationGroup::countGroup()const {
return _group_store.countGroup();
}
......
......@@ -48,18 +48,6 @@ public:
void addProteinMatch(ProteinMatch * protein_match);
std::vector<ProteinMatch *> & getProteinMatchList();
void addMsRunSp(MsRunSp ms_run_sp);
/** @brief count valid proteins
* */
std::size_t countValid()const;
/** @brief count valid and manually checked proteins
* */
std::size_t countValidAndChecked()const;
/** @brief count grouped proteins
* */
std::size_t countGrouped()const;
/** @brief count groups
* */
......@@ -71,10 +59,10 @@ public:
/** @brief count proteins
* */
unsigned int countProtein(ValidationState state) const;
unsigned int countProteinMatch(ValidationState state) const;
/** @brief count decoy proteins
* */
unsigned int countDecoyProtein(ValidationState state) const;
unsigned int countDecoyProteinMatch(ValidationState state) const;
/** @brief count peptide match
* */
unsigned int countPeptideMatch(ValidationState state) const;
......
......@@ -187,21 +187,10 @@ unsigned int ProteinMatch::countPeptideMatch(ValidationState state) const {
});
}
size_t ProteinMatch::countValidSpectrum()const {
return std::count_if (_peptide_match_list.begin(), _peptide_match_list.end(), [](const PeptideMatch * p_peptide_match) {
return (p_peptide_match->isValid());
});
}
size_t ProteinMatch::countValidAndCheckedSpectrum()const {
return std::count_if (_peptide_match_list.begin(), _peptide_match_list.end(), [](const PeptideMatch * p_peptide_match) {
return (p_peptide_match->isValidAndChecked());
});
}
size_t ProteinMatch::countUniqueSequence()const {
size_t ProteinMatch::countUniqueSequence(ValidationState state)const {
std::set<QString> sequence_list;
for (auto & p_peptide_match : _peptide_match_list) {
if (p_peptide_match->isValidAndChecked()) {
if (p_peptide_match->getValidationState() >= state) {
sequence_list.insert(p_peptide_match->getPeptideXtpSp().get()->getSequence());
}
}
......
......@@ -78,16 +78,9 @@ public:
ValidationState getValidationState() const;
unsigned int countPeptideMatch(ValidationState state) const;
/** @brief count valid spectrums
* */
size_t countValidSpectrum()const;
/** @brief count valid and manually checked spectrums
* */
size_t countValidAndCheckedSpectrum()const;
/** @brief count unique identified sequences (from valid and cheked spectrums)
* */
size_t countUniqueSequence()const;
size_t countUniqueSequence(ValidationState state)const;
const pappso::GrpProteinSp & getGrpProteinSp() const;
......
......@@ -83,7 +83,7 @@ unsigned int GroupingGroup::countSubgroupPresence(const PeptideMatch * p_peptide
std::size_t GroupingGroup::countSpecificSpectrum(const ProteinMatch * p_protein_match) const {
if (_number_of_subgroup == 1) {
return p_protein_match->countValidAndCheckedSpectrum();
return p_protein_match->countPeptideMatch(ValidationState::validAndChecked);
}
std::set<QString> spectrum_list_in;
for (auto && p_peptide_match :p_protein_match->getPeptideMatchList()) {
......@@ -111,7 +111,7 @@ std::size_t GroupingGroup::countSpecificSpectrum(const ProteinMatch * p_protein_
std::size_t GroupingGroup::countSpecificSequence(const ProteinMatch * p_protein_match) const {
if (_number_of_subgroup == 1) {
return p_protein_match->countUniqueSequence();
return p_protein_match->countUniqueSequence(ValidationState::validAndChecked);
}
std::set<QString> sequence_list_in;
for (auto && p_peptide_match :p_protein_match->getPeptideMatchList()) {
......
......@@ -68,6 +68,6 @@ void IdentificationGroupWidget::doIdentificationGroupGrouped(IdentificationGroup
ui->group_number_display->setText(QString("%1").arg(_p_identification_group->countGroup()));
ui->subgroup_number_display->setText(QString("%1").arg(_p_identification_group->countSubGroup()));
ui->protein_number_display->setText(QString("%1").arg(_p_identification_group->countGrouped()));
ui->protein_number_display->setText(QString("%1").arg(_p_identification_group->countProteinMatch(ValidationState::grouped)));
}
}
......@@ -142,8 +142,8 @@ void ProjectWindow::computeFdr(ValidationState state) {
pappso::pappso_double total_prot=0;
pappso::pappso_double false_prot=0;
for (IdentificationGroup * identification_group : _project_sp.get()->getIdentificationGroupList()) {
total_prot += identification_group->countProtein(state);
false_prot += identification_group->countDecoyProtein(state);
total_prot += identification_group->countProteinMatch(state);
false_prot += identification_group->countDecoyProteinMatch(state);
}
ui->protein_fdr_label->setText(QString("%1 %").arg(false_prot/total_prot));
......
......@@ -227,7 +227,7 @@ void ProteinListWindow::updateStatusBar() {
if (_p_identification_group == nullptr) {
}
else {
ui->statusbar->showMessage(tr("proteins %1 valid, %2 checked, %3 displayed").arg(_p_identification_group->countValid()).arg(_p_identification_group->countValidAndChecked()).arg(_p_proxy_model->rowCount()));
ui->statusbar->showMessage(tr("proteins %1 valid, %2 checked, %3 displayed").arg(_p_identification_group->countProteinMatch(ValidationState::valid)).arg(_p_identification_group->countProteinMatch(ValidationState::validAndChecked)).arg(_p_proxy_model->rowCount()));
}
}
......@@ -170,7 +170,7 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const {
return QVariant ((qreal)_p_identification_group->getProteinMatchList().at(row)->getEvalue());
}
if (_column_assignment[col] == (std::int8_t) ProteinListColumn::spectrum ) {
return QVariant ((qreal) _p_identification_group->getProteinMatchList().at(row)->countValidAndCheckedSpectrum());
return QVariant ((qreal) _p_identification_group->getProteinMatchList().at(row)->countPeptideMatch(ValidationState::validAndChecked));
}
if (_column_assignment[col] == (std::int8_t) ProteinListColumn::specific_spectrum ) {
......@@ -181,7 +181,7 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const {
}
if (_column_assignment[col] == (std::int8_t) ProteinListColumn::sequence ) {
return QVariant ((qreal) _p_identification_group->getProteinMatchList().at(row)->countUniqueSequence());
return QVariant ((qreal) _p_identification_group->getProteinMatchList().at(row)->countUniqueSequence(ValidationState::validAndChecked));
}
if (_column_assignment[col] == (std::int8_t) ProteinListColumn::specific_sequence ) {
GroupingGroup * p_groupin_group = _p_identification_group->getProteinMatchList().at(row)->getGroupingGroupSp().get();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment