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

get ptm grouping id

parent af7793d0
No related branches found
No related tags found
No related merge requests found
...@@ -150,13 +150,13 @@ bool IdentificationGroup::contains (const MsRun * p_msrun) const { ...@@ -150,13 +150,13 @@ bool IdentificationGroup::contains (const MsRun * p_msrun) const {
return false; return false;
} }
void IdentificationGroup::addIdentificationDataSourceP(IdentificationDataSource * p_identification_source) { void IdentificationGroup::addIdentificationDataSourceP(IdentificationDataSource * p_identification_source) {
addMsRunSp(p_identification_source->getMsRunSp()); addMsRunSp(p_identification_source->getMsRunSp());
auto it = std::find (_id_source_list.begin() ,_id_source_list.end(),p_identification_source); auto it = std::find (_id_source_list.begin() ,_id_source_list.end(),p_identification_source);
if (it == _id_source_list.end()) { if (it == _id_source_list.end()) {
_id_source_list.push_back(p_identification_source); _id_source_list.push_back(p_identification_source);
} }
} }
void IdentificationGroup::addMsRunSp(MsRunSp ms_run_sp) { void IdentificationGroup::addMsRunSp(MsRunSp ms_run_sp) {
auto it = std::find (_ms_run_list.begin() ,_ms_run_list.end(),ms_run_sp); auto it = std::find (_ms_run_list.begin() ,_ms_run_list.end(),ms_run_sp);
if (it == _ms_run_list.end()) { if (it == _ms_run_list.end()) {
...@@ -209,6 +209,22 @@ void IdentificationGroup::startGrouping (const GroupingType & grouping_type) { ...@@ -209,6 +209,22 @@ void IdentificationGroup::startGrouping (const GroupingType & grouping_type) {
qDebug() << "IdentificationGroup::startGrouping end "; qDebug() << "IdentificationGroup::startGrouping end ";
} }
void IdentificationGroup::startPtmGrouping () {
qDebug() << "IdentificationGroup::startPtmGrouping begin ";
if (_p_grp_ptm_experiment != nullptr) {
delete _p_grp_ptm_experiment;
}
_p_grp_ptm_experiment = new PtmGroupingExperiment();
_p_grp_ptm_experiment->setValidationState(ValidationState::grouped);
for (ProteinMatch * p_protein_match : _protein_match_list) {
_p_grp_ptm_experiment->addProteinMatch(p_protein_match);
}
_p_grp_ptm_experiment->startGrouping();
qDebug() << "IdentificationGroup::startPtmGrouping end ";
}
const QString IdentificationGroup::getTabName() const { const QString IdentificationGroup::getTabName() const {
return _ms_run_list[0]->getFilename(); return _ms_run_list[0]->getFilename();
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "msrun.h" #include "msrun.h"
#include "grouping/groupingexperiment.h" #include "grouping/groupingexperiment.h"
#include "grouping/ptm/ptmgroupingexperiment.h"
#include "../utils/types.h" #include "../utils/types.h"
#ifndef IDENTIFICATIONGROUP_H #ifndef IDENTIFICATIONGROUP_H
...@@ -91,6 +92,9 @@ public: ...@@ -91,6 +92,9 @@ public:
void updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters); void updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters);
void startGrouping (const GroupingType & grouping_type); void startGrouping (const GroupingType & grouping_type);
/** @brief creates a new PTM grouping experiment
* */
void startPtmGrouping ();
const std::vector<MsRunSp> & getMsRunSpList() const; const std::vector<MsRunSp> & getMsRunSpList() const;
const std::vector<IdentificationDataSource *> & getIdentificationDataSourceList() const; const std::vector<IdentificationDataSource *> & getIdentificationDataSourceList() const;
...@@ -107,6 +111,7 @@ private : ...@@ -107,6 +111,7 @@ private :
void addMsRunSp(MsRunSp ms_run_sp); void addMsRunSp(MsRunSp ms_run_sp);
private : private :
GroupingExperiment * _p_grp_experiment= nullptr; GroupingExperiment * _p_grp_experiment= nullptr;
PtmGroupingExperiment * _p_grp_ptm_experiment= nullptr;
Project * _p_project; Project * _p_project;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "ptmgroupingexperiment.h" #include "ptmgroupingexperiment.h"
PtmGroupingExperiment::PtmGroupingExperiment(const PtmGroupingExperiment& other) PtmGroupingExperiment::PtmGroupingExperiment()
{ {
/* /*
* accession MOD:00696 * accession MOD:00696
...@@ -73,16 +73,16 @@ PtmGroupingExperiment::~PtmGroupingExperiment() ...@@ -73,16 +73,16 @@ PtmGroupingExperiment::~PtmGroupingExperiment()
} }
void PtmGroupingExperiment::numbering() { void PtmGroupingExperiment::numbering() {
std::sort(_ptm_island_group_list.begin(), _ptm_island_group_list.end(),[](const PtmIslandGroupSp a, const PtmIslandGroupSp b) std::sort(_ptm_island_group_list.begin(), _ptm_island_group_list.end(),[](const PtmIslandGroupSp a, const PtmIslandGroupSp b)
{ {
return *(a.get()) < *(b.get()); return *(a.get()) < *(b.get());
}); });
unsigned int number=0; unsigned int number=0;
for (PtmIslandGroupSp ptm_island_group:_ptm_island_group_list) { for (PtmIslandGroupSp ptm_island_group:_ptm_island_group_list) {
number ++; number ++;
ptm_island_group.get()->setGroupNumber(number); ptm_island_group.get()->setGroupNumber(number);
} }
} }
void PtmGroupingExperiment::startGrouping() { void PtmGroupingExperiment::startGrouping() {
//we have a list of ptm island subgroups to group : //we have a list of ptm island subgroups to group :
...@@ -97,6 +97,7 @@ void PtmGroupingExperiment::startGrouping() { ...@@ -97,6 +97,7 @@ void PtmGroupingExperiment::startGrouping() {
numbering(); numbering();
} }
void PtmGroupingExperiment::addPtmIsland(PtmIslandSp ptm_island_sp) { void PtmGroupingExperiment::addPtmIsland(PtmIslandSp ptm_island_sp) {
_ptm_island_list.push_back(ptm_island_sp);
if (std::none_of(_ptm_island_subgroup_list.begin(), _ptm_island_subgroup_list.end(), [ptm_island_sp](PtmIslandSubgroupSp element) { 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); return element.get()->mergePtmIslandSp(ptm_island_sp);
})) { })) {
......
...@@ -39,22 +39,23 @@ ...@@ -39,22 +39,23 @@
class PtmGroupingExperiment class PtmGroupingExperiment
{ {
public: public:
PtmGroupingExperiment(const PtmGroupingExperiment& other); PtmGroupingExperiment();
~PtmGroupingExperiment(); ~PtmGroupingExperiment();
void setValidationState(ValidationState validation_state); void setValidationState(ValidationState validation_state);
void addProteinMatch(const ProteinMatch* p_protein_match); void addProteinMatch(const ProteinMatch* p_protein_match);
void startGrouping(); void startGrouping();
private: 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); void addPtmIsland(PtmIslandSp ptm_island);
void numbering(); void numbering();
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<PtmIslandSp> _ptm_island_list;
std::vector<PtmIslandSubgroupSp> _ptm_island_subgroup_list; std::vector<PtmIslandSubgroupSp> _ptm_island_subgroup_list;
std::vector<PtmIslandGroupSp> _ptm_island_group_list; std::vector<PtmIslandGroupSp> _ptm_island_group_list;
}; };
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "ptmisland.h" #include "ptmisland.h"
#include <pappsomspp/pappsoexception.h> #include <pappsomspp/pappsoexception.h>
#include "ptmislandsubgroup.h" #include "ptmislandsubgroup.h"
#include "ptmislandgroup.h"
#include <pappsomspp/utils.h>
PtmIsland::PtmIsland(const ProteinMatch* p_protein_match, unsigned int position):_protein_match_p(p_protein_match) PtmIsland::PtmIsland(const ProteinMatch* p_protein_match, unsigned int position):_protein_match_p(p_protein_match)
{ {
...@@ -45,6 +47,19 @@ PtmIsland::~PtmIsland() ...@@ -45,6 +47,19 @@ PtmIsland::~PtmIsland()
} }
const QString PtmIsland::getGroupingId() const {
if(_prot_number==0) {
return "";
}
return QString("ptm%1%2%3").arg(pappso::Utils::getLexicalOrderedString(_ptm_island_subgroup_p->getPtmIslandGroup()->getGroupNumber()))
.arg(pappso::Utils::getLexicalOrderedString(_ptm_island_subgroup_p->getSubgroupNumber())).arg(pappso::Utils::getLexicalOrderedString(_prot_number));
}
void PtmIsland::setPtmIslandSubgroup(PtmIslandSubgroup* p_ptm_island_subgroup) {
_ptm_island_subgroup_p = p_ptm_island_subgroup;
}
void PtmIsland::setProteinNumber(unsigned int prot_number) {
_prot_number = prot_number;
}
const ProteinMatch * PtmIsland::getProteinMatch() const { const ProteinMatch * PtmIsland::getProteinMatch() const {
return _protein_match_p; return _protein_match_p;
} }
......
...@@ -58,6 +58,11 @@ public: ...@@ -58,6 +58,11 @@ public:
std::vector<std::size_t> getSampleScanSet() const; std::vector<std::size_t> getSampleScanSet() const;
const ProteinMatch * getProteinMatch() const; const ProteinMatch * getProteinMatch() const;
unsigned int getProteinStartPosition() const; unsigned int getProteinStartPosition() const;
void setPtmIslandSubgroup(PtmIslandSubgroup* p_ptm_island_subgroup);
void setProteinNumber(unsigned int prot_number);
const QString getGroupingId() const;
private: private:
const ProteinMatch * _protein_match_p; const ProteinMatch * _protein_match_p;
...@@ -66,6 +71,7 @@ private: ...@@ -66,6 +71,7 @@ private:
std::vector<unsigned int> _position_list; std::vector<unsigned int> _position_list;
unsigned int _protein_stop=0; unsigned int _protein_stop=0;
unsigned int _protein_start=0; unsigned int _protein_start=0;
unsigned int _prot_number=0;
PtmIslandSubgroup * _ptm_island_subgroup_p = nullptr; PtmIslandSubgroup * _ptm_island_subgroup_p = nullptr;
}; };
......
...@@ -57,6 +57,9 @@ QString PtmIslandGroup::getFirstAccession() const { ...@@ -57,6 +57,9 @@ QString PtmIslandGroup::getFirstAccession() const {
return accession_list[0]; return accession_list[0];
} }
unsigned int PtmIslandGroup::getGroupNumber() const {
return _group_number;
}
void PtmIslandGroup::setGroupNumber(unsigned int number) { void PtmIslandGroup::setGroupNumber(unsigned int number) {
_group_number = number; _group_number = number;
for (PtmIslandSubgroupSp ptm_island_subgroup:_ptm_island_subgroup_list) { for (PtmIslandSubgroupSp ptm_island_subgroup:_ptm_island_subgroup_list) {
......
...@@ -54,6 +54,7 @@ public: ...@@ -54,6 +54,7 @@ public:
unsigned int maxCountSampleScan() const; unsigned int maxCountSampleScan() const;
QString getFirstAccession() const; QString getFirstAccession() const;
void setGroupNumber(unsigned int number); void setGroupNumber(unsigned int number);
unsigned int getGroupNumber() const;
private : private :
std::vector<PtmIslandSubgroupSp> _ptm_island_subgroup_list; std::vector<PtmIslandSubgroupSp> _ptm_island_subgroup_list;
......
...@@ -50,8 +50,29 @@ const PtmIsland * PtmIslandSubgroup::getFirstPtmIsland() const { ...@@ -50,8 +50,29 @@ const PtmIsland * PtmIslandSubgroup::getFirstPtmIsland() const {
return _ptm_island_list.begin()->get(); return _ptm_island_list.begin()->get();
} }
const PtmIslandGroup * PtmIslandSubgroup::getPtmIslandGroup() const {
return _ptm_island_group_p;
}
unsigned int PtmIslandSubgroup::getSubgroupNumber() const {
return _subgroup_number;
}
void PtmIslandSubgroup::setSubgroupNumber(unsigned int number) { void PtmIslandSubgroup::setSubgroupNumber(unsigned int number) {
_subgroup_number = number; _subgroup_number = number;
for (PtmIslandSp ptm_island:_ptm_island_list) {
ptm_island.get()->setPtmIslandSubgroup(this);
}
std::sort(_ptm_island_list.begin(), _ptm_island_list.end(), [](const PtmIslandSp& a, const PtmIslandSp& b)
{
return (a.get()->getProteinMatch()->getProteinXtpSp().get()->getAccession() < b.get()->getProteinMatch()->getProteinXtpSp().get()->getAccession());
});
unsigned int prot_number=0;
for (PtmIslandSp ptm_island:_ptm_island_list) {
prot_number ++;
ptm_island.get()->setProteinNumber(prot_number);
}
} }
void PtmIslandSubgroup::setPtmIslandGroup(PtmIslandGroup * p_ptm_island_group) { void PtmIslandSubgroup::setPtmIslandGroup(PtmIslandGroup * p_ptm_island_group) {
_ptm_island_group_p = p_ptm_island_group; _ptm_island_group_p = p_ptm_island_group;
......
...@@ -60,7 +60,9 @@ public: ...@@ -60,7 +60,9 @@ public:
void setPtmIslandGroup(PtmIslandGroup * p_ptm_island_group); void setPtmIslandGroup(PtmIslandGroup * p_ptm_island_group);
const PtmIsland * getFirstPtmIsland() const; const PtmIsland * getFirstPtmIsland() const;
unsigned int getSubgroupNumber() const;
void setSubgroupNumber(unsigned int number); void setSubgroupNumber(unsigned int number);
const PtmIslandGroup * getPtmIslandGroup() const;
private: private:
std::vector< PtmIslandSp > _ptm_island_list; std::vector< PtmIslandSp > _ptm_island_list;
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>PtmIslandListView</class> <class>ptm_island_list_window</class>
<widget class="QMainWindow" name="ptm_island_list_window"> <widget class="QMainWindow" name="ptm_island_list_window">
<property name="geometry"> <property name="geometry">
<rect> <rect>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QTableView" name="tableView"> <widget class="QTableView" name="ptm_island_tableview">
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum> <enum>Qt::DefaultContextMenu</enum>
</property> </property>
...@@ -111,95 +111,14 @@ ...@@ -111,95 +111,14 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>826</width> <width>826</width>
<height>25</height> <height>23</height>
</rect> </rect>
</property> </property>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/> <widget class="QStatusBar" name="statusbar"/>
</widget> </widget>
<resources/> <resources/>
<connections> <connections/>
<connection>
<sender>hideNotValidCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>ProteinView</receiver>
<slot>doNotValidHide(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>245</x>
<y>53</y>
</hint>
<hint type="destinationlabel">
<x>839</x>
<y>171</y>
</hint>
</hints>
</connection>
<connection>
<sender>hideNotCheckedCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>ProteinView</receiver>
<slot>doNotCheckedHide(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>482</x>
<y>47</y>
</hint>
<hint type="destinationlabel">
<x>920</x>
<y>269</y>
</hint>
</hints>
</connection>
<connection>
<sender>hideNotGroupedCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>ProteinView</receiver>
<slot>doNotGroupedHide(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>688</x>
<y>57</y>
</hint>
<hint type="destinationlabel">
<x>1079</x>
<y>360</y>
</hint>
</hints>
</connection>
<connection>
<sender>protein_search_edit</sender>
<signal>textChanged(QString)</signal>
<receiver>ProteinView</receiver>
<slot>onProteinSearchEdit(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>352</x>
<y>363</y>
</hint>
<hint type="destinationlabel">
<x>879</x>
<y>391</y>
</hint>
</hints>
</connection>
<connection>
<sender>search_combobox</sender>
<signal>activated(QString)</signal>
<receiver>ProteinView</receiver>
<slot>doSearchOn(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>121</x>
<y>354</y>
</hint>
<hint type="destinationlabel">
<x>867</x>
<y>386</y>
</hint>
</hints>
</connection>
</connections>
<slots> <slots>
<slot>doNotValidHide(bool)</slot> <slot>doNotValidHide(bool)</slot>
<slot>doNotCheckedHide(bool)</slot> <slot>doNotCheckedHide(bool)</slot>
......
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