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

PAI computation

parent 76392b17
No related branches found
No related tags found
No related merge requests found
......@@ -162,6 +162,36 @@ size_t ProteinMatch::countUniqueSequence()const {
return sequence_list.size();
}
unsigned int ProteinMatch::countValidAndCheckedPeptideMassCharge(const pappso::MsRunIdSp & sp_msrun_id) const {
std::set<QString> sequence_list;
for (auto & p_peptide_match : _peptide_match_list) {
if (p_peptide_match->isValidAndChecked()) {
if(sp_msrun_id.get() != nullptr) {
//within sample
if (p_peptide_match->getMsRunIdSp().get() == sp_msrun_id.get()) {
sequence_list.insert(QString("%1-%2").arg(p_peptide_match->getPeptideXtpSp().get()->toAbsoluteString()).arg(p_peptide_match->getCharge()));
}
}
else {
//overall samples
sequence_list.insert(QString("%1-%2").arg(p_peptide_match->getPeptideXtpSp().get()->toAbsoluteString()).arg(p_peptide_match->getCharge()));
}
}
}
return sequence_list.size();
}
pappso::pappso_double ProteinMatch::getPAI() const {
pappso::MsRunIdSp sp_msrun_id;
return getPAI(sp_msrun_id);
}
pappso::pappso_double ProteinMatch::getPAI(const pappso::MsRunIdSp & sp_msrun_id) const {
pappso::pappso_double PAI = (pappso::pappso_double) countValidAndCheckedPeptideMassCharge(sp_msrun_id) / (pappso::pappso_double) _protein_sp.get()->countTrypticPeptidesForPAI();
return PAI;
}
pappso::pappso_double ProteinMatch::getCoverage() const {
size_t prot_size = _protein_sp.get()->size();
//qDebug() << "ProteinMatch::getCoverage begin prot_size=" << prot_size << " " << _protein_sp.get()-//>getSequence();
......@@ -186,7 +216,7 @@ pappso::pappso_double ProteinMatch::getCoverage() const {
return (((pappso::pappso_double)count)/ ((pappso::pappso_double)prot_size));
}
const GroupingGroupSp & ProteinMatch::getGroupingGroupSp() const {
return _sp_group;
return _sp_group;
}
void ProteinMatch::setGroupInstance(GroupStore & group_store) {
......
......@@ -46,6 +46,17 @@ public:
void setEvalue(pappso::pappso_double evalue);
pappso::pappso_double getEvalue() const;
pappso::pappso_double getCoverage() const;
/** @brief compute Protein Abundance Index (PAI)
* overall sample PAI computation (Rappsilber et al. 2002)
* */
pappso::pappso_double getPAI() const;
/** @brief compute Protein Abundance Index (PAI) within sample
* PAI computation (Rappsilber et al. 2002)
* */
pappso::pappso_double getPAI(const pappso::MsRunIdSp & sp_msrun_id) const;
void setProteinXtpSp(ProteinXtpSp protein_sp);
void addPeptideMatch(PeptideMatch * peptide_match);
std::vector<PeptideMatch *> & getPeptideMatchList();
......@@ -95,6 +106,7 @@ private:
/** @brief automatic filter result (false by default)
*/
bool _proxy_valid = false;
unsigned int countValidAndCheckedPeptideMassCharge(const pappso::MsRunIdSp & sp_msrun_id) const;
};
......
......@@ -22,6 +22,7 @@
******************************************************************************/
#include "proteinxtp.h"
#include <pappsomspp/protein/enzyme.h>
ProteinXtp::ProteinXtp():pappso::Protein()
{
......@@ -62,3 +63,32 @@ bool ProteinXtp::isContaminant() const {
bool ProteinXtp::isDecoy() const {
return _is_decoy;
}
class DigestionHandler: public pappso::EnzymeProductInterface {
public:
void setPeptide(std::int8_t sequence_database_id, const pappso::ProteinSp & protein_sp, bool is_decoy, const QString& peptide, unsigned int start, bool is_nter, unsigned int missed_cleavage_number, bool semi_enzyme) override {
_peptide_list.append(peptide);
};
QStringList _peptide_list;
};
unsigned int ProteinXtp::countTrypticPeptidesForPAI() const {
qDebug() << "ProteinXtp::countTrypticPeptidesForPAI begin";
pappso::Enzyme kinase;
kinase.setMiscleavage(0);
DigestionHandler digestion;
kinase.eat(0,this->makeProteinSp(),false,digestion);
unsigned int count = 0;
for (const QString & peptide_str: digestion._peptide_list) {
pappso::Peptide peptide(peptide_str);
pappso::mz mass= peptide.getMass();
if ((mass > 800) && (mass < 2500)) {
count ++;
}
}
return count;
qDebug() << "ProteinXtp::countTrypticPeptidesForPAI end";
}
......@@ -48,6 +48,7 @@ public:
void setIsDecoy(bool conta);
bool isContaminant() const;
bool isDecoy() const;
unsigned int countTrypticPeptidesForPAI() const;
private:
SequenceDatabase * _p_sequence_database;
......
......@@ -167,17 +167,17 @@ void ProjectWindow::doViewProteinList(IdentificationGroup* p_identification_grou
void ProjectWindow::setProjectSp(ProjectSp project_sp) {
for (auto && p_window :_peptide_list_window_collection) {
delete p_window;
delete p_window;
}
_peptide_list_window_collection.clear();
_p_current_peptide_list_window = nullptr;
for (auto && p_window :_protein_list_window_collection) {
delete p_window;
for (auto && p_window :_protein_list_window_collection) {
delete p_window;
}
_protein_list_window_collection.clear();
_p_current_protein_list_window = nullptr;
_project_sp = project_sp;
vector< MsRunIdSp > ms_run_list = _project_sp.get()->getCurrentIdentificationGroupP()->getMsRunIdSpList();
ui->sample_number_display->setText(QString("%1").arg(ms_run_list.size()));
......
......@@ -147,7 +147,7 @@ int ProteinTableModel::rowCount(const QModelIndex &parent ) const {
return 0;
}
int ProteinTableModel::columnCount(const QModelIndex &parent ) const {
return 10;
return 11;
}
QVariant ProteinTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
......@@ -176,6 +176,8 @@ QVariant ProteinTableModel::headerData(int section, Qt::Orientation orientation,
return QString("specific sequence");
case 9:
return QString("coverage");
case 10:
return QString("PAI");
}
}
}
......@@ -264,6 +266,9 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const {
if (col == 9) {
return QVariant ((qreal)_p_identification_group->getProteinMatchList().at(row)->getCoverage());
}
if (col == 10) {
return QVariant ((qreal)_p_identification_group->getProteinMatchList().at(row)->getPAI());
}
return QVariant();
}
......
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