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

work on PTM islands : new ptm subgroup

parent 82747c20
No related branches found
No related tags found
No related merge requests found
...@@ -70,6 +70,7 @@ SET(CPP_FILES ...@@ -70,6 +70,7 @@ SET(CPP_FILES
grouping/groupingpeptidemass.cpp grouping/groupingpeptidemass.cpp
grouping/ptm/ptmgroupingexperiment.cpp grouping/ptm/ptmgroupingexperiment.cpp
grouping/ptm/ptmisland.cpp grouping/ptm/ptmisland.cpp
grouping/ptm/ptmislandsubgroup.cpp
gui/peptide_detail_view/spectrum_widget/spectrumpainter.cpp gui/peptide_detail_view/spectrum_widget/spectrumpainter.cpp
input/xpipsaxhandler.cpp input/xpipsaxhandler.cpp
input/xtandemsaxhandler.cpp input/xtandemsaxhandler.cpp
......
...@@ -72,6 +72,15 @@ PtmGroupingExperiment::~PtmGroupingExperiment() ...@@ -72,6 +72,15 @@ PtmGroupingExperiment::~PtmGroupingExperiment()
} }
void PtmGroupingExperiment::addPtmIsland(PtmIslandSp ptm_island_sp) {
if (std::none_of(_ptm_island_subgroup_list.begin(), _ptm_island_subgroup_list.end(), [ptm_island_sp](PtmIslandSubgroupSp element) {
return element.get()->mergePtmIslandSp(ptm_island_sp);
})) {
//create a new subgroup
_ptm_island_subgroup_list.push_back(std::make_shared<PtmIslandSubgroup>(ptm_island_sp));
}
}
void PtmGroupingExperiment::addProteinMatch(const ProteinMatch* p_protein_match) { void PtmGroupingExperiment::addProteinMatch(const ProteinMatch* p_protein_match) {
if (p_protein_match->getValidationState() >= _peptide_validation_state) { if (p_protein_match->getValidationState() >= _peptide_validation_state) {
std::vector< unsigned int > ptm_position_list = getPtmPositions(p_protein_match); std::vector< unsigned int > ptm_position_list = getPtmPositions(p_protein_match);
...@@ -86,7 +95,10 @@ void PtmGroupingExperiment::addProteinMatch(const ProteinMatch* p_protein_match) ...@@ -86,7 +95,10 @@ void PtmGroupingExperiment::addProteinMatch(const ProteinMatch* p_protein_match)
} }
std::vector< PtmIslandSp > protein_ptm_islands = mergePeptideMatchPtmIslandList(ptm_island_list); std::vector< PtmIslandSp > protein_ptm_islands = mergePeptideMatchPtmIslandList(ptm_island_list);
//=> ptm island subgroups (same set of sample scan numbers) //=> ptm island subgroups (same set of sample scan numbers)
for (PtmIslandSp ptm_island:protein_ptm_islands) {
addPtmIsland(ptm_island);
}
} }
} }
...@@ -101,7 +113,7 @@ std::vector< PtmIslandSp > PtmGroupingExperiment::mergePeptideMatchPtmIslandList ...@@ -101,7 +113,7 @@ std::vector< PtmIslandSp > PtmGroupingExperiment::mergePeptideMatchPtmIslandList
new_ptm_island_list.push_back(ptm_island_sp); new_ptm_island_list.push_back(ptm_island_sp);
} }
} }
return new_ptm_island_list; return new_ptm_island_list;
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "../../core/proteinmatch.h" #include "../../core/proteinmatch.h"
#include <pappsomspp/amino_acid/aamodification.h> #include <pappsomspp/amino_acid/aamodification.h>
#include "ptmisland.h" #include "ptmisland.h"
#include "ptmislandsubgroup.h"
class PtmGroupingExperiment class PtmGroupingExperiment
{ {
...@@ -46,9 +47,11 @@ private: ...@@ -46,9 +47,11 @@ private:
std::vector<unsigned int> getPtmPositions(const ProteinMatch * protein_match) const; std::vector<unsigned int> getPtmPositions(const ProteinMatch * protein_match) const;
std::vector< PtmIslandSp > mergePeptideMatchPtmIslandList(vector< PtmIslandSp > ptm_island_list); std::vector< PtmIslandSp > mergePeptideMatchPtmIslandList(vector< PtmIslandSp > ptm_island_list);
void addPtmIsland(PtmIslandSp ptm_island);
private: private:
std::list<pappso::AaModificationP> _modification_list; std::list<pappso::AaModificationP> _modification_list;
ValidationState _peptide_validation_state = ValidationState::validAndChecked; ValidationState _peptide_validation_state = ValidationState::validAndChecked;
std::vector<PtmIslandSubgroupSp> _ptm_island_subgroup_list;
}; };
#endif // PTMGROUPINGEXPERIMENT_H #endif // PTMGROUPINGEXPERIMENT_H
...@@ -43,6 +43,17 @@ PtmIsland::~PtmIsland() ...@@ -43,6 +43,17 @@ PtmIsland::~PtmIsland()
{ {
} }
std::vector<std::size_t> PtmIsland::getSampleScanSet() const {
std::vector<std::size_t> sample_scan_set;
for (const PeptideMatch * p_peptide_match:_peptide_match_list) {
sample_scan_set.push_back(p_peptide_match->getHashSampleScan());
}
std::sort(sample_scan_set.begin(), sample_scan_set.end());
sample_scan_set.erase(std::unique(sample_scan_set.begin(), sample_scan_set.end()), sample_scan_set.end());
return sample_scan_set;
}
bool PtmIsland::containsPeptideMatch(const PeptideMatch* peptide_match) const { bool PtmIsland::containsPeptideMatch(const PeptideMatch* peptide_match) const {
return std::any_of(_peptide_match_list.begin(), _peptide_match_list.end(), [peptide_match](const PeptideMatch* element) { return std::any_of(_peptide_match_list.begin(), _peptide_match_list.end(), [peptide_match](const PeptideMatch* element) {
......
...@@ -54,6 +54,7 @@ public: ...@@ -54,6 +54,7 @@ public:
bool merge(PtmIslandSp ptm_island_sp); bool merge(PtmIslandSp ptm_island_sp);
bool containsPeptideMatch(const PeptideMatch* element) const; bool containsPeptideMatch(const PeptideMatch* element) const;
std::vector<std::size_t> getSampleScanSet() const;
private: private:
const ProteinMatch * _protein_match_p; const ProteinMatch * _protein_match_p;
std::vector<const PeptideMatch *> _peptide_match_list; std::vector<const PeptideMatch *> _peptide_match_list;
......
/** /**
* \file grouping/ptm/ptmprotein.cpp * \file grouping/ptm/ptmislandsubgroup.cpp
* \date 24/5/2017 * \date 29/5/2017
* \author Olivier Langella * \author Olivier Langella
* \brief PTM protein * \brief object to group ptm islands sharing the same set of sample scans with different proteins
*/ */
/******************************************************************************* /*******************************************************************************
...@@ -27,9 +27,31 @@ ...@@ -27,9 +27,31 @@
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation * Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/ ******************************************************************************/
#include "ptmprotein.h" #include "ptmislandsubgroup.h"
PtmProtein::PtmProtein(PtmGroupingExperiment * experiment, ProteinMatch * protein_match) { PtmIslandSubgroup::PtmIslandSubgroup(PtmIslandSp ptm_island_sp)
_ptm_position_list = experiment->getPtmPositions(protein_match); {
_ptm_island_list.push_back(ptm_island_sp);
_sample_scan_set = ptm_island_sp.get()->getSampleScanSet();
}
PtmIslandSubgroup::PtmIslandSubgroup(const PtmIslandSubgroup& other)
{
_ptm_island_list = other._ptm_island_list;
_sample_scan_set = other._sample_scan_set;
}
PtmIslandSubgroup::~PtmIslandSubgroup()
{
}
bool PtmIslandSubgroup::mergePtmIslandSp(PtmIslandSp ptm_island_sp) {
if (_sample_scan_set == ptm_island_sp.get()->getSampleScanSet()) {
//merge
_ptm_island_list.push_back(ptm_island_sp);
return true;
}
return false;
} }
/** /**
* \file grouping/ptm/ptmprotein.h * \file grouping/ptm/ptmislandsubgroup.h
* \date 24/5/2017 * \date 29/5/2017
* \author Olivier Langella * \author Olivier Langella
* \brief PTM protein * \brief object to group ptm islands sharing the same set of sample scans with different proteins
*/ */
/******************************************************************************* /*******************************************************************************
...@@ -27,20 +27,34 @@ ...@@ -27,20 +27,34 @@
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation * Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/ ******************************************************************************/
#ifndef PTMPROTEIN_H #ifndef PTMISLANDSUBGROUP_H
#define PTMPROTEIN_H #define PTMISLANDSUBGROUP_H
#include <memory>
#include "../../core/proteinmatch.h"
#include "ptmisland.h" #include "ptmisland.h"
#include "ptmgroupingexperiment.h"
class PtmProtein
class PtmIslandSubgroup;
/** \brief shared pointer on a Peptide object
*/
typedef std::shared_ptr<PtmIslandSubgroup> PtmIslandSubgroupSp;
class PtmIslandSubgroup
{ {
public: public:
PtmProtein(PtmGroupingExperiment * experiment, ProteinMatch * protein_match); PtmIslandSubgroup(PtmIslandSp ptm_island_sp);
PtmIslandSubgroup(const PtmIslandSubgroup& other);
~PtmIslandSubgroup();
/** @brief merge with the given ptm island if all sample scans are shared
* */
bool mergePtmIslandSp(PtmIslandSp ptm_island_sp);
private: private:
std::vector<unsigned int> _ptm_position_list; std::vector< PtmIslandSp > _ptm_island_list;
std::vector<std::size_t> _sample_scan_set;
}; };
#endif // PTMPROTEIN_H #endif // PTMISLANDSUBGROUP_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