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"><<a href="mailto:bpederse@gmail.com">bpederse@gmail.com</a>></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 <<a href="mailto:glen@glenjarvis.com">glen@glenjarvis.com</a>> wrote:<br>
> BioPython also will do all of this for you -- too:<br>
>>>> from Bio import SeqIO<br>
><br>
>>>> record = SeqIO.read("NC_005816.fna", "fasta")<br>
>>>> record<br>
> SeqRecord(seq=Seq('TGTAACGAACGGTGCAATAGTGATCCACACCCAACGCCTGAAATCAGATCCAGG...CTG',<br>
> SingleLetterAlphabet()), id='gi|45478711|ref|NC_005816.1|',<br>
> name='gi|45478711|ref|NC_005816.1|',<br>
> description='gi|45478711|ref|NC_005816.1| Yersinia pestis biovar Microtus<br>
> ... sequence',<br>
> dbxrefs=[])<br>
><br>
> You can also look for particular fields (<a href="http://record.id" target="_blank">record.id</a>, record.description, and<br>
> record.sequence):<br>
><br>
> Look at this tutorial:<br>
> <a href="http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc16" target="_blank">http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc16</a><br>
><br>
> Cheers,<br>
><br>
> 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>