[Bioperl-l] Parsing a Fasta file

michael watson (IAH-C) michael.watson at bbsrc.ac.uk
Thu Apr 1 13:47:16 EST 2004


use Bio::SeqIO;

my $in = Bio::SeqIO->new (-file => "/path/to/file/of/sequences.fasta",
				  -format => "Fasta");

while(my $seq = $in->next_seq) {
	print $seq->primary_id, "\n";
	print $seq->seq, "\n";
}

-----Original Message-----
From: Desmond LIM [mailto:desmond_lim at bti.a-star.edu.sg]
Sent: 01 April 2004 03:54
To: bioperl-l at bioperl.org
Subject: [Bioperl-l] Parsing a Fasta file


I have a file that contains protein sequences in fasta format.
 
I need to be able to read each sequence individually, with their
accessions (to check against a database). I was wondering if there is a
module that could do that, giving me 2 variables (the accession and
sequence). I have gone throught the bioperl modules and I found modules
that either just take in 1 sequence and parse it or take in the sequence
if it is in 1 line and not broken into a few like mine. Am I right?
 
Thanks.
 
Desmond


More information about the Bioperl-l mailing list