libXpertMass Developer Documentation
  • libXpertMass
  • CrossLink
  • CrossLink Class

    class MsXpS::libXpertMass::CrossLink

    The CrossLink class provides abstractions to work with a cross-link entity between Monomer instances. More...

    Header: #include <CrossLink.hpp>
    Inherits: MsXpS::libXpertMass::CrossLinker

    Public Functions

    CrossLink(PolChemDefCstSPtr pol_chem_def_csp, Polymer *polymer, const QString &name, const QString &formula, const QString &comment = QString())
    CrossLink(const CrossLinker &cross_linker, Polymer *polymer, const QString &comment = QString())
    CrossLink(const CrossLink &other)
    virtual ~CrossLink()
    bool appendMonomer(const Monomer *monomer)
    const QString &comment() const
    int encompassedBy(int start, int end, int *in = 0, int *out = 0)
    int encompassedBy(const CoordinateList &coordinate_list, int *in = 0, int *out = 0)
    const Monomer *firstMonomer() const
    int involvesMonomer(const Monomer *monomer) const
    const Monomer *monomerAt(int index)
    int monomerIndexList(QList<int> *list)
    QString monomerIndexText()
    QList<const Monomer *> *monomerList()
    QString monomerPosText()
    Polymer *polymer()
    int populateMonomerList(QString text)
    QString *prepareResultsTxtString()
    bool removeMonomerAt(int index)
    void setComment(const QString &comment)
    bool setMonomerAt(Monomer *monomer, int index)
    void setPolymer(Polymer *polymer)
    bool validate()
    virtual bool operator==(const CrossLink &other) const

    Reimplemented Public Functions

    virtual bool accountMasses(double *mono = 0, double *avg = 0, int times = 1) override
    virtual bool accountMasses(Ponderable *ponderable, int times = 1) override
    virtual bool calculateMasses() override

    Protected Variables

    QString m_comment
    QList<const Monomer *> m_monomerList
    Polymer *mp_polymer

    Detailed Description

    The notion of a cross-link is that it is a chemical reaction that involves at least two monomers in a Polymer or in an Oligomer sequence.

    Polymer sequences might contain more than one CrossLink and these are stored as a CrossLinkList.

    Member Function Documentation

    Constructs a CrossLink instance

    Constructs a CrossLink instance

    Constructs a CrossLink instance as a copy of other.

    Destructs this CrossLink instance.

    No entity needs to be destructed, since the Monomer instances in the list are not owned by this CrossLinker instance.

    [override virtual] bool CrossLink::accountMasses(double *mono = 0, double *avg = 0, int times = 1)

    Reimplements: CrossLinker::accountMasses(double *mono, double *avg, int times).

    Adds the member m_mono and m_avg masses to mono and avg, as compounded by the times factor.

    Returns true.

    [override virtual] bool CrossLink::accountMasses(Ponderable *ponderable, int times = 1)

    Reimplements: CrossLinker::accountMasses(Ponderable *ponderable, int times).

    Adds the member m_mono and m_avg masses to ponderable, as compounded by the times factor.

    Returns true.

    bool CrossLink::appendMonomer(const Monomer *monomer)

    Adds monomer to the member list of Monomer instances.

    monomer cannot be nullptr.

    Returns true.

    [override virtual] bool CrossLink::calculateMasses()

    Reimplements: CrossLinker::calculateMasses().

    Calculates the masses of this CrossLink and set them anew to the member masses (Ponderable base class).

    Returns true.

    const QString &CrossLink::comment() const

    Returns the member comment.

    See also setComment().

    int CrossLink::encompassedBy(int start, int end, int *in = 0, int *out = 0)

    Tells if this CrossLink instance is encompassed (partially or fully) or not at all by the Polymer sequence region defined by the [start - end ] Monomer index range.

    The count of monomers involved in this cross-link that:

    If all the monomers are listed as in, then this CrossLink is fully encompassed by the Polymer sequence region defined by the [start - end ] Monomer index range and CROSS_LINK_ENCOMPASSED_FULL is returned.

    If all the monomers are listed as out, then this CrossLink is not at all encompassed by the Polymer sequence region and CROSS_LINK_ENCOMPASSED_NO is returned.

    If both kinds of monmers were found, then CROSS_LINK_ENCOMPASSED_PARTIAL is returned.

    int CrossLink::encompassedBy(const CoordinateList &coordinate_list, int *in = 0, int *out = 0)

    Tells if this CrossLink instance is encompassed (partially or fully) or not at all by various Coordinates instances in the coordinate_list CoordinateList.

    The count of monomers involved in this cross-link that:

    If all the monomers are listed as in, then this CrossLink is fully encompassed by the Polymer sequence regions defined in coordinate_list and CROSS_LINK_ENCOMPASSED_FULL is returned.

    If all the monomers are listed as out, then this CrossLink is not at all encompassed by the Polymer sequence region and CROSS_LINK_ENCOMPASSED_NO is returned.

    If both kinds of monmers were found, then CROSS_LINK_ENCOMPASSED_PARTIAL is returned.

    const Monomer *CrossLink::firstMonomer() const

    Returns the first Monomer instance listed in the member list of monomers. If the list is empty; returns nullptr.

    int CrossLink::involvesMonomer(const Monomer *monomer) const

    Returns the index of monomer found in the member Polymer sequence that is involved in this CrossLink, or -1 if that is not found.

    const Monomer *CrossLink::monomerAt(int index)

    Returns the monomer at index in the member list of Monomer instances.

    index cannot be out-of-bounds.

    See also setMonomerAt().

    int CrossLink::monomerIndexList(QList<int> *list)

    Lists in list the indices of all the monomers involved in this CrossLink instance.

    Returns the count of indices set to list.

    QString CrossLink::monomerIndexText()

    Returns a string containing a ';'-separated list of the indices of all the Monomer instances involved in this CrossLink.

    QList<const Monomer *> *CrossLink::monomerList()

    Returns the member list of Monomer instances.

    QString CrossLink::monomerPosText()

    Returns a string containing a ';'-separated list of the positions of all the Monomer instances involved in this CrossLink.

    Polymer *CrossLink::polymer()

    Returns the Polymer instance in which this CrossLink has been formed.

    See also setPolymer().

    int CrossLink::populateMonomerList(QString text)

    Sets to the member monomer list all the Monomer instances referenced in text as indices to monomer in the Polymer sequence.

    text contains a list of Monomer instance indices separated by ';' characters. The corresponding monomers found in the member Polymer are copied to the member list of Monomer instances, effectively documenting a CrossLink in that member Polymer sequence.

    This CrossLink instance does not own the Monomer instances pointers, as they effectively point to monomer that belong to the member Polymer.

    QString *CrossLink::prepareResultsTxtString()

    Returns an allocated string describing this CrossLink instance.

    bool CrossLink::removeMonomerAt(int index)

    Removes the monomer at index in the member list of Monomer instances.

    index cannot be out-of-bounds.

    Returns true.

    void CrossLink::setComment(const QString &comment)

    Set the member comment to comment.

    See also comment().

    bool CrossLink::setMonomerAt(Monomer *monomer, int index)

    Sets monomer to this CrossLink at index of the member list of Monomer instances, effectively replacing the monomer instance currently at that index.

    monomer cannot be nullptr and index cannot be out-of-bounds.

    This CrossLinker instance does not take ownership of monomer.

    Returns true.

    See also monomerAt().

    void CrossLink::setPolymer(Polymer *polymer)

    Set polymer as the Polymer sequence in which this CrossLink has been formed.

    polymer cannot be nullptr.

    See also polymer().

    bool CrossLink::validate()

    Returns true if this CrossLink instance validates successfully, false otherwise.

    The validation is successful if:

    [virtual] bool CrossLink::operator==(const CrossLink &other) const

    Returns true if this CrossLink instance and other are identical, false otherwise.

    Member Variable Documentation

    QString CrossLink::m_comment

    This variable holds the comment that might be associated to this CrossLink.

    QList<const Monomer *> CrossLink::m_monomerList

    This variable holds the list of Monomer instances that are involved in the formation of this CrossLink.

    The monomers are the Monomer instances found in the mp_polymer Polymer instance. This CrossLink does not own these Monomers.

    The reason the CrossLink lists the involved Monomer instances as pointers to these very monomers in the polymer sequence is that in this way, even if the sequence is edited the cross-link does not loose the relation to the monomers. The only way that the sequence editing modifies a CrossLink instance is by removing a Monomer instance involved in the CrossLink. If that occurs, the CrossLink is informed and its destructed.

    Polymer *CrossLink::mp_polymer

    This variable holds the Polymer instance of which this CrossLink is part. This CrossLink does not own the Polymer.