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

- libXpertMassCore
- ChemicalGroupRule

# MsXpS::libXpertMassCore::ChemicalGroupRule Class

class MsXpS::libXpertMassCore::ChemicalGroupRule

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

Header: | `#include <MsXpS/libXpertMassCore/ChemicalGroupRule.hpp>`

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

## Public Functions

| ChemicalGroupRule(const QString &name = QString(), const QString &entity = QString(), MsXpS::libXpertMassCore::Enums::ChemicalGroupFate fate = Enums::ChemicalGroupFate::LOST)
| ChemicalGroupRule(const MsXpS::libXpertMassCore::ChemicalGroupRule &other)
| ~ChemicalGroupRule()
QString | getEntity()
MsXpS::libXpertMassCore::Enums::ChemicalGroupFate | getFate()
QString | getName()
bool | isValid() const
bool | renderXmlElement(const QDomElement &element)
void | setEntity(const QString &entity)
void | setFate(MsXpS::libXpertMassCore::Enums::ChemicalGroupFate fate)
void | setName(const QString &name)
bool | validate(MsXpS::libXpertMassCore::ErrorList *error_list_p) const
MsXpS::libXpertMassCore::ChemicalGroupRule & | operator=(const MsXpS::libXpertMassCore::ChemicalGroupRule &other)

## Protected Variables

MsXpS::libXpertMassCore::Enums::ChemicalGroupFate | m_chemicalGroupFate
QString | m_entity
QString | m_name

## Detailed Description

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 ChemicalGroup.

## Member Function Documentation

### ChemicalGroupRule::ChemicalGroupRule(const QString &name = QString(), const QString &entity = QString(), MsXpS::libXpertMassCore::Enums::ChemicalGroupFate fate = Enums::ChemicalGroupFate::LOST)

Constructs a ChemicalGroupRule instance.

- name: The name of this ChemicalGroupRule instance.
- entity: The entity of this ChemicalGroupRule instance.
- fate: The fate of this ChemicalGroupRule instance.

### ChemicalGroupRule::ChemicalGroupRule(const MsXpS::libXpertMassCore::ChemicalGroupRule &other)

Constructs a ChemicalGroupRule instance as a copy of other.

### `[noexcept]` ChemicalGroupRule::~ChemicalGroupRule()

brief Constructs this ChemicalGroupRule

### QString ChemicalGroupRule::getEntity()

Returns the entity.

### MsXpS::libXpertMassCore::Enums::ChemicalGroupFate ChemicalGroupRule::getFate()

Returns the fate.

### QString ChemicalGroupRule::getName()

Returns the name.

### bool ChemicalGroupRule::isValid() const

Returns the validity status of this instance.

### bool ChemicalGroupRule::renderXmlElement(const QDomElement &element)

Parses the ChemicalGroupRule XML element.

Upon parsing of the element, its data are validated and set to this ChemicalGroupRule instance, thus essentially initializing it.

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

### void ChemicalGroupRule::setEntity(const QString &entity)

Sets the entity.

### void ChemicalGroupRule::setFate(MsXpS::libXpertMassCore::Enums::ChemicalGroupFate fate)

Sets the fate.

### void ChemicalGroupRule::setName(const QString &name)

Sets the name.

### bool ChemicalGroupRule::validate(MsXpS::libXpertMassCore::ErrorList *error_list_p) const

Validates this instance, setting eventual error messages to error_list_p.

Note: error_list_p is not cleared.

Following a successful validation, m_isValid is set to true, to false otherwise and that result is returned.

### MsXpS::libXpertMassCore::ChemicalGroupRule &ChemicalGroupRule::operator=(const MsXpS::libXpertMassCore::ChemicalGroupRule &other)

Assigns other to this instance.

## Member Variable Documentation

### MsXpS::libXpertMassCore::Enums::ChemicalGroupFate ChemicalGroupRule::m_chemicalGroupFate

This variable holds the fate of the ChemicalGroupRule instance.

See also MsXpS::libXpertMassCore::Enums::ChemicalGroupFate.

### QString ChemicalGroupRule::m_entity

This variable holds the entity of the ChemicalGroupRule instance, like LE_PLM_MODIF for left end polymer modification.

### QString ChemicalGroupRule::m_name

This variable holds the name of the ChemicalGroupRule instance.