NSPDK-based aromaticity prediction.
More...
#include <AP_NSPDK.hh>
Implementation of an AromaticityPerception based on the NSPDK graph
kernel and linear SVM models derived from chemical databases. The graph
kernel features are derived are all anchored within the according ring
of interest.
- Author
- Martin Mann (c) 2011 http://www.bioinf.uni-freiburg.de/~mmann/
Definition at line 38 of file AP_NSPDK.hh.
ggl::chem::AP_NSPDK::AP_NSPDK |
( |
const std::string & |
modelID | ) |
|
Construction
- Parameters
-
model | the aromaticity model to be used |
ggl::chem::AP_NSPDK::AP_NSPDK |
( |
const AP_NSPDK & |
toCopy | ) |
|
Copy construction
- Parameters
-
toCopy | the object to make this a copy of |
virtual ggl::chem::AP_NSPDK::~AP_NSPDK |
( |
| ) |
|
|
virtual |
void ggl::chem::AromaticityPerception::clearData |
( |
| ) |
|
|
protectedinherited |
Resets internal temporary data structures.
virtual AP_NSPDK* ggl::chem::AP_NSPDK::clone |
( |
| ) |
const |
|
virtual |
Creates a heap copy of this instance that has to be deleted by the calling methods later on.
- Returns
- a new instance that is a copy of this object
Implements ggl::chem::AromaticityPerception.
virtual void ggl::chem::AromaticityPerception::correctAromaticity |
( |
Molecule & |
mol, |
|
|
const bool |
checkValence |
|
) |
| throw (std::runtime_error) |
|
virtualinherited |
Identifies aromatic rings within the molecule and relabels atoms and bonds accordingly. If rings are wrongly assigned aromatic, they are relabeled as well.
- Parameters
-
mol | the molecule to correct if needed (done inplace) |
checkValence | whether or not the valence of nodes and bonds should be checked. In error case a std::runtime_error is thrown. |
- Exceptions
-
std::runtime_error | if a canonical relabeling is not possible or the valence checks fail |
Reimplemented in ggl::chem::AP_disabled.
virtual void ggl::chem::AP_NSPDK::findAllRings |
( |
const Molecule & |
mol | ) |
|
|
virtual |
Identifies all rings up to the maximally predictable size of the used NSPDK model and stores them within the allRings container.
- Parameters
-
mol | the molecule to check for rings |
Implements ggl::chem::AromaticityPerception.
virtual std::vector< std::pair< RingList, nspdk::SVector > > ggl::chem::AP_NSPDK::getFeatures |
( |
const Molecule & |
mol | ) |
|
|
virtual |
Identifies all rings and returns for each a RingList representation as well as the according NSPDK features.
Note: if the used model is ringCentered, only ring nodes are viewpoints (ring.ring.begin()..(ring.ring.end()-1))) and thus returned; otherwise a weight for each node is returned.
- Parameters
-
mol | the molecule to check for rings |
- Returns
- a ring representation and the features of each ring
virtual nspdk::SVector ggl::chem::AP_NSPDK::getFeaturesOfRing |
( |
nspdk::GraphClass & |
molGraph, |
|
|
const RingDescriptor & |
ring, |
|
|
const AP_NSPDK_Model & |
aromaticityModel |
|
) |
| |
|
protectedvirtual |
Computes the NSPDK feature vector for a given ring within a molecule. Note, the molecule graph has to show already the according ring relabeling.
Note: if the used model is ringCentered, only ring nodes are viewpoints (ring.ring.begin()..(ring.ring.end()-1))) and thus returned; otherwise a weight for each node is returned.
- Parameters
-
molGraph | the molecule graph containing the ring |
ring | the ring to be described |
aromaticityModel | the model to use |
const AP_NSPDK_Model* const ggl::chem::AP_NSPDK::getModel |
( |
void |
| ) |
const |
Access to the aromaticity model used.
Identifies all rings and returns for each a RingDescriptor as well as the normalized feature weight for each viewpoint node.
Note: if the used model is ringCentered, only ring nodes are viewpoints (ring.ring.begin()..(ring.ring.end()-1))) and thus returned; otherwise a weight for each node is returned.
- Parameters
-
mol | the molecule to check for rings |
- Returns
- a ring representation and the weights for each ring node
virtual double ggl::chem::AP_NSPDK::getPredictionValue |
( |
const RingDescriptor & |
ring | ) |
|
|
protectedvirtual |
Computes the classification prediction value for this ring. This value can be given to "isAromaticRing()" in order to decide if it is aromatic or not.
- Parameters
-
- Returns
- the prediction value for this ring
Generates the set of view point nodes for a given ring in the molecule graph that anchor the feature generation for the NSPDK graph kernel. The view point set depends on the aromaticity model setup, ie. if its covering all nodes or only the ring nodes and their surrounding.
- Parameters
-
molGraph | the graph of interest |
ring | the ring of interest |
model | the model defining what view points to choose |
Computes the normalized NSPDK feature weights for each viewpoint node in the graph for a ring within a molecule. Note, the molecule graph has to show already the according ring relabeling.
Note further: if the model is ringCentered, only ring nodes are viewpoints (ring.ring.begin()..(ring.ring.end()-1))) and thus returned; otherwise a weight for each node is returned.
- Parameters
-
molGraph | the molecule graph containing the ring |
ring | the ring to be described |
aromaticityModel | the model to use |
- Returns
- the feature vector for each viewpoint (see above)
void ggl::chem::AP_NSPDK::identifyAromaticEdges |
( |
const Molecule & |
mol | ) |
|
|
virtual |
Identifies aromatic rings and stores their edges within the aromaticEdges container.
To this end, each ring is classified using an linear NSPDK SVM model of aromaticity.
- Parameters
-
mol | the molecule to check for aromatic rings |
Implements ggl::chem::AromaticityPerception.
virtual void ggl::chem::AP_NSPDK::initializeGraph |
( |
const Molecule |
mol, |
|
|
const std::string |
edgeLabel, |
|
|
const std::string |
ringFlag |
|
) |
| |
|
protectedvirtual |
Initializes the nspdkGraph and relabels all nodes and edges of the nspdkGraph involved within rings.
NOTE: rings that contain edges with valence > 2 or < 1 are ignored!
- Parameters
-
mol | the molecule graph to be used for initialization |
edgeLabel | the edge label to set for all rings |
ringFlag | the flag that is added to the beginning of each node label of nodes involved in a ring |
virtual bool ggl::chem::AP_NSPDK::isAromaticRing |
( |
const RingDescriptor & |
ring | ) |
|
|
protectedvirtual |
Does an aromaticity prediction for the given ring.
- Parameters
-
- Returns
- true if the ring is aromatic; false otherwise
virtual bool ggl::chem::AP_NSPDK::isAromaticRing |
( |
const double |
predictionValue | ) |
|
|
protectedvirtual |
Decides on an aromaticity prediction value if it means aromatic or not.
- Parameters
-
predictionValue | the prediction value to decide on |
- Returns
- true if the ring is aromatic; false otherwise
static void ggl::chem::AromaticityPerception::pruneFusedRings |
( |
std::vector< RingDescriptor * > & |
rings | ) |
|
|
staticprotectedinherited |
Performs a pruning of rings (within the "allRings" container) that are fused versions of smaller rings sharing only one bond.
- Parameters
-
rings | the rings to be pruned |
static void ggl::chem::AromaticityPerception::pruneNonSingleDoubleBondRings |
( |
std::vector< RingDescriptor * > & |
rings, |
|
|
const Molecule & |
mol |
|
) |
| |
|
staticprotectedinherited |
Performs a pruning of rings (within the "allRings" container) that are not composed of single and double bonds only.
- Parameters
-
rings | the rings to be pruned |
mol | the molecule to relabel |
void ggl::chem::AromaticityPerception::relabelMolecule |
( |
Molecule & |
mol, |
|
|
const bool |
checkValence |
|
) |
| throw (std::runtime_error) |
|
protectedinherited |
Relabels the given molecule according to the aromatic rings defined by the aromaticEdges container. All other nodes and edges are set non-aromatic.
- Parameters
-
mol | the molecule to relabel (done inplace) |
checkValence | whether or not the valence of nodes and bonds should be checked. In error case a std::runtime_error is thrown. |
- Exceptions
-
std::runtime_error | if a canonical relabeling is not possible or the valence checks fail |
Is called to report a ring identified by a RingPerception instance.
Here it is used to store each ring within the allRings container.
- Parameters
-
graph | the graph that contains the ring |
ringList | the ring to report |
Implements sgm::RingReporter.
Utility class that converts a RingList, i.e. a list of nodes when traversing a ring within a graph, into the set of nodes that form the ring.
- Parameters
-
graph | the graph that contains the ring |
ringList | the ring list to convert |
- Returns
- the list of nodes traversing the ring
std::vector< RingDescriptor* > ggl::chem::AromaticityPerception::allRings |
|
protectedinherited |
container that will hold all rings of the current molecule -> this list is later pruned to the rings of interest
Definition at line 76 of file AromaticityPerception.hh.
EdgeSet ggl::chem::AromaticityPerception::aromaticEdges |
|
protectedinherited |
nspdk::GraphClass ggl::chem::AP_NSPDK::nspdkGraph |
|
protected |
The documentation for this class was generated from the following file: