Hi,
I would suggest you use the built-in BioPerl method for reading
fasta (or other) format, for example:
sub get_sequence_from_fasta
{
#designed for getting sequences into array from a file (fasta format),
#input: file name
use Bio::SeqIO;
my $file = shift;
my @seqs= ();
open INFILE, "<$file" or die "$0: Can't open file $file: $!";
my $in = Bio::SeqIO->new(-format => 'fasta',
-noclose => 1 ,
-fh => \*INFILE);
while ( my $seq = $in->next_seq() ) {
push @seqs, $seq->seq();
} #end while
return [EMAIL PROTECTED];
}
Hope that helps.
Regards,
Edward WIJAYA
----- Original Message -----
From: chen li <[EMAIL PROTECTED]>
Date: Saturday, January 7, 2006 9:27 am
Subject: Re: new for reading file containing multiple records
> Hi Shawn,
>
> I use the your code to do the job:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use Data::Dumper;
> my $filename='sequence.fasta';
> open (DATA,$filename) or die;
>
> {local $/ = '>';
> while( <DATA> ){
> print Dumper \$_;
> }
> }
> exit;
>
>
--------------------------------------------------
This email is confidential and may be privileged. If you are not the intended
recipient, please delete it and notify us immediately. Please do not copy or
use it for any purpose, or disclose its contents to any other person. Thank you.
--------------------------------------------------
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>