| <large>libXpertMassCore and libXpertMassGui Developer Documentation</large>

- libXpertMassCore
- PkaPhPi

# MsXpS::libXpertMassCore::PkaPhPi Class

class MsXpS::libXpertMassCore::PkaPhPi

The PkaPhPi class provides a model for specifying the acido-basic properties of a chemical entity. More...

Header: | `#include <MsXpS/libXpertMassCore/PkaPhPi.hpp>`
Inherits: | MsXpS::libXpertMassCore::PropListHolder

- List of all members, including inherited members
- PkaPhPi is part of Polymer chemistry building blocks.

## Public Functions

| PkaPhPi(MsXpS::libXpertMassCore::PolChemDefCstSPtr pol_chem_def_csp, MsXpS::libXpertMassCore::PolymerCstQSPtr polymer_cqsp, const MsXpS::libXpertMassCore::CalcOptions &calc_options)
virtual | ~PkaPhPi()
int | accountMonomerModif(const MsXpS::libXpertMassCore::Monomer &monomer, MsXpS::libXpertMassCore::ChemicalGroup &chemical_group)
int | accountPolymerEndModif(MsXpS::libXpertMassCore::Enums::ChemicalEntity polymer_chem_ent, const MsXpS::libXpertMassCore::ChemicalGroup &chemical_group)
double | calculateChargeRatio(double pka, bool is_acid_charged)
int | calculateCharges()
int | calculatePi()
const std::vector<MsXpS::libXpertMassCore::ModifCstSPtr> & | getModifs() const
const std::vector<MsXpS::libXpertMassCore::MonomerCstSPtr> & | getMonomersCstRef() const
MsXpS::libXpertMassCore::PolChemDefCstSPtr | getPolChemDefCstSPtr() const
double | negativeCharges()
double | ph()
double | pi()
double | positiveCharges()
void | setCalcOptions(const MsXpS::libXpertMassCore::CalcOptions &calc_options)
void | setModifs(std::vector<MsXpS::libXpertMassCore::ModifCstSPtr> &modifs)
void | setModifs(std::vector<MsXpS::libXpertMassCore::ModifCstSPtr> &&modifs)
void | setModifs(std::vector<MsXpS::libXpertMassCore::ModifSPtr> &&modifs)
void | setMonomers(std::vector<MsXpS::libXpertMassCore::MonomerCstSPtr> &monomers)
void | setMonomers(std::vector<MsXpS::libXpertMassCore::MonomerCstSPtr> &&monomers)
void | setMonomers(std::vector<MsXpS::libXpertMassCore::MonomerSPtr> &&monomers)
void | setPh(double ph)
void | setPolChemDefCstSPtr(MsXpS::libXpertMassCore::PolChemDefCstSPtr pol_chem_def_csp)

## Protected Variables

MsXpS::libXpertMassCore::CalcOptions | m_calcOptions
std::vector<MsXpS::libXpertMassCore::ModifCstSPtr> | m_modifs
std::vector<MsXpS::libXpertMassCore::MonomerCstSPtr> | m_monomers
double | m_negativeCharges
double | m_ph
double | m_pi
double | m_positiveCharges
MsXpS::libXpertMassCore::PolChemDefCstSPtr | mcsp_polChemDef
MsXpS::libXpertMassCore::PolymerCstQSPtr | mcsp_polymer

## Detailed Description

## Member Function Documentation

### PkaPhPi::PkaPhPi(MsXpS::libXpertMassCore::PolChemDefCstSPtr pol_chem_def_csp, MsXpS::libXpertMassCore::PolymerCstQSPtr polymer_cqsp, const MsXpS::libXpertMassCore::CalcOptions &calc_options)

Constructs a PkaPhPi instance with a number of parameters.

- pol_chem_def_csp: The polymer chemistry definition
- polymer_cqsp: The polymer within the context of which the calculations are performed.
- calc_options: The options driving the calculations.

### `[virtual noexcept]` PkaPhPi::~PkaPhPi()

Destructs this PkaPhPi instance.

### int PkaPhPi::accountMonomerModif(const MsXpS::libXpertMassCore::Monomer &monomer, MsXpS::libXpertMassCore::ChemicalGroup &chemical_group)

Accounts for the chemical_group in the context of the monomer.

A chemical group is described as follows:

    <monomer>
      <code>C</code>
      <mnmchemgroup>
        <name>N-term NH2</name>
        <pka>9.6</pka>
        <acidcharged>TRUE</acidcharged>
        <polrule>left_trapped</polrule>
        <chemgrouprule>
          <entity>LE_PLM_MODIF</entity>
          <name>Acetylation</name>
          <outcome>LOST</outcome>
        </chemgrouprule>
      </mnmchemgroup>
      <mnmchemgroup>
        <name>C-term COOH</name>
        <pka>2.35</pka>
        <acidcharged>FALSE</acidcharged>
        <polrule>right_trapped</polrule>
      </mnmchemgroup>
      <mnmchemgroup>
        <name>Lateral SH2</name>
        <pka>8.3</pka>
        <acidcharged>FALSE</acidcharged>
        <polrule>never_trapped</polrule>
      </mnmchemgroup>
    </monomer>

Returns the count of rules that were accounted for, or -1 if none was.

### int PkaPhPi::accountPolymerEndModif(MsXpS::libXpertMassCore::Enums::ChemicalEntity polymer_chem_ent, const MsXpS::libXpertMassCore::ChemicalGroup &chemical_group)

Accounts for the chemical_group according the the polymer chemical entities defined in polymer_chem_ent.

A chemical group is described as follows:

    <monomer>
      <code>C</code>
      <mnmchemgroup>
        <name>N-term NH2</name>
        <pka>9.6</pka>
        <acidcharged>TRUE</acidcharged>
        <polrule>left_trapped</polrule>
        <chemgrouprule>
          <entity>LE_PLM_MODIF</entity>
          <name>Acetylation</name>
          <outcome>LOST</outcome>
        </chemgrouprule>
      </mnmchemgroup>
      <mnmchemgroup>
        <name>C-term COOH</name>
        <pka>2.35</pka>
        <acidcharged>FALSE</acidcharged>
        <polrule>right_trapped</polrule>
      </mnmchemgroup>
      <mnmchemgroup>
        <name>Lateral SH2</name>
        <pka>8.3</pka>
        <acidcharged>FALSE</acidcharged>
        <polrule>never_trapped</polrule>
      </mnmchemgroup>
    </monomer>

Returns the count of rules that were accounted for, or -1 if none was.

### double PkaPhPi::calculateChargeRatio(double pka, bool is_acid_charged)

Returns the ratio between the charged and the uncharged forms of the chemical entity using pka and is_acid_charged. If the charge is negative, the returned ratio is negative, positive otherwise.

The charged and uncharged species are the AH an A- species of the acido-basic theory.

The calculation is based on the use of the m_ph member variable value.

### int PkaPhPi::calculateCharges()

Calculates the charges (positive and negative).

The general scheme is :

Get the list of the iter_index_range of the different Polymer region selections. For each first monomer and end monomer of a given region selection, check if the the region is an oligomer or a residual chain (m_selectionType of libXpertMassCore::CalcOptions); act accordingly. Also, check for each selection region if it encompasses the polymer left/right end. If the left/right end modifications are to be taken into account, act accordingly.

The positive and negative charges are stored in the member m_positiveCharges and m_negativeCharges variables.

Returns the count of chemical groups that have been processed.

See also calculatePi().

### int PkaPhPi::calculatePi()

Calculates the isoelectric point.

The isoelectric point is the pH at which a given analyte will have a net charge of 0, that is, when the count of negative charges will be equal to the count of positive charges.

The pI will be stored in the m_pi member variable.

Returns the count of chemical groups that have been processed.

See also calculateCharges().

### const std::vector<MsXpS::libXpertMassCore::ModifCstSPtr> &PkaPhPi::getModifs() const

Returns a const reference to the container of Modif instances.

### const std::vector<MsXpS::libXpertMassCore::MonomerCstSPtr> &PkaPhPi::getMonomersCstRef() const

Returns a const reference to the container of Monomer instances.

### MsXpS::libXpertMassCore::PolChemDefCstSPtr PkaPhPi::getPolChemDefCstSPtr() const

Returns the PolChemDef.

### double PkaPhPi::negativeCharges()

Returns the negative charges.

### double PkaPhPi::ph()

Returns the pH.

See also setPh().

### double PkaPhPi::pi()

Returns the pI.

### double PkaPhPi::positiveCharges()

Returns the positive charges.

### void PkaPhPi::setCalcOptions(const MsXpS::libXpertMassCore::CalcOptions &calc_options)

Sets the calculation options to calc_options.

### void PkaPhPi::setModifs(std::vector<MsXpS::libXpertMassCore::ModifCstSPtr> &modifs)

Copies the Modif instances in modifs to the member container.

This is a shallow copy with only the pointers being copied.

### void PkaPhPi::setModifs(std::vector<MsXpS::libXpertMassCore::ModifCstSPtr> &&modifs)

Moves the Modif instances from modifs to the member container.

### void PkaPhPi::setModifs(std::vector<MsXpS::libXpertMassCore::ModifSPtr> &&modifs)

Moves the Modif instances from modifs to the member container.

### void PkaPhPi::setMonomers(std::vector<MsXpS::libXpertMassCore::MonomerCstSPtr> &monomers)

Copies the Monomer instances in monomers to the member container.

This is a shallow copy with only the pointers being copied.

### void PkaPhPi::setMonomers(std::vector<MsXpS::libXpertMassCore::MonomerCstSPtr> &&monomers)

Moves the Monomer instances from monomers to the member container.

### void PkaPhPi::setMonomers(std::vector<MsXpS::libXpertMassCore::MonomerSPtr> &&monomers)

Moves the Monomer instances from monomers to the member container.

### void PkaPhPi::setPh(double ph)

Sets the pH to ph.

See also ph().

### void PkaPhPi::setPolChemDefCstSPtr(MsXpS::libXpertMassCore::PolChemDefCstSPtr pol_chem_def_csp)

Sets the PolChemDef to pol_chem_def_csp.

## Member Variable Documentation

### MsXpS::libXpertMassCore::CalcOptions PkaPhPi::m_calcOptions

This variable holds the CalcOptions that configure the way the computations are to be carried out.

### std::vector<MsXpS::libXpertMassCore::ModifCstSPtr> PkaPhPi::m_modifs

This variable holds the container of Modif instances as read from the pka_ph_pi.xml file.

### std::vector<MsXpS::libXpertMassCore::MonomerCstSPtr> PkaPhPi::m_monomers

This variable holds the container of Monomer instances as read from the pka_ph_pi.xml file.

### double PkaPhPi::m_negativeCharges

This variable holds the count of negative charges.

### double PkaPhPi::m_ph

This variable holds the pH of the environment.

This pH value is required to compute the number of charges of a given chemical entity (a Polymer) sequence, for example.

### double PkaPhPi::m_pi

This variable holds the pI of the chemical entity.

### double PkaPhPi::m_positiveCharges

This variable holds the count of positive charges.

### MsXpS::libXpertMassCore::PolChemDefCstSPtr PkaPhPi::mcsp_polChemDef

This variable holds the polymer chemistry definition.

### MsXpS::libXpertMassCore::PolymerCstQSPtr PkaPhPi::mcsp_polymer

This variable holds the polymer of which the acidobasic properties are computed.