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

wip : protein store

parent daf74d01
No related branches found
No related tags found
No related merge requests found
......@@ -67,6 +67,7 @@ SET(CPP_FILES
grouping/groupingpeptidemass.cpp
input/xpipsaxhandler.cpp
utils/peptidestore.cpp
utils/proteinstore.cpp
utils/readspectrum.cpp
)
......
......@@ -88,4 +88,7 @@ void IdentificationGroup::startGrouping (const GroupingType & grouping_type) {
}
_p_grp_experiment->startGrouping();
//remove contaminant groups
// renumbering
}
......@@ -48,3 +48,16 @@ ProteinXtpSp ProteinXtp::makeProteinXtpSp() const {
return std::make_shared<ProteinXtp>(*this);
}
void ProteinXtp::setIsContaminant(bool conta) {
_is_contaminant = conta;
}
void ProteinXtp::setIsDecoy(bool conta){
_is_decoy = conta;
}
bool ProteinXtp::getIsContaminant() const{
return _is_contaminant;
}
bool ProteinXtp::getIsDecoy() const{
return _is_decoy;
}
......@@ -32,7 +32,7 @@ class ProteinXtp;
/** \brief shared pointer on a Protein object
*/
typedef std::shared_ptr<const ProteinXtp> ProteinXtpSp;
typedef std::shared_ptr<ProteinXtp> ProteinXtpSp;
class ProteinXtp : public pappso::Protein {
public:
......@@ -43,6 +43,11 @@ public:
ProteinXtpSp makeProteinXtpSp() const;
void setIsContaminant(bool conta);
void setIsDecoy(bool conta);
bool getIsContaminant() const;
bool getIsDecoy() const;
private:
SequenceDatabase * _p_sequence_database;
......
......@@ -30,16 +30,35 @@
#include "proteinstore.h"
ProteinStore::ProteinStore()
{
_regexp_contaminant.setPattern("([KR])([^P])");
_regexp_decoy.setPattern(".*\\|reversed$");
}
ProteinStore::~ProteinStore()
{
}
ProteinXtpSp & ProteinStore::getInstance(ProteinXtpSp & peptide_in) {
std::pair<std::unordered_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) {
setProteinInformations(ret.first->second);
}
return ret.first->second;
return (ret.first->second);
}
void ProteinStore::setProteinInformations(ProteinXtpSp & peptide_in) {
QString accession = peptide_in.get()->getAccession();
if (_regexp_contaminant.indexIn(accession, 0)>-1) {
peptide_in.get()->setIsContaminant(true);
}
if (_regexp_decoy.indexIn(accession, 0)>-1) {
peptide_in.get()->setIsDecoy(true);
}
}
......@@ -34,10 +34,13 @@
#include "../core/proteinxtp.h"
#include <QString>
#include <unordered_map>
#include <QRegExp>
#include <map>
class ProteinStore
{
ProteinStore();
~ProteinStore();
ProteinXtpSp & getInstance(ProteinXtpSp & protein_in);
......@@ -45,7 +48,11 @@ private :
void setProteinInformations(ProteinXtpSp & protein_in);
private :
std::unordered_map<QString, ProteinXtpSp> _map_accession_protein_list;
std::map<QString, ProteinXtpSp> _map_accession_protein_list;
/** \brief recognize decoy accession */
QRegExp _regexp_decoy;
/** \brief recognize contaminant accession */
QRegExp _regexp_contaminant;
};
......
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