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

work on PTM islands

parent f50e6227
No related branches found
No related tags found
No related merge requests found
......@@ -68,6 +68,8 @@ SET(CPP_FILES
grouping/groupingexperiment.cpp
grouping/groupinggroup.cpp
grouping/groupingpeptidemass.cpp
grouping/ptm/ptmgroupingexperiment.cpp
grouping/ptm/ptmisland.cpp
gui/peptide_detail_view/spectrum_widget/spectrumpainter.cpp
input/xpipsaxhandler.cpp
input/xtandemsaxhandler.cpp
......
......@@ -97,7 +97,7 @@ unsigned int PeptideMatch::getStop() const {
return _start+_peptide_sp.get()->size();
}
void PeptideMatch::containsPosition(unsigned int position) {
bool PeptideMatch::containsPosition(unsigned int position) const {
if (position < _start) {
return false;
}
......
......@@ -110,10 +110,10 @@ public :
ValidationState getValidationState() const;
/** @brief tells if this peptide contains a position
/** @brief tells if this peptide contains a protein position
* the position is the amino acid position on the protein sequence (starts from 0)
* */
void containsPosition(unsigned int position);
bool containsPosition(unsigned int position) const;
private :
static std::hash<std::string> _hash_fn;
......
......@@ -30,12 +30,15 @@
#include "ptmisland.h"
#include <pappsomspp/pappsoexception.h>
PtmIsland::PtmIsland(const ProteinMatch* p_protein_match, unsigned int position)
PtmIsland::PtmIsland(const ProteinMatch* p_protein_match, unsigned int position):_protein_match_p(p_protein_match)
{
_position_list.push_back(position);
_protein_match_p = p_protein_match;
}
PtmIsland::PtmIsland(const PtmIsland & other):_protein_match_p(other._protein_match_p) {
_position_list = other._position_list;
}
PtmIsland::~PtmIsland()
{
......@@ -67,27 +70,27 @@ bool PtmIsland::merge(PtmIslandSp ptm_island_sp) {
}
else {
//so we merge
_peptide_match_list.insert(0,ptm_island_sp.get()->_peptide_match_list.begin(),ptm_island_sp.get()->_peptide_match_list.end());
_peptide_match_list.insert(_peptide_match_list.begin(),ptm_island_sp.get()->_peptide_match_list.begin(),ptm_island_sp.get()->_peptide_match_list.end());
std::sort(_peptide_match_list.begin(), _peptide_match_list.end());
auto last = std::unique(_peptide_match_list.begin(), _peptide_match_list.end());
_peptide_match_list.erase(last, _peptide_match_list.end());
_position_list.insert(0,ptm_island_sp.get()->_position_list.begin(),ptm_island_sp.get()->_position_list.end());
_position_list.insert(_position_list.begin(),ptm_island_sp.get()->_position_list.begin(),ptm_island_sp.get()->_position_list.end());
std::sort(_position_list.begin(), _position_list.end());
_position_list.erase(std::unique(_position_list.begin(), _position_list.end()), _position_list.end());
PeptideMatch * result = std::max_element(_peptide_match_list.begin(), _peptide_match_list.end(), [](const PeptideMatch * a, const PeptideMatch * b)
std::vector<const PeptideMatch *>::const_iterator it_result = std::max_element(_peptide_match_list.begin(), _peptide_match_list.end(), [](const PeptideMatch * a, const PeptideMatch * b)
{
return a->getStop() < b->getStop();
return (a->getStop() < b->getStop());
});
_protein_stop = result->getStop();
_protein_stop = (*it_result)->getStop();
result = std::min_element(_peptide_match_list.begin(), _peptide_match_list.end(), [](const PeptideMatch * a, const PeptideMatch * b)
it_result = std::min_element(_peptide_match_list.begin(), _peptide_match_list.end(), [](const PeptideMatch * a, const PeptideMatch * b)
{
return a->getStart() < b->getStart();
});
_protein_start = result->getStart();
_protein_start = (*it_result)->getStart();
return true;
}
}
......@@ -34,7 +34,6 @@
#include "../../core/peptidematch.h"
#include <memory>
PtmIslandSp
class PtmIsland;
......@@ -46,6 +45,7 @@ class PtmIsland
{
public:
PtmIsland(const ProteinMatch* p_protein_match, unsigned int position);
PtmIsland(const PtmIsland & other);
~PtmIsland();
void addPeptideMatch(const PeptideMatch* p_peptide_match);
......@@ -55,8 +55,8 @@ public:
bool containsPeptideMatch(const PeptideMatch* element) const;
private:
ProteinMatch * _protein_match_p;
std::vector<PeptideMatch *> _peptide_match_list;
const ProteinMatch * _protein_match_p;
std::vector<const PeptideMatch *> _peptide_match_list;
//std::vector<std::size_t> _sample_scan_set;
unsigned int _group_number; //group together different ptmislands linked by a common protein
unsigned int _subgroup_number; //group together proteins that share the same ptmisland
......
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