[BioPython] how to send a seq object to an outgoing Fasta stream

Leighton Pritchard L.Pritchard at scri.sari.ac.uk
Mon Sep 22 04:16:45 EDT 2003


Hi Andrew,

There's an analogous SeqIO module in BioPython, which contains a FASTA 
format writer, which can be used like this:

from Bio.SeqIO.FASTA import FastaWriter
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq

outfile = open('test.fas', 'w')
writer = FastaWriter(outfile)
record = SeqRecord(Seq('ACGTACGTACGTACGT'),  id='Test sequence')

writer.write(record)

hope this helps...


At 16:51 19/09/2003 -0500, you wrote:
>stillnew to biopython and i am coming from the other biop project..
>
>If i have a seq object or a seqrecord object and I want to then print it 
>in FASTA format, what should I do?
>I noticed that the Fasta.Record object does not take any arguments when 
>intialized and I cant seem to find a way to define an outward going FASTA 
>stream(or do you even do this in pythone) like in bioperl :
>$out=Bio::SeqIO->new(-format=>'fasta);
>$out->write_seq($seq_obj)
>
>What is the equiv in biopython?
>Thanks
>
>---------------------------------------------------
>Andrew Nunberg Ph.D
>Bioinfomagician
>Orion Genomics
>4041 Forest Park
>St Louis, MO
>314-615-6989
>anunberg at oriongenomics.com
>www.oriongenomics.com
>
>_______________________________________________
>BioPython mailing list  -  BioPython at biopython.org
>http://biopython.org/mailman/listinfo/biopython

Dr Leighton Pritchard AMRSC
PPI, Scottish Crop Research Institute
Invergowrie, Dundee, DD2 5DA, Scotland, UK
L.Pritchard at scri.sari.ac.uk
PGP key FEFC205C: http://www.keyserver.net http://pgp.mit.edu



More information about the BioPython mailing list