Oops.. I meant SeqIO.. Thanks Brent!!! I was doing that quickly...<div><br></div><div><br></div><div>Cheers,</div><div><br></div><div>Glen<br><br><div class="gmail_quote">On Wed, Nov 17, 2010 at 1:24 PM, Brent Pedersen <span dir="ltr">&lt;<a href="mailto:bpederse@gmail.com">bpederse@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Wed, Nov 17, 2010 at 1:13 PM, Glen Jarvis &lt;<a href="mailto:glen@glenjarvis.com">glen@glenjarvis.com</a>&gt; wrote:<br>

&gt; BioPython also will do all of this for you -- too:<br>
&gt;&gt;&gt;&gt; from Bio import SeqIO<br>
&gt;<br>
&gt;&gt;&gt;&gt; record = SeqIO.read(&quot;NC_005816.fna&quot;, &quot;fasta&quot;)<br>
&gt;&gt;&gt;&gt; record<br>
&gt; SeqRecord(seq=Seq(&#39;TGTAACGAACGGTGCAATAGTGATCCACACCCAACGCCTGAAATCAGATCCAGG...CTG&#39;,<br>
&gt; SingleLetterAlphabet()), id=&#39;gi|45478711|ref|NC_005816.1|&#39;,<br>
&gt; name=&#39;gi|45478711|ref|NC_005816.1|&#39;,<br>
&gt; description=&#39;gi|45478711|ref|NC_005816.1| Yersinia pestis biovar Microtus<br>
&gt; ... sequence&#39;,<br>
&gt; dbxrefs=[])<br>
&gt;<br>
&gt; You can also look for particular fields (<a href="http://record.id" target="_blank">record.id</a>, record.description, and<br>
&gt; record.sequence):<br>
&gt;<br>
&gt; Look at this tutorial:<br>
&gt; <a href="http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc16" target="_blank">http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc16</a><br>
&gt;<br>
&gt; Cheers,<br>
&gt;<br>
&gt; Glen<br>
<br>
</div>i agree with glen that you should use a library. however, that example<br>
is for a single-entry fasta file. if you want random access to a<br>
multi-fasta, use the SeqIO.index in biopython:<br>
<a href="http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc56" target="_blank">http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc56</a><br>
<br>
if you just want an iterator, use SeqIO.parse<br>
<a href="http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc11" target="_blank">http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc11</a><br>
<font color="#888888"><br>
-brent<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Whatever you can do or imagine, begin it;<br>boldness has beauty, magic, and power in it.<br><br>-- Goethe <br>
</div>