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

new peptidextp object, collection of modifications in peptide store

parent a39c661e
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
/*******************************************************************************
* 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);
}
/*******************************************************************************
* 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
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......@@ -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
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