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
33
34namespace pappso
35{
37{
38 const QString toString() const;
40 std::int16_t count;
41};
42
44{
45 public:
47 ChemicalFormula(const AtomNumberInterface &atom_interface);
48 ChemicalFormula(const ChemicalFormula &other);
49 virtual ~ChemicalFormula();
50
52
55
56 int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override;
57 int getNumberOfIsotope(Enums::Isotope isotope) const override;
58
59 double getMass() const;
60
61
62 /** @brief get formula from an Obo term
63 * */
64 void setOboPsiModTerm(const OboPsiModTerm &term);
65
66 /** @brief add an atom or isotope to the forumla
67 */
68 void addIsotopeCount(const IsotopeCount &isotope_count);
69
70 const QString toString() const;
71
72 /** @brief set full isotope labels
73 */
74 void setFullIsotope(Enums::Isotope isotope);
75
76 private:
77 void setPsimodDiffFormula(const QString &diff_formula);
78 void setUnimodDiffFormula(const QString &diff_formula);
79 void addIsotopeNumberCount(const QString &atom_str,
80 const QString &atom_isotope_number,
81 std::int8_t count);
82
83 /** @brief simplify chemical formula
84 * sort, group isotope, remove 0
85 */
86 void simplify();
87
88 private:
89 std::vector<IsotopeCount> m_isotopeVector;
90};
91} // namespace pappso
int getNumberOfIsotope(Enums::Isotope isotope) const override
get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
void simplify()
simplify chemical formula sort, group isotope, remove 0
const QString toString() const
pappso::ChemicalFormula operator-() const
void setOboPsiModTerm(const OboPsiModTerm &term)
get formula from an Obo term
void addIsotopeNumberCount(const QString &atom_str, const QString &atom_isotope_number, std::int8_t count)
void setPsimodDiffFormula(const QString &diff_formula)
std::vector< IsotopeCount > m_isotopeVector
void setFullIsotope(Enums::Isotope isotope)
set full isotope labels
pappso::ChemicalFormula & operator=(const pappso::ChemicalFormula &other)
pappso::ChemicalFormula operator+(const pappso::ChemicalFormula &to_add) const
int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override
get the number of atom C, O, N, H in the molecule
void addIsotopeCount(const IsotopeCount &isotope_count)
add an atom or isotope to the forumla
void setUnimodDiffFormula(const QString &diff_formula)
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
const QString toString() const
Enums::Isotope isotope