| |
- __builtin__.object
-
- Atom
- Fingerprint
- Molecule
- Outputfile
- Smarts
class Atom(__builtin__.object) |
|
Represent a Pybel atom.
Optional parameters:
OBAtom -- an Open Babel Atom (default is None)
index -- the index of the atom in the molecule (default is None)
An empty Atom is created if an Open Babel atom is not provided.
Attributes:
atomicmass, atomicnum, cidx, coords, coordidx, exactmass,
formalcharge, heavyvalence, heterovalence, hyb, idx,
implicitvalence, index, isotope, partialcharge, spin, type,
valence, vector.
(refer to the Open Babel library documentation for more info).
The original Open Babel atom can be accessed using the attribute:
OBAtom |
|
Methods defined here:
- __getattr__(self, attr)
- __init__(self, OBAtom=None, index=None)
- __str__(self)
- Create a string representation of the atom.
>>> a = Atom()
>>> print a
Atom: 0 (0.0, 0.0, 0.0)
Data and other attributes defined here:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Atom' objects>
- list of weak references to the object (if defined)
|
class Fingerprint(__builtin__.object) |
|
A Molecular Fingerprint.
Required parameters:
obFingerprint -- a vector calculated by OBFingerprint.FindFingerprint()
Attributes:
fp -- the original obFingerprint
bits -- a list of bits set in the Fingerprint
Methods:
The "|" operator can be used to calculate the Tanimoto coeff. For example,
given two Fingerprints 'a', and 'b', the Tanimoto coefficient is given by:
tanimoto = a | b |
|
Methods defined here:
- __getattr__(self, attr)
- __init__(self, obFingerprint)
- __or__(self, other)
- __str__(self)
Data and other attributes defined here:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Fingerprint' objects>
- list of weak references to the object (if defined)
|
class Molecule(__builtin__.object) |
|
Represent a Pybel molecule.
Optional parameters:
OBMol -- an Open Babel molecule (default is None)
An empty Molecule is created if an Open Babel molecule is not provided.
Attributes:
atoms, charge, dim, energy, exactmass, flags, formula,
mod, molwt, spin, sssr, title.
(refer to the Open Babel library documentation for more info).
Methods:
write(), calcfp()
The original Open Babel molecule can be accessed using the attribute:
OBMol |
|
Methods defined here:
- __getattr__(self, attr)
- Return the value of an attribute
Note: The values are calculated on-the-fly. You may want to store the value in
a variable if you repeatedly access the same attribute.
- __init__(self, OBMol=None)
- __iter__(self)
- Iterate over the Atoms of the Molecule.
This allows constructions such as the following:
for atom in mymol:
print atom
- __str__(self)
- calcfp(self, fptype='')
- Calculate a molecular fingerprint.
Optional parameters:
fptype -- the name of the Open Babel fingerprint type.
If fptype is not specified, the default Open Babel fingerprint
type is used. See the Open Babel library documentation for more
details.
- write(self, format='SMI', filename=None, overwrite=False)
- Write the molecule to a file or return a string.
Optional parameters:
format -- default is "SMI"
filename -- default is None
overwite -- default is False
If a filename is specified, the result is written to a file.
Otherwise, a string is returned containing the result.
The overwrite flag is ignored if a filename is not specified.
It controls whether to overwrite an existing file.
Data and other attributes defined here:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Molecule' objects>
- list of weak references to the object (if defined)
|
class Outputfile(__builtin__.object) |
|
Represent a file to which *output* is to be sent.
Although it's possible to write a single molecule to a file by
calling the write() method of a molecule, if multiple molecules
are to be written to the same file you should use the Outputfile
class.
Required parameters:
format
filename
Optional parameters:
overwrite (default is False) -- if the output file already exists,
should it be overwritten?
Methods:
write(molecule) |
|
Methods defined here:
- __init__(self, format, filename, overwrite=False)
- close(self)
- Close the Outputfile to further writing.
- write(self, molecule)
- Write a molecule to the output file.
Required parameters:
molecule
Data and other attributes defined here:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Outputfile' objects>
- list of weak references to the object (if defined)
|
class Smarts(__builtin__.object) |
|
A Smarts Pattern Matcher
Required parameters:
smartspattern
Methods:
findall()
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)] |
|
Methods defined here:
- __init__(self, smartspattern)
- Initialise with a SMARTS pattern.
- findall(self, molecule)
- Find all matches of the SMARTS pattern to a particular molecule.
Required parameters:
molecule
Data and other attributes defined here:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Smarts' objects>
- list of weak references to the object (if defined)
| |