libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
filterobopsimodmap.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/obo/obopsimodmap.cpp
3
* \date 2/10/2024
4
* \author Olivier Langella
5
* \brief map container for obo psi mod terms
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 "
filterobopsimodmap.h
"
30
#include "
pappsomspp/core/exception/exceptionnotfound.h
"
31
32
33
pappso::FilterOboPsiModMap::FilterOboPsiModMap
()
34
{
35
}
36
37
38
pappso::FilterOboPsiModMap::~FilterOboPsiModMap
()
39
{
40
}
41
42
void
43
pappso::FilterOboPsiModMap::setOboPsiModTerm
(
const
pappso::OboPsiModTerm
&term)
44
{
45
m_mapOboPsiModTerm
.insert({term.
getAccession
(), term});
46
}
47
48
const
pappso::OboPsiModTerm
&
49
pappso::FilterOboPsiModMap::getOboPsiModTermWithAccession
(
const
QString &accession)
const
50
{
51
auto
it =
m_mapOboPsiModTerm
.find(accession);
52
if
(it ==
m_mapOboPsiModTerm
.end())
53
{
54
throw
pappso::ExceptionNotFound
(
55
QObject::tr(
"OBO term accession %1 not found"
).arg(accession));
56
}
57
return
it->second;
58
}
59
60
const
pappso::OboPsiModTerm
&
61
pappso::FilterOboPsiModMap::getOboPsiModTermWithName
(
const
QString &name)
const
62
{
63
for
(
auto
&pair_term :
m_mapOboPsiModTerm
)
64
{
65
if
(pair_term.second.m_name == name)
66
return
pair_term.second;
67
}
68
throw
pappso::ExceptionNotFound
(QObject::tr(
"OBO term name %1 not found"
).arg(name));
69
}
pappso::ExceptionNotFound
Definition
exceptionnotfound.h:32
pappso::FilterOboPsiModMap::getOboPsiModTermWithAccession
const OboPsiModTerm & getOboPsiModTermWithAccession(const QString &accession) const
Definition
filterobopsimodmap.cpp:49
pappso::FilterOboPsiModMap::getOboPsiModTermWithName
const OboPsiModTerm & getOboPsiModTermWithName(const QString &name) const
get the first occurence of term with this name
Definition
filterobopsimodmap.cpp:61
pappso::FilterOboPsiModMap::~FilterOboPsiModMap
virtual ~FilterOboPsiModMap()
Definition
filterobopsimodmap.cpp:38
pappso::FilterOboPsiModMap::m_mapOboPsiModTerm
std::map< QString, const OboPsiModTerm > m_mapOboPsiModTerm
Definition
filterobopsimodmap.h:57
pappso::FilterOboPsiModMap::setOboPsiModTerm
virtual void setOboPsiModTerm(const OboPsiModTerm &term) override
triggered function on each obo term when parsing obo file
Definition
filterobopsimodmap.cpp:43
pappso::FilterOboPsiModMap::FilterOboPsiModMap
FilterOboPsiModMap()
Definition
filterobopsimodmap.cpp:33
pappso::OboPsiModTerm
Definition
obopsimodterm.h:34
pappso::OboPsiModTerm::getAccession
const QString & getAccession() const
Definition
obopsimodterm.cpp:261
exceptionnotfound.h
filterobopsimodmap.h
pappsomspp
core
obo
filterobopsimodmap.cpp
Generated on
for libpappsomspp by
1.17.0