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

WIP: new peptide match store object

parent 02cc8df7
No related branches found
No related tags found
No related merge requests found
...@@ -106,6 +106,7 @@ SET(CPP_FILES ...@@ -106,6 +106,7 @@ SET(CPP_FILES
utils/identificationdatasourcestore.cpp utils/identificationdatasourcestore.cpp
utils/groupstore.cpp utils/groupstore.cpp
utils/msrunstore.cpp utils/msrunstore.cpp
utils/peptidematchstore.cpp
utils/peptidestore.cpp utils/peptidestore.cpp
utils/proteinstore.cpp utils/proteinstore.cpp
utils/readspectrum.cpp utils/readspectrum.cpp
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <QFileInfo> #include <QFileInfo>
#include "../../utils/readspectrum.h" #include "../../utils/readspectrum.h"
IdentificationDataSource::IdentificationDataSource(const QString resource_name) IdentificationDataSource::IdentificationDataSource(const QString resource_name)
{ {
_resource_name = resource_name; _resource_name = resource_name;
...@@ -45,6 +44,10 @@ IdentificationDataSource::~IdentificationDataSource() ...@@ -45,6 +44,10 @@ IdentificationDataSource::~IdentificationDataSource()
} }
PeptideMatchStore & IdentificationDataSource::getPeptideMatchStore() {
return _peptide_match_store;
}
void IdentificationDataSource::setXmlId(const QString xmlid) { void IdentificationDataSource::setXmlId(const QString xmlid) {
_xml_id = xmlid; _xml_id = xmlid;
} }
......
...@@ -29,12 +29,14 @@ ...@@ -29,12 +29,14 @@
#include <QVariant> #include <QVariant>
#include "../msrun.h" #include "../msrun.h"
#include "../../utils/fastafilestore.h" #include "../../utils/fastafilestore.h"
#include "../../utils/peptidematchstore.h"
class Project; class Project;
class IdentificationDataSource; class IdentificationDataSource;
typedef std::shared_ptr<IdentificationDataSource> IdentificationDataSourceSp; typedef std::shared_ptr<IdentificationDataSource> IdentificationDataSourceSp;
class IdentificationDataSource class IdentificationDataSource
{ {
public: public:
...@@ -44,6 +46,7 @@ public: ...@@ -44,6 +46,7 @@ public:
~IdentificationDataSource(); ~IdentificationDataSource();
bool operator==(const IdentificationDataSource& other) const; bool operator==(const IdentificationDataSource& other) const;
PeptideMatchStore & getPeptideMatchStore();
void setXmlId(const QString xmlid); void setXmlId(const QString xmlid);
const QString & getXmlId() const; const QString & getXmlId() const;
...@@ -118,6 +121,8 @@ private : ...@@ -118,6 +121,8 @@ private :
std::map<IdentificationEngineParam, QVariant> _params; std::map<IdentificationEngineParam, QVariant> _params;
std::map<IdentificationEngineStatistics, QVariant> _param_stats; std::map<IdentificationEngineStatistics, QVariant> _param_stats;
std::vector<FastaFileSp> _fastafile_list; std::vector<FastaFileSp> _fastafile_list;
PeptideMatchStore _peptide_match_store;
}; };
#endif // IDENTIFICATIONDATASOURCE_H #endif // IDENTIFICATIONDATASOURCE_H
...@@ -49,6 +49,10 @@ PeptideMatch::PeptideMatch(const PeptideMatch & other): PeptideMatch(other._msru ...@@ -49,6 +49,10 @@ PeptideMatch::PeptideMatch(const PeptideMatch & other): PeptideMatch(other._msru
} }
PeptideMatchSp PeptideMatch::makePeptideMatchSp() const {
return std::make_shared<PeptideMatch>(*this);
}
void PeptideMatch::updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters) { void PeptideMatch::updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters) {
_proxy_valid = false; _proxy_valid = false;
......
...@@ -45,6 +45,8 @@ public : ...@@ -45,6 +45,8 @@ public :
std::size_t getHashSampleScan() const; std::size_t getHashSampleScan() const;
std::size_t getHashPeptideMassSample() const; std::size_t getHashPeptideMassSample() const;
PeptideMatchSp makePeptideMatchSp() const;
void setRetentionTime(pappso::pappso_double rt); void setRetentionTime(pappso::pappso_double rt);
void setEvalue(pappso::pappso_double evalue); void setEvalue(pappso::pappso_double evalue);
...@@ -72,7 +74,7 @@ public : ...@@ -72,7 +74,7 @@ public :
/** \brief get specific parameter value /** \brief get specific parameter value
*/ */
virtual const QVariant getParam(PeptideMatchParam param) const; virtual const QVariant getParam(PeptideMatchParam param) const;
const std::map<PeptideMatchParam, QVariant> & getParamList() const; const std::map<PeptideMatchParam, QVariant> & getParamList() const;
...@@ -118,7 +120,7 @@ public : ...@@ -118,7 +120,7 @@ public :
pappso::mz getDeltaMass() const; pappso::mz getDeltaMass() const;
ValidationState getValidationState() const; ValidationState getValidationState() const;
/** @brief tells if this peptide contains a protein position /** @brief tells if this peptide contains a protein position
* the position is the amino acid position on the protein sequence (starts from 0) * the position is the amino acid position on the protein sequence (starts from 0)
* */ * */
......
...@@ -39,12 +39,8 @@ ProteinMatch::ProteinMatch() ...@@ -39,12 +39,8 @@ ProteinMatch::ProteinMatch()
ProteinMatch::~ProteinMatch() ProteinMatch::~ProteinMatch()
{ {
auto it = _peptide_match_list.begin();
while (it != _peptide_match_list.end()) {
delete (*it);
it++;
}
} }
ValidationState ProteinMatch::getValidationState() const { ValidationState ProteinMatch::getValidationState() const {
if (isGrouped()) { if (isGrouped()) {
return ValidationState::grouped; return ValidationState::grouped;
...@@ -141,8 +137,8 @@ bool ProteinMatch::isGrouped() const { ...@@ -141,8 +137,8 @@ bool ProteinMatch::isGrouped() const {
void ProteinMatch::setChecked(bool arg1) { void ProteinMatch::setChecked(bool arg1) {
_checked = arg1; _checked = arg1;
} }
void ProteinMatch::addPeptideMatch(PeptideMatch * peptide_match) { void ProteinMatch::addPeptideMatchSp(PeptideMatchSp peptide_match) {
_peptide_match_list.push_back(peptide_match); _peptide_match_list.push_back(peptide_match.get());
} }
......
...@@ -74,7 +74,7 @@ public: ...@@ -74,7 +74,7 @@ public:
pappso::pappso_double getEmPAI(const MsRun * sp_msrun_id = nullptr) const; pappso::pappso_double getEmPAI(const MsRun * sp_msrun_id = nullptr) const;
void setProteinXtpSp(ProteinXtpSp protein_sp); void setProteinXtpSp(ProteinXtpSp protein_sp);
void addPeptideMatch(PeptideMatch * peptide_match); void addPeptideMatchSp(PeptideMatchSp peptide_match);
std::vector<PeptideMatch *> & getPeptideMatchList(); std::vector<PeptideMatch *> & getPeptideMatchList();
const std::vector<PeptideMatch *> & getPeptideMatchList() const; const std::vector<PeptideMatch *> & getPeptideMatchList() const;
......
...@@ -278,7 +278,10 @@ void IdentificationPwizReader::read( ...@@ -278,7 +278,10 @@ void IdentificationPwizReader::read(
} }
ProteinMatch * protein_match_p = it->second; ProteinMatch * protein_match_p = it->second;
protein_match_p->addPeptideMatch(p_peptide_match_from_evidence); protein_match_p->addPeptideMatchSp(p_peptide_match_from_evidence->getIdentificationDataSource()->getPeptideMatchStore().getInstance(p_peptide_match_from_evidence));
delete p_peptide_match_from_evidence;
//protein_match_p->addPeptideMatch(p_peptide_match_from_evidence);
} }
delete p_peptide_match; delete p_peptide_match;
} }
......
...@@ -279,7 +279,6 @@ bool XpipSaxHandler::startElement_peptide(QXmlAttributes attributes) { ...@@ -279,7 +279,6 @@ bool XpipSaxHandler::startElement_peptide(QXmlAttributes attributes) {
if (attributes.value("validate").simplified().toLower() == "true") { if (attributes.value("validate").simplified().toLower() == "true") {
_p_peptide_match->setChecked(true); _p_peptide_match->setChecked(true);
} }
_p_protein_match->addPeptideMatch(_p_peptide_match);
qDebug() << "startElement_peptide end" ; qDebug() << "startElement_peptide end" ;
return true; return true;
} }
...@@ -296,10 +295,11 @@ bool XpipSaxHandler::startElement_modif(QXmlAttributes attributes) { ...@@ -296,10 +295,11 @@ bool XpipSaxHandler::startElement_modif(QXmlAttributes attributes) {
} }
bool XpipSaxHandler::endElement_peptide() { bool XpipSaxHandler::endElement_peptide() {
qDebug() << "endElement_peptide "; qDebug() << "endElement_peptide ";
PeptideXtpSp peptide_const = PeptideXtp(*(_current_peptide_sp.get())).makePeptideXtpSp(); PeptideXtpSp peptide_const = PeptideXtp(*(_current_peptide_sp.get())).makePeptideXtpSp();
peptide_const = _p_project->getPeptideStore().getInstance(peptide_const); peptide_const = _p_project->getPeptideStore().getInstance(peptide_const);
_p_peptide_match->setPeptideXtpSp(peptide_const); _p_peptide_match->setPeptideXtpSp(peptide_const);
_p_protein_match->addPeptideMatchSp(_p_peptide_match->getIdentificationDataSource()->getPeptideMatchStore().getInstance(_p_peptide_match));
delete _p_peptide_match;
return true; return true;
} }
......
...@@ -303,7 +303,6 @@ bool XtandemSaxHandler::startElement_domain(QXmlAttributes attributes) { ...@@ -303,7 +303,6 @@ bool XtandemSaxHandler::startElement_domain(QXmlAttributes attributes) {
_p_peptide_match->setIdentificationDataSource( _p_identification_data_source); _p_peptide_match->setIdentificationDataSource( _p_identification_data_source);
_p_peptide_match->setChecked(true); _p_peptide_match->setChecked(true);
_p_protein_match->addPeptideMatch(_p_peptide_match);
...@@ -331,6 +330,11 @@ bool XtandemSaxHandler::endElement_domain() { ...@@ -331,6 +330,11 @@ bool XtandemSaxHandler::endElement_domain() {
_current_peptide_sp = _p_project->getPeptideStore().getInstance(_current_peptide_sp); _current_peptide_sp = _p_project->getPeptideStore().getInstance(_current_peptide_sp);
_p_peptide_match->setPeptideXtpSp(_current_peptide_sp); _p_peptide_match->setPeptideXtpSp(_current_peptide_sp);
_p_protein_match->addPeptideMatchSp(_p_peptide_match->getIdentificationDataSource()->getPeptideMatchStore().getInstance(_p_peptide_match));
delete _p_peptide_match;
return is_ok; return is_ok;
} }
bool XtandemSaxHandler::endElement_note() { bool XtandemSaxHandler::endElement_note() {
......
/**
* \file utils/peptidematchstore.cpp
* \date 18/11/2017
* \author Olivier Langella
* \brief store unique instances of peptide match
*/
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#include "peptidematchstore.h"
#include "../core/peptidematch.h"
std::shared_ptr<PeptideMatch> & PeptideMatchStore::getInstance(const PeptideMatch * p_peptide_match) {
}
/**
* \file utils/peptidematchstore.h
* \date 18/11/2017
* \author Olivier Langella
* \brief store unique instances of peptide match
*/
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#ifndef PEPTIDEMATCHSTORE_H
#define PEPTIDEMATCHSTORE_H
#include <memory>
class PeptideMatch;
class PeptideMatchStore
{
public:
std::shared_ptr<PeptideMatch> & getInstance(const PeptideMatch * p_peptide_match);
};
#endif // PEPTIDEMATCHSTORE_H
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