diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bd4b9ebcd36123defee4ce38be8c5e4fbf9d1795..462b946e2b353ed2d3e1d0df183a999ef29b36a7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -53,6 +53,7 @@ configure_file (${CMAKE_SOURCE_DIR}/src/config.h.cmake ${CMAKE_SOURCE_DIR}/src/c # File list SET(CPP_FILES + core/identificationgroup.cpp core/peptidematch.cpp core/project.cpp core/proteinmatch.cpp diff --git a/src/core/identificationgroup.cpp b/src/core/identificationgroup.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0345b1f6268ce2fa046896e9456028bd708b3136 --- /dev/null +++ b/src/core/identificationgroup.cpp @@ -0,0 +1,52 @@ + +/******************************************************************************* +* 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 "identificationgroup.h" + +IdentificationGroup::IdentificationGroup(Project * project) +{ + _p_project = project; +} + +IdentificationGroup::~IdentificationGroup() +{ + auto it = _protein_match_list.begin(); + while (it != _protein_match_list.end()) { + delete (*it); + it++; + } +} + +bool IdentificationGroup::isValid(ProteinMatch* p_protein_match) const { + return true; +} + +void IdentificationGroup::addProteinMatch(ProteinMatch * protein_match) { + _protein_match_list.push_back(protein_match); +} +void IdentificationGroup::addMsRunIdSp(pappso::MsRunIdSp ms_run_sp) { + _ms_run_list.push_back(ms_run_sp); +} +std::vector<ProteinMatch *> & IdentificationGroup::getProteinMatchList() { + return _protein_match_list; +} diff --git a/src/core/identificationgroup.h b/src/core/identificationgroup.h new file mode 100644 index 0000000000000000000000000000000000000000..71d5912864e05898ae54a7b0dc80b6708b7fafbf --- /dev/null +++ b/src/core/identificationgroup.h @@ -0,0 +1,63 @@ + +/******************************************************************************* +* 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 <memory> +#include <pappsomspp/grouping/grpexperiment.h> +#include <QFileInfo> +#include "proteinmatch.h" +#include <pappsomspp/msrun/msrunid.h> + + +#ifndef IDENTIFICATIONGROUP_H +#define IDENTIFICATIONGROUP_H + + +class Project; + +/** @brief an identification group contains one or more sample to consider for grouping + */ +class IdentificationGroup +{ + +public: + IdentificationGroup(Project * project); + ~IdentificationGroup(); + + void addProteinMatch(ProteinMatch * protein_match); + std::vector<ProteinMatch *> & getProteinMatchList(); + void addMsRunIdSp(pappso::MsRunIdSp ms_run_sp); + + + /** @brief is it valid regarding threshold and project rules + */ + bool isValid(ProteinMatch* p_protein_match) const; + + pappso::GrpExperiment * _p_grp_experiment= nullptr; +private : + Project * _p_project; + + std::vector<ProteinMatch *> _protein_match_list; + + std::vector<pappso::MsRunIdSp> _ms_run_list; +}; + +#endif // IDENTIFICATIONGROUP_H diff --git a/src/core/peptidematch.cpp b/src/core/peptidematch.cpp index 9981088c5ab47cd8b2e9bda7fc5adc287d8af253..ba399e77e546c7fcf5867b615229b5bc71e6c398 100644 --- a/src/core/peptidematch.cpp +++ b/src/core/peptidematch.cpp @@ -48,3 +48,10 @@ void PeptideMatch::setCharge(unsigned int charge) { void PeptideMatch::setPeptideSp (pappso::PeptideSp peptide) { _peptide_sp = peptide; } + +void PeptideMatch::setChecked(bool arg1) { + _checked = arg1; +} +void PeptideMatch::setIdentificationDataSource(IdentificationDataSource* identification_source) { + _p_identification_source = identification_source; +} diff --git a/src/core/peptidematch.h b/src/core/peptidematch.h index 738962240a87bc73f1b0c6ae95c855d1445d01ce..1bcfe877dc95b90068bb47206f2db7a02254e7cf 100644 --- a/src/core/peptidematch.h +++ b/src/core/peptidematch.h @@ -39,6 +39,8 @@ public : void setStart(unsigned int start); void setCharge(unsigned int charge); void setPeptideSp (pappso::PeptideSp peptide); + void setIdentificationDataSource(IdentificationDataSource* identification_source); + void setChecked(bool arg1); private : @@ -50,6 +52,15 @@ private : pappso::pappso_double _exp_mass; unsigned int _start; unsigned int _charge; + IdentificationDataSource* _p_identification_source = nullptr; + + /** @brief manually checked by user (true by default) + */ + bool _checked = true; + + /** @brief automatic filter result (false by default) + */ + bool _proxy_valid = false; }; #endif // PEPTIDEMATCH_H diff --git a/src/core/project.cpp b/src/core/project.cpp index d4f5b659742b4a0c9746975ce1471f68f4777a29..bf7bf509456802e694340ab64d3c5406a48ff347 100644 --- a/src/core/project.cpp +++ b/src/core/project.cpp @@ -30,8 +30,8 @@ Project::Project() Project::~Project() { - auto it = _protein_match_list.begin(); - while (it != _protein_match_list.end()) { + auto it = _identification_goup_list.begin(); + while (it != _identification_goup_list.end()) { delete (*it); it++; } @@ -42,6 +42,11 @@ ProjectSp Project::makeProjectSp() const { } +IdentificationGroup* Project::newIdentificationGroup() { + _p_current_identification_group = new IdentificationGroup(this); + _identification_goup_list.push_back(_p_current_identification_group); + return _p_current_identification_group; +} void Project::readXpipFile(QFileInfo xpip_fileinfo) { @@ -57,37 +62,21 @@ void Project::readXpipFile(QFileInfo xpip_fileinfo) { QXmlInputSource xmlInputSource(&qfile); if (simplereader.parse(xmlInputSource)) { + + qfile.close(); } else { qDebug() << parser->errorString(); // throw PappsoException( // QObject::tr("error reading tandem XML result file :\n").append( // parser->errorString())); - } - qfile.close(); - - /* - GrpGroupingMonitor monitor; - GrpExperiment grpExperiment(monitor); - PeptideReader peptideReader(grpExperiment); - FastaReader reader(peptideReader); - reader.parse(&fastaFile); - fastaFile.close(); - grpExperiment.startGrouping(); + qfile.close(); - std::list<GrpProteinSp> protein_list; - grpExperiment.getGroupedProteinSpList(protein_list); - */ + throw pappso::PappsoException(QObject::tr("Error reading %1 XPIP file :\n %2").arg(xpip_fileinfo.absoluteFilePath()).arg(parser->errorString())); + } } - -void Project::addProteinMatch(ProteinMatch * protein_match) { - _protein_match_list.push_back(protein_match); -} -void Project::addMsRunIdSp(pappso::MsRunIdSp ms_run_sp) { - _ms_run_list.push_back(ms_run_sp); -} -std::vector<ProteinMatch *> & Project::getProteinMatchList() { - return _protein_match_list; +IdentificationGroup* Project::getCurrentIdentificationGroupP() const { + return _p_current_identification_group; } diff --git a/src/core/project.h b/src/core/project.h index a04c73a4e1e985a2931c7f1bb4e62fbb4c4b3f36..997d750309e3736d6449cb9a852740779d7a5703 100644 --- a/src/core/project.h +++ b/src/core/project.h @@ -24,10 +24,7 @@ #define PROJECT_H #include<memory> -#include <pappsomspp/grouping/grpexperiment.h> -#include <QFileInfo> -#include "proteinmatch.h" -#include <pappsomspp/msrun/msrunid.h> +#include "identificationgroup.h" class Project; typedef std::shared_ptr<Project> ProjectSp; @@ -40,15 +37,11 @@ public: ProjectSp makeProjectSp() const; void readXpipFile(QFileInfo xpip_source); - void addProteinMatch(ProteinMatch * protein_match); - std::vector<ProteinMatch *> & getProteinMatchList(); - void addMsRunIdSp(pappso::MsRunIdSp ms_run_sp); - - pappso::GrpExperiment * _p_grp_experiment= nullptr; + IdentificationGroup* newIdentificationGroup(); + IdentificationGroup* getCurrentIdentificationGroupP() const; private : - std::vector<ProteinMatch *> _protein_match_list; - - std::vector<pappso::MsRunIdSp> _ms_run_list; + std::vector<IdentificationGroup *> _identification_goup_list; + IdentificationGroup* _p_current_identification_group = nullptr; }; #endif // PROJECT_H diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index 8294cc6e7d82bdadbbd4102bfedffe9281616ed4..c0e05693014720954426a7b52b4e5bb19e6e75f1 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -48,6 +48,12 @@ void ProteinMatch::setProteinSp(pappso::ProteinSp protein_sp) { _protein_sp = protein_sp; } +bool ProteinMatch::isChecked() const { + return _checked; +} +void ProteinMatch::setChecked(bool arg1) { + _checked = arg1; +} void ProteinMatch::addPeptideMatch(PeptideMatch * peptide_match) { _peptide_match_list.push_back(peptide_match); } diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index 5ae01df3a4fd97582c4e7d6a257f62b6d13727d9..ffe62a7efc81228d3b9c47973bb4f7464a952f62 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -40,10 +40,19 @@ public: void setProteinSp(pappso::ProteinSp protein_sp); void addPeptideMatch(PeptideMatch * peptide_match); std::vector<PeptideMatch *> & getPeptideMatchList(); + void setChecked(bool arg1); + bool isChecked() const; private: std::vector<PeptideMatch *> _peptide_match_list; pappso::ProteinSp _protein_sp = nullptr; pappso::pappso_double _evalue=0; + /** @brief manually checked by user (true by default) + */ + bool _checked = true; + + /** @brief automatic filter result (false by default) + */ + bool _proxy_valid = false; }; diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 1bf9b7dd8f6457bb59f800751aa6748ad4a7f30d..487df39db2e6bb21d2a0066aed66cfaa8de621b3 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -92,6 +92,6 @@ void MainWindow::selectXpipFile() { XpipFile xpip_file(new_xpip_file); _project_sp = xpip_file.getProjectSp(); - _protein_list_window->setProject(_project_sp.get()); + _protein_list_window->setIdentificationGroup(_project_sp.get()->getCurrentIdentificationGroupP()); } diff --git a/src/gui/protein_list_view/proteinlistwindow.cpp b/src/gui/protein_list_view/proteinlistwindow.cpp index 4069a46609484ae3a16bcfed7dde282c7c0e9a40..71ae18a086e13c1a413e62f6ca531388ac3cf35f 100644 --- a/src/gui/protein_list_view/proteinlistwindow.cpp +++ b/src/gui/protein_list_view/proteinlistwindow.cpp @@ -53,7 +53,7 @@ ProteinListWindow::ProteinListWindow(QWidget *parent): _protein_table_model_p = new ProteinTableModel(0); - _p_proxy_model = new ProteinTableProxyModel(this); + _p_proxy_model = new ProteinTableProxyModel(this, _protein_table_model_p); _p_proxy_model->setSourceModel(_protein_table_model_p); _p_proxy_model->setDynamicSortFilter(true); ui->tableView->setModel( _p_proxy_model ); @@ -68,8 +68,9 @@ ProteinListWindow::~ProteinListWindow() } -void ProteinListWindow::setProject(Project* project_p) { - _protein_table_model_p->setProject(project_p); - _p_proxy_model->setSourceModel(_protein_table_model_p); +void ProteinListWindow::setIdentificationGroup(IdentificationGroup * p_identification_group) { + _protein_table_model_p->setIdentificationGroup(p_identification_group); + _p_proxy_model->setSourceModel(_protein_table_model_p); } + diff --git a/src/gui/protein_list_view/proteinlistwindow.h b/src/gui/protein_list_view/proteinlistwindow.h index f4e337dc3dade9379dbcb98f06e9900cfcda9f84..e30f7aabefe2eef7e45207c01b46b28f602aed27 100644 --- a/src/gui/protein_list_view/proteinlistwindow.h +++ b/src/gui/protein_list_view/proteinlistwindow.h @@ -40,7 +40,7 @@ public: explicit ProteinListWindow(QWidget * parent = 0); ~ProteinListWindow(); - void setProject(Project* project_p); + void setIdentificationGroup(IdentificationGroup * p_identification_group); public slots: //void peptideEdited(QString peptideStr); diff --git a/src/gui/protein_list_view/proteintablemodel.cpp b/src/gui/protein_list_view/proteintablemodel.cpp index 525861366567bea4b2ca50d2304cb636a5f2fb4e..697cb11e7e1bf20593695d1758e26be1fdb477f0 100644 --- a/src/gui/protein_list_view/proteintablemodel.cpp +++ b/src/gui/protein_list_view/proteintablemodel.cpp @@ -26,14 +26,16 @@ #include <QDebug> -ProteinTableProxyModel::ProteinTableProxyModel(QObject *parent): QSortFilterProxyModel(parent), +ProteinTableProxyModel::ProteinTableProxyModel(QObject *parent,ProteinTableModel* protein_table_model_p): QSortFilterProxyModel(parent), m_minGravity(0.0), m_minDensity(0.0) { + _protein_table_model_p = protein_table_model_p; } bool ProteinTableProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { - return true; + //return _protein_table_model_p->acceptRow(source_row); + return true; } bool ProteinTableProxyModel::lessThan(const QModelIndex & left, const QModelIndex & right) const { @@ -81,9 +83,9 @@ ProteinTableModel::ProteinTableModel(QObject *parent) } -void ProteinTableModel::setProject(Project * p_project) { - qDebug() << "ProteinTableModel::setProject begin " << p_project->getProteinMatchList().size(); - _p_project = p_project; +void ProteinTableModel::setIdentificationGroup(IdentificationGroup * p_identification_group) { + qDebug() << "ProteinTableModel::setIdentificationGroup begin " << p_identification_group->getProteinMatchList().size(); + _p_identification_group = p_identification_group; QModelIndex topLeft = createIndex(0,0); QModelIndex bottomRight = createIndex(rowCount(),columnCount()); @@ -92,9 +94,9 @@ void ProteinTableModel::setProject(Project * p_project) { } int ProteinTableModel::rowCount(const QModelIndex &parent ) const { - if (_p_project != nullptr) { - qDebug() << "ProteinTableModel::rowCount(const QModelIndex &parent ) " << _p_project->getProteinMatchList().size(); - return _p_project->getProteinMatchList().size(); + if (_p_identification_group != nullptr) { + qDebug() << "ProteinTableModel::rowCount(const QModelIndex &parent ) " << _p_identification_group->getProteinMatchList().size(); + return _p_identification_group->getProteinMatchList().size(); } return 0; } @@ -125,21 +127,35 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const { int col = index.column(); qDebug() << QString("row %1, col%2, role %3") .arg(row).arg(col).arg(role); - if (role == Qt::DisplayRole) - { + + switch(role) { + case Qt::CheckStateRole: + + if (col == 0) //add a checkbox to cell(1,0) + { + if ( _p_identification_group->getProteinMatchList().at(row)->isChecked()) { + return Qt::Checked; + } + else { + return Qt::Unchecked; + } + } + break; + case Qt::DisplayRole: if (col == 0) { - if (_p_project != nullptr) { - return QVariant ((quint16) _p_project->getProteinMatchList().at(row)->getPeptideMatchList().size()); + if (_p_identification_group != nullptr) { + + return QVariant ((quint16) _p_identification_group->getProteinMatchList().at(row)->getPeptideMatchList().size()); } } if (col == 1) { - if (_p_project != nullptr) { - return _p_project->getProteinMatchList().at(row)->getProteinSp().get()->getAccession(); + if (_p_identification_group != nullptr) { + return _p_identification_group->getProteinMatchList().at(row)->getProteinSp().get()->getAccession(); } } if (col == 2) { - if (_p_project != nullptr) { - return _p_project->getProteinMatchList().at(row)->getProteinSp().get()->getDescription(); + if (_p_identification_group != nullptr) { + return _p_identification_group->getProteinMatchList().at(row)->getProteinSp().get()->getDescription(); } } return QString("Row%1, Column%2") @@ -148,3 +164,11 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const { } return QVariant(); } + + +bool ProteinTableModel::acceptRow(int source_row) { + if (_p_identification_group->isValid(_p_identification_group->getProteinMatchList().at(source_row))) { + return true; + } + return false; +} diff --git a/src/gui/protein_list_view/proteintablemodel.h b/src/gui/protein_list_view/proteintablemodel.h index 7b11abe6d600549d7ddf4aacb79430c95d3c2f98..2d58c87932d2b7f16be2c378d78b73f282a0e28e 100644 --- a/src/gui/protein_list_view/proteintablemodel.h +++ b/src/gui/protein_list_view/proteintablemodel.h @@ -28,12 +28,12 @@ #include <QSortFilterProxyModel> #include "../../core/project.h" - +class ProteinTableModel; class ProteinTableProxyModel : public QSortFilterProxyModel { Q_OBJECT public: - ProteinTableProxyModel(QObject* parent = 0); + ProteinTableProxyModel(QObject* parent,ProteinTableModel* protein_table_model_p); bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; QVariant headerData(int section, Qt::Orientation orientation, @@ -46,6 +46,7 @@ public slots: private: double m_minGravity; double m_minDensity; + ProteinTableModel* _protein_table_model_p; }; class ProteinTableModel: public QAbstractTableModel @@ -59,10 +60,11 @@ public: QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - void setProject(Project * p_project); + void setIdentificationGroup(IdentificationGroup * p_identification_group); + bool acceptRow(int source_row); private : - Project * _p_project = nullptr; + IdentificationGroup * _p_identification_group = nullptr; }; #endif // PROTEINTABLEMODEL_H diff --git a/src/input/xpipsaxhandler.cpp b/src/input/xpipsaxhandler.cpp index 23deada7cbfb848fa8cb4c0ab026f559a1d0e3c8..1afa8677c48a7d260a756b96b6a59ee73291dc32 100644 --- a/src/input/xpipsaxhandler.cpp +++ b/src/input/xpipsaxhandler.cpp @@ -43,9 +43,12 @@ bool XpipSaxHandler::startElement(const QString & namespaceURI, const QString & try { //startElement_group - if (qName == "protein") - { + if (qName == "match") { + is_ok = startElement_match(attributes); + } else if (qName == "protein") { is_ok = startElement_protein(attributes); + } else if (qName == "identification") { + is_ok = startElement_identification(attributes); } //<sample value="P6_08_10"/> else if (qName == "sample") { @@ -56,7 +59,12 @@ bool XpipSaxHandler::startElement(const QString & namespaceURI, const QString & is_ok = startElement_modifs_mass(attributes); } else if (qName == "modif") { is_ok = startElement_modif(attributes); + } else if (qName == "filter_params") { + is_ok = startElement_filter_params(attributes); + } else if (qName == "information") { + is_ok = startElement_information(attributes); } + _current_text.clear(); } catch (pappso::PappsoException exception_pappso) { @@ -80,12 +88,18 @@ bool XpipSaxHandler::endElement(const QString & namespaceURI, const QString & lo { is_ok = endElement_protein(); } + else if (qName == "identification") { + is_ok = endElement_identification(); + } else if (qName == "peptide") { is_ok = endElement_peptide(); } else if (qName == "sequence") { is_ok = endElement_sequence(); } + else if (qName == "match") { + is_ok = endElement_match(); + } // end of detection_moulon // else if ((_tag_stack.size() > 1) && @@ -106,6 +120,31 @@ bool XpipSaxHandler::endElement(const QString & namespaceURI, const QString & lo return is_ok; } +bool XpipSaxHandler::startElement_identification(QXmlAttributes attributes) { + + qDebug() << "startElement_identification "; + _map_massstr_aamod.clear(); + _current_identification_group_p = _p_project->newIdentificationGroup(); + qDebug() << "startElement_identification end" ; + return true; +} + +bool XpipSaxHandler::startElement_filter_params(QXmlAttributes attributes) { + +//<filter_params pep_evalue="0.01" prot_evalue="-2.0" pep_number="1" filter_to_all="false" database_filter="contaminants_standarts.fasta"/> + qDebug() << "startElement_filter_params "; + qDebug() << "startElement_filter_params end" ; + return true; +} + +bool XpipSaxHandler::startElement_information(QXmlAttributes attributes) { + +//<information Data_Type="indiv" match_number="223"/> + qDebug() << "startElement_information "; + qDebug() << "startElement_information end" ; + return true; +} + bool XpipSaxHandler::startElement_modifs_mass(QXmlAttributes attributes) { /* @@ -120,9 +159,9 @@ bool XpipSaxHandler::startElement_modifs_mass(QXmlAttributes attributes) { qDebug() << "startElement_modifs_mass "; QString mass_str(attributes.value("modvalue").simplified()); pappso::mz mass = mass_str.toDouble(); - + pappso::AaModificationP mod = getAaModificationP(mass); - + _map_massstr_aamod[mass_str] = mod; qDebug() << "startElement_modifs_mass end" ; return true; @@ -137,25 +176,40 @@ bool XpipSaxHandler::startElement_sample(QXmlAttributes attributes) { ms_run.setFilename(attributes.value("value").simplified()); pappso::MsRunIdSp msrunid_sp = ms_run.makeMsRunIdSp(); - _p_project->addMsRunIdSp(msrunid_sp); - + _current_identification_group_p->addMsRunIdSp(msrunid_sp); + _map_msrunid[ms_run.getXmlId()] = msrunid_sp; qDebug() << "startElement_sample end" ; return true; } +bool XpipSaxHandler::startElement_match(QXmlAttributes attributes) { + + qDebug() << "startElement_match "; + /* + * <match_list><match validate="true"> + */ + _p_protein_match = new ProteinMatch(); + _p_protein_match->setChecked(false); + if (attributes.value("validate").simplified().toLower() == "true") { + _p_protein_match->setChecked(true); + } + qDebug() << "startElement_match end" ; + return true; +} bool XpipSaxHandler::startElement_protein(QXmlAttributes attributes) { + qDebug() << "startElement_protein "; /* - * <protein peptide_number="268" evalue="-432.77353" URL="Genome_Z_mays_5a.fasta" description="GRMZM2G083841_P01 P04711 Phosphoenolpyruvate carboxylase 1 (PEPCase 1)(PEPC 1)(EC 4.1.1.31) seq=translation; coord=9:61296279..61301686:1; parent_transcript=GRMZM2G083841_T01; parent_gene=GRMZM2G083841"> + * <protein peptide_number="268" evalue="-432.77353" URL="Genome_Z_mays_5a.fasta" + * description="GRMZM2G083841_P01 P04711 Phosphoenolpyruvate carboxylase 1 (PEPCase 1)(PEPC 1)(EC 4.1.1.31) + * seq=translation; coord=9:61296279..61301686:1; parent_transcript=GRMZM2G083841_T01; parent_gene=GRMZM2G083841"> <protein_evalue evalue="-399.36093" sample="20120906_balliau_extract_1_A02_urzb-1"/> <protein_evalue evalue="-384.54382" sample="20120906_balliau_extract_1_A01_urnb-1"/> <sequence>MASTKAPGPGEKHHSIDAQLRQLVPGKVSEDDKLIEYDALLVDRFLNILQDLHGPSLREFVQECYEVSADYEGKGDTTKLGELGAKLTGLAPADAILVASSILHMLNLANLAEEVQIAHRRRNSKLKKGGFADEGSATTESDIEETLKRLVSEVGKSPEEVFEALKNQTVDLVFTAHPTQSARRSLLQKNARIRNCLTQLNAKDITDDDKQELDEALQREIQAAFRTDEIRRAQPTPQDEMRYGMSYIHETVWKGVPKFLRRVDTALKNIGINERLPYNVSLIRFSSWMGGDRDGNPRVTPEVTRDVCLLARMMAANLYIDQIEELMFELSMWRCNDELRVRAEELHSSSGSKVTKYYIEFWKQIPPNEPYRVILGHVRDKLYNTRERARHLLASGVSEISAESSFTSIEEFLEPLELCYKSLCDCGDKAIADGSLLDLLRQVFTFGLSLVKLDIRQESERHTDVIDAITTHLGIGSYREWPEDKRQEWLLSELRGKRPLLPPDLPQTDEIADVIGAFHVLAELPPDSFGPYIISMATAPSDVLAVELLQRECGVRQPLPVVPLFERLADLQSAPASVERLFSVDWYMDRIKGKQQVMVGYSDSGKDAGRLSAAWQLYRAQEEMAQVAKRYGVKLTLFHGRGGTVGRGGGPTHLAILSQPPDTINGSIRVTVQGEVIEFCFGEEHLCFQTLQRFTAATLEHGMHPPVSPKPEWRKLMDEMAVVATEEYRSVVVKEARFVEYFRSATPETEYGRMNIGSRPAKRRPGGGITTLRAIPWIFSWTQTRFHLPVWLGVGAAFKFAIDKDVRNFQVLKEMYNEWPFFRVTLDLLEMVFAKGDPGIAGLYDELLVAEELKPFGKQLRDKYVETQQLLLQIAGHKDILEGDPFLKQGLVLRNPYITTLNVFQAYTLKRIRDPNFKVTPQPPLSKEFADENKPAGLVKLNPASEYPPGLEDTLILTMKGIAAGMQNTG</sequence> </protein> */ - _p_protein_match = new ProteinMatch(); _p_protein_match->setEvalue(attributes.value("evalue").toDouble()); - qDebug() << "startElement_protein "; _current_protein.setDescription(attributes.value("description").simplified()); _current_protein.setAccession(_current_protein.getDescription().split(" ").at(0)); qDebug() << "startElement_protein end" ; @@ -181,7 +235,21 @@ bool XpipSaxHandler::startElement_peptide(QXmlAttributes attributes) { _p_peptide_match->setExperimentalMass(exp_mass); _p_peptide_match->setStart(attributes.value("start").simplified().toUInt()); _p_peptide_match->setCharge(attributes.value("charge").simplified().toUInt()); - + + _p_peptide_match->setCharge(attributes.value("charge").simplified().toUInt()); + + IdentificationDataSource* p_identification_data_source = IdentificationDataSource::getInstance(attributes.value("sample_file").simplified()); + _p_peptide_match->setIdentificationDataSource( p_identification_data_source); + if (p_identification_data_source->getMsRunSp().get() == nullptr) { + p_identification_data_source->setMsRunSp(ms_run_id); + } + if (p_identification_data_source->getMsRunSp().get() != ms_run_id.get()) { + throw pappso::PappsoException(QObject::tr("p_identification_data_source->getMsRunSp().get() != ms_run_id.get()")); + } + _p_peptide_match->setChecked(false); + if (attributes.value("validate").simplified().toLower() == "true") { + _p_peptide_match->setChecked(true); + } _p_protein_match->addPeptideMatch(_p_peptide_match); qDebug() << "startElement_peptide end" ; return true; @@ -217,10 +285,20 @@ bool XpipSaxHandler::endElement_sequence() { } bool XpipSaxHandler::endElement_protein() { _p_protein_match->setProteinSp(_current_protein.makeProteinSp()); - _p_project->addProteinMatch(_p_protein_match); + + return true; +} + +bool XpipSaxHandler::endElement_identification() { + return true; } +bool XpipSaxHandler::endElement_match() { + _current_identification_group_p->addProteinMatch(_p_protein_match); + _p_protein_match = nullptr; + return true; +} bool XpipSaxHandler::error(const QXmlParseException &exception) { diff --git a/src/input/xpipsaxhandler.h b/src/input/xpipsaxhandler.h index 55e2a2b1cac45b8728954d963991ed7a8762e30a..ae9e8ff1241f7e9c25c7afd204567e9b13377661 100644 --- a/src/input/xpipsaxhandler.h +++ b/src/input/xpipsaxhandler.h @@ -57,14 +57,20 @@ public: private: + bool startElement_filter_params(QXmlAttributes attributes); + bool startElement_information(QXmlAttributes attributes); + bool startElement_identification(QXmlAttributes attributes); + bool startElement_match(QXmlAttributes attributes); bool startElement_peptide(QXmlAttributes attributes); bool startElement_protein(QXmlAttributes attributes); bool startElement_sample(QXmlAttributes attributes); bool startElement_modifs_mass(QXmlAttributes attributes); bool startElement_modif(QXmlAttributes attributes); + bool endElement_identification(); bool endElement_sequence(); bool endElement_protein(); bool endElement_peptide(); + bool endElement_match(); pappso::AaModificationP getAaModificationP(pappso::mz mass) const; @@ -78,6 +84,7 @@ private: PeptideMatch * _p_peptide_match; pappso::Protein _current_protein; pappso::NoConstPeptideSp _current_peptide_sp; + IdentificationGroup * _current_identification_group_p; PeptideStore _peptide_store; QMap<QString, pappso::AaModificationP> _map_massstr_aamod;