1,081
edits
Changes
Created page with "<p><span style="font-family: Courier New">#/usr/bin/perl -w<br /> use strict;<br /> my ($len,$total)=(0,0);<br /> my @x;<br /> while(<>){<br /> if(/^[\>\@]/){<br /> if($..."
<p><span style="font-family: Courier New">#/usr/bin/perl -w<br />
use strict;<br />
my ($len,$total)=(0,0);<br />
my @x;<br />
while(<>){<br />
if(/^[\>\@]/){<br />
if($len>0){<br />
$total+=$len;<br />
push @x,$len;<br />
}<br />
$len=0;<br />
}<br />
else{<br />
s/\s//g;<br />
$len+=length($_);<br />
}<br />
}<br />
if ($len>0){<br />
$total+=$len;<br />
push @x,$len;<br />
}<br />
@x=sort{$b<=>$a} @x; <br />
my ($count,$half)=(0,0);<br />
for (my $j=0;$j<@x;$j++){<br />
$count+=$x[$j];<br />
if (($count>=$total/2)&&($half==0)){<br />
print "N50: $x[$j]\n";<br />
$half=$x[$j]<br />
}elsif ($count>=$total*0.9){<br />
print "N90: $x[$j]\n";<br />
exit;<br />
}<br />
}</span></p>
use strict;<br />
my ($len,$total)=(0,0);<br />
my @x;<br />
while(<>){<br />
if(/^[\>\@]/){<br />
if($len>0){<br />
$total+=$len;<br />
push @x,$len;<br />
}<br />
$len=0;<br />
}<br />
else{<br />
s/\s//g;<br />
$len+=length($_);<br />
}<br />
}<br />
if ($len>0){<br />
$total+=$len;<br />
push @x,$len;<br />
}<br />
@x=sort{$b<=>$a} @x; <br />
my ($count,$half)=(0,0);<br />
for (my $j=0;$j<@x;$j++){<br />
$count+=$x[$j];<br />
if (($count>=$total/2)&&($half==0)){<br />
print "N50: $x[$j]\n";<br />
$half=$x[$j]<br />
}elsif ($count>=$total*0.9){<br />
print "N90: $x[$j]\n";<br />
exit;<br />
}<br />
}</span></p>