Loading...
Searching...
No Matches
chemicalformula.h
Go to the documentation of this file.
/**
* \file pappsomspp/amino_acid/chemicalformula.h
* \date 06/04/2025
* \author Olivier Langella
* \brief simple object to hold chemical formula
**/
/*******************************************************************************
* Copyright (c) 2025 Olivier Langella
*<Olivier.Langella@universite-paris-saclay.fr>.
*
* This file is part of the PAPPSOms++ library.
*
* PAPPSOms++ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms++ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
#include "pappsomspp/export-import-config.h"
#include "pappsomspp/core/amino_acid/atomnumberinterface.h"
namespace pappso
{
struct IsotopeCount
{
const QString toString() const;
Enums::Isotope isotope;
std::int16_t count;
};
class PMSPP_LIB_DECL ChemicalFormula : public AtomNumberInterface
{
public:
ChemicalFormula();
ChemicalFormula(const AtomNumberInterface &atom_interface);
ChemicalFormula(const ChemicalFormula &other);
virtual ~ChemicalFormula();
pappso::ChemicalFormula &operator=(const pappso::ChemicalFormula &other);
pappso::ChemicalFormula operator-() const;
pappso::ChemicalFormula operator+(const pappso::ChemicalFormula &to_add) const;
int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override;
int getNumberOfIsotope(Enums::Isotope isotope) const override;
double getMass() const;
/** @brief get formula from an Obo term
* */
void setOboPsiModTerm(const OboPsiModTerm &term);
/** @brief add an atom or isotope to the forumla
*/
void addIsotopeCount(const IsotopeCount &isotope_count);
const QString toString() const;
/** @brief set full isotope labels
*/
void setFullIsotope(Enums::Isotope isotope);
private:
void setPsimodDiffFormula(const QString &diff_formula);
void setUnimodDiffFormula(const QString &diff_formula);
void addIsotopeNumberCount(const QString &atom_str,
const QString &atom_isotope_number,
std::int8_t count);
/** @brief simplify chemical formula
* sort, group isotope, remove 0
*/
void simplify();
private:
std::vector<IsotopeCount> m_isotopeVector;
};
} // namespace pappso
atomnumberinterface.h
pappso::AtomNumberInterface
Definition atomnumberinterface.h:30
pappso::ChemicalFormula
Definition chemicalformula.h:44
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:89
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::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
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
pappso::Enums::AtomIsotopeSurvey
AtomIsotopeSurvey
Definition types.h:110
pappso::Enums::Isotope
Isotope
Definition types.h:126
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:37
pappso::IsotopeCount::count
std::int16_t count
Definition chemicalformula.h:40
pappso::IsotopeCount::toString
const QString toString() const
Definition chemicalformula.cpp:36
pappso::IsotopeCount::isotope
Enums::Isotope isotope
Definition chemicalformula.h:39