<?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.AlignIO.FastaIO.FastaM10Iterator</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.AlignIO-module.html">Package AlignIO</a> :: <a href="Bio.AlignIO.FastaIO-module.html">Module FastaIO</a> :: Class FastaM10Iterator </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.AlignIO.FastaIO.FastaM10Iterator-class.html" target="_top">no frames</a>]</span></td></tr> </table> </td> </tr> </table> <!-- ==================== CLASS DESCRIPTION ==================== --> <h1 class="epydoc">Class FastaM10Iterator</h1><p class="nomargin-top"><span class="codelink"><a href="Bio.AlignIO.FastaIO-pysrc.html#FastaM10Iterator">source code</a></span></p> <pre class="base-tree"> <a href="Bio.AlignIO.Interfaces.AlignmentIterator-class.html">Interfaces.AlignmentIterator</a> --+ | <strong class="uidshort">FastaM10Iterator</strong> </pre> <hr /> <pre class="literalblock"> Alignment iterator for the FASTA tool's pairwise alignment output. This is for reading the pairwise alignments output by Bill Pearson's FASTA program when called with the -m 10 command line option for machine readable output. For more details about the FASTA tools, see the website http://fasta.bioch.virginia.edu/ and the paper: W.R. Pearson & D.J. Lipman PNAS (1988) 85:2444-2448 This class is intended to be used via the Bio.AlignIO.parse() function by specifying the format as "fasta-m10" as shown in the following code: from Bio import AlignIO handle = ... for a in AlignIO.parse(handle, "fasta-m10") : assert len(a.get_all_seqs()) == 2, "Should be pairwise!" print "Alignment length %i" % a.get_alignment_length() for record in a : print record.seq, record.name, record.id Note that this is not a full blown parser for all the information in the FASTA output - for example, most of the header and all of the footer is ignored. Also, the alignments are not batched according to the input queries. Also note that there can be up to about 30 letters of flanking region included in the raw FASTA output as contextual information. This is NOT part of the alignment itself, and is not included in the resulting Alignment objects returned. </pre> <!-- ==================== 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 colspan="2" class="table-header"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td align="left"><span class="table-header">Instance Methods</span></td> <td align="right" valign="top" ><span class="options">[<a href="#section-InstanceMethods" 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.AlignIO.FastaIO.FastaM10Iterator-class.html#next" class="summary-sig-name">next</a>(<span class="summary-sig-arg">self</span>)</span><br /> Reads from the handle to construct and return the next alignment.</td> <td align="right" valign="top"> <span class="codelink"><a href="Bio.AlignIO.FastaIO-pysrc.html#FastaM10Iterator.next">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.AlignIO.FastaIO.FastaM10Iterator-class.html#_skip_file_header" class="summary-sig-name" onclick="show_private();">_skip_file_header</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">line</span>)</span><br /> Helper function for the main parsing code.</td> <td align="right" valign="top"> <span class="codelink"><a href="Bio.AlignIO.FastaIO-pysrc.html#FastaM10Iterator._skip_file_header">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.AlignIO.FastaIO.FastaM10Iterator-class.html#_parse_query_header" class="summary-sig-name" onclick="show_private();">_parse_query_header</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">line</span>)</span><br /> Helper function for the main parsing code.</td> <td align="right" valign="top"> <span class="codelink"><a href="Bio.AlignIO.FastaIO-pysrc.html#FastaM10Iterator._parse_query_header">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.AlignIO.FastaIO.FastaM10Iterator-class.html#_extract_alignment_region" class="summary-sig-name" onclick="show_private();">_extract_alignment_region</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">alignment_seq_with_flanking</span>, <span class="summary-sig-arg">annotation</span>)</span><br /> Helper function for the main parsing code.</td> <td align="right" valign="top"> <span class="codelink"><a href="Bio.AlignIO.FastaIO-pysrc.html#FastaM10Iterator._extract_alignment_region">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.AlignIO.FastaIO.FastaM10Iterator-class.html#_parse_tag_section" class="summary-sig-name" onclick="show_private();">_parse_tag_section</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">line</span>, <span class="summary-sig-arg">dictionary</span>)</span><br /> Helper function for the main parsing code.</td> <td align="right" valign="top"> <span class="codelink"><a href="Bio.AlignIO.FastaIO-pysrc.html#FastaM10Iterator._parse_tag_section">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td colspan="2" class="summary"> <p class="indent-wrapped-lines"><b>Inherited from <code><a href="Bio.AlignIO.Interfaces.AlignmentIterator-class.html">Interfaces.AlignmentIterator</a></code></b>: <code><a href="Bio.AlignIO.Interfaces.AlignmentIterator-class.html#__init__">__init__</a></code>, <code><a href="Bio.AlignIO.Interfaces.AlignmentIterator-class.html#__iter__">__iter__</a></code> </p> </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 colspan="2" class="table-header"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td align="left"><span class="table-header">Method Details</span></td> <td align="right" valign="top" ><span class="options">[<a href="#section-MethodDetails" class="privatelink" onclick="toggle_private();" >hide private</a>]</span></td> </tr> </table> </td> </tr> </table> <a name="next"></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">next</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="Bio.AlignIO.FastaIO-pysrc.html#FastaM10Iterator.next">source code</a></span> </td> </tr></table> <p>Reads from the handle to construct and return the next alignment.</p> <p>This returns the pairwise alignment of query and match/library sequences as an Alignment object containing two rows.</p> <dl class="fields"> <dt>Overrides: <a href="Bio.AlignIO.Interfaces.AlignmentIterator-class.html#next">Interfaces.AlignmentIterator.next</a> </dt> </dl> </td></tr></table> </div> <a name="_skip_file_header"></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">_skip_file_header</span>(<span class="sig-arg">self</span>, <span class="sig-arg">line</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="Bio.AlignIO.FastaIO-pysrc.html#FastaM10Iterator._skip_file_header">source code</a></span> </td> </tr></table> <p>Helper function for the main parsing code.</p> <p>Skips over the file header region.</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="_parse_query_header"></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">_parse_query_header</span>(<span class="sig-arg">self</span>, <span class="sig-arg">line</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="Bio.AlignIO.FastaIO-pysrc.html#FastaM10Iterator._parse_query_header">source code</a></span> </td> </tr></table> <p>Helper function for the main parsing code.</p> <p>Skips over the free format query header, extracting the tagged parameters.</p> <p>If there are no hits for the current query, it is skipped entirely.</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="_extract_alignment_region"></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">_extract_alignment_region</span>(<span class="sig-arg">self</span>, <span class="sig-arg">alignment_seq_with_flanking</span>, <span class="sig-arg">annotation</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="Bio.AlignIO.FastaIO-pysrc.html#FastaM10Iterator._extract_alignment_region">source code</a></span> </td> </tr></table> <p>Helper function for the main parsing code.</p> <p>To get the actual pairwise alignment sequences, we must first translate the un-gapped sequence based coordinates into positions in the gapped sequence (which may have a flanking region shown using leading - characters). To date, I have never seen any trailing flanking region shown in the m10 file, but the following code should also cope with that.</p> <p>Note that this code seems to work fine even when the "sq_offset" entries are prsent as a result of using the -X command line option.</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="_parse_tag_section"></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">_parse_tag_section</span>(<span class="sig-arg">self</span>, <span class="sig-arg">line</span>, <span class="sig-arg">dictionary</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="Bio.AlignIO.FastaIO-pysrc.html#FastaM10Iterator._parse_tag_section">source code</a></span> </td> </tr></table> <pre class="literalblock"> Helper function for the main parsing code. line - supply line just read from the handle containing the start of the tagged section. dictionary - where to record the tagged values Returns a string, the first line following the tagged section. </pre> <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 Mon Sep 15 09:26:30 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>