[BioPython] parsing fasta file to list of sequences

Faheem Mitha faheem at email.unc.edu
Wed Apr 13 14:30:11 EDT 2005



On Wed, 13 Apr 2005, Frank Kauff wrote:

> [fkauff at osiris align]$ cat fasta
>> one
> AAAAA
>> two
> CCCCCC
>> three
> GGGGGGGG
>
>>>> from Bio import SeqUtils
>>>> fasta=SeqUtils.quick_FASTA_reader('fasta')
>>>> names,seqs=zip(*fasta)
>>>> names
> ('one', 'two', 'three')
>>>> seqs
> ('AAAAA', 'CCCCCC', 'GGGGGGGG')
>
> or to get exactly what you wanted
>
>>>> seqs2=[[s[1]] for s in fasta]
>>>> seqs2
> [['AAAAA'], ['CCCCCC'], ['GGGGGGGG']]

Thanks Frank. That's very helpful.                   Faheem.


More information about the BioPython mailing list