Loading...
Searching...
No Matches
patty Class Reference

`#include <openbabel/patty.h>`

## Public Member Functions

| patty ()
| patty (char *s)
| patty (const std::string &s)
| ~patty ()
void | debug_on ()
void | debug_off ()
void | read_rules (const std::string &infile)
void | assign_rules (std::vector< std::string > &rules)
void | assign_types (OBMol &mol, std::vector< std::string > &atm_typ)
void | assign_types (OBMol &mol, std::vector< int > &atm_typ)
int | type_to_int (const std::string &type, bool failOnUndefined=false)
int | Istype (const std::string &type)

## Detailed Description

Programmable Atom Typer.

Deprecated
  This code is currently not used by the Open Babel library. Instead, OBAtomTyper and OBAromaticTyper are used. Unless there is interest in retaining this independent class, it will be removed in the future.

Patty stands for programmable atom typer. The patty class was kindly donated by W. Patrick Walters. The patty class provides a more flexible means for atom typing than the OBAtomTyper. The behavior of patty is similar to the OBAtomTyper in that rules apply only to the first atom in the SMARTS pattern. The patty class can read any free format ASCII file which contains SMARTS patterns associated with user defined atom type. The following is an example of a valid patty rule

O=C hbacceptor

The following is a code sample that demonstrates the use of patty class:

OBMol mol;
string rulefile = "rules.txt";
patty p;
p.read_rules(p);
vector<string> type;
p.assign_types(mol,type);
for (int i = 1;i <= mol.NumAtoms();++i)
cout << "atom number " << i << " was given a type " << type[i] << endl;
OpenBabel::OBMol
Molecule Class.
Definition mol.h:121
OpenBabel::OBMol::NumAtoms
unsigned int NumAtoms() const
Definition mol.h:261
OpenBabel::patty::patty
patty()
Definition patty.h:46
OpenBabel::patty::read_rules
void read_rules(const std::string &infile)
Definition patty.cpp:75
OpenBabel::patty::assign_types
void assign_types(OBMol &mol, std::vector< std::string > &atm_typ)
Definition patty.cpp:164

The array indices in the vector<string> into which the result values are placed match the corresponding atom numbers. Since atoms are numbered beginning from one, the first element in the vector<string> is empty, and the values are placed in [1...mol.NumAtoms()].

## Constructor & Destructor Documentation

## patty() [1/3]

patty | ( |  | ) |

inline

## patty() [2/3]

patty | ( | char * | s | ) |

inline

## patty() [3/3]

patty | ( | const std::string & | s | ) |

inline

## ~patty()

~patty | ( |  | ) |

inline

## Member Function Documentation

## debug_on()

void debug_on | ( |  | ) |

inline

## debug_off()

void debug_off | ( |  | ) |

inline

## read_rules()

void read_rules | ( | const std::string & | infile | ) |

Referenced by patty(), and patty().

## assign_rules()

void assign_rules | ( | std::vector< std::string > & | rules | ) |

## assign_types() [1/2]

void assign_types | ( | OBMol & | mol,
|  | std::vector< std::string > & | atm_typ )

## assign_types() [2/2]

void assign_types | ( | OBMol & | mol,
|  | std::vector< int > & | atm_typ )

## type_to_int()

int type_to_int | ( | const std::string & | type,
|  | bool | failOnUndefined = false )

Referenced by assign_types().

## Istype()

int Istype | ( | const std::string & | type | ) |

return atom type index, 0 otherwise

return null if the type does not exist, the type position otherwise the first position start at 1

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

- patty.h
- patty.cpp