libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
chemicalformula.h
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/amino_acid/chemicalformula.h
3
* \date 06/04/2025
4
* \author Olivier Langella
5
* \brief simple object to hold chemical formula
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
#pragma once
30
31
#include "
pappsomspp/core/amino_acid/atomnumberinterface.h
"
32
33
namespace
pappso
34
{
35
struct
IsotopeCount
36
{
37
const
QString
toString
()
const
;
38
Enums::Isotope
isotope
;
39
std::int16_t
count
;
40
};
41
42
class
ChemicalFormula
:
public
AtomNumberInterface
43
{
44
public
:
45
ChemicalFormula
();
46
ChemicalFormula
(
const
AtomNumberInterface
&atom_interface);
47
ChemicalFormula
(
const
ChemicalFormula
&other);
48
virtual
~ChemicalFormula
();
49
50
pappso::ChemicalFormula
&
operator=
(
const
pappso::ChemicalFormula
&other);
51
52
pappso::ChemicalFormula
operator-
()
const
;
53
pappso::ChemicalFormula
operator+
(
const
pappso::ChemicalFormula
&to_add)
const
;
54
55
int
getNumberOfAtom
(
Enums::AtomIsotopeSurvey
atom)
const override
;
56
int
getNumberOfIsotope
(
Enums::Isotope
isotope)
const override
;
57
58
double
getMass
()
const
;
59
60
61
/** @brief get formula from an Obo term
62
* */
63
void
setOboPsiModTerm
(
const
OboPsiModTerm
&term);
64
65
/** @brief add an atom or isotope to the forumla
66
*/
67
void
addIsotopeCount
(
const
IsotopeCount
&isotope_count);
68
69
const
QString
toString
()
const
;
70
71
/** @brief set full isotope labels
72
*/
73
void
setFullIsotope
(
Enums::Isotope
isotope);
74
75
private
:
76
void
setPsimodDiffFormula
(
const
QString &diff_formula);
77
void
setUnimodDiffFormula
(
const
QString &diff_formula);
78
void
addIsotopeNumberCount
(
const
QString &atom_str,
79
const
QString &atom_isotope_number,
80
std::int8_t count);
81
82
/** @brief simplify chemical formula
83
* sort, group isotope, remove 0
84
*/
85
void
simplify
();
86
87
private
:
88
std::vector<IsotopeCount>
m_isotopeVector
;
89
};
90
}
// namespace pappso
atomnumberinterface.h
pappso::AtomNumberInterface
Definition
atomnumberinterface.h:30
pappso::ChemicalFormula
Definition
chemicalformula.h:43
pappso::ChemicalFormula::getNumberOfIsotope
int getNumberOfIsotope(Enums::Isotope isotope) const override
get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
Definition
chemicalformula.cpp:284
pappso::ChemicalFormula::simplify
void simplify()
simplify chemical formula sort, group isotope, remove 0
Definition
chemicalformula.cpp:741
pappso::ChemicalFormula::toString
const QString toString() const
Definition
chemicalformula.cpp:659
pappso::ChemicalFormula::operator-
pappso::ChemicalFormula operator-() const
Definition
chemicalformula.cpp:211
pappso::ChemicalFormula::setOboPsiModTerm
void setOboPsiModTerm(const OboPsiModTerm &term)
get formula from an Obo term
Definition
chemicalformula.cpp:352
pappso::ChemicalFormula::addIsotopeNumberCount
void addIsotopeNumberCount(const QString &atom_str, const QString &atom_isotope_number, std::int8_t count)
Definition
chemicalformula.cpp:498
pappso::ChemicalFormula::setPsimodDiffFormula
void setPsimodDiffFormula(const QString &diff_formula)
Definition
chemicalformula.cpp:583
pappso::ChemicalFormula::m_isotopeVector
std::vector< IsotopeCount > m_isotopeVector
Definition
chemicalformula.h:88
pappso::ChemicalFormula::ChemicalFormula
ChemicalFormula()
Definition
chemicalformula.cpp:88
pappso::ChemicalFormula::setFullIsotope
void setFullIsotope(Enums::Isotope isotope)
set full isotope labels
Definition
chemicalformula.cpp:672
pappso::ChemicalFormula::operator=
pappso::ChemicalFormula & operator=(const pappso::ChemicalFormula &other)
Definition
chemicalformula.cpp:204
pappso::ChemicalFormula::getMass
double getMass() const
Definition
chemicalformula.cpp:296
pappso::ChemicalFormula::operator+
pappso::ChemicalFormula operator+(const pappso::ChemicalFormula &to_add) const
Definition
chemicalformula.cpp:225
pappso::ChemicalFormula::~ChemicalFormula
virtual ~ChemicalFormula()
Definition
chemicalformula.cpp:92
pappso::ChemicalFormula::getNumberOfAtom
int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override
get the number of atom C, O, N, H in the molecule
Definition
chemicalformula.cpp:240
pappso::ChemicalFormula::addIsotopeCount
void addIsotopeCount(const IsotopeCount &isotope_count)
add an atom or isotope to the forumla
Definition
chemicalformula.cpp:641
pappso::ChemicalFormula::setUnimodDiffFormula
void setUnimodDiffFormula(const QString &diff_formula)
Definition
chemicalformula.cpp:385
pappso::OboPsiModTerm
Definition
obopsimodterm.h:34
pappso::Enums::AtomIsotopeSurvey
AtomIsotopeSurvey
Definition
types.h:112
pappso::Enums::Isotope
Isotope
Definition
types.h:128
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::IsotopeCount
Definition
chemicalformula.h:36
pappso::IsotopeCount::count
std::int16_t count
Definition
chemicalformula.h:39
pappso::IsotopeCount::toString
const QString toString() const
Definition
chemicalformula.cpp:36
pappso::IsotopeCount::isotope
Enums::Isotope isotope
Definition
chemicalformula.h:38
pappsomspp
core
amino_acid
chemicalformula.h
Generated on Tue Sep 23 2025 09:36:34 for libpappsomspp by
1.13.2