libXpertMass Developer Documentation
  • libXpertMass
  • FragSpec
  • FragSpec Class

    class MsXpS::libXpertMass::FragSpec

    The FragSpec class provides a model for specifying gas phase fragmentations of Oligomer Sequences. More...

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

    Public Functions

    FragSpec(PolChemDefCstSPtr pol_chem_def_csp, QString name, QString formula = QString(), FragEnd frag_end = FRAG_END_NONE, const QString &comment = QString())
    FragSpec(PolChemDefCstSPtr pol_chem_def_csp, QString name, QString formula)
    FragSpec(const FragSpec &other)
    virtual ~FragSpec()
    void appendRule(FragRule *frag_rule)
    QString comment() const
    QString *formatXmlFgsElement(int offset, const QString &indent = QString(" "))
    QString formula() const
    FragEnd fragEnd() const
    void insertRuleAt(int index, FragRule *frag_rule)
    void removeRuleAt(int index)
    bool renderXmlFgsElement(const QDomElement &element, int version)
    QList<FragRule *> &ruleList()
    void setComment(const QString &comment)
    void setFragEnd(FragEnd frag_end)
    bool validate()
    FragSpec &operator=(const FragSpec &other)

    Static Public Members

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

    Detailed Description

    The FragSpec class provides a fragmentation specification. Fragmentation specifications determine the chemical reaction that governs the fragmentation of the polymer in the gas-phase. The chemical reaction is embodied by a formula. The side of the polymer (left or right) that makes the fragment after the fragmentation has occurred is described by a fragmentation-end enumeration.

    A fragmentation specification might not be enough information to determine the manner in which a polymer fragments in the gas-phase. Fragmentation rules (FragRules) might be required to refine the specification. A fragmentation specification might hold as many FragRules as required.

    Member Function Documentation

    FragSpec::FragSpec(PolChemDefCstSPtr pol_chem_def_csp, QString name, QString formula = QString(), FragEnd frag_end = FRAG_END_NONE, const QString &comment = QString())

    Constructs a FragSpec instance.

    pol_chem_def_csp Polymer chemistry definition. Cannot be nullptr.

    name Name. Cannot be empty.

    formula Formula. Defaults to the null string.

    frag_end Fragmentation end. Defaults to FRAG_END_NONE.

    comment Comment. Defaults to the null string.

    FragSpec::FragSpec(PolChemDefCstSPtr pol_chem_def_csp, QString name, QString formula)

    Constructs a fragmentation specification.

    pol_chem_def_csp Polymer chemistry definition. Cannot be nullptr.

    name Name. Cannot be empty.

    formula Formula.

    FragSpec::FragSpec(const FragSpec &other)

    Constructs a FragSpec instance as a copy of other.

    [virtual noexcept] FragSpec::~FragSpec()

    Destroys this FragSpec instance.

    void FragSpec::appendRule(FragRule *frag_rule)

    Adds the frag_rule FragRule instance to the member list of FragRule instances.

    QString FragSpec::comment() const

    Returns the comment.

    See also setComment().

    QString *FragSpec::formatXmlFgsElement(int offset, const QString &indent = QString(" "))

    Formats a string representing this FragSpec instance suitable to use as an XML element.

    The typical fragmentation specification element that is generated in this function looks like this:

    <fgs>
    <name>a</name>
    <end>LE</end>
    <formula>-C1O1</formula>
    <fgr>
    <name>a-fgr-1</name>
    <formula>+H200</formula>
    <prev-mnm-code>E</prev-mnm-code>
    <curr-mnm-code>D</curr-mnm-code>
    <next-mnm-code>F</next-mnm-code>
    <comment>comment here!</comment>
    </fgr>
    <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>
    </fgs>

    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 FragSpec::formula() const

    Returns the Formula as a string.

    FragEnd FragSpec::fragEnd() const

    Returns the fragmentation end.

    See also setFragEnd().

    void FragSpec::insertRuleAt(int index, FragRule *frag_rule)

    Inserts in the member list of FragRule instances at index the frag_rule FragRule instance.

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

    Searches by name for a FragSpec in the frag_spec_list.

    If such fragmentation specification is found, and if other is non-0, the found fragmentation specification's data are copied into other.

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

    void FragSpec::removeRuleAt(int index)

    Removes from the member list of FragRule instances the item at index index.

    bool FragSpec::renderXmlFgsElement(const QDomElement &element, int version)

    Parses a fragmentation specification XML element using a versioned function.

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

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

    QList<FragRule *> &FragSpec::ruleList()

    Returns the list of FragRule instances.

    void FragSpec::setComment(const QString &comment)

    Sets the comment.

    See also comment().

    void FragSpec::setFragEnd(FragEnd frag_end)

    Sets the fragmentation end to frag_end.

    See also fragEnd().

    bool FragSpec::validate()

    Validates the FragSpec.

    The validation involves checking that:

    Returns true upon success, false otherwise.

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

    Assigns other to this FragSpec instance.

    Returns a reference to this FragSpec.