| |
- __builtin__.object
-
- Atom
- Fingerprint
- Molecule
- MoleculeData
- 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, data, dim, energy, exactmass, flags, formula,
mod, molwt, spin, sssr, title, unitcell.
(refer to the Open Babel library documentation for more info).
Methods:
write(), calcfp(), calcdesc()
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)
- calcdesc(self, descnames=[])
- Calculate descriptor values.
Optional parameter:
descnames -- a list of names of descriptors
If descnames is not specified, the full list of Open Babel
descriptors is calculated: LogP, PSA and MR.
- 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 MoleculeData(__builtin__.object) |
|
Store molecule data in a dictionary-type object
Required parameters:
obmol -- an Open Babel OBMol
Methods and accessor methods are like those of a dictionary except
that the data is retrieved on-the-fly from the underlying OBMol.
Example:
>>> mol = readfile("sdf", 'head.sdf').next()
>>> data = mol.data
>>> print data
{'Comment': 'CORINA 2.61 0041 25.10.2001', 'NSC': '1'}
>>> print len(data), data.keys(), data.has_key("NSC")
2 ['Comment', 'NSC'] True
>>> print data['Comment']
CORINA 2.61 0041 25.10.2001
>>> data['Comment'] = 'This is a new comment'
>>> for k,v in data.iteritems():
... print k, "-->", v
Comment --> This is a new comment
NSC --> 1
>>> del data['NSC']
>>> print len(data), data.keys(), data.has_key("NSC")
1 ['Comment'] False |
|
Methods defined here:
- __contains__(self, key)
- __delitem__(self, key)
- __getitem__(self, key)
- __init__(self, obmol)
- __iter__(self)
- __len__(self)
- __repr__(self)
- __setitem__(self, key, value)
- clear(self)
- has_key(self, key)
- items(self)
- iteritems(self)
- keys(self)
- update(self, dictionary)
- values(self)
Data and other attributes defined here:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'MoleculeData' 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)
| |