|
The Polymer class provides abstractions to work with a polymer molecule (protein or saccharide , for example). More...
Header: | #include <Polymer.hpp> |
Inherits: | QObject, MsXpS::libXpertMass::Sequence, and MsXpS::libXpertMass::Ionizable |
Polymer(PolChemDefCstSPtr pol_chem_def_csp, const QString &name = QString("NOT_SET"), const QString &code = QString("NOT_SET"), const QString &author = QString("NOT SET")) | |
virtual | ~Polymer() |
bool | accountCappingMasses(int how, int times = 1) |
bool | accountEndModifMasses(int how) |
bool | accountMasses(const CalcOptions &calc_options) |
QString | author() const |
bool | calculateMasses(const CalcOptions &calc_options, bool reset = true) |
QString | code() const |
bool | crossLink(CrossLink *cross_link_p) |
const CrossLinkList & | crossLinkList() const |
bool | crossLinkList(int start_index, int end_index, QList<CrossLink *> *crosslink_list_p, int *partials) |
CrossLinkList * | crossLinkListPtr() |
bool | crossLinkedMonomerIndexList(int start_index, int end_index, QList<int> *index_list_p, int *partials) |
QString | dateTime() const |
void | debugPutStdErr() |
QString | elementalComposition(const IonizeRule &ionize_rule, const CoordinateList &coordinate_list, const CalcOptions &calc_options) |
QString | filePath() const |
QString * | formatXmlCrossLinksElement(int offset, const QString &indent = QString(" ")) |
QString * | formatXmlDtd() |
QString * | formatXmlPolSeqElement(int offset, const QString &indent = QString(" ")) |
bool | hasModifiedMonomer(int left_index = -1, int right_index = -1) const |
bool | isLeftEndModified() const |
bool | isRightEndModified() const |
const Modif & | leftEndModif() const |
QByteArray | md5Sum(int hash_data_specifs) const |
QString | name() const |
virtual bool | prepareMonomerRemoval(Monomer *monomer) |
bool | renderXmlCodesElement(const QDomElement &element) |
bool | renderXmlCrossLinksElement(const QDomElement &element, int version) |
bool | renderXmlPolymerFile(QString file_path = QString("")) |
bool | renderXmlPolymerModifElement(const QDomElement &element, int version) |
const Modif & | rightEndModif() const |
void | setAuthor(const QString &author) |
void | setCode(const QString &code) |
void | setDateTime(const QString &date_time) |
void | setFilePath(const QString &file_path) |
bool | setLeftEndModif(const QString &name = QString()) |
bool | setLeftEndModif(const Modif &modif) |
void | setName(const QString &name) |
bool | setRightEndModif(const QString &name = QString()) |
bool | setRightEndModif(const Modif &modif) |
bool | uncrossLink(CrossLink *cross_link_p) |
bool | writeXmlFile() |
virtual bool | removeMonomerAt(int index) override |
virtual bool | validate() override |
bool | accountCappingMasses(Polymer *polymer, int how, double *mono, double *avg, int times = 1) |
bool | accountEndModifMasses(Polymer *polymer, int how, double *mono, double *avg) |
bool | accountEndModifMasses(Polymer *polymer, int how, Ponderable *ponderable) |
bool | accountMasses(Polymer *polymer, const CalcOptions &calc_options, double *mono, double *avg) |
bool | calculateMasses(Polymer *polymer_p, const CalcOptions &calc_options, double *mono, double *avg, bool reset = true) |
QString | xmlPolymerFileGetPolChemDefName(const QString &file_path) |
The Polymer class provides a polymer sequence. In the protein world, a polymer sequence is a protein. From a computing standpoint, that sequence is first created by chaining amino acid residues (the residue chain). In a second step, the entity is set to a finished polymer state by adding the N-terminal proton and the C-terminal hydroxyl residue. It might happen also that the ends of a polymer be chemically modified (acetylation of the N-terminal residue, for example).
The Polymer class allows modelling a polymer sequence in its finest details.
Constructs a polymer with name, code, author and the pol_chem_def_csp polymer chemistry definition.
[virtual noexcept]
Polymer::~Polymer()Destructs the polymer.
Accounts for the mass of the end caps.
The polymer sequence is actually a chain of monomers (that is, residues). In order to compute the mass of the polymer in its finished state, it is necessary to add the masses of its end caps (typically, a proton and a hydroxyl group in protein chemistry, respectively capping the N-terminus and the C-terminus).
The mass of the the left end is added to the monoisotopic and average masses of this polymer if (how & CAP_LEFT). The mass of the the right end is added to the monoisotopic and average masses of this polymer if (how & CAP_RIGHT).
The masses of the caps are multiplied by times before accounting them to this polymer's masses.
Returns true.
[static]
bool Polymer::accountCappingMasses(Polymer *polymer, int how, double *mono, double *avg, int times = 1)Accounts for the polymer's masses of its end caps to mono and avg.
The polymer sequence is actually a chain of monomers (that is, residues). In order to compute the mass of the polymer in its finished state, it is necessary to add the masses of its end caps (typically, a proton and a hydroxyl group in protein chemistry, respectively capping the N-terminus and the C-terminus).
The mass of the the left end is added to the mono and avg masses if (how & CAP_LEFT). The mass of the the right end is added to the mono and avg masses if (how & CAP_RIGHT).
The masses of the caps are multiplied by times before accounting them to mono and avg
mono and avg cannot be nullptr. polymer cannot be nullptr. Returns true.
Accounts for this polymer's end modifications masses as defined by how.
The left end's modification masses are accounted for in this polymer if (how & POLYMER_CHEMENT_LEFT_END_MODIF), and the right end's are if (how & POLYMER_CHEMENT_RIGHT_END_MODIF).
Returns true upon success, false otherwise.
[static]
bool Polymer::accountEndModifMasses(Polymer *polymer, int how, double *mono, double *avg)Accounts for the polymer's end modifications masses as defined by how.
The masses are accounted for into mono and avg without resetting these masses. If (how & POLYMER_CHEMENT_LEFT_END_MODIF)
, the left end modification masses are accounted for and the right end's are if (how& POLYMER_CHEMENT_RIGHT_END_MODIF)
.
Returns true upon success and false otherwise.
[static]
bool Polymer::accountEndModifMasses(Polymer *polymer, int how, Ponderable *ponderable)Accounts for the polymer's end modifications masses as defined by how.
The masses are accounted for into ponderable without resetting its masses. If (how & POLYMER_CHEMENT_LEFT_END_MODIF), the left end modification masses are accounted for and the right end's are if (how & POLYMER_CHEMENT_RIGHT_END_MODIF).
Accounts the masses of this polymer.
Accounting masses means calculating masses and adding the results to objects. Here the masses of this polymer are calculated and added to those of this polymer.
The calculation of the masses (monoisotopic and average) is configured in calc_options.
Returns true upon success, false otherwise.
See also CalcOptions.
[static]
bool Polymer::accountMasses(Polymer *polymer, const CalcOptions &calc_options, double *mono, double *avg)Accounts the masses of this polymer.
Accounting masses means calculating masses and adding the results to objects. Here the masses of this polymer are calculated and set to mono and avg.
The calculation of the masses (monoisotopic and average) is configured in calc_options.
See also CalcOptions.
Returns the author.
See also setAuthor().
Calculates the masses of this polymer.
The calculated masses are set to this polymer. If reset is true, the masses of this polymer are first reset, otherwise this polymer's masses are incremented with those obtained from the calculation.
The calculation of the masses (monoisotopic and average) is configured in calc_options.
Returns true.
See also CalcOptions.
[static]
bool Polymer::calculateMasses(Polymer *polymer_p, const CalcOptions &calc_options, double *mono, double *avg, bool reset = true)Calculates the masses of polymer_p.
The calculated masses are set to mono and avg (that cannot be nullptr).
If reset is true, mono and avg are reset, otherwise they are incremented with the masses obtained from the calculation.
The calculation of the masses (monoisotopic and average) is configured in calc_options.
Returns true.
See also CalcOptions.
Returns the code.
See also setCode().
Performs the actual cross-linking as described in cross_link_p.
The chemical representation of the cross-link must have been performed in cross_link_p.
Returns true upon success or false if the CrossLink does not validate successfully.
Returns a reference to the list of CrossLink entities associated to this polymer.
Fills-in the crosslink_list_p with cross-links.
This function iterates in this polymer's list of cross-links and checks for each cross-link the monomers that are involved in that cross-link have indices:
The crosslink_list_p is filled only with cross-links found to be fully encompassed by the range.
If partials is not nullptr, then, it is set to the count of cross-links involving monomers only partially contained in range [start_index, end_index].
Returns true if at least one cross-link was found to be fully encompassed by the range, false otherwise.
Returns the list of CrossLink entities associated to this polymer.
Fills-in the index_list_p with indices of monomers involved in cross-links.
This function iterates in this polymer's list of cross-links and checks for each cross-link the monomers that are involved in that cross-link have indices:
The index_list_p is filled only with indices of monomers involved in cross-links of which the monomers are fully contained in range [start_index, end_index].
If partials is not nullptr, then, it is set to the count of cross-links involving monomers only partially contained in range [start_index, end_index].
Returns true if at least one cross-link was found to be fully encompassed by the range, false otherwise.
Returns the date and time.
See also setDateTime().
Outputs a string describing the polymer using qDebug().
Used for debugging purposes.
Determines the element composition of this polymer.
The elemental composition is performed by looking into the core chemical entities of the polymer, like the monomers, the modifications, but also by accounting for the IonizeRule ionize_rule, and the CalcOptions calc_options.
The polymer sequence is accounted for by looking at the coordinate_list list of Coordinates.
Returns the elemental composition.
See also Coordinates, CoordinateList, and IonizeRule.
Returns the file path.
See also setFilePath().
Formats an XML element suitable to describe the <crosslinks>
element.
Iterates in the cross-link list of this polymer and crafts XML elements describing them.
The XML element looks like this:
<crosslinks> <crosslink> <name>DisulfideBond</name> <targets>;2;6;</targets> </crosslink> </crosslinks>
offset times the indent string must be used as a lead in the formatting of elements.
Returns the XML element as a dynamically allocated string.
Creates the XML DTD for a polymer sequence file.
Returns The DTD in a dynamically allocated string.
Formats this polymer's sequence as a string suitable to use as an XML element.
This function generates a string holding all the elements pertaining to this polymer' sequence (the list of monomers, potentially modified, not all the other data). The typical element that is generated in this function looks like this:
<polseq> <codes>MEFEEDWYGEEDWYGTEEDWYGTEEDWYGTEEDWYGTEEDWYGTEEDWYGT</codes> <monomer> <code>S</code> <mdf> <name>Phosphorylation</name> <formula></formula> <targets>*</targets> </mdf> </monomer> </polseq>
offset times the indent string must be used as a lead in the formatting of elements.
Returns a dynamically allocated string that needs to be freed after use.
See also writeXmlFile().
Returns true if a least one monomer in the sequence between residues left_index and right_index is modified.
Returns true if this polymer is modified at its left end.
Returns true if this polymer is modified at its right end.
Returns this polymer's left end modif.
See also setLeftEndModif().
Computes a MD5SUM has with the data described in hash_data_specifs.
If hash_data_specifs & HASH_ACCOUNT_SEQUENCE, the sequence is included in the hash computation. If hash_data_specifs & HASH_ACCOUNT_MONOMER_MODIF, the monomer modifications are included in the hash computation. If hash_data_specifs & HASH_ACCOUNT_POLYMER_MODIF, the polymer modifications are include in the hash computation.
Returns the hash.
Returns the name.
See also setName().
[virtual]
bool Polymer::prepareMonomerRemoval(Monomer *monomer)Prepares for the removal of monomer from this polymer's sequence.
The challenge is that monomers might be involved in cross-links. In that case, removing a monomer that was involved in a cross-link need preparation: it needs to first be uncross-linked.
Returns true;
See also uncrossLink().
[override virtual]
bool Polymer::removeMonomerAt(int index)Reimplements: Sequence::removeMonomerAt(int index).
Removes the monomer at index.
The monomer is first uncross-linked (if it was).
Returns false if the uncross-linking of the monomer failed, true otherwise.
Parses the XML element representing a sequence of monomer codes.
We are getting this: <codes>MEFEEGTEEDWYGTEEDWYGTEEDWYGTEEDWYGT</codes>
about which we need to create Monomers and add them to this polymer's Sequence.
Returns true if parsing and conversion of the text to a monomer list were successful, false otherwise.
See also Sequence::makeMonomerList().
Extracts from element, using the proper function (version), all the CrossLinks contained in it.
Each cross-link is rendered apart and applied to this polymer.
Returns true if no error was encountered, false otherwise.
See also crossLink().
Parses the file_path polymer sequence file.
During parsing, the encountered data are set to this polymer. This parsing is called "rendering".
Returns true if parsing succeeded, false otherwise.
Extracts from element, using the proper function (version), the polymer end modification.
The element tag is found in the polymer sequence XML file.
If the element tag name is le_modif
, the modification name is set to the left end modification of this polymer sequence; if the tag name is re_modif
, the right end of this polymer is modifified. The modifications are then rendered in place.
Returns true if no error was encountered, false otherwise.
See also Modif::renderXmlMdfElement().
Returns this polymer's right end modif.
See also setRightEndModif().
Sets the author.
See also author().
Sets the code.
See also code().
Set the date and time to date_time.
See also dateTime().
Sets the file path to file_path.
See also filePath().
Sets this polymer's left end modification to name.
Returns true if a modification by name was found in the member polymer chemistry definition's list of modifications and if that modification could be set and its masses could be calculated successfully, otherwise returns false.
See also leftEndModif().
Sets this polymer's left end modification to modif.
Returns true if the modification could be set and its masses could be calculated successfully, otherwise returns false.
Sets the name.
See also name().
Sets this polymer's right end modification to name.
Returns true if a modification by name was found in the member polymer chemistry definition's list of modifications and if that modification could be set and its masses could be calculated successfully, otherwise returns false.
See also rightEndModif().
Sets this polymer's right end modification to modif.
Returns true if the modification could be set and its masses could be calculated successfully, otherwise returns false.
Undoes the cross-link cross_link_p.
Returns true upon success or false if the CrossLink does not validate successfully.
[override virtual]
bool Polymer::validate()Reimplements: Ionizable::validate().
Validates the Sequence of this polymer.
Returns true if validation was successful, false, otherwise.
See also Sequence::validate().
Writes this polymer to file.
Returns true if successful, false otherwise.
[static]
QString Polymer::xmlPolymerFileGetPolChemDefName(const QString &file_path)Extracts the name of the polymer chemistry definition from the file_path polymer sequence file.
Returns the polymer chemistry definition name.