Loading...
Searching...
No Matches
OBGroupContrib Class Referenceabstract

`#include <openbabel/groupcontrib.h>`

Inheritance diagram for OBGroupContrib:
[legend]

## Public Types

typedef std::map< const char *, OBPlugin *, CharPtrLess > | PluginMapType
typedef PluginMapType::const_iterator | PluginIterator

## Public Member Functions

| OBGroupContrib (const char *ID, const char *filename, const char *descr)
virtual const char * | Description ()
virtual OBGroupContrib * | MakeInstance (const std::vector< std::string > &textlines)
virtual double | Predict (OBBase *pOb, std::string *param=nullptr)
const char * | TypeID ()
double | PredictAndSave (OBBase *pOb, std::string *param=nullptr)
virtual double | GetStringValue (OBBase *pOb, std::string &svalue, std::string *param=nullptr)
virtual bool | Compare (OBBase *pOb, std::istream &ss, bool noEval, std::string *param=nullptr)
virtual bool | Display (std::string &txt, const char *param, const char *ID=nullptr)
virtual bool | Order (double p1, double p2)
virtual bool | Order (std::string s1, std::string s2)
virtual void | Init ()
const char * | GetID () const
virtual PluginMapType & | GetMap () const =0

## Static Public Member Functions

static bool | FilterCompare (OBBase *pOb, std::istream &ss, bool noEval)
static void | AddProperties (OBBase *pOb, const std::string &DescrList)
static void | DeleteProperties (OBBase *pOb, const std::string &DescrList)
static std::string | GetValues (OBBase *pOb, const std::string &DescrList)
static std::pair< std::string, std::string > | GetIdentifier (std::istream &optionText)
static OBPlugin * | GetPlugin (const char *Type, const char *ID)
static bool | ListAsVector (const char *PluginID, const char *param, std::vector< std::string > &vlist)
static void | List (const char *PluginID, const char *param=nullptr, std::ostream *os=&std::cout)
static std::string | ListAsString (const char *PluginID, const char *param=nullptr)
static std::string | FirstLine (const char *txt)
static PluginIterator | Begin (const char *PluginID)
static PluginIterator | End (const char *PluginID)
static void | LoadAllPlugins ()

## Static Protected Member Functions

static double | ParsePredicate (std::istream &optionText, char &ch1, char &ch2, std::string &svalue)
static bool | ReadStringFromFilter (std::istream &ss, std::string &result)
static bool | CompareStringWithFilter (std::istream &optionText, std::string &s, bool noEval, bool NoCompOK=false)
static bool | ispunctU (char ch)
static bool | MatchPairData (OBBase *pOb, std::string &s)
static PluginMapType & | PluginMap ()
static PluginMapType & | GetTypeMap (const char *PluginID)
static OBPlugin * | BaseFindType (PluginMapType &Map, const char *ID)

## Protected Attributes

const char * | _id

## Static Protected Attributes

static int | AllPluginsLoaded = 0

## Detailed Description

Handle group contribution algorithms.

This is the base class for calculations that use the JOELib2 contribution algorithm.

## Constructor & Destructor Documentation

## OBGroupContrib()

OBGroupContrib | ( | const char * | ID,
|  | const char * | filename,
|  | const char * | descr )

inline

constructor. Each instance provides an ID and a datafile.

Predict the logP, MR, TPSA (each instance of OBGroupContrib uses different parameters loaded from its own datafile) for molecule mol using the group contributions algorithm from JOELib2.

Referenced by MakeInstance().

## Member Function Documentation

## Description()

virtual const char * Description | ( |  | ) |

virtual

Required description of a sub-type.

Reimplemented from OBPlugin.

## MakeInstance()

virtual OBGroupContrib * MakeInstance | ( | const std::vector< std::string > & |  | ) |

inline virtual

Make a new instance of the class. See OpTransform, OBGroupContrib, SmartsDescriptor classes for derived versions. Usually, the first parameter is the classname, the next three are parameters(ID, filename, description) for a constructor, and the rest data.

Reimplemented from OBPlugin.

## Predict()

virtual double Predict | ( | OBBase * | ,
|  | std::string * | = nullptr )

virtual

Returns
  the value of a numeric descriptor

Reimplemented from OBDescriptor.

## TypeID()

const char * TypeID | ( |  | ) |

inline virtual inherited

Redefined by each plugin type: "formats", "fingerprints", etc.

Reimplemented from OBPlugin.

## PredictAndSave()

double PredictAndSave | ( | OBBase * | pOb,
|  | std::string * | param = nullptr )

inherited

Returns
  the value of the descriptor and adds it to the object's OBPairData

Referenced by AddProperties().

## GetStringValue()

double GetStringValue | ( | OBBase * | pOb,
|  | std::string & | svalue,
|  | std::string * | param = nullptr )

virtual inherited

Provides a string value for non-numeric descriptors and returns NaN, or a string representation and returns a numeric value.

This default version provides a string representation of the numeric value.

Referenced by GetValues(), and PredictAndSave().

## Compare()

bool Compare | ( | OBBase * | pOb,
|  | std::istream & | ss,
|  | bool | noEval,
|  | std::string * | param = nullptr )

virtual inherited

Parses the filter stream for a relational expression and returns its result when applied to the chemical object.

Compare() is a virtual function and can be overridden to allow different comparison behaviour. The default implementation here is suitable for OBDescriptor classes which return a double value. The stringstream is parsed to retrieve a comparison operator, one of > < >= <= = == != , and a numerical value. The function compares this the value returned by Predict() and returns the result. The stringstream is left after the number, and its state reflects whether any errors have occurred. If noEval is true, the parsing is as normal but Predict is not called and the function returns false.

Referenced by FilterCompare().

## Display()

bool Display | ( | std::string & | txt,
|  | const char * | param,
|  | const char * | ID = nullptr )

virtual inherited

Write information on a plugin class to the string txt. If the parameter is a descriptor ID, displays the verbose description for that descriptor only e.g. babel -L descriptors HBA1

Reimplemented from OBPlugin.

## Order() [1/2]

virtual bool Order | ( | double | p1,
|  | double | p2 )

inline virtual inherited

Comparison of the values of the descriptor. Used in sorting. Descriptors may use more complicated ordering than this default (e.g.InChIFilter)

## Order() [2/2]

virtual bool Order | ( | std::string | s1,
|  | std::string | s2 )

inline virtual inherited

## FilterCompare()

bool FilterCompare | ( | OBBase * | pOb,
|  | std::istream & | optionText,
|  | bool | noEval )

static inherited

Interprets the –filter option string and returns the combined result of all the comparisons it contains.

The string has the form: PropertyID1 predicate1 [booleanOp] PropertyID2 predicate2 ... The propertyIDs are the ID of instances of a OBDescriptor class or the Attributes of OBPairData, and contain only letters, numbers and underscores. The predicates must start with a punctuation character and are interpreted by the Compare function of the OBDescriptor class. The default implementation expects a comparison operator and a number, e.g. >=1.3 Whitespace is optional and is ignored. Each predicate and this OBBase object (usually OBMol) is passed to the Compare function of a OBDescriptor. The result of each comparison is combined in a boolean expression (which can include parentheses) in the normal way. The AND operator can be & or &&, the OR operator can be | or ||, and a unitary NOT is ! The expected operator precedence is achieved using recursive calls of the function. If there is no boolean Op, all the tests have to return true for the function to return true, i.e. the default is AND. If the first operand of an AND is 0, or of an OR is 1, the parsing of the second operand continues but no comparisons are done since the result does not matter.

Referenced by OBMol::DoTransformations(), and FilterCompare().

## AddProperties()

void AddProperties | ( | OBBase * | pOb,
|  | const std::string & | DescrList )

static inherited

Reads list of descriptor IDs and calls PredictAndSave() for each.

Referenced by OBMol::DoTransformations().

## DeleteProperties()

void DeleteProperties | ( | OBBase * | pOb,
|  | const std::string & | DescrList )

static inherited

Deletes all the OBPairDatas whose attribute names are in the list (if they exist).

Referenced by OBMol::DoTransformations().

## GetValues()

string GetValues | ( | OBBase * | pOb,
|  | const std::string & | DescrList )

static inherited

Reads list of descriptor IDs and OBPairData names and returns a list of values, each precede by a space or the first character in the list if it is whitespace or punctuation.

Referenced by OBMol::DoTransformations().

## GetIdentifier()

pair< string, string > GetIdentifier | ( | std::istream & | optionText | ) |

static inherited

Read an identifier and its parameter from the filter string.

Referenced by AddProperties(), FilterCompare(), and GetValues().

## ParsePredicate()

double ParsePredicate | ( | std::istream & | optionText,
|  | char & | ch1,
|  | char & | ch2,
|  | std::string & | svalue )

static protected inherited

Reads comparison operator and the following string. Return its value if possible else NaN.

Referenced by CompareStringWithFilter(), and FilterCompare().

## ReadStringFromFilter()

bool ReadStringFromFilter | ( | std::istream & | ss,
|  | std::string & | result )

static protected inherited

Reads a string from the filter string optionally preceded by = or !=.

Reads a string from the filter stream, optionally preceded by = or !=

Returns
  false if != operator found, and true otherwise.

On entry the stringstream position should be just after the ID. On exit it is after the string. If there is an error, the stringstream badbit is set. Returns false if != found, to indicate negation. Can be of any of the following forms: mystring =mystring ==mystring [must be terminated by a space or tab] "mystring" 'mystring' ="mystring" ='mystring' [mystring can contain spaces or tabs] !=mystring !="mystring" [Returns false indicating negate] There can be spaces or tabs after the operator = == !=

Referenced by ParsePredicate().

## CompareStringWithFilter()

bool CompareStringWithFilter | ( | std::istream & | optionText,
|  | std::string & | s,
|  | bool | noEval,
|  | bool | NoCompOK = false )

static protected inherited

Makes a comparison using the operator and a string read from the filter stream with a provided string.

Returns
  the result of the comparison and true if NoCompOK==true and there is no comparison operator.

Referenced by FilterCompare().

## ispunctU()

bool ispunctU | ( | char | ch | ) |

inline static protected inherited

Referenced by Compare(), FilterCompare(), GetIdentifier(), and GetValues().

## MatchPairData()

bool MatchPairData | ( | OBBase * | pOb,
|  | std::string & | s )

static protected inherited

Returns
  true if s (with or without _ replaced by spaces) is a PairData attribute. On return s is the form which matches.

Referenced by DeleteProperties(), FilterCompare(), and GetValues().

The documentation for this class was generated from the following file:

- groupcontrib.h