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

minimum peptide number bug fixed

parent 32646ed5
No related branches found
No related tags found
No related merge requests found
......@@ -29,8 +29,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS} ${Qt5
#sudo apt-get install libpappsomspp-dev
#FIND_PACKAGE( Pappsomspp REQUIRED )
# SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp")
SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp")
SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp")
# SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp")
SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src")
SET (PAPPSOMSPP_QT4_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/libpappsomspp-qt4.so")
......
......@@ -42,48 +42,42 @@ ProteinMatch::~ProteinMatch()
}
void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters) {
qDebug() <<"ProteinMatch::updateAutomaticFilters begin " ;
_proxy_valid = false;
unsigned int _number_of_valid_peptides =0;
std::map<const pappso::MsRunId*, unsigned int> _count_per_msrun;
unsigned int number_of_valid_peptides =0;
bool cross_sample = automatic_filter_parameters.getFilterCrossSamplePeptideNumber();
std::set<QString> sequence_li_list;
for (auto & p_peptide_match : _peptide_match_list) {
p_peptide_match->updateAutomaticFilters(automatic_filter_parameters);
//count valid and checked peptides :
if (p_peptide_match->isValidAndChecked()) {
QString sequence_li(p_peptide_match->getPeptideXtpSp().get()->toAbsoluteString());
std::set<QString>::iterator it_sequence = sequence_li_list.find(sequence_li);
if (it_sequence == sequence_li_list.end()) {
//if this sequence was not already counted
sequence_li_list.insert(sequence_li);
if (cross_sample) {
_number_of_valid_peptides++;
}
else {
std::pair<std::map<const pappso::MsRunId*, unsigned int>::iterator,bool> ret = _count_per_msrun.insert(std::pair<const pappso::MsRunId*, unsigned int>(p_peptide_match->getMsRunIdSp().get(),0));
ret.first->second +=1;
}
}
if (cross_sample) {
for (auto & p_peptide_match : _peptide_match_list) {
p_peptide_match->updateAutomaticFilters(automatic_filter_parameters);
}
number_of_valid_peptides= countValidAndCheckedPeptide(nullptr);
}
for (auto && pair_msrun_count : _count_per_msrun) {
if (pair_msrun_count.second > _number_of_valid_peptides) {
_number_of_valid_peptides = pair_msrun_count.second;
else {
std::set<const pappso::MsRunId *> msrun_set;
for (auto & p_peptide_match : _peptide_match_list) {
p_peptide_match->updateAutomaticFilters(automatic_filter_parameters);
if (p_peptide_match->isValidAndChecked()) {
msrun_set.insert(p_peptide_match->getMsRunIdSp().get());
}
}
for (const pappso::MsRunId * p_msrun : msrun_set) {
unsigned int count = countValidAndCheckedPeptide(p_msrun);
if (count > number_of_valid_peptides) {
number_of_valid_peptides = count;
}
}
}
//update protein evalue ?
if (_number_of_valid_peptides < automatic_filter_parameters.getFilterMinimumPeptidePerMatch()) {
if (number_of_valid_peptides < automatic_filter_parameters.getFilterMinimumPeptidePerMatch()) {
}
else {
if (_evalue <= automatic_filter_parameters.getFilterProteinEvalue()) {
_proxy_valid = true;
}
}
qDebug() <<"ProteinMatch::updateAutomaticFilters end " << number_of_valid_peptides ;
}
const ProteinXtpSp & ProteinMatch::getProteinXtpSp() const {
......@@ -174,6 +168,27 @@ size_t ProteinMatch::countUniqueSequence()const {
return sequence_list.size();
}
unsigned int ProteinMatch::countValidAndCheckedPeptide(const pappso::MsRunId * p_msrun_id) const {
std::set<QString> sequence_list;
for (auto & p_peptide_match : _peptide_match_list) {
if (p_peptide_match->isValidAndChecked()) {
if(p_msrun_id != nullptr) {
//within sample
if (p_peptide_match->getMsRunIdSp().get() == p_msrun_id) {
sequence_list.insert(p_peptide_match->getPeptideXtpSp().get()->getSequenceLi());
}
}
else {
//overall samples
sequence_list.insert(p_peptide_match->getPeptideXtpSp().get()->getSequenceLi());
}
}
}
qDebug() <<"ProteinMatch::countValidAndCheckedPeptide end " << sequence_list.size();
return sequence_list.size();
}
unsigned int ProteinMatch::countValidAndCheckedPeptideMassCharge(const pappso::MsRunIdSp & sp_msrun_id) const {
std::set<QString> sequence_list;
for (auto & p_peptide_match : _peptide_match_list) {
......
......@@ -104,6 +104,7 @@ protected :
void setGroupInstance(GroupStore & group_store);
private :
unsigned int countValidAndCheckedPeptide(const pappso::MsRunId * p_msrun_id) const;
unsigned int countValidAndCheckedPeptideMassCharge(const pappso::MsRunIdSp & sp_msrun_id) const;
private:
......
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