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

protein store and peptide store inside the project, contaminant groups removed

parent 54235386
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 ...@@ -29,8 +29,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS} ${Qt5
#sudo apt-get install libpappsomspp-dev #sudo apt-get install libpappsomspp-dev
#FIND_PACKAGE( Pappsomspp REQUIRED ) #FIND_PACKAGE( Pappsomspp REQUIRED )
# SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp") SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp")
SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp") # SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp")
SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src") SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src")
SET (PAPPSOMSPP_QT4_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/libpappsomspp-qt4.so") SET (PAPPSOMSPP_QT4_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/libpappsomspp-qt4.so")
......
...@@ -39,6 +39,14 @@ Project::~Project() ...@@ -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) { void Project::updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters) {
_automatic_filter_parameters = automatic_filter_parameters; _automatic_filter_parameters = automatic_filter_parameters;
for (auto & p_id_group : _identification_goup_list) { for (auto & p_id_group : _identification_goup_list) {
...@@ -91,7 +99,7 @@ IdentificationGroup* Project::getCurrentIdentificationGroupP() const { ...@@ -91,7 +99,7 @@ IdentificationGroup* Project::getCurrentIdentificationGroupP() const {
void Project::startGrouping() { 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); p_id_group->startGrouping(_grouping_type);
} }
......
...@@ -26,7 +26,9 @@ ...@@ -26,7 +26,9 @@
#include<memory> #include<memory>
#include "identificationgroup.h" #include "identificationgroup.h"
#include "automaticfilterparameters.h" #include "automaticfilterparameters.h"
#include "utils/types.h" #include "../utils/types.h"
#include "../utils/peptidestore.h"
#include "../utils/proteinstore.h"
class Project; class Project;
typedef std::shared_ptr<Project> ProjectSp; typedef std::shared_ptr<Project> ProjectSp;
...@@ -41,6 +43,8 @@ public: ...@@ -41,6 +43,8 @@ public:
~Project(); ~Project();
ProjectSp makeProjectSp() const; ProjectSp makeProjectSp() const;
ProteinStore & getProteinStore();
PeptideStore & getPeptideStore();
void readXpipFile(QFileInfo xpip_source); void readXpipFile(QFileInfo xpip_source);
IdentificationGroup* newIdentificationGroup(); IdentificationGroup* newIdentificationGroup();
IdentificationGroup* getCurrentIdentificationGroupP() const; IdentificationGroup* getCurrentIdentificationGroupP() const;
...@@ -58,6 +62,9 @@ private : ...@@ -58,6 +62,9 @@ private :
AutomaticFilterParameters _automatic_filter_parameters; AutomaticFilterParameters _automatic_filter_parameters;
GroupingType _grouping_type = GroupingType::PeptideMass; GroupingType _grouping_type = GroupingType::PeptideMass;
ProteinStore _protein_store;
PeptideStore _peptide_store;
}; };
#endif // PROJECT_H #endif // PROJECT_H
...@@ -116,13 +116,19 @@ void ProteinMatch::setGroupingExperiment(GroupingExperiment * p_grp_experiment) ...@@ -116,13 +116,19 @@ void ProteinMatch::setGroupingExperiment(GroupingExperiment * p_grp_experiment)
_sp_grp_protein = nullptr; _sp_grp_protein = nullptr;
if (isValidAndChecked()) { if (isValidAndChecked()) {
_sp_grp_protein = p_grp_experiment->getGrpProteinSp(this); _sp_grp_protein = p_grp_experiment->getGrpProteinSp(this);
for (auto & p_peptide_match : _peptide_match_list) { for (auto & p_peptide_match : _peptide_match_list) {
p_peptide_match->setGrpPeptideSp(nullptr); p_peptide_match->setGrpPeptideSp(nullptr);
if (p_peptide_match->isValidAndChecked()) { if (p_peptide_match->isValidAndChecked()) {
p_peptide_match->setGrpPeptideSp(p_grp_experiment->setGrpPeptide(_sp_grp_protein, p_peptide_match)); 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);
}
} }
} }
......
...@@ -55,9 +55,9 @@ ProteinXtpSp ProteinXtp::makeProteinXtpSp() const { ...@@ -55,9 +55,9 @@ ProteinXtpSp ProteinXtp::makeProteinXtpSp() const {
void ProteinXtp::setIsDecoy(bool conta){ void ProteinXtp::setIsDecoy(bool conta){
_is_decoy = conta; _is_decoy = conta;
} }
bool ProteinXtp::getIsContaminant() const{ bool ProteinXtp::isContaminant() const{
return _is_contaminant; return _is_contaminant;
} }
bool ProteinXtp::getIsDecoy() const{ bool ProteinXtp::isDecoy() const{
return _is_decoy; return _is_decoy;
} }
...@@ -46,8 +46,8 @@ public: ...@@ -46,8 +46,8 @@ public:
void setIsContaminant(bool conta); void setIsContaminant(bool conta);
void setIsDecoy(bool conta); void setIsDecoy(bool conta);
bool getIsContaminant() const; bool isContaminant() const;
bool getIsDecoy() const; bool isDecoy() const;
private: private:
SequenceDatabase * _p_sequence_database; SequenceDatabase * _p_sequence_database;
......
...@@ -41,6 +41,7 @@ public: ...@@ -41,6 +41,7 @@ public:
virtual pappso::GrpProteinSp & getGrpProteinSp(ProteinMatch* p_protein_match) = 0; virtual pappso::GrpProteinSp & getGrpProteinSp(ProteinMatch* p_protein_match) = 0;
virtual pappso::GrpPeptideSp & setGrpPeptide(pappso::GrpProteinSp proteinSp, PeptideMatch* p_peptide_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; virtual void startGrouping()= 0;
}; };
......
...@@ -50,3 +50,7 @@ pappso::GrpPeptideSp & GroupingPeptideMass::setGrpPeptide(pappso::GrpProteinSp p ...@@ -50,3 +50,7 @@ pappso::GrpPeptideSp & GroupingPeptideMass::setGrpPeptide(pappso::GrpProteinSp p
void GroupingPeptideMass::startGrouping() { void GroupingPeptideMass::startGrouping() {
_p_grp_experiment->startGrouping(); _p_grp_experiment->startGrouping();
} }
void GroupingPeptideMass::addPostGroupingGrpProteinSpRemoval(pappso::GrpProteinSp sp_protein) {
_p_grp_experiment->addPostGroupingGrpProteinSpRemoval(sp_protein);
}
...@@ -34,6 +34,8 @@ public: ...@@ -34,6 +34,8 @@ public:
virtual pappso::GrpProteinSp & getGrpProteinSp(ProteinMatch* p_protein_match) override; virtual pappso::GrpProteinSp & getGrpProteinSp(ProteinMatch* p_protein_match) override;
virtual pappso::GrpPeptideSp & setGrpPeptide(pappso::GrpProteinSp proteinSp, PeptideMatch* p_peptide_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; virtual void startGrouping() override;
protected : protected :
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <pappsomspp/msrun/msrunid.h> #include <pappsomspp/msrun/msrunid.h>
#include <pappsomspp/exception/exceptionnotfound.h> #include <pappsomspp/exception/exceptionnotfound.h>
#include <cmath> #include <cmath>
#include "../utils/peptidestore.h"
#include "../utils/proteinstore.h"
XpipSaxHandler::XpipSaxHandler(Project * p_project):_p_project(p_project) XpipSaxHandler::XpipSaxHandler(Project * p_project):_p_project(p_project)
{ {
...@@ -277,7 +279,7 @@ bool XpipSaxHandler::endElement_peptide() { ...@@ -277,7 +279,7 @@ bool XpipSaxHandler::endElement_peptide() {
qDebug() << "endElement_peptide "; qDebug() << "endElement_peptide ";
pappso::PeptideSp peptide_const = pappso::Peptide(*(_current_peptide_sp.get())).makePeptideSp(); 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); _p_peptide_match->setPeptideSp(peptide_const);
return true; return true;
} }
...@@ -292,7 +294,9 @@ bool XpipSaxHandler::endElement_sequence() { ...@@ -292,7 +294,9 @@ bool XpipSaxHandler::endElement_sequence() {
return true; return true;
} }
bool XpipSaxHandler::endElement_protein() { 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; return true;
} }
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <pappsomspp/amino_acid/aamodification.h> #include <pappsomspp/amino_acid/aamodification.h>
#include "../core/project.h" #include "../core/project.h"
#include "../core/proteinmatch.h" #include "../core/proteinmatch.h"
#include "../utils/peptidestore.h"
class XpipSaxHandler: public QXmlDefaultHandler class XpipSaxHandler: public QXmlDefaultHandler
{ {
...@@ -87,7 +86,6 @@ private: ...@@ -87,7 +86,6 @@ private:
pappso::NoConstPeptideSp _current_peptide_sp; pappso::NoConstPeptideSp _current_peptide_sp;
IdentificationGroup * _current_identification_group_p; IdentificationGroup * _current_identification_group_p;
PeptideStore _peptide_store;
QMap<QString, pappso::AaModificationP> _map_massstr_aamod; QMap<QString, pappso::AaModificationP> _map_massstr_aamod;
QMap<QString, pappso::MsRunIdSp> _map_msrunid; QMap<QString, pappso::MsRunIdSp> _map_msrunid;
}; };
......
...@@ -28,13 +28,14 @@ ...@@ -28,13 +28,14 @@
******************************************************************************/ ******************************************************************************/
#include "proteinstore.h" #include "proteinstore.h"
#include <QDebug>
ProteinStore::ProteinStore() ProteinStore::ProteinStore()
{ {
_regexp_contaminant.setPattern("([KR])([^P])"); _regexp_contaminant.setPattern("^conta\\|");
_regexp_decoy.setPattern(".*\\|reversed$"); _regexp_decoy.setPattern(".*\\|reversed$");
} }
ProteinStore::~ProteinStore() ProteinStore::~ProteinStore()
...@@ -45,7 +46,7 @@ ProteinStore::~ProteinStore() ...@@ -45,7 +46,7 @@ ProteinStore::~ProteinStore()
ProteinXtpSp & ProteinStore::getInstance(ProteinXtpSp & peptide_in) { 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)); 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) { if (ret.second) {
setProteinInformations(ret.first->second); setProteinInformations(ret.first->second);
} }
...@@ -54,11 +55,14 @@ ProteinXtpSp & ProteinStore::getInstance(ProteinXtpSp & peptide_in) { ...@@ -54,11 +55,14 @@ ProteinXtpSp & ProteinStore::getInstance(ProteinXtpSp & peptide_in) {
} }
void ProteinStore::setProteinInformations(ProteinXtpSp & peptide_in) { void ProteinStore::setProteinInformations(ProteinXtpSp & peptide_in) {
qDebug() << "ProteinStore::setProteinInformations begin";
QString accession = peptide_in.get()->getAccession(); QString accession = peptide_in.get()->getAccession();
if (_regexp_contaminant.indexIn(accession, 0)>-1) { if (_regexp_contaminant.indexIn(accession, 0)>-1) {
qDebug() << "ProteinStore::setProteinInformations is contaminant " << accession;
peptide_in.get()->setIsContaminant(true); peptide_in.get()->setIsContaminant(true);
} }
if (_regexp_decoy.indexIn(accession, 0)>-1) { if (_regexp_decoy.indexIn(accession, 0)>-1) {
peptide_in.get()->setIsDecoy(true); peptide_in.get()->setIsDecoy(true);
} }
qDebug() << "ProteinStore::setProteinInformations end";
} }
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
class ProteinStore class ProteinStore
{ {
public:
ProteinStore(); ProteinStore();
~ProteinStore(); ~ProteinStore();
......
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