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

- libXpertMassCore
- Cleaver

# MsXpS::libXpertMassCore::Cleaver Class

class MsXpS::libXpertMassCore::Cleaver

The Cleaver class provides a model for performing aqueous cleavage reactions involving CleavageAgent objects and Polymer Sequences. More...

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

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

## Public Functions

| Cleaver()
| Cleaver(MsXpS::libXpertMassCore::PolymerCstQSPtr polymer_cqsp, MsXpS::libXpertMassCore::PolChemDefCstSPtr pol_chem_def_csp, const MsXpS::libXpertMassCore::CleavageConfig &cleavage_config, const MsXpS::libXpertMassCore::CalcOptions &calc_options, const MsXpS::libXpertMassCore::Ionizer &ionizer)
| Cleaver(const MsXpS::libXpertMassCore::Cleaver &other)
| ~Cleaver()
bool | accountCleavageRule(MsXpS::libXpertMassCore::CleavageRuleSPtr cleavage_rule_sp, MsXpS::libXpertMassCore::OligomerSPtr oligomer_sp)
int | analyzeCrossLinkedOligomer(MsXpS::libXpertMassCore::OligomerSPtr oligomer_sp, MsXpS::libXpertMassCore::OligomerCollection &oligomers)
int | analyzeCrossLinks(MsXpS::libXpertMassCore::OligomerCollection &oligomers)
bool | cleave(bool reset = false)
int | cleavePartial(int partial_cleavage)
int | fillCleavageIndices()
QString | getCleaveAgentName() const
const MsXpS::libXpertMassCore::OligomerCollection & | getOligomerCollectionCstRef() const
MsXpS::libXpertMassCore::OligomerCollection & | getOligomerCollectionRef()
int | removeDuplicateCleavageIndices()
int | resolveCleavageNoCleavage()
std::size_t | transferOligomers(MsXpS::libXpertMassCore::OligomerCollection &source, MsXpS::libXpertMassCore::OligomerCollection &dest)
bool | operator!=(const MsXpS::libXpertMassCore::Cleaver &other) const
MsXpS::libXpertMassCore::Cleaver & | operator=(const MsXpS::libXpertMassCore::Cleaver &other)
bool | operator==(const MsXpS::libXpertMassCore::Cleaver &other) const

## Protected Variables

MsXpS::libXpertMassCore::CalcOptions | m_calcOptions
MsXpS::libXpertMassCore::CleavageConfig | m_cleavageConfig
std::vector<int> | m_doCleaveIndices
std::vector<int> | m_doNotCleaveIndices
MsXpS::libXpertMassCore::Ionizer | m_ionizer
MsXpS::libXpertMassCore::OligomerCollection | m_oligomers
MsXpS::libXpertMassCore::PolChemDefCstSPtr | mcsp_polChemDef
MsXpS::libXpertMassCore::PolymerCstQSPtr | mcsp_polymer

## Detailed Description

See also CleavageAgent, CleavageMotif, CleavageConfig, and Ionizer.

## Member Function Documentation

### Cleaver::Cleaver()

Constructs an entirely empty Cleaver instance.

### Cleaver::Cleaver(MsXpS::libXpertMassCore::PolymerCstQSPtr polymer_cqsp, MsXpS::libXpertMassCore::PolChemDefCstSPtr pol_chem_def_csp, const MsXpS::libXpertMassCore::CleavageConfig &cleavage_config, const MsXpS::libXpertMassCore::CalcOptions &calc_options, const MsXpS::libXpertMassCore::Ionizer &ionizer)

Constructs a Cleaver instance with a number of parameters.

- polymer_cqsp The Polymer instance to be cleaved.
- pol_chem_def_csp The PolChemDef (polymer chemistry definition) that is the context in which the Polymer exists.
- cleavage_config The CleavageConfig instance that configures the cleavage.
- calc_options The CalcOptions instance that configures the mass and formula calculations.
- ionizer The Ionizer instance that drives the ionization of the Oligomer instances generated by the cleavage.

If polymer_cqsp or pol_chem_def_csp is nullptr, that is a fatal error.

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

Constructs Cleaver instance as a copy of other.

If polymer_cqsp or pol_chem_def_csp is nullptr, that is a fatal error.

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

Desstructs this Cleaver instance

### bool Cleaver::accountCleavageRule(MsXpS::libXpertMassCore::CleavageRuleSPtr cleavage_rule_sp, MsXpS::libXpertMassCore::OligomerSPtr oligomer_sp)

Accounts into the oligomer_sp for the cleavage_rule_sp.

Returns true if the accounting succeeded, false otherwise.

### int Cleaver::analyzeCrossLinkedOligomer(MsXpS::libXpertMassCore::OligomerSPtr oligomer_sp, MsXpS::libXpertMassCore::OligomerCollection &oligomers)

Pulls down all the Oligomer instances in oligomers that are found to be cross-linked to oligomer_sp.

Returns the count of IndexRange instances found in oligomer_sp, which is a reflection of the number of oligomers that are found to be cross-linked to it.

### int Cleaver::analyzeCrossLinks(MsXpS::libXpertMassCore::OligomerCollection &oligomers)

Analyzes the CrossLink instances that might be involved in the Oligomer instances in the oligomers collection.

The Oligomers that are found cross-linked are set in oligomers and the size of this collection is returned.

### bool Cleaver::cleave(bool reset = false)

Performs the actual cleavage, thus generating Oligomer instances that are added to the member OligomerCollection instance.

If reset is true, the member OligomerCollection is first cleared; otherwise the newly generated Oligomer instances are simply added to it.

Returns true upon success, false otherwise.

### int Cleaver::cleavePartial(int partial_cleavage)

Performs a cleavage operation for partial cleavage partial_cleavage.

Returns -1 if an error occurred, the count of generated oligomers otherwise.

### int Cleaver::fillCleavageIndices()

Fills-in all the index values that correspond to precise locations where the cleavage reactions must occur. These indices represent location in the member Polymer Sequence.

If the pattern only contains cleaving sites, all the indices are added to the member container of cleavage indices. If the pattern contains also no-cleaving sites (like with Trypsin's "-Lys/Pro" pattern), then the corresponding indices are set to the member container of no-cleavage indices.

Returns the sum of the two cleavage/no-cleavage containers sizes. Or 0 if not a single cleavage site was found in the Polymer Sequence.

### QString Cleaver::getCleaveAgentName() const

Returns the CleavageAgent name (from the member CleavageConfig instance's base class).

### const MsXpS::libXpertMassCore::OligomerCollection &Cleaver::getOligomerCollectionCstRef() const

Returns a const reference to the member OligomerCollection instance.

### MsXpS::libXpertMassCore::OligomerCollection &Cleaver::getOligomerCollectionRef()

Returns a reference to the member OligomerCollection instance.

### int Cleaver::removeDuplicateCleavageIndices()

Removes the duplicate cleavage indices from the container of cleavage indices.

### int Cleaver::resolveCleavageNoCleavage()

Removes form the container of cleavage indices all the indices that were found to be no-cleavage indices in the corresponding container.

Returns the size of the container of cleavage indices.

### std::size_t Cleaver::transferOligomers(MsXpS::libXpertMassCore::OligomerCollection &source, MsXpS::libXpertMassCore::OligomerCollection &dest)

Transfers (using std::move()) all the Oligomer instances from source to dest.

After the transfer, the source Oligomer container is cleared since it contains only nullptr items.

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

Returns true if this instance is different than other, false otherwise.

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

Returns a reference to this Cleaver instance after initialization using other.

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

Returns true if this instance is identical to other, false otherwise.

## Member Variable Documentation

### MsXpS::libXpertMassCore::CalcOptions Cleaver::m_calcOptions

This variable holds the CalcOptions that configure the way masses and formulas are to be computed.

### MsXpS::libXpertMassCore::CleavageConfig Cleaver::m_cleavageConfig

This variable holds the CleavageConfig that configures the cleavage reaction.

### std::vector<int> Cleaver::m_doCleaveIndices

This variable holds the vector of indices in the Polymer Sequence that are indeed the site of cleavage.

### std::vector<int> Cleaver::m_doNotCleaveIndices

This variable holds the vector of indices in the Polymer Sequence that are not the site of cleavage.

### MsXpS::libXpertMassCore::Ionizer Cleaver::m_ionizer

This variable holds the Ionizer that directs the ionization of the Oligomer instances obtained by cleaving the Polymer.

### MsXpS::libXpertMassCore::OligomerCollection Cleaver::m_oligomers

This variable holds the vector of Oligomer instances generated as a result of the cleavage.

### MsXpS::libXpertMassCore::PolChemDefCstSPtr Cleaver::mcsp_polChemDef

This variable holds the PolChemDef polymer chemistry definition.

### MsXpS::libXpertMassCore::PolymerCstQSPtr Cleaver::mcsp_polymer

This variable holds the Polymer polymer that is being cleaved (digested).