diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9ddba1dee86da30108fb04a640c6ae99ea936b29..d0ea825a97102f700e6d19542d4c0ed5eae3b47a 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/project.cpp b/src/core/project.cpp index f4a69901d605598e86bc9af5332eae70eb55100e..b5b3940dce5948e6aca2f55630cda0650dfe7d3a 100644 --- a/src/core/project.cpp +++ b/src/core/project.cpp @@ -39,6 +39,14 @@ Project::~Project() } } +PeptideStore & Project::getPeptideStore() { + return _peptide_store; +} + +ProteinStore & Project::getProteinStore() { + return _protein_store; +} + void Project::updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters) { _automatic_filter_parameters = automatic_filter_parameters; for (auto & p_id_group : _identification_goup_list) { @@ -91,7 +99,7 @@ IdentificationGroup* Project::getCurrentIdentificationGroupP() const { void Project::startGrouping() { - for (auto & p_id_group : _identification_goup_list) { + for (auto & p_id_group : _identification_goup_list) { p_id_group->startGrouping(_grouping_type); } diff --git a/src/core/project.h b/src/core/project.h index 5992dbf88781b175e51175ba2b7ab3b4e8d86cbe..2e98fc3cf866b1da147b8edc4377f37789c4c9c1 100644 --- a/src/core/project.h +++ b/src/core/project.h @@ -26,7 +26,9 @@ #include<memory> #include "identificationgroup.h" #include "automaticfilterparameters.h" -#include "utils/types.h" +#include "../utils/types.h" +#include "../utils/peptidestore.h" +#include "../utils/proteinstore.h" class Project; typedef std::shared_ptr<Project> ProjectSp; @@ -41,6 +43,8 @@ public: ~Project(); ProjectSp makeProjectSp() const; + ProteinStore & getProteinStore(); + PeptideStore & getPeptideStore(); void readXpipFile(QFileInfo xpip_source); IdentificationGroup* newIdentificationGroup(); IdentificationGroup* getCurrentIdentificationGroupP() const; @@ -58,6 +62,9 @@ private : AutomaticFilterParameters _automatic_filter_parameters; GroupingType _grouping_type = GroupingType::PeptideMass; + + ProteinStore _protein_store; + PeptideStore _peptide_store; }; #endif // PROJECT_H diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index b03473c2a54233d51399456a9a5b3dea2417fe05..e750622d0a3ebe9e480320831e2596bdf499f3b5 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -116,13 +116,19 @@ void ProteinMatch::setGroupingExperiment(GroupingExperiment * p_grp_experiment) _sp_grp_protein = nullptr; if (isValidAndChecked()) { _sp_grp_protein = p_grp_experiment->getGrpProteinSp(this); - + for (auto & p_peptide_match : _peptide_match_list) { p_peptide_match->setGrpPeptideSp(nullptr); if (p_peptide_match->isValidAndChecked()) { p_peptide_match->setGrpPeptideSp(p_grp_experiment->setGrpPeptide(_sp_grp_protein, p_peptide_match)); } } + + + if (_protein_sp.get()->isContaminant()) { + p_grp_experiment->addPostGroupingGrpProteinSpRemoval(_sp_grp_protein); + } + } } diff --git a/src/core/proteinxtp.cpp b/src/core/proteinxtp.cpp index 32cb090ad48f6f7adfc16ffdecd294fd83645103..ed3226324fe325bb2a25d2616d410c32f14763b6 100644 --- a/src/core/proteinxtp.cpp +++ b/src/core/proteinxtp.cpp @@ -55,9 +55,9 @@ ProteinXtpSp ProteinXtp::makeProteinXtpSp() const { void ProteinXtp::setIsDecoy(bool conta){ _is_decoy = conta; } - bool ProteinXtp::getIsContaminant() const{ + bool ProteinXtp::isContaminant() const{ return _is_contaminant; } - bool ProteinXtp::getIsDecoy() const{ + bool ProteinXtp::isDecoy() const{ return _is_decoy; } diff --git a/src/core/proteinxtp.h b/src/core/proteinxtp.h index 935dc282ce362ff79852b70cd4c00909d893efc1..764266d3e3d866e469c7a8136d588144463c76a4 100644 --- a/src/core/proteinxtp.h +++ b/src/core/proteinxtp.h @@ -46,8 +46,8 @@ public: void setIsContaminant(bool conta); void setIsDecoy(bool conta); - bool getIsContaminant() const; - bool getIsDecoy() const; + bool isContaminant() const; + bool isDecoy() const; private: SequenceDatabase * _p_sequence_database; diff --git a/src/grouping/groupingexperiment.h b/src/grouping/groupingexperiment.h index e05d9e0f1aefc44c7916f2347be4ea7de98a1d3c..af56449df7b6e11b8b2d1e62063d771f6c4521bb 100644 --- a/src/grouping/groupingexperiment.h +++ b/src/grouping/groupingexperiment.h @@ -41,6 +41,7 @@ public: virtual pappso::GrpProteinSp & getGrpProteinSp(ProteinMatch* p_protein_match) = 0; virtual pappso::GrpPeptideSp & setGrpPeptide(pappso::GrpProteinSp proteinSp, PeptideMatch* p_peptide_match) = 0; + virtual void addPostGroupingGrpProteinSpRemoval(pappso::GrpProteinSp sp_protein) = 0; virtual void startGrouping()= 0; }; diff --git a/src/grouping/groupingpeptidemass.cpp b/src/grouping/groupingpeptidemass.cpp index 7dc382e8c0dd86775b4b2495132597115bf2caf3..8368af9d7c0868f1123c09bf8c3db25e61206cb4 100644 --- a/src/grouping/groupingpeptidemass.cpp +++ b/src/grouping/groupingpeptidemass.cpp @@ -50,3 +50,7 @@ pappso::GrpPeptideSp & GroupingPeptideMass::setGrpPeptide(pappso::GrpProteinSp p void GroupingPeptideMass::startGrouping() { _p_grp_experiment->startGrouping(); } + +void GroupingPeptideMass::addPostGroupingGrpProteinSpRemoval(pappso::GrpProteinSp sp_protein) { + _p_grp_experiment->addPostGroupingGrpProteinSpRemoval(sp_protein); +} diff --git a/src/grouping/groupingpeptidemass.h b/src/grouping/groupingpeptidemass.h index 2d585026c1f6a8ad85de750bd0a74a78b8d44175..2391bba35f91c1b37a2f14e45d2926a3b9489fe1 100644 --- a/src/grouping/groupingpeptidemass.h +++ b/src/grouping/groupingpeptidemass.h @@ -34,6 +34,8 @@ public: virtual pappso::GrpProteinSp & getGrpProteinSp(ProteinMatch* p_protein_match) override; virtual pappso::GrpPeptideSp & setGrpPeptide(pappso::GrpProteinSp proteinSp, PeptideMatch* p_peptide_match) override; + virtual void addPostGroupingGrpProteinSpRemoval(pappso::GrpProteinSp sp_protein) override; + virtual void startGrouping() override; protected : diff --git a/src/input/xpipsaxhandler.cpp b/src/input/xpipsaxhandler.cpp index 719ebbd8ef226421d71a57ea45d285e3ff13ae7f..921d4262a1f300c291b2eb23586b86111c0456ab 100644 --- a/src/input/xpipsaxhandler.cpp +++ b/src/input/xpipsaxhandler.cpp @@ -24,6 +24,8 @@ #include <pappsomspp/msrun/msrunid.h> #include <pappsomspp/exception/exceptionnotfound.h> #include <cmath> +#include "../utils/peptidestore.h" +#include "../utils/proteinstore.h" XpipSaxHandler::XpipSaxHandler(Project * p_project):_p_project(p_project) { @@ -277,7 +279,7 @@ bool XpipSaxHandler::endElement_peptide() { qDebug() << "endElement_peptide "; pappso::PeptideSp peptide_const = pappso::Peptide(*(_current_peptide_sp.get())).makePeptideSp(); - peptide_const = _peptide_store.getInstance(peptide_const); + peptide_const = _p_project->getPeptideStore().getInstance(peptide_const); _p_peptide_match->setPeptideSp(peptide_const); return true; } @@ -292,7 +294,9 @@ bool XpipSaxHandler::endElement_sequence() { return true; } bool XpipSaxHandler::endElement_protein() { - _p_protein_match->setProteinXtpSp(_current_protein.makeProteinXtpSp()); + ProteinXtpSp sp_xtp_protein = _current_protein.makeProteinXtpSp(); + + _p_protein_match->setProteinXtpSp(_p_project->getProteinStore().getInstance(sp_xtp_protein)); return true; } diff --git a/src/input/xpipsaxhandler.h b/src/input/xpipsaxhandler.h index 804a40c6181b50eb7099441224ad34fd77f19994..063d13d04eee1b7a5b0b20e5c253d3fe9579ef29 100644 --- a/src/input/xpipsaxhandler.h +++ b/src/input/xpipsaxhandler.h @@ -30,7 +30,6 @@ #include <pappsomspp/amino_acid/aamodification.h> #include "../core/project.h" #include "../core/proteinmatch.h" -#include "../utils/peptidestore.h" class XpipSaxHandler: public QXmlDefaultHandler { @@ -87,7 +86,6 @@ private: pappso::NoConstPeptideSp _current_peptide_sp; IdentificationGroup * _current_identification_group_p; - PeptideStore _peptide_store; QMap<QString, pappso::AaModificationP> _map_massstr_aamod; QMap<QString, pappso::MsRunIdSp> _map_msrunid; }; diff --git a/src/utils/proteinstore.cpp b/src/utils/proteinstore.cpp index d4d11d8ac4f140f6aa6176756d8eb2f3688edc31..acb0a8763f65907111f5b8b0671e297ed7480e61 100644 --- a/src/utils/proteinstore.cpp +++ b/src/utils/proteinstore.cpp @@ -28,13 +28,14 @@ ******************************************************************************/ #include "proteinstore.h" +#include <QDebug> ProteinStore::ProteinStore() { -_regexp_contaminant.setPattern("([KR])([^P])"); + _regexp_contaminant.setPattern("^conta\\|"); -_regexp_decoy.setPattern(".*\\|reversed$"); + _regexp_decoy.setPattern(".*\\|reversed$"); } ProteinStore::~ProteinStore() @@ -45,7 +46,7 @@ ProteinStore::~ProteinStore() ProteinXtpSp & ProteinStore::getInstance(ProteinXtpSp & peptide_in) { std::pair<std::map< QString, ProteinXtpSp>::iterator,bool> ret = _map_accession_protein_list.insert(std::pair<QString, ProteinXtpSp>(peptide_in.get()->getAccession(),peptide_in)); - + if (ret.second) { setProteinInformations(ret.first->second); } @@ -54,11 +55,14 @@ ProteinXtpSp & ProteinStore::getInstance(ProteinXtpSp & peptide_in) { } void ProteinStore::setProteinInformations(ProteinXtpSp & peptide_in) { + qDebug() << "ProteinStore::setProteinInformations begin"; QString accession = peptide_in.get()->getAccession(); if (_regexp_contaminant.indexIn(accession, 0)>-1) { + qDebug() << "ProteinStore::setProteinInformations is contaminant " << accession; peptide_in.get()->setIsContaminant(true); } if (_regexp_decoy.indexIn(accession, 0)>-1) { peptide_in.get()->setIsDecoy(true); } + qDebug() << "ProteinStore::setProteinInformations end"; } diff --git a/src/utils/proteinstore.h b/src/utils/proteinstore.h index fb09cdf6dd5a40ff3bf6b8880dacd824a7190d45..14d7f1945e2f4b227211343f4859f3b8774ebeb9 100644 --- a/src/utils/proteinstore.h +++ b/src/utils/proteinstore.h @@ -39,6 +39,7 @@ class ProteinStore { +public: ProteinStore(); ~ProteinStore();