diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 31f62f99dd5936a2e6cc4862a6d637f43e2de88b..e9dc26851f0c4d604f78826ff25c79230b5fddb2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,11 +26,11 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS} ${Qt5 #sudo apt-get install libpappsomspp-dev -#FIND_PACKAGE( Pappsomspp REQUIRED ) -SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp") +FIND_PACKAGE( Pappsomspp REQUIRED ) +#SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp") # SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp") - SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src") - SET (PAPPSOMSPP_QT4_LIBRARY "${PAPPSOMSPP_DIR}/build/src/libpappsomspp-qt4.so") + #SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src") + #SET (PAPPSOMSPP_QT4_LIBRARY "${PAPPSOMSPP_DIR}/build/src/libpappsomspp-qt4.so") INCLUDE_DIRECTORIES( ${PAPPSOMSPP_INCLUDE_DIR} ) @@ -53,6 +53,9 @@ configure_file (${CMAKE_SOURCE_DIR}/src/config.h.cmake ${CMAKE_SOURCE_DIR}/src/c SET(CPP_FILES utils/readspectrum.cpp core/project.cpp + core/match.cpp + core/identification_sources/identificationdatasource.cpp + core/identification_sources/identificationxtandemfile.cpp files/xpipfile.cpp input/xpipsaxhandler.cpp ) @@ -105,5 +108,3 @@ TARGET_LINK_LIBRARIES(xtpcpp ${PAPPSOMSPP_QT4_LIBRARY} ${Pwiz_LIBRARY} ${ODSSTRE INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/xtpcpp DESTINATION bin) #configure_file (${CMAKE_SOURCE_DIR}/templates/share/applications/pt-peptideviewer.desktop.cmake ${CMAKE_BINARY_DIR}/templates/share/applications/pt-peptideviewer.desktop) - -add_subdirectory(input) \ No newline at end of file diff --git a/src/core/identification_sources/identificationdatasource.cpp b/src/core/identification_sources/identificationdatasource.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f6c6ca64170fe05f7214bfa4e888a5ea27ded38c --- /dev/null +++ b/src/core/identification_sources/identificationdatasource.cpp @@ -0,0 +1,54 @@ + +/******************************************************************************* +* Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.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@moulon.inra.fr> - initial API and implementation +******************************************************************************/ +#include "identificationdatasource.h" + +IdentificationDataSource::IdentificationDataSource(pappso::MsRunIdSp & ms_run_sp) +{ + _ms_run_sp = ms_run_sp; +} + +IdentificationDataSource::IdentificationDataSource(const IdentificationDataSource& other) +{ + _ms_run_sp = other._ms_run_sp; + _resource_name = other._resource_name; +} + +IdentificationDataSource::~IdentificationDataSource() +{ + +} + +bool IdentificationDataSource::operator==(const IdentificationDataSource& other) const +{ + +} + + +const QString & IdentificationDataSource::getResourceName () const { + return _resource_name; +} + + +pappso::MsRunIdSp IdentificationDataSource::getMsRunSp () const { + return (_ms_run_sp); +} diff --git a/src/core/identification_sources/identificationdatasource.h b/src/core/identification_sources/identificationdatasource.h new file mode 100644 index 0000000000000000000000000000000000000000..27b995956728a32faba347cc195829281f70423e --- /dev/null +++ b/src/core/identification_sources/identificationdatasource.h @@ -0,0 +1,45 @@ + +/******************************************************************************* +* Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.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@moulon.inra.fr> - initial API and implementation +******************************************************************************/ +#ifndef IDENTIFICATIONDATASOURCE_H +#define IDENTIFICATIONDATASOURCE_H + + +#include <pappsomspp/msrun/msrunid.h> +class IdentificationDataSource +{ +public: + IdentificationDataSource(pappso::MsRunIdSp & ms_run_sp); + IdentificationDataSource(const IdentificationDataSource& other); + ~IdentificationDataSource(); + bool operator==(const IdentificationDataSource& other) const; + + const QString & getResourceName () const; + pappso::MsRunIdSp getMsRunSp () const; + +protected : + QString _resource_name; +private : + pappso::MsRunIdSp _ms_run_sp = nullptr; +}; + +#endif // IDENTIFICATIONDATASOURCE_H diff --git a/src/core/identification_sources/identificationxtandemfile.cpp b/src/core/identification_sources/identificationxtandemfile.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9e4aa1dadeb2be0bf6a5fc25ad2419f6489b8109 --- /dev/null +++ b/src/core/identification_sources/identificationxtandemfile.cpp @@ -0,0 +1,42 @@ + +/******************************************************************************* +* Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.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@moulon.inra.fr> - initial API and implementation +******************************************************************************/ +#include "identificationxtandemfile.h" + +IdentificationXtandemFile::IdentificationXtandemFile(pappso::MsRunIdSp & ms_run_sp, const QFileInfo & xtandem_file) : IdentificationDataSource(ms_run_sp), _xtandem_file(xtandem_file) +{ + _resource_name = _xtandem_file.absoluteFilePath(); +} + +IdentificationXtandemFile::IdentificationXtandemFile(const IdentificationXtandemFile& other) : IdentificationDataSource(other),_xtandem_file (other._xtandem_file) +{ +} + +IdentificationXtandemFile::~IdentificationXtandemFile() +{ + +} + +bool IdentificationXtandemFile::operator==(const IdentificationXtandemFile& other) const +{ + +} diff --git a/src/core/identification_sources/identificationxtandemfile.h b/src/core/identification_sources/identificationxtandemfile.h new file mode 100644 index 0000000000000000000000000000000000000000..1b53831148e4642821e3f2b15df3e1482e4d404e --- /dev/null +++ b/src/core/identification_sources/identificationxtandemfile.h @@ -0,0 +1,41 @@ + +/******************************************************************************* +* Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.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@moulon.inra.fr> - initial API and implementation +******************************************************************************/ +#ifndef IDENTIFICATIONXTANDEMFILE_H +#define IDENTIFICATIONXTANDEMFILE_H + +#include "identificationdatasource.h" +#include <QFileInfo> + +class IdentificationXtandemFile: public IdentificationDataSource +{ +public: + IdentificationXtandemFile(pappso::MsRunIdSp & ms_run_sp, const QFileInfo & xtandem_file); + IdentificationXtandemFile(const IdentificationXtandemFile& other); + ~IdentificationXtandemFile(); + bool operator==(const IdentificationXtandemFile& other) const; + +private: + const QFileInfo _xtandem_file; +}; + +#endif // IDENTIFICATIONXTANDEMFILE_H diff --git a/src/core/match.cpp b/src/core/match.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6e62456fefa891867190acc77e6690d271acf786 --- /dev/null +++ b/src/core/match.cpp @@ -0,0 +1,33 @@ + +/******************************************************************************* +* Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.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@moulon.inra.fr> - initial API and implementation +******************************************************************************/ +#include "match.h" + +Match::Match() +{ + +} + +Match::~Match() +{ + +} diff --git a/src/core/match.h b/src/core/match.h new file mode 100644 index 0000000000000000000000000000000000000000..a04d7329526c788474dc3b592ca413db48ea3cf9 --- /dev/null +++ b/src/core/match.h @@ -0,0 +1,38 @@ + +/******************************************************************************* +* Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.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@moulon.inra.fr> - initial API and implementation +******************************************************************************/ +#ifndef MATCH_H +#define MATCH_H + +#include <pappsomspp/protein/protein.h> + +class Match +{ +public: + Match(); + ~Match(); + +private: + pappso::ProteinSp _protein_sp = nullptr; +}; + +#endif // MATCH_H diff --git a/src/core/project.cpp b/src/core/project.cpp index af17bcbd715ce4ea417182f02a654ae1bc3da918..265ee946fb15d8b7bf8970ec7998f2d8ebf636e2 100644 --- a/src/core/project.cpp +++ b/src/core/project.cpp @@ -81,7 +81,9 @@ void Project::readXpipFile(QFileInfo xpip_fileinfo) { void Project::addProteinSp(pappso::ProteinSp protein_sp) { _protein_list.push_back(protein_sp); } - +void Project::addMsRunIdSp(pappso::MsRunIdSp ms_run_sp) { + _ms_run_list.push_back(ms_run_sp); +} std::vector<pappso::ProteinSp> & Project::getProteinList() { return _protein_list; } \ No newline at end of file diff --git a/src/core/project.h b/src/core/project.h index 07ea7a3a2de517173a50b09ec6ccc3a0340dc148..be0f518f84f216490139d4e8b79836e688767450 100644 --- a/src/core/project.h +++ b/src/core/project.h @@ -27,6 +27,7 @@ #include <pappsomspp/grouping/grpexperiment.h> #include <QFileInfo> #include <pappsomspp/protein/protein.h> +#include <pappsomspp/msrun/msrunid.h> class Project; typedef std::shared_ptr<Project> ProjectSp; @@ -41,10 +42,13 @@ public: void readXpipFile(QFileInfo xpip_source); void addProteinSp(pappso::ProteinSp protein_sp); std::vector<pappso::ProteinSp> & getProteinList(); + void addMsRunIdSp(pappso::MsRunIdSp ms_run_sp); pappso::GrpExperiment * _p_grp_experiment= nullptr; private : std::vector<pappso::ProteinSp> _protein_list; + + std::vector<pappso::MsRunIdSp> _ms_run_list; }; #endif // PROJECT_H diff --git a/src/input/xpipsaxhandler.cpp b/src/input/xpipsaxhandler.cpp index f05a2dd4a46948fbdcb2596b486dbf490777cf50..520c02a79c032524ae23b08e222d2e72ba3e74d2 100644 --- a/src/input/xpipsaxhandler.cpp +++ b/src/input/xpipsaxhandler.cpp @@ -21,6 +21,7 @@ ******************************************************************************/ #include "xpipsaxhandler.h" +#include <pappsomspp/msrun/msrunid.h> XpipSaxHandler::XpipSaxHandler(Project * p_project):_p_project(p_project) { @@ -45,14 +46,18 @@ bool XpipSaxHandler::startElement(const QString & namespaceURI, const QString & { is_ok = startElement_protein(attributes); } + //<sample value="P6_08_10"/> + else if (qName == "sample") { + is_ok = startElement_sample(attributes); + } _current_text.clear(); } catch (PappsoException exception_pappso) { - _errorStr = QObject::tr("ERROR in XtandemResultsHandler::startElement tag %1, PAPPSO exception:\n%2").arg(qName).arg(exception_pappso.qwhat()); + _errorStr = QObject::tr("ERROR in XpipSaxHandler::startElement tag %1, PAPPSO exception:\n%2").arg(qName).arg(exception_pappso.qwhat()); return false; } catch (std::exception exception_std) { - _errorStr = QObject::tr("ERROR in XtandemResultsHandler::startElement tag %1, std exception:\n%2").arg(qName).arg(exception_std.what()); + _errorStr = QObject::tr("ERROR in XpipSaxHandler::startElement tag %1, std exception:\n%2").arg(qName).arg(exception_std.what()); return false; } return is_ok; @@ -69,19 +74,19 @@ bool XpipSaxHandler::endElement(const QString & namespaceURI, const QString & lo is_ok = endElement_protein(); } else if (qName == "sequence") { - is_ok = endElement_sequence(); - } + is_ok = endElement_sequence(); + } // end of detection_moulon // else if ((_tag_stack.size() > 1) && // (_tag_stack[_tag_stack.size() - 2] == "detection_moulon")) } catch (PappsoException exception_pappso) { - _errorStr = QObject::tr("ERROR in XtandemResultsHandler::endElement tag %1, PAPPSO exception:\n%2").arg(qName).arg(exception_pappso.qwhat()); + _errorStr = QObject::tr("ERROR in XpipSaxHandler::endElement tag %1, PAPPSO exception:\n%2").arg(qName).arg(exception_pappso.qwhat()); return false; } catch (std::exception exception_std) { - _errorStr = QObject::tr("ERROR in XtandemResultsHandler::endElement tag %1, std exception:\n%2").arg(qName).arg(exception_std.what()); + _errorStr = QObject::tr("ERROR in XpipSaxHandler::endElement tag %1, std exception:\n%2").arg(qName).arg(exception_std.what()); return false; } @@ -91,6 +96,19 @@ bool XpipSaxHandler::endElement(const QString & namespaceURI, const QString & lo return is_ok; } +//<sample value="P6_21_23"/> +bool XpipSaxHandler::startElement_sample(QXmlAttributes attributes) { + + qDebug() << "startElement_sample "; + MsRunId ms_run; + ms_run.setXmlId(attributes.value("value").simplified()); + ms_run.setFilename(attributes.value("value").simplified()); + + _p_project->addMsRunIdSp(ms_run.makeMsRunIdSp()); + qDebug() << "startElement_sample end" ; + return true; +} + /* * <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"/> @@ -98,7 +116,6 @@ bool XpipSaxHandler::endElement(const QString & namespaceURI, const QString & lo <sequence>MASTKAPGPGEKHHSIDAQLRQLVPGKVSEDDKLIEYDALLVDRFLNILQDLHGPSLREFVQECYEVSADYEGKGDTTKLGELGAKLTGLAPADAILVASSILHMLNLANLAEEVQIAHRRRNSKLKKGGFADEGSATTESDIEETLKRLVSEVGKSPEEVFEALKNQTVDLVFTAHPTQSARRSLLQKNARIRNCLTQLNAKDITDDDKQELDEALQREIQAAFRTDEIRRAQPTPQDEMRYGMSYIHETVWKGVPKFLRRVDTALKNIGINERLPYNVSLIRFSSWMGGDRDGNPRVTPEVTRDVCLLARMMAANLYIDQIEELMFELSMWRCNDELRVRAEELHSSSGSKVTKYYIEFWKQIPPNEPYRVILGHVRDKLYNTRERARHLLASGVSEISAESSFTSIEEFLEPLELCYKSLCDCGDKAIADGSLLDLLRQVFTFGLSLVKLDIRQESERHTDVIDAITTHLGIGSYREWPEDKRQEWLLSELRGKRPLLPPDLPQTDEIADVIGAFHVLAELPPDSFGPYIISMATAPSDVLAVELLQRECGVRQPLPVVPLFERLADLQSAPASVERLFSVDWYMDRIKGKQQVMVGYSDSGKDAGRLSAAWQLYRAQEEMAQVAKRYGVKLTLFHGRGGTVGRGGGPTHLAILSQPPDTINGSIRVTVQGEVIEFCFGEEHLCFQTLQRFTAATLEHGMHPPVSPKPEWRKLMDEMAVVATEEYRSVVVKEARFVEYFRSATPETEYGRMNIGSRPAKRRPGGGITTLRAIPWIFSWTQTRFHLPVWLGVGAAFKFAIDKDVRNFQVLKEMYNEWPFFRVTLDLLEMVFAKGDPGIAGLYDELLVAEELKPFGKQLRDKYVETQQLLLQIAGHKDILEGDPFLKQGLVLRNPYITTLNVFQAYTLKRIRDPNFKVTPQPPLSKEFADENKPAGLVKLNPASEYPPGLEDTLILTMKGIAAGMQNTG</sequence> </protein> */ - bool XpipSaxHandler::startElement_protein(QXmlAttributes attributes) { qDebug() << "startElement_protein "; @@ -110,7 +127,7 @@ bool XpipSaxHandler::startElement_protein(QXmlAttributes attributes) { bool XpipSaxHandler::endElement_sequence() { if ((_tag_stack.size() > 1) && (_tag_stack[_tag_stack.size() - 1] == "protein")) { - _current_protein.setSequence(_current_text); + _current_protein.setSequence(_current_text); } else { // XtandemHyperscore hyperscore(_curent_spectrum, _current_peptide_sp, _precision, _ion_list, _max_charge,_refine_spectrum_synthesis); diff --git a/src/input/xpipsaxhandler.h b/src/input/xpipsaxhandler.h index 860584e06439eac54861d8306ea6865761ce8f5e..e8b2dc4518702c412dd91133ff7cb8b45218dad4 100644 --- a/src/input/xpipsaxhandler.h +++ b/src/input/xpipsaxhandler.h @@ -56,6 +56,7 @@ public: private: bool startElement_protein(QXmlAttributes attributes); + bool startElement_sample(QXmlAttributes attributes); bool endElement_sequence(); bool endElement_protein();