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
32
33namespace pappso
34{
36{
37 const QString toString() const;
39 std::int16_t count;
40};
41
43{
44 public:
46 ChemicalFormula(const AtomNumberInterface &atom_interface);
47 ChemicalFormula(const ChemicalFormula &other);
48 virtual ~ChemicalFormula();
49
51
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
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)
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