libXpertMass Developer Documentation
  • libXpertMass
  • FragRule
  • FragRule Class

    class MsXpS::libXpertMass::FragRule

    The FragRule class provides a model for specifying gas phase fragmentation rules for refining fragmentation specifications (FragSpec) of Oligomer Sequences. More...

    Header: #include <FragRule.hpp>
    Inherits: MsXpS::libXpertMass::PolChemDefEntity and MsXpS::libXpertMass::Formula

    Public Functions

    FragRule(PolChemDefCstSPtr pol_chem_def_csp, QString name, QString prevCode = QString(), QString currCode = QString(), QString nextCode = QString(), QString formula = QString(), const QString &comment = QString())
    FragRule(const FragRule &other)
    virtual ~FragRule()
    QString comment() const
    QString currCode() const
    QString *formatXmlFgrElement(int offset, const QString &indent = QString(" "))
    QString formula() const
    QString nextCode() const
    QString prevCode() const
    bool renderXmlFgrElement(const QDomElement &element)
    void setComment(const QString &comment)
    void setCurrCode(const QString &code)
    void setNextCode(const QString &code)
    void setPrevCode(const QString &code)
    bool validate()
    FragRule &operator=(const FragRule &other)

    Static Public Members

    int isNameInList(const QString &name, const QList<FragRule *> &frag_rule_list, FragRule *other = nullptr)

    Protected Variables

    QString m_comment
    QString m_currCode
    QString m_nextCode
    QString m_prevCode

    Detailed Description

    Fragmentation rules characterize in more detail the chemical reaction that governs the fragmentation of the polymer in the gas-phase. The rule is a conditional rule. Its logic is based on the presence of specified monomers right at the place of the fragmentation and before or after that precise location.

    In saccharide chemistry, fragmentations are a very complex topic. This is because a given monomer will fragment according to a given chemistry if it is preceded in the sequence by a monomer of a given identity and according to another chemistry if its direct environment is different.

    This paradigm is implemented using a sequence environment logic based on conditions that can be formulated thanks to three monomer codes:

    The use of these codes is typically according to this logic:

    If current monomer is Glu and that previous monomer is Gly and following monomer is Arg, then fragmentation should occur according to this formula : "-H2O".

    See also FragSpec.

    Member Function Documentation

    FragRule::FragRule(PolChemDefCstSPtr pol_chem_def_csp, QString name, QString prevCode = QString(), QString currCode = QString(), QString nextCode = QString(), QString formula = QString(), const QString &comment = QString())

    Constructs a fragmentation rule.

    pol_chem_def_csp Polymer chemistry definition. Cannot be nullptr.

    name Name. Cannot be empty.

    prevCode Previous monomer code. Defaults to the null string.

    currCode Current monomer code. Defaults to the null string.

    nextCode Next monomer code. Defaults to the null string.

    formula Formula. Defaults to the null string.

    comment Comment. Defaults to the null string.

    FragRule::FragRule(const FragRule &other)

    Constructs a FragRule instance as a copy of other.

    [virtual noexcept] FragRule::~FragRule()

    Destructs the fragmentation rule.

    QString FragRule::comment() const

    Returns the comment.

    See also setComment().

    QString FragRule::currCode() const

    Returns the current monomer code.

    See also setCurrCode().

    QString *FragRule::formatXmlFgrElement(int offset, const QString &indent = QString(" "))

    Formats a string suitable to use as an XML element.

    The string is suitable to be used as an XML element in a polymer chemistry definition file. The typical fragmentation rule element that is generated in this function looks like this:

    <fgr>
    <name>a-fgr-2</name>
    <formula>+H100</formula>
    <prev-mnm-code>F</prev-mnm-code>
    <curr-mnm-code>D</curr-mnm-code>
    <next-mnm-code>E</next-mnm-code>
    <comment>comment here!</comment>
    </fgr>

    The formatting of the XML element takes into account offset and indent by prepending the string with offset * indent character substring.

    indent defaults to two spaces.

    Returns a dynamically allocated string that needs to be freed after use.

    QString FragRule::formula() const

    Returns the Formula as a string.

    [static] int FragRule::isNameInList(const QString &name, const QList<FragRule *> &frag_rule_list, FragRule *other = nullptr)

    Searches by name a FragRule in frag_rule_list.

    If a FragRule instance is found and other is non-nullptr, the found fragmentation rule's data are copied into other.

    Returns the index of the found FragRule or -1 if none is found or if name is empty.

    QString FragRule::nextCode() const

    Returns the next monomer code.

    See also setNextCode().

    QString FragRule::prevCode() const

    Returns the previous monomer code.

    See also setPrevCode().

    bool FragRule::renderXmlFgrElement(const QDomElement &element)

    Parses the FragRule XML element.

    Upon parsing and validation of the parsed data, the member data are updated, thus essentially initializing this FragRule instance.

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

    void FragRule::setComment(const QString &comment)

    Sets the comment.

    See also comment().

    void FragRule::setCurrCode(const QString &code)

    Sets the current monomer code.

    See also currCode().

    void FragRule::setNextCode(const QString &code)

    Sets the next monomer code.

    See also nextCode().

    void FragRule::setPrevCode(const QString &code)

    Sets the previous monomer code.

    See also prevCode().

    bool FragRule::validate()

    Validates the FragRule.

    The validation involves checking that:

    Returns true upon success, false otherwise.

    FragRule &FragRule::operator=(const FragRule &other)

    Assigns other to this FragRule instance.

    Returns a reference to this fragmentation rule.

    Member Variable Documentation

    QString FragRule::m_comment

    This variable holds a comment associated to the FragRule.

    QString FragRule::m_currCode

    This variable holds the Monomer code at the actual fragmentation site.

    QString FragRule::m_nextCode

    This variable holds the Monomer code located after the actual fragmentation site.

    QString FragRule::m_prevCode

    This variable holds the Monomer code located before the actual fragmentation site.