libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
obounimod.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/obo/obounimod.cpp
3
* \date 06/04/2025
4
* \author Olivier Langella
5
* \brief OBO UNIMOD file parser
6
**/
7
8
/*******************************************************************************
9
* Copyright (c) 2025 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 "
obounimod.h
"
30
31
#include "
obopsims.h
"
32
33
#include <QDir>
34
#include <QDebug>
35
#include "
pappsomspp/core/pappsoexception.h
"
36
#include <iostream>
37
38
inline
void
39
initMyResource
()
40
{
41
Q_INIT_RESOURCE(libpappsomspp_core_resources);
42
}
43
44
45
pappso::OboUnimod::OboUnimod
(
pappso::OboPsiModHandlerInterface
&handler) :
m_handler
(handler)
46
{
47
48
qDebug();
49
initMyResource
();
50
parse
();
51
}
52
53
pappso::OboUnimod::~OboUnimod
()
54
{
55
}
56
57
58
void
59
pappso::OboUnimod::parse
()
60
{
61
// std::cout << "OboPsiMod::parse Begin parsing OBO file" << std::endl;
62
qDebug();
63
QFile obofile(
":/obo/resources/obo/unimod.obo"
);
64
if
(!obofile.exists())
65
{
66
throw
PappsoException
(
67
QObject::tr(
"UNIMOD OBO resource file : %1 not found"
).arg(obofile.fileName()));
68
}
69
obofile.open(QIODevice::ReadOnly);
70
QTextStream p_in(&obofile);
71
72
// Search accession conta
73
// QTextStream in(p_in);
74
QString
line
= p_in.readLine();
75
bool
in_term =
false
;
76
while
(!p_in.atEnd())
77
{
78
// qDebug() << "OboPsiMod::parse line "<< line;
79
if
(
line
.startsWith(
"[Term]"
))
80
{
81
in_term =
true
;
82
m_term
.clearTerm();
83
}
84
else
if
(
line
.isEmpty())
85
{
86
if
(in_term)
87
{
88
m_handler
.setOboPsiModTerm(
m_term
);
89
in_term =
false
;
90
}
91
}
92
else
93
{
94
if
(in_term)
95
m_term
.parseLine(
line
);
96
// m_handler.setSequence(line);
97
}
98
line
= p_in.readLine();
99
}
100
if
(in_term)
101
{
102
m_handler
.setOboPsiModTerm(
m_term
);
103
}
104
// p_in->close();
105
106
obofile.close();
107
}
CardanoResultCase::line
@ line
Definition
cardano.h:42
pappso::OboPsiModHandlerInterface
Definition
obopsimodhandlerinterface.h:31
pappso::OboUnimod::OboUnimod
OboUnimod(OboPsiModHandlerInterface &handler)
Definition
obounimod.cpp:45
pappso::OboUnimod::parse
void parse()
starts reading obo file and reports each term with the callback function
Definition
obounimod.cpp:59
pappso::OboUnimod::m_handler
OboPsiModHandlerInterface & m_handler
Definition
obounimod.h:46
pappso::OboUnimod::m_term
OboPsiModTerm m_term
Definition
obounimod.h:45
pappso::OboUnimod::~OboUnimod
virtual ~OboUnimod()
Definition
obounimod.cpp:53
pappso::PappsoException
Definition
pappsoexception.h:42
initMyResource
void initMyResource()
Definition
obopsimod.cpp:32
obopsims.h
initMyResource
void initMyResource()
Definition
obounimod.cpp:39
obounimod.h
pappsoexception.h
pappsomspp
core
obo
obounimod.cpp
Generated on Tue Sep 23 2025 09:36:35 for libpappsomspp by
1.13.2