Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Count the number of N in fasta file with Perl

  • Public
By Poonam Mahapatra 2668 days ago
#!/usr/bin/perl my ($h, $n, $l); open(I,$ARGV[0]) or die($!); while(<I>){ chomp; if(/^>/){ $h=substr($_,1); }else{ $n=($_=~tr/nN/nN/); $l=length($_); print $h,"\t",$l,"\t",$n,"\t",$n/($l-$n),"\n"; } } close(I);