diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d0ea825a97102f700e6d19542d4c0ed5eae3b47a..507261d07128f98e30d6d4b07f9a092b3fbb9a54 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,8 +29,8 @@ 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") -# SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp") +# 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}/cbuild/src/libpappsomspp-qt4.so") @@ -56,6 +56,7 @@ SET(CPP_FILES core/automaticfilterparameters.cpp core/identificationgroup.cpp core/peptidematch.cpp + core/peptidextp.cpp ./core/project.cpp core/proteinmatch.cpp core/proteinxtp.cpp diff --git a/src/core/peptidextp.cpp b/src/core/peptidextp.cpp new file mode 100644 index 0000000000000000000000000000000000000000..87db6ca7926bb8bc166c91f480eb6ae587095d1e --- /dev/null +++ b/src/core/peptidextp.cpp @@ -0,0 +1,44 @@ + +/******************************************************************************* +* 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 "peptidextp.h" + +PeptideXtp::PeptideXtp(const QString & pepstr):pappso::Peptide(pepstr) +{ + +} + +PeptideXtp::PeptideXtp(const PeptideXtp& other):pappso::Peptide(other) +{ + +} + +PeptideXtp::~PeptideXtp() +{ + +} + +PeptideXtpSp PeptideXtp::makePeptideXtpSp() const { + return std::make_shared<PeptideXtp>(*this); +} diff --git a/src/core/peptidextp.h b/src/core/peptidextp.h new file mode 100644 index 0000000000000000000000000000000000000000..8b8ddd55f5d4ed11aa9f8bc6521d86d53e81ddf6 --- /dev/null +++ b/src/core/peptidextp.h @@ -0,0 +1,46 @@ + +/******************************************************************************* +* 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 PEPTIDEXTP_H +#define PEPTIDEXTP_H + +#include <pappsomspp/peptide/peptide.h> + +class PeptideXtp; + +/** \brief shared pointer on a Peptide object + */ +typedef std::shared_ptr<PeptideXtp> PeptideXtpSp; + +class PeptideXtp : public pappso::Peptide +{ +public: + PeptideXtp(const QString & pepstr); + PeptideXtp(const PeptideXtp& other); + ~PeptideXtp(); + + PeptideXtpSp makePeptideXtpSp() const; + +}; + +#endif // PEPTIDEXTP_H diff --git a/src/input/xpipsaxhandler.cpp b/src/input/xpipsaxhandler.cpp index 1d42b8ca126f5b04eaedb80a811e26dfbcc58c48..bfa87f107e6b45a57db1ecf5823735c0fc3e606f 100644 --- a/src/input/xpipsaxhandler.cpp +++ b/src/input/xpipsaxhandler.cpp @@ -236,7 +236,7 @@ bool XpipSaxHandler::startElement_peptide(QXmlAttributes attributes) { //<modifs><modif aa="M" modvalue="15.99491" posi="17" posi_in_prot="49"/> //</modifs> qDebug() << "startElement_peptide "; - _current_peptide_sp = pappso::Peptide(attributes.value("sequence").simplified()).makeNoConstPeptideSp(); + _current_peptide_sp = PeptideXtp(attributes.value("sequence").simplified()).makePeptideXtpSp(); pappso::MsRunIdSp ms_run_id = _map_msrunid[attributes.value("sample").simplified()]; _p_peptide_match = new PeptideMatch(ms_run_id, attributes.value("scan").simplified().toUInt()); _p_peptide_match->setRetentionTime(attributes.value("RT").simplified().toDouble()); @@ -278,7 +278,7 @@ bool XpipSaxHandler::startElement_modif(QXmlAttributes attributes) { bool XpipSaxHandler::endElement_peptide() { qDebug() << "endElement_peptide "; - pappso::PeptideSp peptide_const = pappso::Peptide(*(_current_peptide_sp.get())).makePeptideSp(); + PeptideXtpSp peptide_const = PeptideXtp(*(_current_peptide_sp.get())).makePeptideXtpSp(); peptide_const = _p_project->getPeptideStore().getInstance(peptide_const); _p_peptide_match->setPeptideSp(peptide_const); return true; diff --git a/src/input/xpipsaxhandler.h b/src/input/xpipsaxhandler.h index 063d13d04eee1b7a5b0b20e5c253d3fe9579ef29..f3f0ed5c973cf03b20abb892682151aa6e371518 100644 --- a/src/input/xpipsaxhandler.h +++ b/src/input/xpipsaxhandler.h @@ -26,7 +26,7 @@ #include <QXmlDefaultHandler> #include <pappsomspp/pappsoexception.h> #include "../core/proteinxtp.h" -#include <pappsomspp/peptide/peptide.h> +#include "../core/peptidextp.h" #include <pappsomspp/amino_acid/aamodification.h> #include "../core/project.h" #include "../core/proteinmatch.h" @@ -83,7 +83,7 @@ private: ProteinMatch * _p_protein_match; PeptideMatch * _p_peptide_match; ProteinXtp _current_protein; - pappso::NoConstPeptideSp _current_peptide_sp; + PeptideXtpSp _current_peptide_sp; IdentificationGroup * _current_identification_group_p; QMap<QString, pappso::AaModificationP> _map_massstr_aamod; diff --git a/src/utils/peptidestore.cpp b/src/utils/peptidestore.cpp index 5da496c72c7b6878a77ad63c89d1c5682bbdf641..1fe1dcf1a0fa52ecf1e720496fee4ec50c483af9 100644 --- a/src/utils/peptidestore.cpp +++ b/src/utils/peptidestore.cpp @@ -28,6 +28,7 @@ ******************************************************************************/ #include "peptidestore.h" +#include <pappsomspp/amino_acid/Aa.h> PeptideStore::PeptideStore() { @@ -39,14 +40,21 @@ PeptideStore::~PeptideStore() } -pappso::PeptideSp & PeptideStore::getInstance(pappso::PeptideSp & peptide_in) { - std::size_t sequence_li_crc = _hash_fn ( peptide_in.get()->getLiAbsoluteString().toStdString()); +PeptideXtpSp & PeptideStore::getInstance(PeptideXtpSp & peptide_in) { + std::size_t sequence_crc = _hash_fn ( peptide_in.get()->toAbsoluteString().toStdString()); //QByteArray source = peptide_in.get()->getLiAbsoluteString().toUtf8(); //quint16 sequence_li_crc = qChecksum(source.data(), source.length()); - std::pair<std::unordered_map< std::size_t, pappso::PeptideSp>::iterator,bool> ret = _map_crc_peptide_list.insert(std::pair<std::size_t, pappso::PeptideSp>(sequence_li_crc,peptide_in)); - + std::pair<std::unordered_map< std::size_t, PeptideXtpSp>::iterator,bool> ret = _map_crc_peptide_list.insert(std::pair<std::size_t, PeptideXtpSp>(sequence_crc,peptide_in)); + if (ret.second) { + //if new peptide in store + + for (auto && aa : *(ret.first->second.get())) { + std::list<pappso::AaModificationP> mod_list = aa.getModificationList(); + _modification_collection.insert(mod_list.begin(), mod_list.end()); + } + } return ret.first->second; } diff --git a/src/utils/peptidestore.h b/src/utils/peptidestore.h index d6f88ea1b877c5a1c93caa37806ee57175685101..1d5d9de2efd811eed84f87f419d30635a82d50f1 100644 --- a/src/utils/peptidestore.h +++ b/src/utils/peptidestore.h @@ -30,8 +30,9 @@ #ifndef PEPTIDESTORE_H #define PEPTIDESTORE_H -#include <pappsomspp/peptide/peptide.h> +#include "../core/peptidextp.h" #include <unordered_map> +#include <set> class PeptideStore { @@ -39,12 +40,13 @@ public: PeptideStore(); ~PeptideStore(); - pappso::PeptideSp & getInstance(pappso::PeptideSp & peptide_in); + PeptideXtpSp & getInstance(PeptideXtpSp & peptide_in); private : std::hash<std::string> _hash_fn; - std::unordered_map<std::size_t, pappso::PeptideSp> _map_crc_peptide_list; + std::unordered_map<std::size_t, PeptideXtpSp> _map_crc_peptide_list; + std::set<pappso::AaModificationP> _modification_collection; }; #endif // PEPTIDESTORE_H