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
#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")
......
......@@ -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);
}
......
......@@ -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
......@@ -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);
}
}
}
......
......@@ -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;
}
......@@ -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;
......
......@@ -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;
};
......
......@@ -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);
}
......@@ -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 :
......
......@@ -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;
}
......
......@@ -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;
};
......
......@@ -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";
}
......@@ -39,6 +39,7 @@
class ProteinStore
{
public:
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