<?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>Bio.SeqIO.PhdIO</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"> <!-- 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> <th class="navbar" width="100%"></th> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="100%"> <span class="breadcrumbs"> <a href="Bio-module.html">Package Bio</a> :: <a href="Bio.SeqIO-module.html">Package SeqIO</a> :: Module PhdIO </span> </td> <td> <table cellpadding="0" cellspacing="0"> <!-- hide/show private --> <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink" onclick="toggle_private();">hide private</a>]</span></td></tr> <tr><td align="right"><span class="options" >[<a href="frames.html" target="_top">frames</a >] | <a href="Bio.SeqIO.PhdIO-module.html" target="_top">no frames</a>]</span></td></tr> </table> </td> </tr> </table> <!-- ==================== MODULE DESCRIPTION ==================== --> <h1 class="epydoc">Module PhdIO</h1><p class="nomargin-top"><span class="codelink"><a href="Bio.SeqIO.PhdIO-pysrc.html">source code</a></span></p> <p>Bio.SeqIO support for the "phd" file format.</p> <p>PHD files are output by PHRED and used by PHRAP and CONSED.</p> <p>You are expected to use this module via the Bio.SeqIO functions, under the format name "phd". See also the underlying Bio.Sequencing.Phd module.</p> <p>For example, using Bio.SeqIO we can read in one of the example PHRED files from the Biopython unit tests:</p> <pre class="py-doctest"> <span class="py-prompt">>>> </span><span class="py-keyword">from</span> Bio <span class="py-keyword">import</span> SeqIO <span class="py-prompt">>>> </span><span class="py-keyword">for</span> record <span class="py-keyword">in</span> SeqIO.parse(open(<span class="py-string">"Phd/phd1"</span>), <span class="py-string">"phd"</span>): <span class="py-more">... </span> <span class="py-keyword">print</span> record.id <span class="py-more">... </span> <span class="py-keyword">print</span> record.seq[:10], <span class="py-string">"..."</span> <span class="py-more">... </span> <span class="py-keyword">print</span> record.letter_annotations[<span class="py-string">"phred_quality"</span>][:10], <span class="py-string">"..."</span> <span class="py-output">34_222_(80-A03-19).b.ab1</span> <span class="py-output">ctccgtcgga ...</span> <span class="py-output">[9, 9, 10, 19, 22, 37, 28, 28, 24, 22] ...</span> <span class="py-output">425_103_(81-A03-19).g.ab1</span> <span class="py-output">cgggatccca ...</span> <span class="py-output">[14, 17, 22, 10, 10, 10, 15, 8, 8, 9] ...</span> <span class="py-output">425_7_(71-A03-19).b.ab1</span> <span class="py-output">acataaatca ...</span> <span class="py-output">[10, 10, 10, 10, 8, 8, 6, 6, 6, 6] ...</span></pre> <p>Since PHRED files contain quality scores, you can save them as FASTQ or as QUAL files, for example using Bio.SeqIO.write(...), or simply with the format method of the SeqRecord object:</p> <pre class="py-doctest"> <span class="py-prompt">>>> </span><span class="py-keyword">print</span> record[:50].format(<span class="py-string">"fastq"</span>) <span class="py-output">@425_7_(71-A03-19).b.ab1</span> <span class="py-output">acataaatcaaattactnaccaacacacaaaccngtctcgcgtagtggag</span> <span class="py-output">+</span> <span class="py-output">++++))'''')(''')$!$''')''''(+.''$!$))))+)))'''''''</span> <span class="py-output"><BLANKLINE></span></pre> <p>Or,</p> <pre class="py-doctest"> <span class="py-prompt">>>> </span><span class="py-keyword">print</span> record[:50].format(<span class="py-string">"qual"</span>) <span class="py-output">>425_7_(71-A03-19).b.ab1</span> <span class="py-output">10 10 10 10 8 8 6 6 6 6 8 7 6 6 6 8 3 0 3 6 6 6 8 6 6 6 6 7</span> <span class="py-output">10 13 6 6 3 0 3 8 8 8 8 10 8 8 8 6 6 6 6 6 6 6</span> <span class="py-output"><BLANKLINE></span></pre> <p>Note these examples only show the first 50 bases to keep the output short.</p> <!-- ==================== CLASSES ==================== --> <a name="section-Classes"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td colspan="2" class="table-header"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td align="left"><span class="table-header">Classes</span></td> <td align="right" valign="top" ><span class="options">[<a href="#section-Classes" class="privatelink" onclick="toggle_private();" >hide private</a>]</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="Bio.SeqIO.PhdIO.PhdWriter-class.html" class="summary-name">PhdWriter</a><br /> Class to write Phd format files </td> </tr> </table> <!-- ==================== FUNCTIONS ==================== --> <a name="section-Functions"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td colspan="2" class="table-header"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td align="left"><span class="table-header">Functions</span></td> <td align="right" valign="top" ><span class="options">[<a href="#section-Functions" class="privatelink" onclick="toggle_private();" >hide private</a>]</span></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="Bio.SeqIO.PhdIO-module.html#PhdIterator" class="summary-sig-name">PhdIterator</a>(<span class="summary-sig-arg">handle</span>)</span><br /> Returns SeqRecord objects from a PHD file.</td> <td align="right" valign="top"> <span class="codelink"><a href="Bio.SeqIO.PhdIO-pysrc.html#PhdIterator">source code</a></span> </td> </tr> </table> </td> </tr> <tr class="private"> <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="Bio.SeqIO.PhdIO-module.html#_test" class="summary-sig-name" onclick="show_private();">_test</a>()</span><br /> Run the Bio.SeqIO.PhdIO module's doctests.</td> <td align="right" valign="top"> <span class="codelink"><a href="Bio.SeqIO.PhdIO-pysrc.html#_test">source code</a></span> </td> </tr> </table> </td> </tr> </table> <!-- ==================== VARIABLES ==================== --> <a name="section-Variables"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td colspan="2" class="table-header"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td align="left"><span class="table-header">Variables</span></td> <td align="right" valign="top" ><span class="options">[<a href="#section-Variables" class="privatelink" onclick="toggle_private();" >hide private</a>]</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="'Bio.SeqIO'"><code class="variable-quote">'</code><code class="variable-string">Bio.SeqIO</code><code class="variable-quote">'</code></code> </td> </tr> </table> <!-- ==================== FUNCTION DETAILS ==================== --> <a name="section-FunctionDetails"></a> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td colspan="2" class="table-header"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td align="left"><span class="table-header">Function Details</span></td> <td align="right" valign="top" ><span class="options">[<a href="#section-FunctionDetails" class="privatelink" onclick="toggle_private();" >hide private</a>]</span></td> </tr> </table> </td> </tr> </table> <a name="PhdIterator"></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">PhdIterator</span>(<span class="sig-arg">handle</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="Bio.SeqIO.PhdIO-pysrc.html#PhdIterator">source code</a></span> </td> </tr></table> <p>Returns SeqRecord objects from a PHD file.</p> <p>This uses the Bio.Sequencing.Phd module to do the hard work.</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="_test"></a> <div class="private"> <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">_test</span>()</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="Bio.SeqIO.PhdIO-pysrc.html#_test">source code</a></span> </td> </tr></table> <p>Run the Bio.SeqIO.PhdIO module's doctests.</p> <p>This will try and locate the unit tests directory, and run the doctests from there in order that the relative paths used in the examples work.</p> <dl class="fields"> </dl> </td></tr></table> </div> <br /> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- 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> <th class="navbar" width="100%"></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 Aug 18 18:19:22 2011 </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>