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

new identification data source object

parent 494a5dab
No related branches found
No related tags found
No related merge requests found
......@@ -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
/*******************************************************************************
* 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);
}
/*******************************************************************************
* 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
/*******************************************************************************
* 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
{
}
/*******************************************************************************
* 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
/*******************************************************************************
* 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()
{
}
/*******************************************************************************
* 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
......@@ -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
......@@ -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
......@@ -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);
......
......@@ -56,6 +56,7 @@ public:
private:
bool startElement_protein(QXmlAttributes attributes);
bool startElement_sample(QXmlAttributes attributes);
bool endElement_sequence();
bool endElement_protein();
......
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