1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579
|
<!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"><br></font></td></tr></table>
<p><tt>pybel - A Python module for accessing OpenBabel<br>
<br>
Global variables:<br>
ob - the underlying SWIG bindings for OpenBabel<br>
informats - a dictionary of supported input formats<br>
outformats - a dictionary of supported output formats<br>
descs - a list of supported descriptors<br>
fps - a list of supported fingerprint types<br>
forcefields - a list of supported forcefields</tt></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="openbabel.html">openbabel</a><br>
<a href="os.html">os</a><br>
</td><td width="25%" valign=top><a href="ImageTk.html">ImageTk</a><br>
<a href="tempfile.html">tempfile</a><br>
</td><td width="25%" valign=top><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, 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-__init__"><strong>__init__</strong></a>(self, OBAtom)</dt></dl>
<dl><dt><a name="Atom-__str__"><strong>__str__</strong></a>(self)</dt></dl>
<hr>
Properties defined here:<br>
<dl><dt><strong>atomicmass</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = atomicmass(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>atomicnum</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = atomicnum(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>cidx</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = cidx(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>coordidx</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = coordidx(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>coords</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = coords(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>exactmass</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = exactmass(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>formalcharge</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = formalcharge(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>heavyvalence</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = heavyvalence(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>heterovalence</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = heterovalence(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>hyb</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = hyb(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>idx</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = idx(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>implicitvalence</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = implicitvalence(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>isotope</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = isotope(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>partialcharge</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = partialcharge(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>spin</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = spin(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>type</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = type(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>valence</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = valence(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>vector</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = vector(self)</dt></dl>
</dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>__dict__</strong> = <dictproxy object><dd><tt>dictionary for instance variables (if defined)</tt></dl>
<dl><dt><strong>__weakref__</strong> = <attribute '__weakref__' of 'Atom' objects><dd><tt>list of weak references to the <a href="__builtin__.html#object">object</a> (if defined)</tt></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>
fingerprint -- a vector calculated by OBFingerprint.FindFingerprint()<br>
<br>
Attributes:<br>
fp -- the underlying fingerprint <a href="__builtin__.html#object">object</a><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-__init__"><strong>__init__</strong></a>(self, fingerprint)</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>
Properties defined here:<br>
<dl><dt><strong>bits</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = bits(self)</dt></dl>
</dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>__dict__</strong> = <dictproxy object><dd><tt>dictionary for instance variables (if defined)</tt></dl>
<dl><dt><strong>__weakref__</strong> = <attribute '__weakref__' of 'Fingerprint' objects><dd><tt>list of weak references to the <a href="__builtin__.html#object">object</a> (if defined)</tt></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 <a href="#Molecule">Molecule</a>.<br>
<br>
Required parameter:<br>
OBMol -- an Open Babel OBMol or any type of cinfony <a href="#Molecule">Molecule</a><br>
<br>
Attributes:<br>
atoms, charge, conformers, data, dim, energy, exactmass, formula, <br>
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>(),<br>
<a href="#Molecule-write">write</a>() <br>
<br>
The underlying 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-__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, all available descriptors are<br>
calculated. See the descs variable for a list of available<br>
descriptors.</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 fingerprint type (default is "FP2"). See the<br>
fps variable for a list of of available fingerprint<br>
types.</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". See the forcefields variable<br>
for a list of available forcefields.<br>
steps -- default is 500<br>
<br>
If the molecule does not have any 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". See the forcefields variable<br>
for a list of available forcefields.<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 -- see the informats variable for a list of available<br>
output formats (default is "smi")<br>
filename -- default is None<br>
overwite -- if the output file already exists, should it<br>
be overwritten? (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>
<br>
To write multiple molecules to the same file you should use<br>
the <a href="#Outputfile">Outputfile</a> class.</tt></dd></dl>
<hr>
Properties defined here:<br>
<dl><dt><strong>atoms</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = atoms(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>charge</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = charge(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>conformers</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = conformers(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>data</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = data(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>dim</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = dim(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>energy</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = energy(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>exactmass</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = exactmass(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>formula</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = formula(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>molwt</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = molwt(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>spin</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = spin(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>sssr</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = sssr(self)</dt></dl>
</dd>
</dl>
<dl><dt><strong>title</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = _gettitle(self)</dt></dl>
</dd>
<dd><dl><dt><a name="-<em>set</em>"><strong><em>set</em></strong></a> = _settitle(self, val)</dt></dl>
</dd>
</dl>
<dl><dt><strong>unitcell</strong></dt>
<dd><dl><dt><a name="-<em>get</em>"><strong><em>get</em></strong></a> = unitcell(self)</dt></dl>
</dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>__dict__</strong> = <dictproxy object><dd><tt>dictionary for instance variables (if defined)</tt></dl>
<dl><dt><strong>__weakref__</strong> = <attribute '__weakref__' of 'Molecule' objects><dd><tt>list of weak references to the <a href="__builtin__.html#object">object</a> (if defined)</tt></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 and other attributes defined here:<br>
<dl><dt><strong>__dict__</strong> = <dictproxy object><dd><tt>dictionary for instance variables (if defined)</tt></dl>
<dl><dt><strong>__weakref__</strong> = <attribute '__weakref__' of 'MoleculeData' objects><dd><tt>list of weak references to the <a href="__builtin__.html#object">object</a> (if defined)</tt></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 - see the outformats variable for a list of available<br>
output formats<br>
filename<br>
<br>
Optional parameters:<br>
overwrite -- if the output file already exists, should it<br>
be overwritten? (default is False)<br>
<br>
Methods:<br>
<a href="#Outputfile-write">write</a>(molecule)<br>
<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 and other attributes defined here:<br>
<dl><dt><strong>__dict__</strong> = <dictproxy object><dd><tt>dictionary for instance variables (if defined)</tt></dl>
<dl><dt><strong>__weakref__</strong> = <attribute '__weakref__' of 'Outputfile' objects><dd><tt>list of weak references to the <a href="__builtin__.html#object">object</a> (if defined)</tt></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 and other attributes defined here:<br>
<dl><dt><strong>__dict__</strong> = <dictproxy object><dd><tt>dictionary for instance variables (if defined)</tt></dl>
<dl><dt><strong>__weakref__</strong> = <attribute '__weakref__' of 'Smarts' objects><dd><tt>list of weak references to the <a href="__builtin__.html#object">object</a> (if defined)</tt></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 - see the informats variable for a list of available<br>
input formats<br>
filename<br>
<br>
You can access the first molecule in a file using the next() method<br>
of the iterator:<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 = list(<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>
>>> 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 - see the informats variable for a list of available<br>
input formats<br>
string<br>
<br>
Example:<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', 'adfout': 'ADF output 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', ...}<br>
<strong>oasa</strong> = None<br>
<strong>operations</strong> = ['Gen3D']<br>
<strong>outformats</strong> = {'adf': 'ADF cartesian input format', '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', ...}</td></tr></table>
</body></html>
|