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

start and size of ptm islands

parent 3674e012
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,12 @@ PtmIsland::~PtmIsland()
{
}
unsigned int PtmIsland::getStart() const {
return _protein_start;
}
unsigned int PtmIsland::size() const {
return _protein_stop - _protein_start;
}
unsigned int PtmIsland::countSampleScanMultiPtm(const PtmGroupingExperiment * p_ptm_grouping_experiment) const {
std::set<std::size_t> sample_scan_list;
......@@ -110,7 +116,16 @@ void PtmIsland::addPeptideMatch(const PeptideMatch* p_peptide_match) {
if (_position_list.size()==1) {
unsigned int position = _position_list[0];
if (p_peptide_match->containsPosition(position)) {
if (_peptide_match_list.size() == 0) {
_protein_start = p_peptide_match->getStart();
}
_peptide_match_list.push_back(p_peptide_match);
if (p_peptide_match->getStart() < _protein_start) {
_protein_start = p_peptide_match->getStart();
}
if (p_peptide_match->getStop() > _protein_stop) {
_protein_stop = p_peptide_match->getStop();
}
}
}
else {
......
......@@ -50,25 +50,28 @@ public:
PtmIsland(const PtmIsland & other);
~PtmIsland();
void addPeptideMatch(const PeptideMatch* p_peptide_match);
/** @brief merge with the given ptm island if there is at least one common peptide match
* */
bool merge(PtmIslandSp ptm_island_sp);
bool containsPeptideMatch(const PeptideMatch* element) const;
std::vector<std::size_t> getSampleScanSet() const;
const ProteinMatch * getProteinMatch() const;
unsigned int getProteinStartPosition() const;
void setPtmIslandSubgroup(PtmIslandSubgroup* p_ptm_island_subgroup);
void setProteinNumber(unsigned int prot_number);
const QString getGroupingId() const;
const std::vector<unsigned int> & getPositionList() const;
const PtmIslandSubgroup * getPtmIslandSubroup() const;
unsigned int countSequence() const;
unsigned int countSampleScanMultiPtm(const PtmGroupingExperiment * p_ptm_grouping_experiment) const;
unsigned int getStart() const;
unsigned int size() const;
private:
const ProteinMatch * _protein_match_p;
std::vector<const PeptideMatch *> _peptide_match_list;
......
......@@ -77,17 +77,17 @@ void PtmIslandGroup::setGroupNumber(unsigned int number) {
}
}
bool PtmIslandGroup::operator<(const PtmIslandGroup& other) const {
if (_ptm_island_subgroup_list.size() == other._ptm_island_subgroup_list.size()) {
if (maxCountSampleScan() == other.maxCountSampleScan()) {
return (getFirstAccession() < other.getFirstAccession());
}
else {
return (maxCountSampleScan() < other.maxCountSampleScan());
}
//if (_ptm_island_subgroup_list.size() == other._ptm_island_subgroup_list.size()) {
if (maxCountSampleScan() == other.maxCountSampleScan()) {
return (getFirstAccession() < other.getFirstAccession());
}
else {
return (_ptm_island_subgroup_list.size() < other._ptm_island_subgroup_list.size());
return (maxCountSampleScan() > other.maxCountSampleScan());
}
//}
//else {
// return (_ptm_island_subgroup_list.size() < other._ptm_island_subgroup_list.size());
//}
}
unsigned int PtmIslandGroup::maxCountSampleScan() const {
std::vector<PtmIslandSubgroupSp>::const_iterator it_result = std::max_element(_ptm_island_subgroup_list.begin(), _ptm_island_subgroup_list.end(), [](const PtmIslandSubgroupSp & a, const PtmIslandSubgroupSp & b)
......
......@@ -39,7 +39,9 @@ PtmIslandTableModel::columnMap PtmIslandTableModel::_column_assignment = {
(std::int8_t)PtmIslandListColumn::spectrum,
(std::int8_t)PtmIslandListColumn::sequence,
(std::int8_t)PtmIslandListColumn::ptm_position_list,
(std::int8_t)PtmIslandListColumn::multiptm
(std::int8_t)PtmIslandListColumn::multiptm,
(std::int8_t)PtmIslandListColumn::ptm_island_start,
(std::int8_t)PtmIslandListColumn::ptm_island_length
};
......@@ -54,30 +56,36 @@ PtmIslandTableModel::~PtmIslandTableModel()
}
const QString PtmIslandTableModel::getTitle(std::int8_t column) const {
switch (column) {
case (std::int8_t) PtmIslandListColumn::spectrum:
return "spectrum";
break;
case (std::int8_t) PtmIslandListColumn::description:
return "description";
break;
case (std::int8_t) PtmIslandListColumn::multiptm:
return "multi PTM";
break;
case (std::int8_t) PtmIslandListColumn::sequence:
return "sequence";
break;
case (std::int8_t) PtmIslandListColumn::ptm_island_id:
return "PTM island ID";
break;
case (std::int8_t) PtmIslandListColumn::accession:
return "accession";
break;
case (std::int8_t) PtmIslandListColumn::ptm_position_list:
return "ptm positions";
}
case (std::int8_t) PtmIslandListColumn::spectrum:
return "spectrum";
break;
case (std::int8_t) PtmIslandListColumn::description:
return "description";
break;
case (std::int8_t) PtmIslandListColumn::multiptm:
return "multi PTM";
break;
case (std::int8_t) PtmIslandListColumn::sequence:
return "sequence";
break;
case (std::int8_t) PtmIslandListColumn::ptm_island_id:
return "PTM island ID";
break;
case (std::int8_t) PtmIslandListColumn::accession:
return "accession";
break;
case (std::int8_t) PtmIslandListColumn::ptm_position_list:
return "ptm positions";
break;
case (std::int8_t) PtmIslandListColumn::ptm_island_start:
return "start";
break;
case (std::int8_t) PtmIslandListColumn::ptm_island_length:
return "length";
}
return "";
}
void PtmIslandTableModel::setIdentificationGroup(IdentificationGroup * p_identification_group) {
......@@ -91,9 +99,10 @@ void PtmIslandTableModel::setIdentificationGroup(IdentificationGroup * p_identif
endResetModel();
}
const PtmGroupingExperiment * PtmIslandTableModel::getPtmGroupingExperiment() const {
if (_p_identification_group == nullptr) {return nullptr;
}
return _p_identification_group->getPtmGroupingExperiment();
if (_p_identification_group == nullptr) {
return nullptr;
}
return _p_identification_group->getPtmGroupingExperiment();
}
int PtmIslandTableModel::rowCount(const QModelIndex &parent ) const {
//qDebug() << "ProteinTableModel::rowCount begin ";
......@@ -106,7 +115,7 @@ int PtmIslandTableModel::rowCount(const QModelIndex &parent ) const {
int PtmIslandTableModel::columnCount(const QModelIndex &parent ) const {
//qDebug() << "ProteinTableModel::columnCount begin ";
if (getPtmGroupingExperiment() != nullptr) {
return 7;
return 9;
}
return 0;
}
......@@ -116,9 +125,9 @@ QVariant PtmIslandTableModel::headerData(int section, Qt::Orientation orientatio
if (orientation == Qt::Horizontal)
{
if (role == Qt::DisplayRole)
{
return QVariant(getTitle(_column_assignment [section]));
}
{
return QVariant(getTitle(_column_assignment [section]));
}
}
return QVariant();
}
......@@ -127,39 +136,45 @@ QVariant PtmIslandTableModel::data(const QModelIndex &index, int role ) const {
if (getPtmGroupingExperiment() == nullptr) return QVariant();
int row = index.row();
int col = index.column();
switch(role) {
case Qt::DisplayRole:
switch(role) {
case Qt::DisplayRole:
if (_p_identification_group == nullptr) {
return QVariant();
}
switch (_column_assignment [col]) {
case (std::int8_t) PtmIslandListColumn::spectrum:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getPtmIslandSubroup()->countSampleScan());
break;
case (std::int8_t) PtmIslandListColumn::description:
case (std::int8_t) PtmIslandListColumn::spectrum:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getPtmIslandSubroup()->countSampleScan());
break;
case (std::int8_t) PtmIslandListColumn::description:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getProteinMatch()->getProteinXtpSp().get()->getDescription());
break;
case (std::int8_t) PtmIslandListColumn::multiptm:
break;
case (std::int8_t) PtmIslandListColumn::multiptm:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->countSampleScanMultiPtm(getPtmGroupingExperiment()));
break;
case (std::int8_t) PtmIslandListColumn::sequence:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->countSequence());
break;
case (std::int8_t) PtmIslandListColumn::ptm_island_id:
break;
case (std::int8_t) PtmIslandListColumn::sequence:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->countSequence());
break;
case (std::int8_t) PtmIslandListColumn::ptm_island_id:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getGroupingId());
break;
case (std::int8_t) PtmIslandListColumn::accession:
break;
case (std::int8_t) PtmIslandListColumn::accession:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getProteinMatch()->getProteinXtpSp().get()->getAccession());
break;
case (std::int8_t) PtmIslandListColumn::ptm_position_list:
QStringList position_list;
for (unsigned int position :getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getPositionList()) {
position_list << QString("%1").arg(position+1);
}
break;
case (std::int8_t) PtmIslandListColumn::ptm_island_start:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getStart());
break;
case (std::int8_t) PtmIslandListColumn::ptm_island_length:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->size());
break;
case (std::int8_t) PtmIslandListColumn::ptm_position_list:
QStringList position_list;
for (unsigned int position :getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getPositionList()) {
position_list << QString("%1").arg(position+1);
}
return QVariant(position_list.join(" "));
}
}
}
return QVariant();
}
......
......@@ -33,7 +33,26 @@
#include <QAbstractTableModel>
#include "../../core/identificationgroup.h"
#include "../../grouping/ptm/ptmgroupingexperiment.h"
#include "../../utils/types.h"
/** \def PtmIslandListColumn list of available fields to display in ptm island list
*
*/
enum class PtmIslandListColumn {
ptm_island_id, ///< ptm_island_id
accession, ///< protein accession
description, ///< protein description
ptm_position_list, ///< ptm position list
spectrum, ///< count sample scans
sequence, ///< unique sequence count
multiptm, ///< count multi ptm peptide match
ptm_island_start, ///< start position of the ptm island on the protein
ptm_island_length, ///< length of the ptm island
};
class PtmIslandListWindow;
class PtmIslandTableModel: public QAbstractTableModel
......
......@@ -113,20 +113,4 @@ enum class ProteinListColumn {
pai, ///< PAI
};
/** \def PtmIslandListColumn list of available fields to display in ptm island list
*
*/
enum class PtmIslandListColumn {
ptm_island_id, ///< ptm_island_id
accession, ///< protein accession
description, ///< protein description
ptm_position_list, ///< ptm position list
spectrum, ///< count sample scans
sequence, ///< unique sequence count
multiptm, ///< count multi ptm peptide match
};
#endif /* _TYPES_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