libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
obopsims.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/obo/obopsims.cpp
3
* \date 2/10/2024
4
* \author Olivier Langella
5
* \brief OBO PSI:MS file parser
6
**/
7
8
/*******************************************************************************
9
* Copyright (c) 2024 Olivier Langella
10
*<Olivier.Langella@universite-paris-saclay.fr>.
11
*
12
* This file is part of the PAPPSOms++ library.
13
*
14
* PAPPSOms++ is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License as published by
16
* the Free Software Foundation, either version 3 of the License, or
17
* (at your option) any later version.
18
*
19
* PAPPSOms++ is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
* GNU General Public License for more details.
23
*
24
* You should have received a copy of the GNU General Public License
25
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
26
*
27
******************************************************************************/
28
29
#include "
obopsims.h
"
30
31
#include <QDir>
32
#include <QDebug>
33
#include "
pappsomspp/core/pappsoexception.h
"
34
#include <iostream>
35
36
inline
void
37
initMyResource
()
38
{
39
Q_INIT_RESOURCE(libpappsomspp_core_resources);
40
}
41
42
43
pappso::OboPsiMs::OboPsiMs
(
pappso::OboPsiModHandlerInterface
&handler) :
m_handler
(handler)
44
{
45
46
qDebug();
47
initMyResource
();
48
parse
();
49
}
50
51
pappso::OboPsiMs::~OboPsiMs
()
52
{
53
}
54
55
56
void
57
pappso::OboPsiMs::parse
()
58
{
59
// std::cout << "OboPsiMod::parse Begin parsing OBO file" << std::endl;
60
qDebug();
61
QFile obofile(
":/obo/resources/obo/psi-ms.obo"
);
62
if
(!obofile.exists())
63
{
64
throw
PappsoException
(
65
QObject::tr(
"PSI-MS OBO resource file : %1 not found"
).arg(obofile.fileName()));
66
}
67
obofile.open(QIODevice::ReadOnly);
68
QTextStream p_in(&obofile);
69
70
// Search accession conta
71
// QTextStream in(p_in);
72
QString
line
= p_in.readLine();
73
bool
in_term =
false
;
74
while
(!p_in.atEnd())
75
{
76
// qDebug() << "OboPsiMod::parse line "<< line;
77
if
(
line
.startsWith(
"[Term]"
))
78
{
79
in_term =
true
;
80
m_term
.clearTerm();
81
}
82
else
if
(
line
.isEmpty())
83
{
84
if
(in_term)
85
{
86
m_handler
.setOboPsiModTerm(
m_term
);
87
in_term =
false
;
88
}
89
}
90
else
91
{
92
if
(in_term)
93
m_term
.parseLine(
line
);
94
// m_handler.setSequence(line);
95
}
96
line
= p_in.readLine();
97
}
98
if
(in_term)
99
{
100
m_handler
.setOboPsiModTerm(
m_term
);
101
}
102
// p_in->close();
103
104
obofile.close();
105
}
CardanoResultCase::line
@ line
Definition
cardano.h:42
pappso::OboPsiModHandlerInterface
Definition
obopsimodhandlerinterface.h:31
pappso::OboPsiMs::m_handler
OboPsiModHandlerInterface & m_handler
Definition
obopsims.h:46
pappso::OboPsiMs::m_term
OboPsiModTerm m_term
Definition
obopsims.h:45
pappso::OboPsiMs::parse
void parse()
starts reading obo file and reports each term with the callback function
Definition
obopsims.cpp:57
pappso::OboPsiMs::OboPsiMs
OboPsiMs(OboPsiModHandlerInterface &handler)
Definition
obopsims.cpp:43
pappso::OboPsiMs::~OboPsiMs
virtual ~OboPsiMs()
Definition
obopsims.cpp:51
pappso::PappsoException
Definition
pappsoexception.h:42
initMyResource
void initMyResource()
Definition
obopsimod.cpp:32
initMyResource
void initMyResource()
Definition
obopsims.cpp:37
obopsims.h
pappsoexception.h
pappsomspp
core
obo
obopsims.cpp
Generated on Tue Sep 23 2025 09:36:35 for libpappsomspp by
1.13.2