|
The Modif class provides abstractions to work with chemical modifications. More...
Header: | #include <Modif.hpp> |
Inherits: | MsXpS::libXpertMass::PolChemDefEntity, MsXpS::libXpertMass::Formula, MsXpS::libXpertMass::Ponderable, and MsXpS::libXpertMass::PropListHolder |
Modif(PolChemDefCstSPtr pol_chem_def_csp, QString name, QString formula = QString()) | |
Modif(const Modif &other) | |
virtual | ~Modif() |
bool | accountMasses(double *mono = 0, double *avg = 0, int times = 1) |
void | debugPutStdErr() |
QString * | formatXmlMdfElement(int offset, const QString &indent = QString(" ")) |
bool | hasMonomerTarget(QString code) const |
int | isNameKnown() |
int | maxCount() |
bool | renderXmlMdfElement(const QDomElement &element, int version) |
void | reset() |
void | setMaxCount(int value) |
QString & | setTargets(QString targets) |
QString | targets() const |
int | targets(QStringList &string_list) const |
bool | validate() |
bool | validateTargets(bool simplify = true) |
bool | operator!=(const Modif &other) |
Modif & | operator=(const Modif &other) |
bool | operator==(const Modif &other) |
virtual bool | calculateMasses() override |
int | isNameInList(const QString &name, const QList<Modif *> &refList, Modif *other = 0) |
The Modif class provides a chemical modification that can be set to any monomer in a polymer sequence or to any one of the polymer sequence ends.In the protein world, chemical modifications of proteins that occur in the living cell are called post-translational modifications.This class aims at modelling, among others, such modifications.
The chemical reaction described by the Modif class is encoded as an actionformula (see Formula).
Constructs a modification.
A Modif instance cannot be of any use if it is not associated logically to a polymer chemistry definition (pol_chem_def_csp). The formula is defined by its name and its formula.
The formula might be a simple formula ("O", for an oxydation) or an actionformula, if that is required to best characterize the modification ("-H20+CH3COOH", for example, for an acetylation).
The Ponderable base class' mono and avg masses are initialized to (0,0).
The targets (m_targets) is set to "all", that is "*"
and the maximum count of this modification that can set set to a target is set to 1
by default.
Constructs a Modif object as a copy of other.
[virtual noexcept]
Modif::~Modif()Destructs this Modif.
Adds to mono and avg the corresponding mass of this modification.
The m_mono and m_avg masses are added to the arguments. The masses are compounded by factor times before the addition.
Returns true.
[override virtual]
bool Modif::calculateMasses()Calculates the net masses of this modification.
The masses of the modification are the masses (monoisotopic and average) that are added to the target as a result of that target being modified with this modification.
The calculated masses are set to the Ponderable base class' m_mono and m_avg members.
Returns true if the mass calculations were successful, false otherwise.
See also Formula::accountMasses().
Outputs a string representing this modification using qDebug().
Formats this modification's data as a string suitable to be used as a mdf
XML element in the polymer chemistry definition.
The typical modification element that is generated in this function looks like this:
<mdf> <name>Acetylation</name> <formula>C2H2O1</formula> <targets>;K;</targets> <maxcount>1</maxcount> </mdf> <mdf> <name>AmidationAsp</name> <formula>H1N1-O1</formula> <targets>;D;</targets> <maxcount>1</maxcount> </mdf>
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.
Returns true if monomer code is found among the targets of this modifications, false otherwise.
[static]
int Modif::isNameInList(const QString &name, const QList<Modif *> &refList, Modif *other = 0)Searches for a modification by name name in the reference list refList.
If a modification is found, and other is non-nullptr, the found modif is copied to other.
Returns true if the modification was found, false otherwise.
Returns true if this modification's name is found in the member polymer chemistry definition's list of modifications, false otherwise
Returns the maximum count of times that this modification might be set to a target.
See also setMaxCount().
Parses the modification XML element specifically for version.
Parses the modif mdf
XML element passed as argument and for each encountered data will set the data to this modif (this is called XML rendering).The parsing is delegated to a function that is specific for version of the polymer chemistry definition.
The mdf
XML element is found in the polymer chemistry definition and has the following form:
<mdf> <name>Acetylation</name> <formula>C2H2O1</formula> <targets>;K;</targets> <maxcount>1</maxcount> </mdf> <mdf> <name>AmidationAsp</name> <formula>H1N1-O1</formula> <targets>;D;</targets> <maxcount>1</maxcount> </mdf>
After setting all the data, this modification calculates it masses and validates itself. If any of these steps fails, the error is reported by returning false.
Returns true if parsing was successful, false otherwise.
Resets this modification to an empty object.
Set the maximum count of times that this modification might be set to a target to value.
See also maxCount().
Sets the targets for this modification.
Setting targets means specifying which target might be modified using this modification. For example, for Phosphorylation
, in protein chemistry, one would define targets as Serine
, Threonine
, Tyrosine
(there are other targets, but very rarely encountered).
Multiple targets are separated using ';'.
See also targets().
Returns the tagets of this modification.
See also setTargets().
Returns the tagets of this modification in the form a string list.
The member m_targets string is split using ';' as a delimitor, the obtained list of strings is set to string_list and the size of the list is returned.
Validates this modification.
The modification validates successfully if:
Returns true if the modification validates successfully, false otherwise.
Validates the target of this modification.
The target list is split using ';' as a delimiter. If '*' is found and simplify is true, the function returns true immediately (as all the monomers in the polymer chemistry definition might be a target of this modification).
If at least one target is found, then each target is a monomer code and that code is looked for in the member polymer chemistry definition list of monomers. If the code is found, that code is added to a temporary string. If the code is not found, m_targets is set to that temporary string (only having in it monomer codes found in the polymer chemistry definition's list of monomers) and the function returns false.
Returns true if the targets of this modification all validated successfully.
Returns true if this and the other modifications differ, false otherwise.
Assigns other to this modification.
Returns a reference to this modification.
Returns true if this and the other modifications are identical, false otherwise.