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

WIP : parsing pep XML files

parent e43fa0b9
No related branches found
No related tags found
No related merge requests found
/**
* \file input/pepxmlsaxhandler.cpp
* \date 18/6/2018
* \author Olivier Langella
* \brief parse pepxml result file
*/
/*******************************************************************************
* Copyright (c) 2018 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/>.
*
******************************************************************************/
#include "pepxmlsaxhandler.h"
#include <pappsomspp/exception/exceptionnotfound.h>
#include <cmath>
#include "../core/peptideevidence.h"
#include "../utils/peptidestore.h"
#include "../utils/proteinstore.h"
PepXmlSaxHandler::PepXmlSaxHandler(WorkMonitorInterface *p_monitor,
Project *p_project)
: _p_project(p_project)
{
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_p_monitor = p_monitor;
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
PepXmlSaxHandler::~PepXmlSaxHandler()
{
}
bool
PepXmlSaxHandler::startElement(const QString &namespaceURI,
const QString &localName, const QString &qName,
const QXmlAttributes &attributes)
{
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_tag_stack.push_back(qName);
bool is_ok = true;
try
{
// startElement_group
if(_tag_stack.size() == 1)
{
_is_xtpcpp_xpip = true;
if(qName != "xpip")
{
_is_xtpcpp_xpip = false;
throw pappso::ExceptionNotFound(
QObject::tr("ERROR this file is not a pep xml file %1")
.arg(qName));
}
}
else if(qName == "protein_match")
{
if(_count_total % 100 == 0)
{
_p_monitor->message(QString("reading protein matches %1 on %2")
.arg(_count_protein_matches)
.arg(_total_protein_matches),
_count_total);
}
is_ok = startElement_protein_match(attributes);
}
else if(qName == "peptide_match")
{
is_ok = startElement_peptide_match(attributes);
}
else if(qName == "protein")
{
if(_count_total % 100 == 0)
{
_p_monitor->message(QString("reading proteins %1 on %2")
.arg(_count_proteins)
.arg(_total_proteins),
_count_total);
}
is_ok = startElement_protein(attributes);
}
else if(qName == "identification_source")
{
is_ok = startElement_identification_source(attributes);
}
else if(qName == "param")
{
is_ok = startElement_param(attributes);
}
else if(qName == "stat")
{
is_ok = startElement_stat(attributes);
}
else if(qName == "identification_group")
{
is_ok = startElement_identification_group(attributes);
}
else if(qName == "peptide_evidence_list")
{
is_ok = startElement_peptide_evidence_list(attributes);
}
else if(qName == "counts")
{
is_ok = startElement_counts(attributes);
}
else if(qName == "label_method")
{
is_ok = startElement_label_method(attributes);
}
//<sample value="P6_08_10"/>
else if(qName == "msrun")
{
is_ok = startElement_msrun(attributes);
}
else if(qName == "peptide")
{
if(_count_total % 100 == 0)
{
_p_monitor->message(QObject::tr("reading peptide %1 on %2")
.arg(_count_peptides)
.arg(_total_peptides),
_count_total);
}
is_ok = startElement_peptide(attributes);
}
else if(qName == "peptide_evidence")
{
if(_count_total % 100 == 0)
{
_p_monitor->message(
QObject::tr("reading peptide evidence %1 on %2")
.arg(_count_peptide_evidences)
.arg(_total_peptide_evidences),
_count_total);
}
is_ok = startElement_peptide_evidence(attributes);
}
else if(qName == "modification")
{
is_ok = startElement_modification(attributes);
}
else if(qName == "mod")
{
is_ok = startElement_mod(attributes);
}
else if(qName == "filter_params")
{
is_ok = startElement_filter_params(attributes);
}
else if(qName == "description")
{
is_ok = startElement_description(attributes);
}
else if(qName == "fasta_file")
{
is_ok = startElement_fasta_file(attributes);
}
else if(qName == "contaminants")
{
is_ok = startElement_contaminants(attributes);
}
else if(qName == "decoys")
{
is_ok = startElement_decoys(attributes);
}
_current_text.clear();
}
catch(pappso::PappsoException exception_pappso)
{
_errorStr = QObject::tr("ERROR in PepXmlSaxHandler::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 PepXmlSaxHandler::startElement tag %1, std exception:\n%2")
.arg(qName)
.arg(exception_std.what());
return false;
}
return is_ok;
}
bool
PepXmlSaxHandler::endElement(const QString &namespaceURI,
const QString &localName, const QString &qName)
{
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
bool is_ok = true;
// endElement_peptide_list
try
{
if(qName == "protein")
{
is_ok = endElement_protein();
}
else if(qName == "peptide")
{
is_ok = endElement_peptide();
}
else if(qName == "msrun")
{
is_ok = endElement_msrun();
}
else if(qName == "sequence")
{
is_ok = endElement_sequence();
}
else if(qName == "protein_match")
{
is_ok = endElement_protein_match();
}
else if(qName == "peptide_evidence")
{
is_ok = endElement_peptide_evidence();
}
else if(qName == "peptide_evidence_list")
{
is_ok = endElement_peptide_evidence_list();
}
else if(qName == "identification_group")
{
is_ok = endElement_identification_group();
}
else if(qName == "identification_source")
{
is_ok = endElement_identification_source();
}
// end of detection_moulon
// else if ((_tag_stack.size() > 1) &&
// (_tag_stack[_tag_stack.size() - 2] == "detection_moulon"))
}
catch(pappso::PappsoException exception_pappso)
{
_errorStr = QObject::tr("ERROR in PepXmlSaxHandler::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 PepXmlSaxHandler::endElement tag %1, std exception:\n%2")
.arg(qName)
.arg(exception_std.what());
return false;
}
_current_text.clear();
_tag_stack.pop_back();
return is_ok;
}
// <msms_pipeline_analysis date="2015-01-19T13:28:41"
// xmlns="http://regis-web.systemsbiology.net/pepXML"
// xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
// xsi:schemaLocation="http://sashimi.sourceforge.net/schema_revision/pepXML/pepXML_v117.xsd"
// summary_xml="/gorgone/pappso/abrf_2015/mzXML/JD_06232014_sample1-A.pep.xml">
bool
PepXmlSaxHandler::startElement_msms_pipeline_analysis(QXmlAttributes attributes)
{
QString original_filename = attributes.value("summary_xml");
}
// <msms_run_summary
// base_name="/gorgone/pappso/abrf_2015/mzXML/JD_06232014_sample1-A"
// msManufacturer="Thermo Scientific" msModel="Q Exactive"
// raw_data_type="raw" raw_data=".mzXML">
bool
PepXmlSaxHandler::startElement_msms_run_summary(QXmlAttributes attributes)
{
QString mz_datafile = QString("%1%2")
.arg(attributes.value("base_name"))
.arg(attributes.value("raw_data"));
}
// <search_database
// local_path="/gorgone/pappso/abrf_2015/fasta/iPRG2015.fasta" type="AA"/>
bool
PepXmlSaxHandler::startElement_search_database(QXmlAttributes attributes)
{
QString fastafile = attributes.value("local_path");
}
// <search_summary
// base_name="/gorgone/pappso/moulon/users/Olivier/Delphine_Pecqueur/mzXML/330_01_01_C3G3_150122_01"
// search_engine="X! Tandem (k-score)" precursor_mass_type="monoisotopic"
// fragment_mass_type="monoisotopic" search_id="1">
bool
PepXmlSaxHandler::startElement_search_summary(QXmlAttributes attributes)
{
_current_search_engine = attributes.value("search_engine");
}
// <spectrum_query spectrum="JD_06232014_sample1-A.00005.00005.2"
// start_scan="5" end_scan="5" precursor_neutral_mass="819.347822"
// assumed_charge="2" index="1" retention_time_sec="1.4">
// <spectrum_query spectrum="JD_06232014_sample1-A.00006.00006.2"
// start_scan="6" end_scan="6" precursor_neutral_mass="870.405029296875"
// assumed_charge="2" index="1">
bool
PepXmlSaxHandler::startElement_spectrum_query(QXmlAttributes attributes)
{
unsigned int start_scan = attributes.value("start_scan").toUInt();
unsigned int end_scan = attributes.value("end_scan").toUInt();
if(start_scan != end_scan)
{
String message = "ERROR reading pepxml file :\n" +
"unable to read search results from '" +
this.currentSearchEngine + "' as start " +
currentStartScan + " and end " + currentEndScan +
" scans are different";
logger.error(message);
throw new MSMSException(message);
}
currentZ = new Integer(attrs.getValue("assumed_charge"));
if(attrs.getValue("retention_time_sec") == null)
{
String message =
"ERROR reading pepxml file :\n" +
"unable to read search results from '" + this.currentSearchEngine +
"' as retention time is not given in spectrum_query elements";
logger.warn(message);
// throw new MSMSException(message);
currentRt = (double)0;
}
else
{
currentRt = new Double(attrs.getValue("retention_time_sec"));
}
currentPrecursorNeutralMass =
new Double(attrs.getValue("precursor_neutral_mass")) + Utils.mhplus;
}
// <search_hit hit_rank="5" peptide="MKDFSTK" peptide_prev_aa="K"
// peptide_next_aa="R" protein="sp|P34218|SAS3_YEAST" num_tot_proteins="1"
// num_matched_ions="2" tot_num_ions="12" calc_neutral_pep_mass="871.410939"
// massdiff="-1.006264" num_tol_term="2" num_missed_cleavages="1"
// num_matched_peptides="190">
bool
PepXmlSaxHandler::startElement_search_hit(QXmlAttributes attributes)
{
QString proteinName = attributes.value("protein");
Protein protein = new Protein();
protein.set_description(proteinName);
if(identification.contain_protein(protein))
{
// new protein, new match
currentMatch = new Match();
currentMatch.set_protein_match(protein);
identification.add_protein(protein, currentMatch);
}
else
{
// get existing match for this protein
currentMatch = (Match)identification.get_match(protein);
}
protein = currentMatch.get_protein_match();
protein.setDatabase(
identification.getDatabaseSet().getInstance(this.fastaFile.getName()));
this.currentPeptide = new PeptideProphet();
currentPeptide.set_sample_id(
identification.getMsRunSet().getInstance(identificationDataSource),
identificationDataSource);
_current_peptide_sp =
PeptideXtp(attributes.value("peptide").simplified()).makePeptideXtpSp();
currentPeptide.set_pre(attrs.getValue("peptide_prev_aa"));
currentPeptide.set_post(attrs.getValue("peptide_next_aa"));
currentPeptide.set_scan(this.currentEndScan.intValue());
Double calc_neutral_pep_mass =
new Double(attrs.getValue("calc_neutral_pep_mass")) + Utils.mhplus;
Double massdiff = new Double(attrs.getValue("massdiff"));
currentPeptide.set_mhplus_theo(calc_neutral_pep_mass);
currentPeptide.set_deltamass(massdiff);
currentPeptide.set_mhplus_obser(currentPrecursorNeutralMass);
currentPeptide.set_charge(this.currentZ);
currentPeptide.setRt(this.currentRt.floatValue());
/*
* if (Math.abs(massdiff) > 1) { String message =
* "massdiff is too high"; logger.error(message); throw new
* MSMSException(message); }
*/
// valeur specifique de la séquence matche
// peptide.set_start(Integer.parseInt(attrs.getValue("start")));
// peptide.set_stop(Integer.parseInt(attrs.getValue("end")));
// peptide.set_evalue(Float.valueOf(attrs.getValue("expect")));
// peptide.set_hypercorr(Float.valueOf(attrs.getValue("hyperscore")));
}
bool
XtpXpipSaxHandler::endElement_search_hit()
{
if(currentPeptideProphetProbability != null)
{
currentPeptide.setProphetProbability(currentPeptideProphetProbability);
}
if(currentPeptideInterProphetProbability != null)
{
currentPeptide.setInterProphetProbability(
currentPeptideInterProphetProbability);
}
currentPeptide.setSearchEngine(this.currentSearchEngine);
identification.add_peptide(this.currentPeptide);
currentMatch.add_peptide_match(currentPeptide);
currentPeptideProphetProbability = null;
currentPeptideInterProphetProbability = null;
currentExpectedValue = null;
}
// <peptideprophet_result probability="0.0245"
// all_ntt_prob="(0.0000,0.0093,0.0245)">
bool
PepXmlSaxHandler::startElement_peptideprophet_result(QXmlAttributes attributes)
{
this.currentPeptideProphetProbability =
Double.parseDouble(attrs.getValue("probability"));
}
// <interprophet_result probability="0.00886064"
// all_ntt_prob="(0,0.0033303,0.00886064)">
bool
PepXmlSaxHandler::startElement_interprophet_result(QXmlAttributes attributes)
{
this.currentPeptideInterProphetProbability =
Double.parseDouble(attrs.getValue("probability"));
}
/*
* <search_score name="xcorr" value="0.528"/> <search_score name="deltacn"
* value="0.059"/> <search_score name="deltacnstar" value="0.000"/>
* <search_score name="spscore" value="29.4"/> <search_score name="sprank"
* value="2"/> <search_score name="expect" value="1.00E+00"/>
*/
bool
PepXmlSaxHandler::startElement_search_score(QXmlAttributes attributes)
{
String name = attrs.getValue("name");
String valueStr = attrs.getValue("value");
if(!valueStr.isEmpty())
{
if(name.equals("expect"))
{
currentExpectedValue = new Double(valueStr);
currentPeptide.set_evalue(currentExpectedValue.floatValue());
}
// <search_score name="hyperscore" value="232"/>
if(name.equals("hyperscore"))
{
currentPeptide.set_hypercorr(Float.parseFloat(valueStr));
}
}
}
// <modification_info modified_peptide="SQRDCR"> <mod_aminoacid_mass
// position="5" mass="160.030649"/> </modification_info>
bool
PepXmlSaxHandler::startElement_mod_aminoacid_mass(QXmlAttributes attributes)
{
double massFloat = attributes.value("mass").toDouble();
int position = attributes.value("position").toUInt();
String aa = _current_peptide_sp.get()->getSequence().substring(position - 1, position);
Float massDiff = massFloat - Utils.getAaMass(aa.charAt(0));
this.currentPeptide.set_Modifs(aa, position - 1, massDiff);
// modifs liste for isotopic analysis
identification.add_modifs_to_liste(new Modifs(massFloat));
pappso::AaModificationP modif = Utils::guessAaModificationPbyMonoisotopicMassDelta(attributes.value("modified").simplified().toDouble());
pappso::AaModificationP modif = pappso::AaModification::getInstance(attributes.value("mass").simplified());
unsigned int position = attributes.value("position").simplified().toUInt();
_current_peptide_sp.get()->addAaModification(modif, position-1);
}
bool
PepXmlSaxHandler::endElement_modification_info()
{
}
bool PepXmlSaxHandler::error(const QXmlParseException &exception) {
_errorStr = QObject::tr("Parse error at line %1, column %2 :\n"
"%3").arg(exception.lineNumber()).arg(exception.columnNumber()).arg(
exception.message());
return false;
}
bool PepXmlSaxHandler::fatalError(const QXmlParseException &exception) {
_errorStr = QObject::tr("Parse error at line %1, column %2 :\n"
"%3").arg(exception.lineNumber()).arg(exception.columnNumber()).arg(
exception.message());
return false;
}
QString PepXmlSaxHandler::errorString() const {
return _errorStr;
}
bool PepXmlSaxHandler::endDocument() {
return true;
}
bool PepXmlSaxHandler::startDocument() {
return true;
}
bool PepXmlSaxHandler::characters(const QString &str) {
_current_text += str;
return true;
}
/**
* \file input/pepxmlsaxhandler.h
* \date 18/6/2018
* \author Olivier Langella
* \brief parse pepxml result file
*/
/*******************************************************************************
* Copyright (c) 2018 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/>.
*
******************************************************************************/
#ifndef PEPXMLSAXHANDLER_H
#define PEPXMLSAXHANDLER_H
#include <QXmlDefaultHandler>
#include <pappsomspp/pappsoexception.h>
#include "../core/proteinxtp.h"
#include "../core/peptidextp.h"
#include <pappsomspp/amino_acid/aamodification.h>
#include "../core/project.h"
#include "../core/proteinmatch.h"
class PepXmlSaxHandler : public QXmlDefaultHandler
{
public:
PepXmlSaxHandler(Project *p_project,
IdentificationGroup *p_identification_group,
IdentificationDataSource *p_identification_data_source);
~PepXmlSaxHandler();
bool startElement(const QString &namespaceURI, const QString &localName,
const QString &qName, const QXmlAttributes &attributes);
bool endElement(const QString &namespaceURI, const QString &localName,
const QString &qName);
bool startDocument();
bool endDocument();
bool characters(const QString &str);
bool fatalError(const QXmlParseException &exception);
bool error(const QXmlParseException &exception);
QString errorString() const;
private:
bool startElement_msms_pipeline_analysis(QXmlAttributes attrs);
bool startElement_protein(QXmlAttributes attributes);
bool startElement_note(QXmlAttributes attributes);
bool startElement_file(QXmlAttributes attributes);
bool startElement_aa(QXmlAttributes attributes);
bool startElement_domain(QXmlAttributes attributes);
bool endElement_domain();
bool endElement_note();
private:
std::vector<QString> _tag_stack;
QString _errorStr;
QString _current_text;
Project *_p_project;
IdentificationGroup *_p_identification_group;
IdentificationDataSource *_p_identification_data_source;
MsRunSp _sp_msrun;
ProteinMatch *_p_protein_match;
PeptideEvidence *_p_peptide_evidence;
PeptideMatch _current_peptide_match;
ProteinXtp _current_protein;
PeptideXtpSp _current_peptide_sp;
QMap<QString, pappso::AaModificationP> _map_massstr_aamod;
QString _current_group_label;
QString _current_group_type;
QString _current_note_label;
QString _current_note_type;
unsigned int _scan;
pappso::pappso_double _mhplus_obser;
unsigned int _charge;
pappso::pappso_double _retention_time;
bool _is_protein_description = false;
};
#endif // PEPXMLSAXHANDLER_H
......@@ -7,26 +7,27 @@
/*******************************************************************************
* 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
******************************************************************************/
* 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 XTANDEMSAXHANDLER_H
#define XTANDEMSAXHANDLER_H
......@@ -40,68 +41,69 @@
#include "../core/project.h"
#include "../core/proteinmatch.h"
class XtandemSaxHandler: public QXmlDefaultHandler
class XtandemSaxHandler : public QXmlDefaultHandler
{
public:
XtandemSaxHandler(Project * p_project, IdentificationGroup * p_identification_group,
IdentificationDataSource * p_identification_data_source);
~XtandemSaxHandler();
bool startElement(const QString & namespaceURI, const QString & localName,
const QString & qName, const QXmlAttributes & attributes);
bool endElement(const QString & namespaceURI, const QString & localName,
const QString & qName);
bool startDocument();
bool endDocument();
bool characters(const QString &str);
bool fatalError(const QXmlParseException &exception);
bool error(const QXmlParseException &exception);
QString errorString() const;
private:
bool startElement_group(QXmlAttributes attrs);
bool startElement_protein(QXmlAttributes attributes);
bool startElement_note(QXmlAttributes attributes);
bool startElement_file(QXmlAttributes attributes);
bool startElement_aa(QXmlAttributes attributes);
bool startElement_domain(QXmlAttributes attributes);
bool endElement_domain();
bool endElement_note();
private:
std::vector<QString> _tag_stack;
QString _errorStr;
QString _current_text;
Project * _p_project;
IdentificationGroup * _p_identification_group;
IdentificationDataSource * _p_identification_data_source;
MsRunSp _sp_msrun;
ProteinMatch * _p_protein_match;
PeptideEvidence * _p_peptide_evidence;
PeptideMatch _current_peptide_match;
ProteinXtp _current_protein;
PeptideXtpSp _current_peptide_sp;
QMap<QString, pappso::AaModificationP> _map_massstr_aamod;
QString _current_group_label;
QString _current_group_type;
QString _current_note_label;
QString _current_note_type;
unsigned int _scan;
pappso::pappso_double _mhplus_obser;
unsigned int _charge;
pappso::pappso_double _retention_time;
bool _is_protein_description = false;
public:
XtandemSaxHandler(Project *p_project,
IdentificationGroup *p_identification_group,
IdentificationDataSource *p_identification_data_source);
~XtandemSaxHandler();
bool startElement(const QString &namespaceURI, const QString &localName,
const QString &qName, const QXmlAttributes &attributes);
bool endElement(const QString &namespaceURI, const QString &localName,
const QString &qName);
bool startDocument();
bool endDocument();
bool characters(const QString &str);
bool fatalError(const QXmlParseException &exception);
bool error(const QXmlParseException &exception);
QString errorString() const;
private:
bool startElement_group(QXmlAttributes attrs);
bool startElement_protein(QXmlAttributes attributes);
bool startElement_note(QXmlAttributes attributes);
bool startElement_file(QXmlAttributes attributes);
bool startElement_aa(QXmlAttributes attributes);
bool startElement_domain(QXmlAttributes attributes);
bool endElement_domain();
bool endElement_note();
private:
std::vector<QString> _tag_stack;
QString _errorStr;
QString _current_text;
Project *_p_project;
IdentificationGroup *_p_identification_group;
IdentificationDataSource *_p_identification_data_source;
MsRunSp _sp_msrun;
ProteinMatch *_p_protein_match;
PeptideEvidence *_p_peptide_evidence;
PeptideMatch _current_peptide_match;
ProteinXtp _current_protein;
PeptideXtpSp _current_peptide_sp;
QMap<QString, pappso::AaModificationP> _map_massstr_aamod;
QString _current_group_label;
QString _current_group_type;
QString _current_note_label;
QString _current_note_type;
unsigned int _scan;
pappso::pappso_double _mhplus_obser;
unsigned int _charge;
pappso::pappso_double _retention_time;
bool _is_protein_description = false;
};
#endif // XTANDEMSAXHANDLER_H
/*******************************************************************************
* Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
*
* This file is part of PAPPSOms-tools.
*
* PAPPSOms-tools 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.
*
* PAPPSOms-tools 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 PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and implementation
******************************************************************************/
* Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
*
* This file is part of PAPPSOms-tools.
*
* PAPPSOms-tools 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.
*
* PAPPSOms-tools 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 PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
*implementation
******************************************************************************/
#include "config.h"
#include "gui/mainwindow.h"
#include "utils/types.h"
#include <QApplication>
#include <QTimer>
#include <iostream>
#include <pappsomspp/pappsoexception.h>
#include "config.h"
#include "gui/mainwindow.h"
#include "utils/types.h"
using namespace std;
int main(int argc, char *argv[])
int
main(int argc, char *argv[])
{
QTextStream errorStream(stderr, QIODevice::WriteOnly);
QApplication app(argc, argv);
QTextStream errorStream(stderr, QIODevice::WriteOnly);
QApplication app(argc, argv);
qRegisterMetaType<TandemRunBatch>("TandemRunBatch");
qRegisterMetaType<std::vector<pappso::mz>>("std::vector<pappso::mz>");
qRegisterMetaType<pappso::PrecisionP>("pappso::PrecisionP");
qRegisterMetaType<std::vector<pappso::XicSp>>("std::vector<pappso::XicSp>");
qRegisterMetaType<pappso::PeptideSp>("pappso::PeptideSp");
qRegisterMetaType<pappso::XicExtractMethod>("pappso::XicExtractMethod");
qRegisterMetaType<pappso::SpectrumSp>("pappso::SpectrumSp");
qRegisterMetaType<MsRunSp>("MsRunSp");
qRegisterMetaType<std::vector<pappso::PeptideNaturalIsotopeAverageSp>>("std::vector<pappso::PeptideNaturalIsotopeAverageSp>");
qRegisterMetaType<TandemRunBatch>("TandemRunBatch");
qRegisterMetaType<std::vector<pappso::mz>>("std::vector<pappso::mz>");
qRegisterMetaType<pappso::PrecisionP>("pappso::PrecisionP");
qRegisterMetaType<std::vector<pappso::XicSp>>("std::vector<pappso::XicSp>");
qRegisterMetaType<pappso::PeptideSp>("pappso::PeptideSp");
qRegisterMetaType<pappso::XicExtractMethod>("pappso::XicExtractMethod");
qRegisterMetaType<pappso::SpectrumSp>("pappso::SpectrumSp");
qRegisterMetaType<MsRunSp>("MsRunSp");
qRegisterMetaType<std::vector<pappso::PeptideNaturalIsotopeAverageSp>>(
"std::vector<pappso::PeptideNaturalIsotopeAverageSp>");
try {
QCoreApplication::setOrganizationName("PAPPSO");
QCoreApplication::setOrganizationDomain("pappso.inra.fr");
QCoreApplication::setApplicationName("xtpcpp");
MainWindow window;
window.show();
try
{
QCoreApplication::setOrganizationName("PAPPSO");
QCoreApplication::setOrganizationDomain("pappso.inra.fr");
QCoreApplication::setApplicationName("xtpcpp");
MainWindow window;
window.show();
// This code will start the messaging engine in QT and in
// 10ms it will start the execution in the MainClass.run routine;
QTimer::singleShot(10, &window, SLOT(run()));
// This code will start the messaging engine in QT and in
// 10ms it will start the execution in the MainClass.run routine;
QTimer::singleShot(10, &window, SLOT(run()));
return app.exec();
return app.exec();
}
catch (pappso::PappsoException& error)
catch(pappso::PappsoException &error)
{
errorStream << "Oops! an error occurred in XTPcpp. Dont Panic :" << endl;
errorStream << error.qwhat() << endl;
app.exit(1);
errorStream << "Oops! an error occurred in XTPcpp. Dont Panic :" << endl;
errorStream << error.qwhat() << endl;
app.exit(1);
}
catch (std::exception& error)
catch(std::exception &error)
{
errorStream << "Oops! an error occurred in XTPcpp. Dont Panic :" << endl;
errorStream << error.what() << endl;
app.exit(1);
errorStream << "Oops! an error occurred in XTPcpp. Dont Panic :" << endl;
errorStream << error.what() << endl;
app.exit(1);
}
}
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