<?xml version="1.0" encoding="ascii"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Scientific.IO.PDB.PDBFile</title> <link rel="stylesheet" href="epydoc.css" type="text/css" /> <script type="text/javascript" src="epydoc.js"></script> </head> <body bgcolor="white" text="black" link="blue" vlink="#204080" alink="#204080"> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="Scientific-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <!-- Project homepage --> <th class="navbar" align="right" width="100%"> <table border="0" cellpadding="0" cellspacing="0"> <tr><th class="navbar" align="center" ><a class="navbar" target="_top" href="http://dirac.cnrs-orleans.fr/ScientificPython/">Scientific Python</a></th> </tr></table></th> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="100%"> <span class="breadcrumbs"> <a href="Scientific-module.html">Package Scientific</a> :: <a href="Scientific.IO-module.html">Package IO</a> :: <a href="Scientific.IO.PDB-module.html">Module PDB</a> :: Class PDBFile </span> </td> <td> <table cellpadding="0" cellspacing="0"> <!-- hide/show private --> <tr><td align="right"><span class="options" >[<a href="frames.html" target="_top">frames</a >] | <a href="Scientific.IO.PDB.PDBFile-class.html" target="_top">no frames</a>]</span></td></tr> </table> </td> </tr> </table> <!-- ==================== CLASS DESCRIPTION ==================== --> <h1 class="epydoc">Class PDBFile</h1><p class="nomargin-top"></p> <p><a name="index-PDB"></a><i class="indexterm">PDB</i> file with access at the record level</p> <p>The low-level file access is handled by the module <a href="Scientific.IO.TextFile-module.html" class="link">Scientific.IO.TextFile</a>, therefore compressed files and URLs (for reading) can be used as well.</p> <!-- ==================== INSTANCE METHODS ==================== --> <a name="section-InstanceMethods"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Instance Methods</span></td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="__del__"></a><span class="summary-sig-name">__del__</span>(<span class="summary-sig-arg">self</span>)</span></td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="Scientific.IO.PDB.PDBFile-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">file_or_filename</span>, <span class="summary-sig-arg">mode</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">r</code><code class="variable-quote">'</code></span>, <span class="summary-sig-arg">subformat</span>=<span class="summary-sig-default">None</span>)</span></td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="Scientific.IO.PDB.PDBFile-class.html#close" class="summary-sig-name">close</a>(<span class="summary-sig-arg">self</span>)</span><br /> Close the file.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="Scientific.IO.PDB.PDBFile-class.html#nextChain" class="summary-sig-name">nextChain</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">chain_id</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">segment_id</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>)</span><br /> Signal the beginning of a new chain.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="Scientific.IO.PDB.PDBFile-class.html#nextResidue" class="summary-sig-name">nextResidue</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">name</span>, <span class="summary-sig-arg">number</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">terminus</span>=<span class="summary-sig-default">None</span>)</span><br /> Signal the beginning of a new residue, starting with the next call to <a href="Scientific.IO.PDB.PDBFile-class.html#writeAtom" class="link">writeAtom</a>.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><code>tuple</code></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="Scientific.IO.PDB.PDBFile-class.html#readLine" class="summary-sig-name">readLine</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return the contents of the next non-blank line (= record) The return value is a tuple whose first element (a string) contains the record type.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="terminateChain"></a><span class="summary-sig-name">terminateChain</span>(<span class="summary-sig-arg">self</span>)</span><br /> Signal the end of a chain.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="Scientific.IO.PDB.PDBFile-class.html#writeAtom" class="summary-sig-name">writeAtom</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">name</span>, <span class="summary-sig-arg">position</span>, <span class="summary-sig-arg">occupancy</span>=<span class="summary-sig-default">0.0</span>, <span class="summary-sig-arg">temperature_factor</span>=<span class="summary-sig-default">0.0</span>, <span class="summary-sig-arg">element</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>)</span><br /> Write an ATOM or HETATM record using the information supplied.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="Scientific.IO.PDB.PDBFile-class.html#writeComment" class="summary-sig-name">writeComment</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">text</span>)</span><br /> Write text into one or several comment lines.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="Scientific.IO.PDB.PDBFile-class.html#writeLine" class="summary-sig-name">writeLine</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">type</span>, <span class="summary-sig-arg">data</span>)</span><br /> Write a line using record type and data dictionary in the same format as returned by readLine().</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> </table> <!-- ==================== METHOD DETAILS ==================== --> <a name="section-MethodDetails"></a> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Method Details</span></td> </tr> </table> <a name="__init__"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>, <span class="sig-arg">file_or_filename</span>, <span class="sig-arg">mode</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">r</code><code class="variable-quote">'</code></span>, <span class="sig-arg">subformat</span>=<span class="sig-default">None</span>)</span> <br /><em class="fname">(Constructor)</em> </h3> </td><td align="right" valign="top" > </td> </tr></table> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>file_or_filename</code></strong> (<code>str</code> or <code>file</code>) - the name of the PDB file, or a file object</li> <li><strong class="pname"><code>mode</code></strong> (<code>str</code>) - the file access mode, 'r' (read) or 'w' (write)</li> <li><strong class="pname"><code>subformat</code></strong> (<code>str</code> or <code>NoneType</code>) - indicates a specific dialect of the PDB format. Subformats are defined in <code class="link">Scientific.IO.PDBExportFilters</code>; they are used only when writing.</li> </ul></dd> </dl> </td></tr></table> </div> <a name="close"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">close</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>Close the file. This method <b>must</b> be called for write mode because otherwise the file will be incomplete.</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="nextChain"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">nextChain</span>(<span class="sig-arg">self</span>, <span class="sig-arg">chain_id</span>=<span class="sig-default">None</span>, <span class="sig-arg">segment_id</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>Signal the beginning of a new chain.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>chain_id</code></strong> (<code>str</code> or <code>NoneType</code>) - a chain identifier. If <code>None</code>, consecutive letters from the alphabet are used.</li> <li><strong class="pname"><code>segment_id</code></strong> (<code>str</code>) - a chain identifier</li> </ul></dd> </dl> </td></tr></table> </div> <a name="nextResidue"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">nextResidue</span>(<span class="sig-arg">self</span>, <span class="sig-arg">name</span>, <span class="sig-arg">number</span>=<span class="sig-default">None</span>, <span class="sig-arg">terminus</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>Signal the beginning of a new residue, starting with the next call to <a href="Scientific.IO.PDB.PDBFile-class.html#writeAtom" class="link">writeAtom</a>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>name</code></strong> (<code>str</code>) - the residue name</li> <li><strong class="pname"><code>number</code></strong> (<code>int</code> or <code>NoneType</code>) - the residue number. If <code>None</code>, the residues will be numbered sequentially, starting from 1.</li> <li><strong class="pname"><code>terminus</code></strong> - <code>None</code>, "C", or "N". This information is passed to export filters that can use this information in order to use different atom or residue names in terminal residues.</li> </ul></dd> </dl> </td></tr></table> </div> <a name="readLine"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">readLine</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>Return the contents of the next non-blank line (= record) The return value is a tuple whose first element (a string) contains the record type. For supported record types (HEADER, CRYST1, SCALEn, MTRIXn, ATOM, HETATM, ANISOU, TERM, MODEL, CONECT), the items from the remaining fields are put into a dictionary which is returned as the second tuple element. Most dictionary elements are strings or numbers; atom positions are returned as a vector, and anisotropic temperature factors are returned as a rank-2 tensor, already multiplied by 1.e-4. White space is stripped from all strings except for atom names, whose correct interpretation can depend on an initial space. For unsupported record types, the second tuple element is a string containing the remaining part of the record.</p> <dl class="fields"> <dt>Returns: <code>tuple</code></dt> <dd>the contents of one PDB record</dd> </dl> </td></tr></table> </div> <a name="writeAtom"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">writeAtom</span>(<span class="sig-arg">self</span>, <span class="sig-arg">name</span>, <span class="sig-arg">position</span>, <span class="sig-arg">occupancy</span>=<span class="sig-default">0.0</span>, <span class="sig-arg">temperature_factor</span>=<span class="sig-default">0.0</span>, <span class="sig-arg">element</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>Write an ATOM or HETATM record using the information supplied. The residue and chain information is taken from the last calls to the methods <a href="Scientific.IO.PDB.PDBFile-class.html#nextResidue" class="link">nextResidue</a> and <a href="Scientific.IO.PDB.PDBFile-class.html#nextChain" class="link">nextChain</a>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>name</code></strong> (<code>str</code>) - the atom name</li> <li><strong class="pname"><code>position</code></strong> (<a href="Scientific.Geometry.Vector-class.html" class="link">Scientific.Geometry.Vector</a>) - the atom position</li> <li><strong class="pname"><code>occupancy</code></strong> (<code>float</code>) - the occupancy</li> <li><strong class="pname"><code>temperature_factor</code></strong> (<code>float</code>) - the temperature factor (B-factor)</li> <li><strong class="pname"><code>element</code></strong> (<code>str</code>) - the chemical element</li> </ul></dd> </dl> </td></tr></table> </div> <a name="writeComment"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">writeComment</span>(<span class="sig-arg">self</span>, <span class="sig-arg">text</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>Write text into one or several comment lines. Each line of the text is prefixed with 'REMARK' and written to the file.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>text</code></strong> (<code>str</code>) - the comment contents</li> </ul></dd> </dl> </td></tr></table> </div> <a name="writeLine"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">writeLine</span>(<span class="sig-arg">self</span>, <span class="sig-arg">type</span>, <span class="sig-arg">data</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>Write a line using record type and data dictionary in the same format as returned by readLine(). Default values are provided for non-essential information, so the data dictionary need not contain all entries.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>type</code></strong> (<code>str</code>) - PDB record type</li> <li><strong class="pname"><code>data</code></strong> (<code>tuple</code>) - PDB record data</li> </ul></dd> </dl> </td></tr></table> </div> <br /> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="Scientific-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <!-- Project homepage --> <th class="navbar" align="right" width="100%"> <table border="0" cellpadding="0" cellspacing="0"> <tr><th class="navbar" align="center" ><a class="navbar" target="_top" href="http://dirac.cnrs-orleans.fr/ScientificPython/">Scientific Python</a></th> </tr></table></th> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%%"> <tr> <td align="left" class="footer"> Generated by Epydoc 3.0.1 on Thu Dec 4 08:05:44 2008 </td> <td align="right" class="footer"> <a target="mainFrame" href="http://epydoc.sourceforge.net" >http://epydoc.sourceforge.net</a> </td> </tr> </table> <script type="text/javascript"> <!-- // Private objects are initially displayed (because if // javascript is turned off then we want them to be // visible); but by default, we want to hide them. So hide // them unless we have a cookie that says to show them. checkCookie(); // --> </script> </body> </html>