[BioPython] Sequence from Fasta
Peter
biopython at maubp.freeserve.co.uk
Sun Jun 29 11:19:13 EDT 2008
On Sun, Jun 29, 2008 at 3:42 PM, Stefanie Lück <lueck at ipk-gatersleben.de> wrote:
> Hi!
>
> Is there a way to extract only the sequence (full length) from a fasta file?
Yes. Based on your requirement to have name-space-sequence, how about:
handle = open(filename)
from Bio import SeqIO
for record in SeqIO.parse(handle, "fasta") :
print "%s %s" % (record.id, record.seq)
handle.close()
> If I try the code from page 10 in the tutorial, I get of course this:
> Seq('CGTAACAAGGTTTCCGTAGGTGAACCTGCGGAAGGATCATTGATGAGACCGTGGAATAAA ...', SingleLetterAlphabet())
Which bit of the tutorial exactly? That looks like printing the
repr() of a Seq object, and Seq objects don't have names. If
something could be clarified that's useful feedback.
Peter
More information about the BioPython
mailing list