Alternative content
sub readSeqFromFasta{
my $file = $_[0];
my (%map,$id,$seq);
open(IN,$file) or die("Cannot open file for reading $file:$!\n");
while(<IN>){
chomp;
if($_ =~ /^>/){
if(defined $id && defined $seq){
$map{$id} = $seq;
$seq="";
}
($id) = split(' ',$_);
$id=~s/>//;
}
else {
$seq=$seq.$_;
}
}
$map{$id} = $seq;
close(IN);
return \%map;
}