Package cinfony :: Module pybel :: Class Smarts
[frames] | no frames]

Class Smarts

source code

object --+
         |
        Smarts

A Smarts Pattern Matcher

Required parameters:
   smartspattern

Methods:
   findall(molecule)

Example:
>>> mol = readstring("smi","CCN(CC)CC") # triethylamine
>>> smarts = Smarts("[#6][#6]") # Matches an ethyl group
>>> print smarts.findall(mol)
[(1, 2), (4, 5), (6, 7)]

The numbers returned are the indices (starting from 1) of the atoms
that match the SMARTS pattern. In this case, there are three matches
for each of the three ethyl groups in the molecule.

Instance Methods
 
__init__(self, smartspattern)
Initialise with a SMARTS pattern.
source code
 
findall(self, molecule)
Find all matches of the SMARTS pattern to a particular molecule.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, smartspattern)
(Constructor)

source code 

Initialise with a SMARTS pattern.

Overrides: object.__init__

findall(self, molecule)

source code 
Find all matches of the SMARTS pattern to a particular molecule.

Required parameters:
   molecule