libXpertMassCore and libXpertMassGui Developer Documentation
  • libXpertMassCore
  • ChemicalGroup
  • ChemicalGroup Class

    class MsXpS::libXpertMassCore::ChemicalGroup

    The ChemicalGroup class provides a model for specifying the acido-basic behaviour of a chemical group of either a Monomer object or of a Modif object. More...

    Header: #include <ChemicalGroup.hpp>

    Public Functions

    ChemicalGroup(const QString &name = QString(), float pka = 7.0, bool is_acid_charged = true, MsXpS::libXpertMassCore::Enums::ChemicalGroupTrapped polymerization_rule = Enums::ChemicalGroupTrapped::NEVER)
    ChemicalGroup(const MsXpS::libXpertMassCore::ChemicalGroup &other)
    ~ChemicalGroup()
    MsXpS::libXpertMassCore::ChemicalGroupRuleSPtr findRuleByEntity(const QString &entity, std::size_t &index) const
    MsXpS::libXpertMassCore::ChemicalGroupRuleSPtr findRuleByEntityAndName(const QString &entity, const QString &name, std::size_t &index) const
    MsXpS::libXpertMassCore::ChemicalGroupRuleSPtr findRuleByName(const QString &name, std::size_t &index) const
    QString getName() const
    float getPka() const
    MsXpS::libXpertMassCore::Enums::ChemicalGroupTrapped getPolRule() const
    const std::vector<MsXpS::libXpertMassCore::ChemicalGroupRuleSPtr> &getRulesCstRef() const
    std::vector<MsXpS::libXpertMassCore::ChemicalGroupRuleSPtr> &getRulesRef()
    bool isAcidCharged() const
    bool isValid() const
    bool renderXmlMdfElement(const QDomElement &element)
    bool renderXmlMnmElement(const QDomElement &element)
    void setAcidCharged(bool acid_charged)
    void setName(QString name)
    void setPka(float pka)
    void setPolRule(MsXpS::libXpertMassCore::Enums::ChemicalGroupTrapped pol_rule)
    bool validate(MsXpS::libXpertMassCore::ErrorList *error_list_p) const
    MsXpS::libXpertMassCore::ChemicalGroup &operator=(const MsXpS::libXpertMassCore::ChemicalGroup &other)

    Protected Variables

    bool m_acidCharged
    QString m_name
    float m_pka
    MsXpS::libXpertMassCore::Enums::ChemicalGroupTrapped m_polymerizationRule
    std::vector<MsXpS::libXpertMassCore::ChemicalGroupRuleSPtr> m_rules

    Detailed Description

    If the ChemicalGroup does not prove sufficient to characterize precisely the acido-basic properties of an entity, ChemicalGroupRule instances can be added to that effect.

    In an pkaphpidata definition file, the following xml structure is encountered:

    <pkaphpidata>
      <monomers>
        <monomer>
          <code>A</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>
        </monomer>
        <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>
        .....
      <modifs>
        <modif>
          <name>Phosphorylation</name>
          <mdfchemgroup>
            <name>none_set</name>
            <pka>1.2</pka>
            <acidcharged>FALSE</acidcharged>
          </mdfchemgroup>
          <mdfchemgroup>
            <name>none_set</name>
            <pka>6.5</pka>
            <acidcharged>FALSE</acidcharged>
          </mdfchemgroup>
        </modif>
      </modifs>
    </pkaphpidata>

    See also ChemicalGroupRule.

    Member Function Documentation

    ChemicalGroup::ChemicalGroup(const QString &name = QString(), float pka = 7.0, bool is_acid_charged = true, MsXpS::libXpertMassCore::Enums::ChemicalGroupTrapped polymerization_rule = Enums::ChemicalGroupTrapped::NEVER)

    Constructs a ChemicalGroup instance.

    name The name of this ChemicalGroup. pka The pKa value of this ChemicalGroup. is_acid_charged Tells if the ChemicalGroup bears a charge when in acidic conditions. polymerization_rule Specifies the polymerization rule.

    Upon construction the object is validated and m_isValid is set to the result of that validation.

    ChemicalGroup::ChemicalGroup(const MsXpS::libXpertMassCore::ChemicalGroup &other)

    Construct a ChemicalGroup instance as a copy of other.

    There is no checking of the validity of other.

    [noexcept] ChemicalGroup::~ChemicalGroup()

    Destructs this ChemicalGroup instance.

    MsXpS::libXpertMassCore::ChemicalGroupRuleSPtr ChemicalGroup::findRuleByEntity(const QString &entity, std::size_t &index) const

    Searches by entity for a ChemicalGroupRule instance.

    Returns the index of the ChemicalGroupRule instance in the member list of ChemicalGroupRule instances or -1 if not found.

    MsXpS::libXpertMassCore::ChemicalGroupRuleSPtr ChemicalGroup::findRuleByEntityAndName(const QString &entity, const QString &name, std::size_t &index) const

    Searches by entity and name for a ChemicalGroupRule instance.

    Returns the index of the ChemicalGroupRule instance in the member list of ChemicalGroupRule instances or -1 if not found.

    MsXpS::libXpertMassCore::ChemicalGroupRuleSPtr ChemicalGroup::findRuleByName(const QString &name, std::size_t &index) const

    Searches by name for a ChemicalGroupRule instance.

    Returns the index of the ChemicalGroupRule instance in the member list of ChemicalGroupRule instances or -1 if not found.

    QString ChemicalGroup::getName() const

    Returns the name.

    float ChemicalGroup::getPka() const

    Returns the pKa.

    MsXpS::libXpertMassCore::Enums::ChemicalGroupTrapped ChemicalGroup::getPolRule() const

    Returns the polymerization rule.

    const std::vector<MsXpS::libXpertMassCore::ChemicalGroupRuleSPtr> &ChemicalGroup::getRulesCstRef() const

    Returns a const reference to the container of ChemicalGroupRule instances.

    std::vector<MsXpS::libXpertMassCore::ChemicalGroupRuleSPtr> &ChemicalGroup::getRulesRef()

    Returns a reference to the container of ChemicalGroupRule instances.

    bool ChemicalGroup::isAcidCharged() const

    Returns the charge condition in acidic conditions.

    If true, the group bears a charge when the pH is less than the pKa.

    bool ChemicalGroup::isValid() const

    Returns the validity status of this instance.

    bool ChemicalGroup::renderXmlMdfElement(const QDomElement &element)

    Parses the ChemicalGroup XML element related to a Modif.

    Upon parsing of the element (tag <mnmchemgroup>), its data are validated and set to this ChemicalGroup instance, thus essentially initializing it.

    In an pkaphpidata definition file, the following xml structure is encountered:

    <pkaphpidata>
      <monomers>
        <monomer>
          <code>A</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>
        </monomer>
        .......
      </monomers>
      <modifs>
        <modif>
          <name>Phosphorylation</name>
          <mdfchemgroup>
            <name>none_set</name>
            <pka>1.2</pka>
            <acidcharged>FALSE</acidcharged>
          </mdfchemgroup>
          <mdfchemgroup>
            <name>none_set</name>
            <pka>6.5</pka>
            <acidcharged>FALSE</acidcharged>
          </mdfchemgroup>
        </modif>
      </modifs>
    </pkaphpidata>

    Upon parsing of the element, all the data are validated and set to this ChemicalGroup instance, thus essentially initializing it. If there are ChemicalGroupRules associated to the ChemicalGroup element, these are rendered also.

    Returns true if parsing and validation were successful, false otherwise.

    bool ChemicalGroup::renderXmlMnmElement(const QDomElement &element)

    Parses the ChemicalGroup XML element related to a Monomer.

    Upon parsing of the element (tag

    are validated and set to this ChemicalGroup instance, thus essentially
    initializing it.
    
    In an pkaphpidata definition file, the following xml structure
    is encountered:
    
    \code
    <pkaphpidata>
      <monomers>
        <monomer>
          <code>A</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>
        </monomer>
        <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>

    Upon parsing of the element, all the data are validated and set to this ChemicalGroup instance, thus essentially initializing it. If there are ChemicalGroupRules associated to the ChemicalGroup element, these are rendered also.

    Returns true if parsing and validation were successful, false otherwise.

    void ChemicalGroup::setAcidCharged(bool acid_charged)

    Sets the charge condition in acidic conditions to acid_charged.

    If true, the group bears a charge when the pH is less than the pKa.

    See also isAcidCharged().

    void ChemicalGroup::setName(QString name)

    Sets the name.

    void ChemicalGroup::setPka(float pka)

    Sets the pKa to pka.

    void ChemicalGroup::setPolRule(MsXpS::libXpertMassCore::Enums::ChemicalGroupTrapped pol_rule)

    Sets the polymerization rule to pol_rule.

    The polymerization rule determines if the chemical group is trapped upon formation of a Monomer-to-Monomer bond.

    bool ChemicalGroup::validate(MsXpS::libXpertMassCore::ErrorList *error_list_p) const

    Validates this instance, setting eventual error messages in error_list_p.

    Note: error_list_p is not cleared.

    If the validation is successful, m_isValid is set to true, otherwise it is set to false. That result is returned.

    MsXpS::libXpertMassCore::ChemicalGroup &ChemicalGroup::operator=(const MsXpS::libXpertMassCore::ChemicalGroup &other)

    Assigns other to this ChemicalGroup instance.

    Note: The ChemicalGroupRule instances in other are deep-duplicated.

    Returns a reference to this ChemicalGroup instance.

    Member Variable Documentation

    bool ChemicalGroup::m_acidCharged

    Tells if the group is charged when in acid conditions (that is, the pH is less than the pKa).

    QString ChemicalGroup::m_name

    This variable holds the name of the ChemicalGroup instance.

    float ChemicalGroup::m_pka

    This variable holds the pKa of the ChemicalGroup instance.

    MsXpS::libXpertMassCore::Enums::ChemicalGroupTrapped ChemicalGroup::m_polymerizationRule

    This variable holds the way this ChemicalGroup behaves upon polymerization of the chemical entity into a Polymer.

    std::vector<MsXpS::libXpertMassCore::ChemicalGroupRuleSPtr> ChemicalGroup::m_rules

    This variable holds the container of ChemicalGroupRule instances.