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

count spectrum and unique sequences

parent a7d3669a
No related branches found
No related tags found
No related merge requests found
......@@ -59,7 +59,7 @@ void PeptideMatch::setCharge(unsigned int charge) {
_charge =charge;
}
void PeptideMatch::setPeptideSp (pappso::PeptideSp peptide) {
void PeptideMatch::setPeptideXtpSp (PeptideXtpSp peptide) {
_peptide_sp = peptide;
}
......@@ -93,7 +93,7 @@ unsigned int PeptideMatch::getCharge() const {
return _charge;
}
const pappso::PeptideSp & PeptideMatch::getPeptideSp() const {
const PeptideXtpSp & PeptideMatch::getPeptideXtpSp() const {
return _peptide_sp;
}
......
......@@ -25,7 +25,7 @@
#define PEPTIDEMATCH_H
#include <pappsomspp/msrun/msrunid.h>
#include <pappsomspp/types.h>
#include <pappsomspp/peptide/peptide.h>
#include "peptidextp.h"
#include "identification_sources/identificationdatasource.h"
#include "automaticfilterparameters.h"
......@@ -49,7 +49,7 @@ public :
* */
unsigned int getStart() const;
void setCharge(unsigned int charge);
void setPeptideSp (pappso::PeptideSp peptide);
void setPeptideXtpSp (PeptideXtpSp peptide);
void setIdentificationDataSource(IdentificationDataSource* identification_source);
void setChecked(bool arg1);
bool isChecked() const;
......@@ -61,7 +61,7 @@ public :
unsigned int getScan() const;
pappso::pappso_double getRetentionTime() const;
unsigned int getCharge() const;
const pappso::PeptideSp & getPeptideSp() const;
const PeptideXtpSp & getPeptideXtpSp() const;
pappso::pappso_double getEvalue() const;
void setGrpPeptideSp(const pappso::GrpPeptideSp & sp_grp_peptide);
......@@ -75,7 +75,7 @@ private :
pappso::MsRunIdSp _msrunid_sp;
unsigned int _scan;
pappso::GrpPeptideSp _sp_grp_peptide;
pappso::PeptideSp _peptide_sp;
PeptideXtpSp _peptide_sp;
pappso::pappso_double _rt;
pappso::pappso_double _evalue;
pappso::pappso_double _exp_mass;
......
......@@ -42,3 +42,8 @@ PeptideXtp::~PeptideXtp()
PeptideXtpSp PeptideXtp::makePeptideXtpSp() const {
return std::make_shared<PeptideXtp>(*this);
}
pappso::mz PeptideXtp::getGroupingMass() const {
return getMass();
}
......@@ -40,6 +40,11 @@ public:
~PeptideXtp();
PeptideXtpSp makePeptideXtpSp() const;
/** \brief get the tehoretical mass to use for grouping
* This mass might be different than the true peptide mass to recognize that a tagged
* peptide with taget modification is a light, inter or heavy version of the same peptide
*/
pappso::mz getGroupingMass() const;
};
......
......@@ -24,6 +24,7 @@
#include "proteinmatch.h"
#include <pappsomspp/msrun/msrunid.h>
#include <pappsomspp/grouping/grpprotein.h>
#include <set>
ProteinMatch::ProteinMatch()
......@@ -136,6 +137,26 @@ const pappso::GrpProteinSp & ProteinMatch::getGrpProteinSp() const {
return _sp_grp_protein;
}
size_t ProteinMatch::countValidSpectrum()const {
return std::count_if (_peptide_match_list.begin(), _peptide_match_list.end(), [](const PeptideMatch * p_peptide_match) {
return (p_peptide_match->isValid());
});
}
size_t ProteinMatch::countValidAndCheckedSpectrum()const {
return std::count_if (_peptide_match_list.begin(), _peptide_match_list.end(), [](const PeptideMatch * p_peptide_match) {
return (p_peptide_match->isValidAndChecked());
});
}
size_t ProteinMatch::countUniqueSequence()const {
std::set<QString> sequence_list;
for (auto & p_peptide_match : _peptide_match_list) {
if (p_peptide_match->isValidAndChecked()) {
sequence_list.insert(p_peptide_match->getPeptideXtpSp().get()->getSequence());
}
}
return sequence_list.size();
}
pappso::pappso_double ProteinMatch::getCoverage() const {
size_t prot_size = _protein_sp.get()->size();
......@@ -144,7 +165,7 @@ pappso::pappso_double ProteinMatch::getCoverage() const {
bool cover_bool[prot_size] = {false};
for (auto & p_peptide_match : _peptide_match_list) {
if (p_peptide_match->isValidAndChecked()) {
size_t size = p_peptide_match->getPeptideSp().get()->size();
size_t size = p_peptide_match->getPeptideXtpSp().get()->size();
size_t offset = p_peptide_match->getStart();
if (offset >= 0) {
for (size_t i=0; (i < size) && (offset < prot_size) ; i++,offset++) {
......
......@@ -50,12 +50,25 @@ public:
bool isValid() const;
bool isValidAndChecked() const;
/** @brief count valid spectrums
* */
size_t countValidSpectrum()const;
/** @brief count valid and manually checked spectrums
* */
size_t countValidAndCheckedSpectrum()const;
/** @brief count unique identified sequences (from valid and cheked spectrums)
* */
size_t countUniqueSequence()const;
/** @brief validate or invalidate peptides and proteins based automatic filters and manual checks
* */
void updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters);
void setGroupingExperiment(GroupingExperiment * p_grp_experiment);
const pappso::GrpProteinSp & getGrpProteinSp() const;
private:
......
......@@ -44,7 +44,7 @@ pappso::GrpProteinSp & GroupingPeptideMass::getGrpProteinSp(ProteinMatch* p_prot
}
pappso::GrpPeptideSp & GroupingPeptideMass::setGrpPeptide(pappso::GrpProteinSp proteinSp, PeptideMatch* p_peptide_match) {
return _p_grp_experiment->setGrpPeptide(proteinSp,p_peptide_match->getPeptideSp().get()->getSequence(), p_peptide_match->getPeptideSp().get()->getMass());
return _p_grp_experiment->setGrpPeptide(proteinSp,p_peptide_match->getPeptideXtpSp().get()->getSequence(), p_peptide_match->getPeptideXtpSp().get()->getGroupingMass());
}
void GroupingPeptideMass::startGrouping() {
......
......@@ -169,7 +169,7 @@ QVariant PeptideTableModel::data(const QModelIndex &index, int role ) const {
return QVariant ((quint8) _p_protein_match->getPeptideMatchList().at(row)->getCharge());
}
if (col ==6) {
return _p_protein_match->getPeptideMatchList().at(row)->getPeptideSp().get()->getSequence();
return _p_protein_match->getPeptideMatchList().at(row)->getPeptideXtpSp().get()->getSequence();
}
}
return QString("Row%1, Column%2")
......
......@@ -127,7 +127,7 @@ int ProteinTableModel::rowCount(const QModelIndex &parent ) const {
return 0;
}
int ProteinTableModel::columnCount(const QModelIndex &parent ) const {
return 7;
return 8;
}
QVariant ProteinTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
......@@ -149,6 +149,8 @@ QVariant ProteinTableModel::headerData(int section, Qt::Orientation orientation,
case 5:
return QString("spectrum");
case 6:
return QString("unique");
case 7:
return QString("coverage");
}
}
......@@ -203,9 +205,12 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const {
}
if (col == 5) {
return QVariant ((quint16) _p_identification_group->getProteinMatchList().at(row)->getPeptideMatchList().size());
return QVariant ((quint16) _p_identification_group->getProteinMatchList().at(row)->countValidAndCheckedSpectrum());
}
if (col == 6) {
return QVariant ((quint16) _p_identification_group->getProteinMatchList().at(row)->countUniqueSequence());
}
if (col == 7) {
return QVariant ((qreal)_p_identification_group->getProteinMatchList().at(row)->getCoverage());
}
......
......@@ -280,7 +280,7 @@ bool XpipSaxHandler::endElement_peptide() {
PeptideXtpSp peptide_const = PeptideXtp(*(_current_peptide_sp.get())).makePeptideXtpSp();
peptide_const = _p_project->getPeptideStore().getInstance(peptide_const);
_p_peptide_match->setPeptideSp(peptide_const);
_p_peptide_match->setPeptideXtpSp(peptide_const);
return true;
}
......
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