mirror of
https://github.com/openbabel/openbabel.git
synced 2025-02-25 18:55:23 -06:00
452 lines
28 KiB
HTML
452 lines
28 KiB
HTML
|
|
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html><head><title>Python: module pybel</title>
|
|
</head><body bgcolor="#f0f0f8">
|
|
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
|
|
<tr bgcolor="#7799ee">
|
|
<td valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>pybel</strong></big></big></font></td
|
|
><td align=right valign=bottom
|
|
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:///D|/tools/cinfony/trunk/cinfony/pybel.py">d:\tools\cinfony\trunk\cinfony\pybel.py</a></font></td></tr></table>
|
|
<p></p>
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#aa55cc">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
|
|
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="Image.html">Image</a><br>
|
|
<a href="math.html">math</a><br>
|
|
</td><td width="25%" valign=top><a href="oasa.html">oasa</a><br>
|
|
<a href="openbabel.html">openbabel</a><br>
|
|
</td><td width="25%" valign=top><a href="os.html">os</a><br>
|
|
<a href="ImageTk.html">ImageTk</a><br>
|
|
</td><td width="25%" valign=top><a href="tempfile.html">tempfile</a><br>
|
|
<a href="Tkinter.html">Tkinter</a><br>
|
|
</td></tr></table></td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ee77aa">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
|
|
<td width="100%"><dl>
|
|
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
|
|
</font></dt><dd>
|
|
<dl>
|
|
<dt><font face="helvetica, arial"><a href="pybel.html#Atom">Atom</a>
|
|
</font></dt><dt><font face="helvetica, arial"><a href="pybel.html#Fingerprint">Fingerprint</a>
|
|
</font></dt><dt><font face="helvetica, arial"><a href="pybel.html#Molecule">Molecule</a>
|
|
</font></dt><dt><font face="helvetica, arial"><a href="pybel.html#MoleculeData">MoleculeData</a>
|
|
</font></dt><dt><font face="helvetica, arial"><a href="pybel.html#Outputfile">Outputfile</a>
|
|
</font></dt><dt><font face="helvetica, arial"><a href="pybel.html#Smarts">Smarts</a>
|
|
</font></dt></dl>
|
|
</dd>
|
|
</dl>
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="Atom">class <strong>Atom</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>Represent a Pybel atom.<br>
|
|
<br>
|
|
Required parameter:<br>
|
|
OBAtom -- an Open Babel OBAtom<br>
|
|
<br>
|
|
Attributes:<br>
|
|
atomicmass, atomicnum, cidx, coords, coordidx, exactmass,<br>
|
|
formalcharge, heavyvalence, heterovalence, hyb, idx,<br>
|
|
implicitvalence, index, isotope, partialcharge, spin, type,<br>
|
|
valence, vector.<br>
|
|
<br>
|
|
(refer to the Open Babel library documentation for more info).<br>
|
|
<br>
|
|
The original Open Babel atom can be accessed using the attribute:<br>
|
|
OBAtom<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="Atom-__getattr__"><strong>__getattr__</strong></a>(self, attr)</dt></dl>
|
|
|
|
<dl><dt><a name="Atom-__init__"><strong>__init__</strong></a>(self, OBAtom)</dt></dl>
|
|
|
|
<dl><dt><a name="Atom-__str__"><strong>__str__</strong></a>(self)</dt><dd><tt>Create a string representation of the atom.<br>
|
|
<br>
|
|
>>> a = <a href="#Atom">Atom</a>()<br>
|
|
>>> print a<br>
|
|
<a href="#Atom">Atom</a>: 0 (0.0, 0.0, 0.0)</tt></dd></dl>
|
|
|
|
<hr>
|
|
Data descriptors defined here:<br>
|
|
<dl><dt><strong>__dict__</strong></dt>
|
|
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
|
|
</dl>
|
|
<dl><dt><strong>__weakref__</strong></dt>
|
|
<dd><tt>list of weak references to the object (if defined)</tt></dd>
|
|
</dl>
|
|
</td></tr></table> <p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="Fingerprint">class <strong>Fingerprint</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>A Molecular <a href="#Fingerprint">Fingerprint</a>.<br>
|
|
<br>
|
|
Required parameters:<br>
|
|
obFingerprint -- a vector calculated by OBFingerprint.FindFingerprint()<br>
|
|
<br>
|
|
Attributes:<br>
|
|
fp -- the original obFingerprint<br>
|
|
bits -- a list of bits set in the <a href="#Fingerprint">Fingerprint</a><br>
|
|
<br>
|
|
Methods:<br>
|
|
The "|" operator can be used to calculate the Tanimoto coeff. For example,<br>
|
|
given two Fingerprints 'a', and 'b', the Tanimoto coefficient is given by:<br>
|
|
tanimoto = a | b<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="Fingerprint-__getattr__"><strong>__getattr__</strong></a>(self, attr)</dt></dl>
|
|
|
|
<dl><dt><a name="Fingerprint-__init__"><strong>__init__</strong></a>(self, obFingerprint)</dt></dl>
|
|
|
|
<dl><dt><a name="Fingerprint-__or__"><strong>__or__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="Fingerprint-__str__"><strong>__str__</strong></a>(self)</dt></dl>
|
|
|
|
<hr>
|
|
Data descriptors defined here:<br>
|
|
<dl><dt><strong>__dict__</strong></dt>
|
|
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
|
|
</dl>
|
|
<dl><dt><strong>__weakref__</strong></dt>
|
|
<dd><tt>list of weak references to the object (if defined)</tt></dd>
|
|
</dl>
|
|
</td></tr></table> <p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="Molecule">class <strong>Molecule</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>Represent a Pybel molecule.<br>
|
|
<br>
|
|
Required parameter:<br>
|
|
OBMol -- an Open Babel OBMol<br>
|
|
or<br>
|
|
<a href="#Molecule">Molecule</a> -- any type of cinfony <a href="#Molecule">Molecule</a> (e.g. one from cinfony.rdkit)<br>
|
|
<br>
|
|
If a cinfony <a href="#Molecule">Molecule</a> is provided it will be converted into a pybel <a href="#Molecule">Molecule</a>. <br>
|
|
<br>
|
|
Attributes:<br>
|
|
atoms, charge, data, dim, energy, exactmass, flags, formula, <br>
|
|
mod, molwt, spin, sssr, title, unitcell.<br>
|
|
(refer to the Open Babel library documentation for more info).<br>
|
|
<br>
|
|
Methods:<br>
|
|
<a href="#Molecule-addh">addh</a>(), <a href="#Molecule-calcfp">calcfp</a>(), <a href="#Molecule-calcdesc">calcdesc</a>(), <a href="#Molecule-draw">draw</a>(), <a href="#Molecule-localopt">localopt</a>(), <a href="#Molecule-make3D">make3D</a>(), <a href="#Molecule-removeh">removeh</a>(), <a href="#Molecule-write">write</a>() <br>
|
|
<br>
|
|
The original Open Babel molecule can be accessed using the attribute:<br>
|
|
OBMol<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="Molecule-__getattr__"><strong>__getattr__</strong></a>(self, attr)</dt><dd><tt>Return the value of an attribute<br>
|
|
<br>
|
|
Note: The values are calculated on-the-fly. You may want to store the value in<br>
|
|
a variable if you repeatedly access the same attribute.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Molecule-__init__"><strong>__init__</strong></a>(self, OBMol)</dt></dl>
|
|
|
|
<dl><dt><a name="Molecule-__iter__"><strong>__iter__</strong></a>(self)</dt><dd><tt>Iterate over the Atoms of the <a href="#Molecule">Molecule</a>.<br>
|
|
<br>
|
|
This allows constructions such as the following:<br>
|
|
for atom in mymol:<br>
|
|
print atom</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Molecule-__str__"><strong>__str__</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="Molecule-addh"><strong>addh</strong></a>(self)</dt><dd><tt>Add hydrogens.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Molecule-calcdesc"><strong>calcdesc</strong></a>(self, descnames<font color="#909090">=[]</font>)</dt><dd><tt>Calculate descriptor values.<br>
|
|
<br>
|
|
Optional parameter:<br>
|
|
descnames -- a list of names of descriptors<br>
|
|
<br>
|
|
If descnames is not specified, the full list of Open Babel<br>
|
|
descriptors is calculated: LogP, PSA and MR.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Molecule-calcfp"><strong>calcfp</strong></a>(self, fptype<font color="#909090">='FP2'</font>)</dt><dd><tt>Calculate a molecular fingerprint.<br>
|
|
<br>
|
|
Optional parameters:<br>
|
|
fptype -- the name of the Open Babel fingerprint type.<br>
|
|
<br>
|
|
If fptype is not specified, the FP2 fingerprint type<br>
|
|
is used. See the Open Babel library documentation for more<br>
|
|
details.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Molecule-draw"><strong>draw</strong></a>(self, show<font color="#909090">=True</font>, filename<font color="#909090">=None</font>, update<font color="#909090">=False</font>, usecoords<font color="#909090">=False</font>)</dt><dd><tt>Create a 2D depiction of the molecule.<br>
|
|
<br>
|
|
Optional parameters:<br>
|
|
show -- display on screen (default is True)<br>
|
|
filename -- write to file (default is None)<br>
|
|
update -- update the coordinates of the atoms to those<br>
|
|
determined by the structure diagram generator<br>
|
|
(default is False)<br>
|
|
usecoords -- don't calculate 2D coordinates, just use<br>
|
|
the current coordinates (default is False)<br>
|
|
<br>
|
|
OASA is used for 2D coordinate generation and depiction. Tkinter and<br>
|
|
Python Imaging Library are required for image display.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Molecule-localopt"><strong>localopt</strong></a>(self, forcefield<font color="#909090">='MMFF94'</font>, steps<font color="#909090">=500</font>)</dt><dd><tt>Locally optimize the coordinates.<br>
|
|
<br>
|
|
Optional parameters:<br>
|
|
forcefield -- default is "MMFF94"<br>
|
|
steps -- default is 500<br>
|
|
<br>
|
|
If the molecule does not have 2D or 3D coordinates, <a href="#Molecule-make3D">make3D</a>() is<br>
|
|
called before the optimization. Note that the molecule needs<br>
|
|
to have explicit hydrogens. If not, call <a href="#Molecule-addh">addh</a>().</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Molecule-make3D"><strong>make3D</strong></a>(self, forcefield<font color="#909090">='MMFF94'</font>, steps<font color="#909090">=50</font>)</dt><dd><tt>Generate 3D coordinates.<br>
|
|
<br>
|
|
Optional parameters:<br>
|
|
forcefield -- default is "MMFF94"<br>
|
|
steps -- default is 50<br>
|
|
<br>
|
|
Once coordinates are generated, hydrogens are added and a quick<br>
|
|
local optimization is carried out with 50 steps and the<br>
|
|
MMFF94 forcefield. Call <a href="#Molecule-localopt">localopt</a>() if you want<br>
|
|
to improve the coordinates further.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Molecule-removeh"><strong>removeh</strong></a>(self)</dt><dd><tt>Remove hydrogens.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Molecule-write"><strong>write</strong></a>(self, format<font color="#909090">='SMI'</font>, filename<font color="#909090">=None</font>, overwrite<font color="#909090">=False</font>)</dt><dd><tt>Write the molecule to a file or return a string.<br>
|
|
<br>
|
|
Optional parameters:<br>
|
|
format -- default is "SMI"<br>
|
|
filename -- default is None<br>
|
|
overwite -- default is False<br>
|
|
<br>
|
|
If a filename is specified, the result is written to a file.<br>
|
|
Otherwise, a string is returned containing the result.<br>
|
|
The overwrite flag is ignored if a filename is not specified.<br>
|
|
It controls whether to overwrite an existing file.</tt></dd></dl>
|
|
|
|
<hr>
|
|
Data descriptors defined here:<br>
|
|
<dl><dt><strong>__dict__</strong></dt>
|
|
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
|
|
</dl>
|
|
<dl><dt><strong>__weakref__</strong></dt>
|
|
<dd><tt>list of weak references to the object (if defined)</tt></dd>
|
|
</dl>
|
|
</td></tr></table> <p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="MoleculeData">class <strong>MoleculeData</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>Store molecule data in a dictionary-type <a href="__builtin__.html#object">object</a><br>
|
|
<br>
|
|
Required parameters:<br>
|
|
obmol -- an Open Babel OBMol <br>
|
|
<br>
|
|
Methods and accessor methods are like those of a dictionary except<br>
|
|
that the data is retrieved on-the-fly from the underlying OBMol.<br>
|
|
<br>
|
|
Example:<br>
|
|
>>> mol = <a href="#-readfile">readfile</a>("sdf", 'head.sdf').next()<br>
|
|
>>> data = mol.data<br>
|
|
>>> print data<br>
|
|
{'Comment': 'CORINA 2.61 0041 25.10.2001', 'NSC': '1'}<br>
|
|
>>> print len(data), data.<a href="#MoleculeData-keys">keys</a>(), data.<a href="#MoleculeData-has_key">has_key</a>("NSC")<br>
|
|
2 ['Comment', 'NSC'] True<br>
|
|
>>> print data['Comment']<br>
|
|
CORINA 2.61 0041 25.10.2001<br>
|
|
>>> data['Comment'] = 'This is a new comment'<br>
|
|
>>> for k,v in data.<a href="#MoleculeData-iteritems">iteritems</a>():<br>
|
|
... print k, "-->", v<br>
|
|
Comment --> This is a new comment<br>
|
|
NSC --> 1<br>
|
|
>>> del data['NSC']<br>
|
|
>>> print len(data), data.<a href="#MoleculeData-keys">keys</a>(), data.<a href="#MoleculeData-has_key">has_key</a>("NSC")<br>
|
|
1 ['Comment'] False<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="MoleculeData-__contains__"><strong>__contains__</strong></a>(self, key)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-__delitem__"><strong>__delitem__</strong></a>(self, key)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-__getitem__"><strong>__getitem__</strong></a>(self, key)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-__init__"><strong>__init__</strong></a>(self, obmol)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-__iter__"><strong>__iter__</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-__len__"><strong>__len__</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-__repr__"><strong>__repr__</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-__setitem__"><strong>__setitem__</strong></a>(self, key, value)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-clear"><strong>clear</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-has_key"><strong>has_key</strong></a>(self, key)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-items"><strong>items</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-iteritems"><strong>iteritems</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-keys"><strong>keys</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-update"><strong>update</strong></a>(self, dictionary)</dt></dl>
|
|
|
|
<dl><dt><a name="MoleculeData-values"><strong>values</strong></a>(self)</dt></dl>
|
|
|
|
<hr>
|
|
Data descriptors defined here:<br>
|
|
<dl><dt><strong>__dict__</strong></dt>
|
|
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
|
|
</dl>
|
|
<dl><dt><strong>__weakref__</strong></dt>
|
|
<dd><tt>list of weak references to the object (if defined)</tt></dd>
|
|
</dl>
|
|
</td></tr></table> <p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="Outputfile">class <strong>Outputfile</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>Represent a file to which *output* is to be sent.<br>
|
|
<br>
|
|
Although it's possible to write a single molecule to a file by<br>
|
|
calling the <a href="#Outputfile-write">write</a>() method of a molecule, if multiple molecules<br>
|
|
are to be written to the same file you should use the <a href="#Outputfile">Outputfile</a><br>
|
|
class.<br>
|
|
<br>
|
|
Required parameters:<br>
|
|
format<br>
|
|
filename<br>
|
|
Optional parameters:<br>
|
|
overwrite (default is False) -- if the output file already exists,<br>
|
|
should it be overwritten?<br>
|
|
Methods:<br>
|
|
<a href="#Outputfile-write">write</a>(molecule), <a href="#Outputfile-close">close</a>()<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="Outputfile-__init__"><strong>__init__</strong></a>(self, format, filename, overwrite<font color="#909090">=False</font>)</dt></dl>
|
|
|
|
<dl><dt><a name="Outputfile-close"><strong>close</strong></a>(self)</dt><dd><tt>Close the <a href="#Outputfile">Outputfile</a> to further writing.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Outputfile-write"><strong>write</strong></a>(self, molecule)</dt><dd><tt>Write a molecule to the output file.<br>
|
|
<br>
|
|
Required parameters:<br>
|
|
molecule</tt></dd></dl>
|
|
|
|
<hr>
|
|
Data descriptors defined here:<br>
|
|
<dl><dt><strong>__dict__</strong></dt>
|
|
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
|
|
</dl>
|
|
<dl><dt><strong>__weakref__</strong></dt>
|
|
<dd><tt>list of weak references to the object (if defined)</tt></dd>
|
|
</dl>
|
|
</td></tr></table> <p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="Smarts">class <strong>Smarts</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>A <a href="#Smarts">Smarts</a> Pattern Matcher<br>
|
|
<br>
|
|
Required parameters:<br>
|
|
smartspattern<br>
|
|
<br>
|
|
Methods:<br>
|
|
<a href="#Smarts-findall">findall</a>(molecule)<br>
|
|
<br>
|
|
Example:<br>
|
|
>>> mol = <a href="#-readstring">readstring</a>("smi","CCN(CC)CC") # triethylamine<br>
|
|
>>> smarts = <a href="#Smarts">Smarts</a>("[#6][#6]") # Matches an ethyl group<br>
|
|
>>> print smarts.<a href="#Smarts-findall">findall</a>(mol) <br>
|
|
[(1, 2), (4, 5), (6, 7)]<br>
|
|
<br>
|
|
The numbers returned are the indices (starting from 1) of the atoms<br>
|
|
that match the SMARTS pattern. In this case, there are three matches<br>
|
|
for each of the three ethyl groups in the molecule.<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="Smarts-__init__"><strong>__init__</strong></a>(self, smartspattern)</dt><dd><tt>Initialise with a SMARTS pattern.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Smarts-findall"><strong>findall</strong></a>(self, molecule)</dt><dd><tt>Find all matches of the SMARTS pattern to a particular molecule.<br>
|
|
<br>
|
|
Required parameters:<br>
|
|
molecule</tt></dd></dl>
|
|
|
|
<hr>
|
|
Data descriptors defined here:<br>
|
|
<dl><dt><strong>__dict__</strong></dt>
|
|
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
|
|
</dl>
|
|
<dl><dt><strong>__weakref__</strong></dt>
|
|
<dd><tt>list of weak references to the object (if defined)</tt></dd>
|
|
</dl>
|
|
</td></tr></table></td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#eeaa77">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
|
|
<td width="100%"><dl><dt><a name="-readfile"><strong>readfile</strong></a>(format, filename)</dt><dd><tt>Iterate over the molecules in a file.<br>
|
|
<br>
|
|
Required parameters:<br>
|
|
format<br>
|
|
filename<br>
|
|
<br>
|
|
You can access the first molecule in a file using:<br>
|
|
mol = <a href="#-readfile">readfile</a>("smi", "myfile.smi").next()<br>
|
|
<br>
|
|
You can make a list of the molecules in a file using:<br>
|
|
mols = [mol for mol in <a href="#-readfile">readfile</a>("smi", "myfile.smi")]<br>
|
|
<br>
|
|
You can iterate over the molecules in a file as shown in the<br>
|
|
following code snippet...<br>
|
|
<br>
|
|
>>> atomtotal = 0<br>
|
|
>>> for mol in <a href="#-readfile">readfile</a>("sdf","head.sdf"):<br>
|
|
... atomtotal += len(mol.atoms)<br>
|
|
...<br>
|
|
>>> print atomtotal<br>
|
|
43</tt></dd></dl>
|
|
<dl><dt><a name="-readstring"><strong>readstring</strong></a>(format, string)</dt><dd><tt>Read in a molecule from a string.<br>
|
|
<br>
|
|
Required parameters:<br>
|
|
format<br>
|
|
string<br>
|
|
<br>
|
|
>>> input = "C1=CC=CS1"<br>
|
|
>>> mymol = <a href="#-readstring">readstring</a>("smi",input)<br>
|
|
>>> len(mymol.atoms)<br>
|
|
5</tt></dd></dl>
|
|
</td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#55aa55">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
|
|
<td width="100%"><strong>descs</strong> = ['LogP', 'MR', 'TPSA']<br>
|
|
<strong>forcefields</strong> = ['UFF', 'MMFF94', 'Ghemical']<br>
|
|
<strong>fps</strong> = ['FP2', 'FP3', 'FP4']<br>
|
|
<strong>informats</strong> = {'acr': 'ACR format', 'alc': 'Alchemy format', 'arc': 'Accelrys/MSI Biosym/Insight II CAR format', 'bgf': 'MSI BGF format', 'box': 'Dock 3.5 Box format', 'bs': 'Ball and Stick format', 'c3d1': 'Chem3D Cartesian 1 format', 'c3d2': 'Chem3D Cartesian 2 format', 'caccrt': 'Cacao Cartesian format', 'car': 'Accelrys/MSI Biosym/Insight II CAR format', ...}<br>
|
|
<strong>operations</strong> = ['Gen3D']<br>
|
|
<strong>outformats</strong> = {'alc': 'Alchemy format', 'bgf': 'MSI BGF format', 'box': 'Dock 3.5 Box format', 'bs': 'Ball and Stick format', 'c3d1': 'Chem3D Cartesian 1 format', 'c3d2': 'Chem3D Cartesian 2 format', 'cac': 'CAChe MolStruct format', 'caccrt': 'Cacao Cartesian format', 'cache': 'CAChe MolStruct format', 'cacint': 'Cacao Internal format', ...}</td></tr></table>
|
|
</body></html> |