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

- libXpertMassCore
- CleavageMotif

# MsXpS::libXpertMassCore::CleavageMotif Class

class MsXpS::libXpertMassCore::CleavageMotif

The CleavageMotif class provides a model for specifying aqueous cleavage motfis of Polymer Sequences. More...

Header: | `#include <CleavageMotif.hpp>`

- List of all members, including inherited members
- CleavageMotif is part of Aqueous chemical reactions.

## Public Functions

| CleavageMotif(MsXpS::libXpertMassCore::PolChemDefCstSPtr pol_chem_def_csp)
| CleavageMotif(MsXpS::libXpertMassCore::PolChemDefCstSPtr pol_chem_def_csp, const QString &motif, int offset, MsXpS::libXpertMassCore::Enums::CleavageAction cleavage_action)
| CleavageMotif(const MsXpS::libXpertMassCore::CleavageMotif &other)
| ~CleavageMotif()
MsXpS::libXpertMassCore::Enums::CleavageAction | getCleavageAction() const
const std::vector<MsXpS::libXpertMassCore::MonomerSPtr> & | getMonomersCstRef() const
std::vector<MsXpS::libXpertMassCore::MonomerSPtr> & | getMonomersRef()
QString | getMotif() const
int | getOffset() const
MsXpS::libXpertMassCore::PolChemDefCstSPtr | getPolChemDefCstSPtr() const
std::size_t | parseMotif(const QString &motif)
std::size_t | parseSite(const QString &site)
void | setCleavageAction(MsXpS::libXpertMassCore::Enums::CleavageAction cleavage_action)
void | setMotif(const QString &motif)
void | setOffset(int offset)
void | setPolChemDefCstSPtr(MsXpS::libXpertMassCore::PolChemDefCstSPtr pol_chem_def_csp)
bool | validate(MsXpS::libXpertMassCore::ErrorList *error_list_p) const
bool | operator!=(const MsXpS::libXpertMassCore::CleavageMotif &other) const
MsXpS::libXpertMassCore::CleavageMotif & | operator=(const MsXpS::libXpertMassCore::CleavageMotif &other)
bool | operator==(const MsXpS::libXpertMassCore::CleavageMotif &other) const

## Protected Variables

MsXpS::libXpertMassCore::Enums::CleavageAction | m_cleavageAction
bool | m_isValid
std::vector<MsXpS::libXpertMassCore::MonomerSPtr> | m_monomers
std::size_t | m_offset
MsXpS::libXpertMassCore::PolChemDefCstSPtr | mcsp_polChemDef

## Detailed Description

When a polymer sequence cleavage occurs, using, for example, the Trypsin cleavage agent, that cleavage agent specifies that cleavage should occur at the following sites "Lys/;Arg/;-Lys/Pro".

The "Lys/;Arg/;-Lys/Pro" string of sites gets parsed and cleavage motifs are generated from it. In this specific case, we'll have three CleavageMotif instances with the following data:

- First motif (or cleavage site): - "Lys" - monomer container: [0] = "Lys" - offset = 1 ('/' indicates that the cut is right of monomer) - is for cleavage ? = Enums::CleavageAction::CLEAVE

- Second motif (or cleavage site): - "Arg" - monomer container: [0] = "Arg" - offset = 1 ('/' indicates that the cut is right of monomer) - is for cleavage ? = Enums::CleavageAction::CLEAVE

- Third motif (or non-cleavage site): - "-LysPro" - monomer container: [0] = "Lys", [1] = "Pro" - offset = 1 ('/' indicates that the cut is right of monomer) - is for cleavage ? = Enums::CleavageAction::NO_CLEAVE

Thanks to this deconstruction (from "Lys/;Arg/;-Lys/Pro" to the 3 cleavage motifs above) is the polymer sequence cleaved according to the cleavage agent specification.

See also CleavageAgent and CleavageRule.

## Member Function Documentation

### `[explicit]` CleavageMotif::CleavageMotif(MsXpS::libXpertMassCore::PolChemDefCstSPtr pol_chem_def_csp)

Constructs a cleavage motif with pol_chem_def_csp as the polymer chemistry definition.

The instance will be invalid (m_isValid set to false).

### `[explicit]` CleavageMotif::CleavageMotif(MsXpS::libXpertMassCore::PolChemDefCstSPtr pol_chem_def_csp, const QString &motif, int offset, MsXpS::libXpertMassCore::Enums::CleavageAction cleavage_action)

Constructs a cleavage motif with a number of parameters.

- pol_chem_def_csp Polymer chemistry definition. Cannot be nullptr.
- motif Motif in the form of "Lys/" or "Lys/Pro" or "/Asp".
- offset Offset position of the cleavage to the first monomer code in the motif.
- cleavage_action Tells if motif is for cleavage (for example, "Lys/") or not for cleavage (for example, "-Lys/Pro").

After setting the member data, the CleavageMotif instance is validated and m_isValid is set to the result of this validation.

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

Constructs a CleavageMotif instance as a copy of other.

After setting the member data, the CleavageMotif instance is validated and m_isValid is set to the result of this validation.

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

Destructs this CleavageMotif instance.

### MsXpS::libXpertMassCore::Enums::CleavageAction CleavageMotif::getCleavageAction() const

Returns if motif is for cleavage or not.

### const std::vector<MsXpS::libXpertMassCore::MonomerSPtr> &CleavageMotif::getMonomersCstRef() const

Returns a const reference to the container of Monomers.

### std::vector<MsXpS::libXpertMassCore::MonomerSPtr> &CleavageMotif::getMonomersRef()

Returns a reference to the container of Monomers.

### QString CleavageMotif::getMotif() const

Returns the motif as a concatenation of the codes of the Monomer instances found in the member container of Monomers.

### int CleavageMotif::getOffset() const

Returns the offset.

### MsXpS::libXpertMassCore::PolChemDefCstSPtr CleavageMotif::getPolChemDefCstSPtr() const

Returns the PolChemDef.

### std::size_t CleavageMotif::parseMotif(const QString &motif)

Parses the cleavage motif and returns the count of Monomer instances stored in m_monomers as a result of parsing the motif.

A cleavage motif is a string in the form "LysPro" or "Asp" (in fact that is the string representation of a Sequence).

### std::size_t CleavageMotif::parseSite(const QString &site)

Parses the cleavage site and returns the count of Monomer instances stored in the member container as a result of parsing the site.

A cleavage site is a string in the form "Lys/Pro" or "/Asp". The member container of Monomer pointers is filled-in with pointers to the PolChemDef's Monomer instances having codes {Lys, Pro} or {Asp}. The offset is the position of the '/' cleavage symbol (that is, the actual cleavage position in the motif). For "Lys/Pro", the offset is 1 while for "/Asp", the offset is 0.

After setting the member data, the CleavageMotif instance is validated and m_isValid is set to the result of this validation.

### void CleavageMotif::setCleavageAction(MsXpS::libXpertMassCore::Enums::CleavageAction cleavage_action)

Sets the member Enums::CleavageAction to cleavage_action.

This instance then undergoes validation and m_isValid is set to the result of it.

### void CleavageMotif::setMotif(const QString &motif)

Parses the motif and fills-in the member container of Monomers as a result of the parsing.

See also parseMotif().

### void CleavageMotif::setOffset(int offset)

Sets the offset.

The offset is the position of the cleavage inside the motif, with reset to the first monomer code in that motif. For example, for a cleavage site "Lys/Pro", the cleavage motif becomes {"Lys", "Pro"} and the offset is 1, while for a site "/Asp", the cleavage motif becomes {"Asp"} and the offset is 0.

An offset value can thus not be greater than the number of Monomer codes in the motif.

This instance then undergoes validation and m_isValid is set to the result of it.

### void CleavageMotif::setPolChemDefCstSPtr(MsXpS::libXpertMassCore::PolChemDefCstSPtr pol_chem_def_csp)

Sets the PolChemDef member to pol_chem_def_csp.

This instance then undergoes validation and m_isValid is set to the result of it.

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

Returns true if validation of this CleavageMotif instance was successful, false otherwise.

If errors are encountered and error_list_p is not nullptr, then these error are stored in that ErrorList.

### bool CleavageMotif::operator!=(const MsXpS::libXpertMassCore::CleavageMotif &other) const

Returns true if `this` and other are different.

Returns the negated result of operator==().

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

Assigns other to this CleavageMotif instance.

This instance then undergoes validation and m_isValid is set to the result of it.

Returns a reference to this CleavageMotif instance.

### bool CleavageMotif::operator==(const MsXpS::libXpertMassCore::CleavageMotif &other) const

Returns true if `this` and other are identical.

The comparison of the Monomer instances in the member container is deep (that is the Monomer instances are compared and not the shared pointers).

## Member Variable Documentation

### MsXpS::libXpertMassCore::Enums::CleavageAction CleavageMotif::m_cleavageAction

Tells if the motif is for cleavage or not for cleavage.

In the "Lys/" and "Arg/" motif, that would be true; for "-Lys/Pro", that would be false, because Trypsin does not cleave after a Lysyl residue if it is followed by a Prolyl residue.

### bool CleavageMotif::m_isValid

Tell the validity status of the CleavageMotif instance.

### std::vector<MsXpS::libXpertMassCore::MonomerSPtr> CleavageMotif::m_monomers

This variable holds the container of Monomer instances. The Monomer instances are in the form of const shared pointers to Monomer in the polymer chemistry definition.

A "Lys/Pro" motif will translate into two Monomer instances (actually pointers) having codes Lys and Pro, in the right order.

### std::size_t CleavageMotif::m_offset

This variable holds the offset between the actual cleavage site and the first monomer of the motif.

In the The "Lys/", "Arg/" and "-Lys/Pro" examples, the offset would be 1 for each motif, because each time the cleavage occurs after the first monomer code: Lys/, or Arg/ or Lys/Pro. In the /Asp cleavage site the offset would be 0, because the cleavage occurs before the first monomer in the motif (Asp). In the ATGC/GCAT cleavage motif, the offset would be 4.

### MsXpS::libXpertMassCore::PolChemDefCstSPtr CleavageMotif::mcsp_polChemDef

This variable holds the PolChemDef (polymer chemistry definition) that is needed.