Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* \file input/xtpxpipsaxhandler.h
* \date 17/11/2017
* \author Olivier Langella
* \brief parse new xpip files from xtpcpp
*/
/*******************************************************************************
* 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 XTPXPIPSAXHANDLER_H
#define XTPXPIPSAXHANDLER_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"
#include "../utils/workmonitor.h"
class XtpXpipSaxHandler: public QXmlDefaultHandler
{
public:
XtpXpipSaxHandler(WorkMonitorInterface * p_monitor, Project * p_project);
~XtpXpipSaxHandler();
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_filter_params(QXmlAttributes attributes);
bool startElement_description(QXmlAttributes attributes);
bool startElement_fasta_file(QXmlAttributes attributes);
bool startElement_protein_match(QXmlAttributes attributes);
bool startElement_peptide_match(QXmlAttributes attributes);
bool startElement_peptide(QXmlAttributes attributes);
bool startElement_peptide_evidence(QXmlAttributes attributes);
bool startElement_protein(QXmlAttributes attributes);
bool startElement_msrun(QXmlAttributes attributes);
bool startElement_identification_source(QXmlAttributes attributes);
bool startElement_modification(QXmlAttributes attributes);
bool startElement_mod(QXmlAttributes attributes);
bool endElement_sequence();
bool endElement_protein();
bool endElement_peptide();
private:
WorkMonitorInterface * _p_monitor;
std::vector<QString> _tag_stack;
QString _errorStr;
QString _current_text;
AutomaticFilterParameters _automatic_filter_parameters;
Project * _p_project;
ProteinMatch * _p_protein_match;
PeptideMatch _current_peptide_match;
PeptideEvidence * _p_peptide_evidence;
IdentificationGroup * _current_identification_group_p;
std::map<QString, pappso::AaModificationP> _map_modifs;
std::map<QString, FastaFileSp> _map_fasta_files;
std::map<QString, ProteinXtpSp> _map_proteins;
std::map<QString, MsRunSp> _map_msruns;
std::map<QString, IdentificationDataSourceSp> _map_ident_sources;
std::map<QString, PeptideEvidenceSp> _map_peptide_evidences;
ProteinXtp _current_protein;
PeptideXtpSp _current_peptide_sp;
std::map<QString, PeptideXtpSp> _map_peptides;
uint _count_protein_match=0;
uint _total_protein_match;
};
#endif // XTPXPIPSAXHANDLER_H