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

new peptide counting method : peptide+mass+sample

parent ef940b5b
No related branches found
No related tags found
No related merge requests found
...@@ -42,17 +42,40 @@ IdentificationGroup::~IdentificationGroup() ...@@ -42,17 +42,40 @@ IdentificationGroup::~IdentificationGroup()
} }
const GroupStore & IdentificationGroup::getGroupStore() const { const GroupStore & IdentificationGroup::getGroupStore() const {
return _group_store; return _group_store;
}
unsigned int IdentificationGroup::countPeptideMassSample(ValidationState state) const {
std::vector<std::size_t> count_peptide_mass_sample;
for (auto & p_protein_match : _protein_match_list) {
p_protein_match->countPeptideMassSample(count_peptide_mass_sample, state);
}
std::sort(count_peptide_mass_sample.begin(), count_peptide_mass_sample.end());
auto last = std::unique(count_peptide_mass_sample.begin(),count_peptide_mass_sample.end());
return std::distance(count_peptide_mass_sample.begin(),last);
}
unsigned int IdentificationGroup::countDecoyPeptideMassSample(ValidationState state) const {
std::vector<std::size_t> count_peptide_mass_sample;
for (auto & p_protein_match : _protein_match_list) {
if (p_protein_match->getProteinXtpSp().get()->isDecoy()) {
p_protein_match->countPeptideMassSample(count_peptide_mass_sample, state);
}
} }
std::sort(count_peptide_mass_sample.begin(), count_peptide_mass_sample.end());
auto last = std::unique(count_peptide_mass_sample.begin(),count_peptide_mass_sample.end());
return std::distance(count_peptide_mass_sample.begin(),last);
}
unsigned int IdentificationGroup::countDecoyPeptideMatch(ValidationState state) const { unsigned int IdentificationGroup::countDecoyPeptideMatch(ValidationState state) const {
unsigned int i=0; unsigned int i=0;
for (auto & p_protein_match : _protein_match_list) { for (auto & p_protein_match : _protein_match_list) {
//if (p_protein_match->getValidationState() == state) { //if (p_protein_match->getValidationState() == state) {
if (p_protein_match->getProteinXtpSp().get()->isDecoy()) { if (p_protein_match->getProteinXtpSp().get()->isDecoy()) {
i+=p_protein_match->countPeptideMatch(state); i+=p_protein_match->countPeptideMatch(state);
} }
//} //}
} }
return i; return i;
...@@ -72,7 +95,7 @@ unsigned int IdentificationGroup::countPeptideMatch(ValidationState state) const ...@@ -72,7 +95,7 @@ unsigned int IdentificationGroup::countPeptideMatch(ValidationState state) const
unsigned int i=0; unsigned int i=0;
for (auto & p_protein_match : _protein_match_list) { for (auto & p_protein_match : _protein_match_list) {
//if (p_protein_match->getValidationState() >= state) { //if (p_protein_match->getValidationState() >= state) {
i+=p_protein_match->countPeptideMatch(state); i+=p_protein_match->countPeptideMatch(state);
//} //}
} }
return i; return i;
......
...@@ -50,54 +50,60 @@ public: ...@@ -50,54 +50,60 @@ public:
std::vector<ProteinMatch *> & getProteinMatchList(); std::vector<ProteinMatch *> & getProteinMatchList();
void addMsRunSp(MsRunSp ms_run_sp); void addMsRunSp(MsRunSp ms_run_sp);
/** @brief count groups /** @brief count groups
* */ * */
std::size_t countGroup()const; std::size_t countGroup()const;
/** @brief count subgroups /** @brief count subgroups
* */ * */
std::size_t countSubGroup()const; std::size_t countSubGroup()const;
/** @brief count proteins /** @brief count proteins
* */ * */
unsigned int countProteinMatch(ValidationState state) const; unsigned int countProteinMatch(ValidationState state) const;
/** @brief count decoy proteins /** @brief count decoy proteins
* */ * */
unsigned int countDecoyProteinMatch(ValidationState state) const; unsigned int countDecoyProteinMatch(ValidationState state) const;
/** @brief count peptide match /** @brief count peptide match (peptide spectrum match + protein match)
* */ * */
unsigned int countPeptideMatch(ValidationState state) const; unsigned int countPeptideMatch(ValidationState state) const;
/** @brief count decoy peptide match /** @brief count decoy peptide match
* */ * */
unsigned int countDecoyPeptideMatch(ValidationState state) const; unsigned int countDecoyPeptideMatch(ValidationState state) const;
/** @brief count peptide (peptide+mass+sample)
* */
unsigned int countPeptideMassSample(ValidationState state) const;
/** @brief count peptide (peptide+mass+sample) included by decoy proteins
* */
unsigned int countDecoyPeptideMassSample(ValidationState state) const;
/** @brief validate or invalidate peptides and proteins based automatic filters and manual checks /** @brief validate or invalidate peptides and proteins based automatic filters and manual checks
* */ * */
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);
const std::vector<MsRunSp> & getMsRunSpList() const; const std::vector<MsRunSp> & getMsRunSpList() const;
/** @brief get tab name for qtabwidget /** @brief get tab name for qtabwidget
* */ * */
const QString getTabName() const; const QString getTabName() const;
bool contains (const MsRun * p_msrun) const; bool contains (const MsRun * p_msrun) const;
void collectMhDelta(std::vector< pappso::pappso_double> & delta_list, pappso::PrecisionUnit unit, ValidationState state) const; void collectMhDelta(std::vector< pappso::pappso_double> & delta_list, pappso::PrecisionUnit unit, ValidationState state) const;
private : private :
GroupingExperiment * _p_grp_experiment= nullptr; GroupingExperiment * _p_grp_experiment= nullptr;
Project * _p_project; Project * _p_project;
GroupStore _group_store; GroupStore _group_store;
std::vector<ProteinMatch *> _protein_match_list; std::vector<ProteinMatch *> _protein_match_list;
std::vector<MsRunSp> _ms_run_list; std::vector<MsRunSp> _ms_run_list;
std::map<QString, ProteinMatch *> _cache_accession_protein_match; std::map<QString, ProteinMatch *> _cache_accession_protein_match;
}; };
......
...@@ -47,6 +47,10 @@ void PeptideMatch::setEvalue(pappso::pappso_double evalue) { ...@@ -47,6 +47,10 @@ void PeptideMatch::setEvalue(pappso::pappso_double evalue) {
} }
std::size_t PeptideMatch::getHashPeptideMassSample() const {
return PeptideMatch::_hash_fn (QString("%1 %2").arg(_peptide_sp.get()->getLiAbsoluteString()).arg(_msrunid_sp->getXmlId()).toStdString());
}
std::size_t PeptideMatch::getHashSampleScan() const { std::size_t PeptideMatch::getHashSampleScan() const {
return _hash_sample_scan; return _hash_sample_scan;
} }
......
...@@ -36,6 +36,7 @@ class PeptideMatch ...@@ -36,6 +36,7 @@ class PeptideMatch
public : public :
PeptideMatch(MsRun * msrunid_sp, unsigned int scan); PeptideMatch(MsRun * msrunid_sp, unsigned int scan);
std::size_t getHashSampleScan() const; std::size_t getHashSampleScan() const;
std::size_t getHashPeptideMassSample() const;
void setRetentionTime(pappso::pappso_double rt); void setRetentionTime(pappso::pappso_double rt);
void setEvalue(pappso::pappso_double evalue); void setEvalue(pappso::pappso_double evalue);
......
...@@ -176,6 +176,15 @@ const pappso::GrpProteinSp & ProteinMatch::getGrpProteinSp() const { ...@@ -176,6 +176,15 @@ const pappso::GrpProteinSp & ProteinMatch::getGrpProteinSp() const {
} }
void ProteinMatch::countPeptideMassSample(std::vector<size_t> & count_peptide_mass_sample, ValidationState state) const {
for (auto & p_peptide_match : _peptide_match_list) {
if (p_peptide_match->getValidationState() >= state) {
count_peptide_mass_sample.push_back(p_peptide_match->getHashPeptideMassSample());
}
}
}
unsigned int ProteinMatch::countPeptideMatch(ValidationState state) const { unsigned int ProteinMatch::countPeptideMatch(ValidationState state) const {
return std::count_if (_peptide_match_list.begin(), _peptide_match_list.end(), [state](const PeptideMatch * p_peptide_match) { return std::count_if (_peptide_match_list.begin(), _peptide_match_list.end(), [state](const PeptideMatch * p_peptide_match) {
if (p_peptide_match->getValidationState() >= state) { if (p_peptide_match->getValidationState() >= state) {
......
...@@ -77,6 +77,10 @@ public: ...@@ -77,6 +77,10 @@ public:
ValidationState getValidationState() const; ValidationState getValidationState() const;
unsigned int countPeptideMatch(ValidationState state) const; unsigned int countPeptideMatch(ValidationState state) const;
/** @brief count peptide (peptide+mass+sample)
*/
void countPeptideMassSample(std::vector<size_t> & count_peptide_mass_sample, ValidationState state) const;
/** @brief count unique identified sequences (from valid and cheked spectrums) /** @brief count unique identified sequences (from valid and cheked spectrums)
* */ * */
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<string/> <string/>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="identifications"> <widget class="QWidget" name="identifications">
<attribute name="title"> <attribute name="title">
...@@ -52,6 +52,9 @@ ...@@ -52,6 +52,9 @@
<string>Contaminants</string> <string>Contaminants</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QListView" name="contaminant_database_listview"/>
</item>
<item> <item>
<widget class="QLineEdit" name="contaminant_protein_regexp_line_edit"> <widget class="QLineEdit" name="contaminant_protein_regexp_line_edit">
<property name="placeholderText"> <property name="placeholderText">
......
...@@ -45,6 +45,7 @@ ProjectWindow::ProjectWindow(MainWindow *parent): ...@@ -45,6 +45,7 @@ ProjectWindow::ProjectWindow(MainWindow *parent):
_p_fasta_str_li = new QStandardItemModel(); _p_fasta_str_li = new QStandardItemModel();
ui->decoy_database_listview->setModel(_p_fasta_str_li); ui->decoy_database_listview->setModel(_p_fasta_str_li);
ui->contaminant_database_listview->setModel(_p_fasta_str_li);
_p_automatic_filter_widget = new AutomaticFilterWidget(this); _p_automatic_filter_widget = new AutomaticFilterWidget(this);
ui->filter_parameter_layout->addWidget(_p_automatic_filter_widget); ui->filter_parameter_layout->addWidget(_p_automatic_filter_widget);
...@@ -153,8 +154,10 @@ void ProjectWindow::computeFdr() { ...@@ -153,8 +154,10 @@ void ProjectWindow::computeFdr() {
for (IdentificationGroup * identification_group : _project_sp.get()->getIdentificationGroupList()) { for (IdentificationGroup * identification_group : _project_sp.get()->getIdentificationGroupList()) {
total_prot += identification_group->countProteinMatch(state); total_prot += identification_group->countProteinMatch(state);
false_prot += identification_group->countDecoyProteinMatch(state); false_prot += identification_group->countDecoyProteinMatch(state);
total_peptide += identification_group->countPeptideMatch(state); //total_peptide += identification_group->countPeptideMatch(state);
false_peptide += identification_group->countDecoyPeptideMatch(state); //false_peptide += identification_group->countDecoyPeptideMatch(state);
total_peptide += identification_group->countPeptideMassSample(state);
false_peptide += identification_group->countDecoyPeptideMassSample(state);
} }
ui->protein_fdr_label->setText(QString("%1 %").arg(QString::number((false_prot/total_prot)*100.0,'f',10))); ui->protein_fdr_label->setText(QString("%1 %").arg(QString::number((false_prot/total_prot)*100.0,'f',10)));
ui->peptide_fdr_label->setText(QString("%1 %").arg(QString::number((false_peptide/total_peptide)*100.0,'f',10))); ui->peptide_fdr_label->setText(QString("%1 %").arg(QString::number((false_peptide/total_peptide)*100.0,'f',10)));
...@@ -353,7 +356,6 @@ void ProjectWindow::setProjectSp(ProjectSp project_sp) { ...@@ -353,7 +356,6 @@ void ProjectWindow::setProjectSp(ProjectSp project_sp) {
qDebug() << "ProjectWindow::setProjectSp begin " << _project_sp.get()->getFastaFileStore().getFastaFileList().size() ; qDebug() << "ProjectWindow::setProjectSp begin " << _project_sp.get()->getFastaFileStore().getFastaFileList().size() ;
_fastafile_list = _project_sp.get()->getFastaFileStore().getFastaFileList(); _fastafile_list = _project_sp.get()->getFastaFileStore().getFastaFileList();
for (FastaFileSp fasta_file : _fastafile_list ) { for (FastaFileSp fasta_file : _fastafile_list ) {
QStandardItem *item; QStandardItem *item;
......
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