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

FDR computation OK

parent 4efc0810
No related branches found
No related tags found
No related merge requests found
......@@ -54,34 +54,20 @@ unsigned int IdentificationGroup::countDecoyPeptideMatch(ValidationState state)
return i;
}
unsigned int IdentificationGroup::countDecoyProtein(ValidationState state) const {
unsigned int i=0;
for (auto & p_protein_match : _protein_match_list) {
if (!p_protein_match->getProteinXtpSp().get()->isDecoy()) continue;
if (state == ValidationState::grouped) {
if (p_protein_match->isGrouped()) {
i++;
}
}
else if(state == ValidationState::valid) {
if (p_protein_match->isValid()) {
i++;
}
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;
}
else if (state == ValidationState::validAndChecked) {
if (p_protein_match->isValidAndChecked()) {
i++;
}
else {
return false;
}
}
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) {
if (p_protein_match->getValidationState() >= state) {
i+=p_protein_match->countPeptideMatch(state);
}
}
......@@ -89,29 +75,14 @@ unsigned int IdentificationGroup::countPeptideMatch(ValidationState state) const
}
unsigned int IdentificationGroup::countProtein(ValidationState state) const {
unsigned int i=0;
if (state == ValidationState::grouped) {
for (auto & p_protein_match : _protein_match_list) {
if (p_protein_match->isGrouped()) {
i++;
}
}
}
else if(state == ValidationState::valid) {
for (auto & p_protein_match : _protein_match_list) {
if (p_protein_match->isValid()) {
i++;
}
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;
}
}
else if (state == ValidationState::validAndChecked) {
for (auto & p_protein_match : _protein_match_list) {
if (p_protein_match->isValidAndChecked()) {
i++;
}
else {
return false;
}
}
return i;
});
}
void IdentificationGroup::updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters) {
......
......@@ -70,13 +70,13 @@ void PeptideMatch::setChecked(bool arg1) {
}
ValidationState PeptideMatch::getValidationState() const {
if (isValid()) {
return ValidationState::valid;
if (isGrouped()) {
return ValidationState::grouped;
} else if (isValidAndChecked()) {
return ValidationState::validAndChecked;
} else if (isGrouped()) {
return ValidationState::grouped;
}
} else if (isValid()) {
return ValidationState::valid;
}
return ValidationState::notValid;
}
......
......@@ -44,13 +44,13 @@ ProteinMatch::~ProteinMatch()
}
}
ValidationState ProteinMatch::getValidationState() const {
if (isValid()) {
return ValidationState::valid;
if (isGrouped()) {
return ValidationState::grouped;
} else if (isValidAndChecked()) {
return ValidationState::validAndChecked;
} else if (isGrouped()) {
return ValidationState::grouped;
}
} else if (isValid()) {
return ValidationState::valid;
}
return ValidationState::notValid;
}
bool ProteinMatch::contains(PeptideMatch * peptide_match) const {
......@@ -178,7 +178,7 @@ const pappso::GrpProteinSp & ProteinMatch::getGrpProteinSp() const {
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) {
if (p_peptide_match->getValidationState() >= state) {
return true;
}
else {
......
......@@ -25,6 +25,7 @@
#ifndef _TYPES_H_
#define _TYPES_H_ 1
#include <cstdint>
/*********** enumerations *********************************/
/** \def GroupingType list of available grouping algoritms
......@@ -50,11 +51,11 @@ 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
enum class ValidationState: std::int8_t {
notValid = 0,///< notValid : automatic filter validation failed
valid =1, ///< valid : automatic filter validation passed
validAndChecked=2, ///< validAndChecked : automatic filter validation passed + manual checking
grouped=3 ///< 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