[BioPython] How to access the actual sequence from Bio.SeqIO.FASTA

bartek wilczynski bartek at rezolwenta.eu.org
Tue Oct 3 08:00:05 UTC 2006


Citing Wijaya Edward <ewijaya at i2r.a-star.edu.sg>:

> 
> Dear experts,
>  
> I have the following script which try to 
> use Bio.SeqIO's FASTA method to read
> sequence and simply print the actual sequence.
>  
> __BEGIN__
> from Bio.SeqIO import FASTA
> import sys
>  
> handle  = open(sys.argv[1])
> it = FASTA.FastaReader(handle)
> seq = it.next()
> while seq:
>     print seq.seq
>     seq = it.next()
> handle.close()
> __END__
>  
>  
> But how come the output looks like this?
>  
> Seq('AACTAACAGTTTCCCTTGTCTAAAGCCTGCTCCCGATAAAAATAAGGCTGTGGGTTCTGG ...',
> Alphabet())
> Seq('CACCATCAGGGCGAGATTTAGCCGCTAGGTTTGTCTCATGGAAGAAAAGCAGTAGAAAAA ...',
> Alphabet())
> Seq('ACTTCCCACGTACGTCTGCAGGAACTTGCCTGTACCACAGGAAGACGATCGTCATGAGAA ...',
> Alphabet())
> 
> Is there a way to get the actual plain ATCG sequence (i.e wihtout
> brackets,quotes,and Alphabet()).
> Sorry I'm new with Python. Please bear with me. 
> 


Hi, 

seq.seq.tostring() will return a string instead of a sequence object seq.seq

regards 

Bartek Wilczynski


More information about the Biopython mailing list