diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 21b70805f3b5b588efffde1cef92db591f9ea050..6bc611419b44acbe1d2e6e5e1cc0debcfef6993c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,6 +58,8 @@ SET(CPP_FILES core/peptidematch.cpp ./core/project.cpp core/proteinmatch.cpp + core/proteinxtp.cpp + core/sequencedatabase.cpp core/identification_sources/identificationdatasource.cpp core/identification_sources/identificationxtandemfile.cpp files/xpipfile.cpp diff --git a/src/core/automaticfilterparameters.cpp b/src/core/automaticfilterparameters.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5e4f2bc284f4c92994ed021bee2fb7c1d29ecda0 --- /dev/null +++ b/src/core/automaticfilterparameters.cpp @@ -0,0 +1,65 @@ + +/******************************************************************************* +* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>. +* +* This file is part of XTPcpp. +* +* XTPcpp is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* XTPcpp is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>. +* +* Contributors: +* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation +******************************************************************************/ + +#include "automaticfilterparameters.h" + +AutomaticFilterParameters::AutomaticFilterParameters() +{ + +} + +AutomaticFilterParameters::AutomaticFilterParameters(const AutomaticFilterParameters& other) +{ + +} + +AutomaticFilterParameters::~AutomaticFilterParameters() +{ + +} + +void AutomaticFilterParameters::setFilterPeptideEvalue( pappso::pappso_double evalue) { + _filter_minimum_peptide_evalue = evalue; +} + +void AutomaticFilterParameters::setFilterProteinEvalue( pappso::pappso_double evalue) { + _filter_minimum_protein_evalue = evalue; +} +void AutomaticFilterParameters::setFilterMinimumPeptidePerMatch(unsigned int number) { + _filter_minimum_peptide_per_match = number; +} +void AutomaticFilterParameters::setFilterCrossSamplePeptideNumber(bool cross) { + _filter_is_cross_sample_peptide_number = cross; +} +pappso::pappso_double AutomaticFilterParameters::getFilterPeptideEvalue() const { + return (_filter_minimum_peptide_evalue ); +} +pappso::pappso_double AutomaticFilterParameters::getFilterProteinEvalue() const { + return ( _filter_minimum_protein_evalue ); +} +unsigned int AutomaticFilterParameters::getFilterMinimumPeptidePerMatch()const { + return (_filter_minimum_peptide_per_match ); +} +bool AutomaticFilterParameters::getFilterCrossSamplePeptideNumber()const { + return _filter_is_cross_sample_peptide_number ; +} diff --git a/src/core/automaticfilterparameters.h b/src/core/automaticfilterparameters.h new file mode 100644 index 0000000000000000000000000000000000000000..f76fdabe219bbc2ff21889e53dbe418588539489 --- /dev/null +++ b/src/core/automaticfilterparameters.h @@ -0,0 +1,55 @@ + +/******************************************************************************* +* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>. +* +* This file is part of XTPcpp. +* +* XTPcpp is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* XTPcpp is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>. +* +* Contributors: +* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation +******************************************************************************/ + +#ifndef AUTOMATICFILTERPARAMETERS_H +#define AUTOMATICFILTERPARAMETERS_H +#include <pappsomspp/types.h> + +class AutomaticFilterParameters +{ +public: + AutomaticFilterParameters(); + AutomaticFilterParameters(const AutomaticFilterParameters& other); + ~AutomaticFilterParameters(); + + + void setFilterPeptideEvalue( pappso::pappso_double evalue); + void setFilterProteinEvalue( pappso::pappso_double evalue); + void setFilterMinimumPeptidePerMatch(unsigned int number); + void setFilterCrossSamplePeptideNumber(bool cross); + + pappso::pappso_double getFilterPeptideEvalue() const; + pappso::pappso_double getFilterProteinEvalue()const; + unsigned int getFilterMinimumPeptidePerMatch()const; + bool getFilterCrossSamplePeptideNumber()const; + + +private : + + pappso::pappso_double _filter_minimum_peptide_evalue=1; + pappso::pappso_double _filter_minimum_protein_evalue=1; + unsigned int _filter_minimum_peptide_per_match=1; + bool _filter_is_cross_sample_peptide_number=false; +}; + +#endif // AUTOMATICFILTERPARAMETERS_H diff --git a/src/core/identificationgroup.cpp b/src/core/identificationgroup.cpp index 3a7cea893b81bef77c8cd6a5419024b7a3f55357..c8d345bb0b1af02d0dca357b2cf041a8100c96fb 100644 --- a/src/core/identificationgroup.cpp +++ b/src/core/identificationgroup.cpp @@ -24,6 +24,7 @@ #include "identificationgroup.h" #include "project.h" + IdentificationGroup::IdentificationGroup(Project * project) { _p_project = project; @@ -43,6 +44,7 @@ void IdentificationGroup::updateAutomaticFilters(const AutomaticFilterParameters p_protein_match->updateAutomaticFilters(automatic_filter_parameters); } + } void IdentificationGroup::addProteinMatch(ProteinMatch * protein_match) { _protein_match_list.push_back(protein_match); diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index f72acb9d2e541bc225a47ed49b62d1197bc0ac68..05432afa2c0e814a09dccd53af79e1e4538f444b 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -63,6 +63,9 @@ void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & auto } + //update protein evalue ? + + if (_number_of_valid_peptides >= automatic_filter_parameters.getFilterMinimumPeptidePerMatch()) { if (_evalue <= automatic_filter_parameters.getFilterProteinEvalue()) { _proxy_valid = true; @@ -70,7 +73,7 @@ void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & auto } } -const pappso::ProteinSp & ProteinMatch::getProteinSp() const { +const ProteinXtpSp & ProteinMatch::getProteinXtpSp() const { return _protein_sp; } void ProteinMatch::setEvalue(pappso::pappso_double evalue) { @@ -80,7 +83,7 @@ void ProteinMatch::setEvalue(pappso::pappso_double evalue) { pappso::pappso_double ProteinMatch::getEvalue() const { return _evalue; } -void ProteinMatch::setProteinSp(pappso::ProteinSp protein_sp) { +void ProteinMatch::setProteinXtpSp(ProteinXtpSp protein_sp) { _protein_sp = protein_sp; } @@ -92,7 +95,7 @@ bool ProteinMatch::isChecked() const { return _checked; } -bool ProteinMatch::isValidAndChecked() const{ +bool ProteinMatch::isValidAndChecked() const { return _proxy_valid && _checked; } diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index 6fba08333efa79ab0a566d411baba1005a3c8d77..2983550146959d0af71722f38f61348f42681b25 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -21,25 +21,25 @@ * Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation ******************************************************************************/ -#ifndef PROTEINMATCH_H -#define PROTEINMATCH_H - #include <vector> #include <pappsomspp/types.h> -#include <pappsomspp/protein/protein.h> +#include "proteinxtp.h" #include "peptidematch.h" #include "automaticfilterparameters.h" +#ifndef PROTEINMATCH_H +#define PROTEINMATCH_H + class ProteinMatch { public: ProteinMatch(); ~ProteinMatch(); - const pappso::ProteinSp & getProteinSp() const; + const ProteinXtpSp & getProteinXtpSp() const; void setEvalue(pappso::pappso_double evalue); pappso::pappso_double getEvalue() const; - void setProteinSp(pappso::ProteinSp protein_sp); + void setProteinXtpSp(ProteinXtpSp protein_sp); void addPeptideMatch(PeptideMatch * peptide_match); std::vector<PeptideMatch *> & getPeptideMatchList(); void setChecked(bool arg1); @@ -54,7 +54,7 @@ public: private: std::vector<PeptideMatch *> _peptide_match_list; - pappso::ProteinSp _protein_sp = nullptr; + ProteinXtpSp _protein_sp = nullptr; pappso::pappso_double _evalue=0; /** @brief manually checked by user (true by default) */ diff --git a/src/core/proteinxtp.cpp b/src/core/proteinxtp.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6e6121684e8952cba6226aa46a474b94fee0ccc9 --- /dev/null +++ b/src/core/proteinxtp.cpp @@ -0,0 +1,50 @@ + +/******************************************************************************* +* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>. +* +* This file is part of XTPcpp. +* +* XTPcpp is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* XTPcpp is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>. +* +* Contributors: +* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation +******************************************************************************/ + +#include "proteinxtp.h" + +ProteinXtp::ProteinXtp():pappso::Protein() +{ + +} + +ProteinXtp::ProteinXtp(const ProteinXtp& other):pappso::Protein(other) +{ + _is_decoy=other._is_decoy; + _is_contaminant=other._is_contaminant; +} + +ProteinXtp::~ProteinXtp() +{ + +} + +bool ProteinXtp::operator==(const ProteinXtp& other) const +{ + return pappso::Protein::operator==(other); +} + +ProteinXtpSp ProteinXtp::makeProteinXtpSp() const { + return std::make_shared<ProteinXtp>(*this); +} + diff --git a/src/core/proteinxtp.h b/src/core/proteinxtp.h new file mode 100644 index 0000000000000000000000000000000000000000..0ce23be2777ab686140e5e75eadb67c690da0a58 --- /dev/null +++ b/src/core/proteinxtp.h @@ -0,0 +1,53 @@ + +/******************************************************************************* +* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>. +* +* This file is part of XTPcpp. +* +* XTPcpp is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* XTPcpp is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>. +* +* Contributors: +* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation +******************************************************************************/ + +#include <pappsomspp/protein/protein.h> +#include "sequencedatabase.h" + +#ifndef PROTEIN_XTP_H +#define PROTEIN_XTP_H + + +class ProteinXtp; + +/** \brief shared pointer on a Protein object + */ +typedef std::shared_ptr<const ProteinXtp> ProteinXtpSp; + +class ProteinXtp : public pappso::Protein { +public: + ProteinXtp(); + ProteinXtp(const ProteinXtp& other); + virtual ~ProteinXtp(); + bool operator==(const ProteinXtp& other) const; + + + ProteinXtpSp makeProteinXtpSp() const; + +private: + SequenceDatabase * _p_sequence_database; + bool _is_decoy=false; + bool _is_contaminant=false; +}; + +#endif // PROTEIN_XTP_H diff --git a/src/core/sequencedatabase.cpp b/src/core/sequencedatabase.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9deb2a0c0bd49e16df6080b0a58943b093ca6a6a --- /dev/null +++ b/src/core/sequencedatabase.cpp @@ -0,0 +1,34 @@ + +/******************************************************************************* +* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>. +* +* This file is part of XTPcpp. +* +* XTPcpp is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* XTPcpp is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>. +* +* Contributors: +* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation +******************************************************************************/ + +#include "sequencedatabase.h" + +SequenceDatabase::SequenceDatabase() +{ + +} + +SequenceDatabase::~SequenceDatabase() +{ + +} diff --git a/src/core/sequencedatabase.h b/src/core/sequencedatabase.h new file mode 100644 index 0000000000000000000000000000000000000000..4123ebd04bc2df426e71db37ae753b380873bfa5 --- /dev/null +++ b/src/core/sequencedatabase.h @@ -0,0 +1,42 @@ + +/******************************************************************************* +* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>. +* +* This file is part of XTPcpp. +* +* XTPcpp is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* XTPcpp is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>. +* +* Contributors: +* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation +******************************************************************************/ + +#ifndef SEQUENCEDATABASE_H +#define SEQUENCEDATABASE_H +#include <memory> + + +class SequenceDatabase; + +/** \brief shared pointer on a SequenceDatabase object + */ +typedef std::shared_ptr<SequenceDatabase> SequenceDatabaseSp; + +class SequenceDatabase +{ +public: + SequenceDatabase(); + virtual ~SequenceDatabase(); +}; + +#endif // SEQUENCEDATABASE_H diff --git a/src/gui/peptide_list_view/peptidelistwindow.cpp b/src/gui/peptide_list_view/peptidelistwindow.cpp index 08ba30f04eae1c5668082f243710b8ec7567c1f3..f933f6990abf3dfebd3b2dbaa20ba4c8bc2170e6 100644 --- a/src/gui/peptide_list_view/peptidelistwindow.cpp +++ b/src/gui/peptide_list_view/peptidelistwindow.cpp @@ -73,7 +73,7 @@ PeptideListWindow::~PeptideListWindow() void PeptideListWindow::setProteinMatch(Project * p_project, ProteinMatch * p_protein_match) { _peptide_table_model_p->setProteinMatch(p_project, p_protein_match); _p_proxy_model->setSourceModel(_peptide_table_model_p); - ui->proteinLabel->setText(p_protein_match->getProteinSp().get()->getDescription()); + ui->proteinLabel->setText(p_protein_match->getProteinXtpSp().get()->getDescription()); } diff --git a/src/gui/protein_list_view/proteintablemodel.cpp b/src/gui/protein_list_view/proteintablemodel.cpp index 5ceaa2609ed249bf866e8b9a5c77d98ba480263c..7a88357c1741e476cf2318c3f62f7142b5bf326c 100644 --- a/src/gui/protein_list_view/proteintablemodel.cpp +++ b/src/gui/protein_list_view/proteintablemodel.cpp @@ -167,12 +167,12 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const { } if (col == 1) { if (_p_identification_group != nullptr) { - return _p_identification_group->getProteinMatchList().at(row)->getProteinSp().get()->getAccession(); + return _p_identification_group->getProteinMatchList().at(row)->getProteinXtpSp().get()->getAccession(); } } if (col == 2) { if (_p_identification_group != nullptr) { - return _p_identification_group->getProteinMatchList().at(row)->getProteinSp().get()->getDescription(); + return _p_identification_group->getProteinMatchList().at(row)->getProteinXtpSp().get()->getDescription(); } } if (col == 3) { @@ -219,7 +219,7 @@ void ProteinTableModel::onTableClicked(const QModelIndex &index) bool ProteinTableModel::acceptRow(int source_row) { ProteinMatch * protein_match = _p_identification_group->getProteinMatchList().at(source_row); if (!_protein_search_string.isEmpty()) { - if (!protein_match->getProteinSp().get()->getDescription().contains(_protein_search_string)) { + if (!protein_match->getProteinXtpSp().get()->getDescription().contains(_protein_search_string)) { return false; } } diff --git a/src/input/xpipsaxhandler.cpp b/src/input/xpipsaxhandler.cpp index ca567de05ea9f401c0c249d43c2527c18b9f5e30..569c04532af61109af060bebf8401a31b1bc7421 100644 --- a/src/input/xpipsaxhandler.cpp +++ b/src/input/xpipsaxhandler.cpp @@ -292,7 +292,7 @@ bool XpipSaxHandler::endElement_sequence() { return true; } bool XpipSaxHandler::endElement_protein() { - _p_protein_match->setProteinSp(_current_protein.makeProteinSp()); + _p_protein_match->setProteinXtpSp(_current_protein.makeProteinXtpSp()); return true; } diff --git a/src/input/xpipsaxhandler.h b/src/input/xpipsaxhandler.h index 7a6e471f186c2ce994b06126bbc789ae30aace8f..804a40c6181b50eb7099441224ad34fd77f19994 100644 --- a/src/input/xpipsaxhandler.h +++ b/src/input/xpipsaxhandler.h @@ -25,7 +25,7 @@ #include <QXmlDefaultHandler> #include <pappsomspp/pappsoexception.h> -#include <pappsomspp/protein/protein.h> +#include "../core/proteinxtp.h" #include <pappsomspp/peptide/peptide.h> #include <pappsomspp/amino_acid/aamodification.h> #include "../core/project.h" @@ -83,7 +83,7 @@ private: Project * _p_project; ProteinMatch * _p_protein_match; PeptideMatch * _p_peptide_match; - pappso::Protein _current_protein; + ProteinXtp _current_protein; pappso::NoConstPeptideSp _current_peptide_sp; IdentificationGroup * _current_identification_group_p;