Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Perl subroutine to read genome/reads fasta file !

  • Public
By Rahul Nayak 2127 days ago
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; }