<div dir="ltr"><p>Hello <span style="color:rgb(51,51,51);font-family:arial,helvetica,sans-serif">Ismail,</span></p><p dir="ltr">An easy fix for this is to just use the built in function str() on the Seq output. Parsing the fasta file with SeqIO.parse() should generate SeqRecord objects which will have a Seq object stored as the seq attribute. Calling str() on this attribute will give the string that you want.</p>
<p dir="ltr">>>> from Bio import SeqIO<br>
>>> rec_generator = SeqIO.parse("mylibrary.fasta", "fasta")<br>>>> mydict = {<a href="http://rec.id">rec.id</a> : str(rec.seq) for rec in rec_generator}</p><p>This snippet of code should produce what you are looking for. I would consider working with the native biopython SeqRecord though. It is easier to call str() on a Seq object later than it is to reassign meta-data but obviously you should do what suits your needs best. Also, you might look into SeqIO.index() as it will produce an 'id : SeqRecord' dictionary directly and with greater memory efficiency for large files.</p>
<p>- Evan</p><p><br></p><p dir="ltr">On Jun 29, 2014 7:36 PM, "Ismail Uddin" <<a href="mailto:ismail.sameeuddin@gmail.com" target="_blank">ismail.sameeuddin@gmail.com</a>> wrote:<br>><br>> Dear Sir or Madam,<br>
><br>> I would like to post a question regarding FASTA file parsing using the BioPython module. The current tutorial online indicates how to parse a FASTA file, but the output is in the format Seq('<<sequence here>>', SingleLetterAlphabet())<br>
><br>> I would like to know how one may simply print out the entire sequence without any adjoining text i.e. 'ACTACGGCGAT'<br>><br>> I ask this question, as I am trying to write a script that will read each entry in the FASTA file and produce a dictionary of key being the ID and the val<span style="color:rgb(51,51,51);font-family:arial,helvetica,sans-serif">ue being the raw sequence.</span></p>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(51,51,51)">
<div class="gmail_default">
<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px"><div dir="ltr"><div><font face="arial, helvetica, sans-serif" color="#999999"><div class="gmail_default" style="font-size:small;color:rgb(51,51,51);display:inline">
Thank you in advance for your help and cooperation,<br></div></font></div><div><font face="arial, helvetica, sans-serif" color="#999999"><div class="gmail_default" style="font-size:small;color:rgb(51,51,51);display:inline">
Ismail Uddin</div></font></div></div></div></div>
</div>
<br>_______________________________________________<br>
Biopython mailing list - <a href="mailto:Biopython@mailman.open-bio.org" target="_blank">Biopython@mailman.open-bio.org</a><br>
<a href="http://mailman.open-bio.org/mailman/listinfo/biopython" target="_blank">http://mailman.open-bio.org/mailman/listinfo/biopython</a><br></blockquote></div>
</div>