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

FDR computation OK

parent 370a54be
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,17 @@ IdentificationGroup::~IdentificationGroup()
}
unsigned int IdentificationGroup::countDecoyPeptideMatch(ValidationState state) const {
unsigned int i=0;
for (auto & p_protein_match : _protein_match_list) {
if (p_protein_match->getValidationState() == state) {
if (p_protein_match->getProteinXtpSp().get()->isDecoy()) {
i+=p_protein_match->countPeptideMatch(state);
}
}
}
return i;
}
unsigned int IdentificationGroup::countDecoyProtein(ValidationState state) const {
unsigned int i=0;
for (auto & p_protein_match : _protein_match_list) {
......@@ -67,6 +78,16 @@ unsigned int IdentificationGroup::countDecoyProtein(ValidationState state) const
return i;
}
unsigned int IdentificationGroup::countPeptideMatch(ValidationState state) const {
unsigned int i=0;
for (auto & p_protein_match : _protein_match_list) {
if (p_protein_match->getValidationState() == state) {
i+=p_protein_match->countPeptideMatch(state);
}
}
return i;
}
unsigned int IdentificationGroup::countProtein(ValidationState state) const {
unsigned int i=0;
if (state == ValidationState::grouped) {
......
......@@ -74,7 +74,13 @@ public:
unsigned int countProtein(ValidationState state) const;
/** @brief count decoy proteins
* */
unsigned int countDecoyProtein(ValidationState state) const;
unsigned int countDecoyProtein(ValidationState state) const;
/** @brief count peptide match
* */
unsigned int countPeptideMatch(ValidationState state) const;
/** @brief count decoy peptide match
* */
unsigned int countDecoyPeptideMatch(ValidationState state) const;
/** @brief validate or invalidate peptides and proteins based automatic filters and manual checks
......
......@@ -69,6 +69,17 @@ void PeptideMatch::setChecked(bool arg1) {
_checked = arg1;
}
ValidationState PeptideMatch::getValidationState() const {
if (isValid()) {
return ValidationState::valid;
} else if (isValidAndChecked()) {
return ValidationState::validAndChecked;
} else if (isGrouped()) {
return ValidationState::grouped;
}
return ValidationState::notValid;
}
bool PeptideMatch::isValid() const {
return _proxy_valid;
}
......
......@@ -75,6 +75,8 @@ public :
/** @brief get delta between theoretical mhplus mass and mhplus experimental mass
*/
pappso::mz getDeltaMass() const;
ValidationState getValidationState() const;
private :
MsRun * _msrunid_sp;
......
......@@ -43,7 +43,16 @@ ProteinMatch::~ProteinMatch()
it++;
}
}
ValidationState ProteinMatch::getValidationState() const {
if (isValid()) {
return ValidationState::valid;
} else if (isValidAndChecked()) {
return ValidationState::validAndChecked;
} else if (isGrouped()) {
return ValidationState::grouped;
}
return ValidationState::notValid;
}
bool ProteinMatch::contains(PeptideMatch * peptide_match) const {
if (peptide_match == nullptr) return false;
for (auto & p_peptide_match : _peptide_match_list) {
......@@ -166,6 +175,18 @@ const pappso::GrpProteinSp & ProteinMatch::getGrpProteinSp() const {
return _sp_grp_protein;
}
unsigned int ProteinMatch::countPeptideMatch(ValidationState state) const {
return std::count_if (_peptide_match_list.begin(), _peptide_match_list.end(), [state](const PeptideMatch * p_peptide_match) {
if (p_peptide_match->getValidationState() == state) {
return true;
}
else {
return false;
}
});
}
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());
......@@ -312,7 +333,7 @@ const QString ProteinMatch::getHtmlSequence(PeptideMatch * peptide_match_to_loca
}
else {
sequence_html.append(QString("</span>"));
i--;
i--;
break;
}
}
......@@ -323,9 +344,9 @@ const QString ProteinMatch::getHtmlSequence(PeptideMatch * peptide_match_to_loca
i++;
for (; i < prot_size; i++) {
if (highlight_bool[i]) {
i--;
break;
}
i--;
break;
}
if(cover_bool[i]) {
sequence_html.append(sequence[i]);
}
......
......@@ -75,6 +75,9 @@ public:
bool isValidAndChecked() const;
bool isGrouped() const;
ValidationState getValidationState() const;
unsigned int countPeptideMatch(ValidationState state) const;
/** @brief count valid spectrums
* */
size_t countValidSpectrum()const;
......
......@@ -151,9 +151,11 @@ void ProjectWindow::computeFdr(ValidationState state) {
pappso::pappso_double total_peptide=0;
pappso::pappso_double false_peptide=0;
for (IdentificationGroup * identification_group : _project_sp.get()->getIdentificationGroupList()) {
//total_peptide += identification_group->countPeptideMatch(state);
//false_peptide += identification_group->countDecoyPeptideMatch(state);
total_peptide += identification_group->countPeptideMatch(state);
false_peptide += identification_group->countDecoyPeptideMatch(state);
}
qDebug() << "ProjectWindow::computeFdr false_peptide=" <<false_peptide;
qDebug() << "ProjectWindow::computeFdr total_peptide=" <<total_peptide;
ui->peptide_fdr_label->setText(QString("%1 %").arg(false_peptide/total_peptide));
}
......
......@@ -51,6 +51,7 @@ enum class MzFormat {
*/
enum class ValidationState {
notValid,///< notValid : automatic filter validation failed
valid, ///< valid : automatic filter validation passed
validAndChecked, ///< validAndChecked : automatic filter validation passed + manual checking
grouped, ///< grouped : automatic filter validation passed + manual checking + grouped
......
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