diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4617222382e4525867e60dc612152ff20643d433..617e2004adf804e1d6b0d3d49aab0ca0b7747dc0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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") diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index fc62465f66de9d1915acc35b6c1eb817c7afe4ec..296354947207b6deff0a23ffcfb8cb3347dddaad 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -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) { diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index 9460c4c14fe2148c91213c23e5eb9fdc12289771..74ce8c123102bd2a9319b461fe8038d6f134d620 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -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: