Changes

From Biolecture.org

N50 and N90

974 bytes added, 19:40, 8 November 2010
Created page with "<p>The N50 contig size is a weighted median value and defined as <br /> the length of the smallest contig S in the sorted list of all <br /> contigs where the cumulative length f..."
<p>The N50 contig size is a weighted median value and defined as <br />
the length of the smallest contig S in the sorted list of all <br />
contigs where the cumulative length from the largest contig to <br />
contig S is at least 50% of the total length.<br />
&nbsp;</p>
<p>&nbsp;</p>
<p>perl -e 'my ($len,$total)=(0,0);my @x;while(&lt;&gt;){if(/^[\&gt;\@]/){if($len&gt;0){$total+=$len;push@x,$len;};$len=0;}else{s/\s//g;$len+=length($_);}}if ($len&gt;0){$total+=$len;push @x,$len;}@x=sort{$b&lt;=&gt;$a}@x; my ($count,$half)=(0,0);for (my $j=0;$j&lt;@x;$j++){$count+=$x[$j];if(($count&gt;=$total/2)&amp;&amp;($half==0)){print &quot;N50: $x[$j]\n&quot;;$half=$x[$j]}elsif($count&gt;=$total*0.9){print &quot;N90: $x[$j]\n&quot;;exit;}}'&nbsp; contigs.fahttp://seqanswers.com/forums/showthread.php?t=2766</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://seqanswers.com/forums/showthread.php?t=2766">http://seqanswers.com/forums/showthread.php?t=2766</a></p>
<p>&nbsp;</p>

Navigation menu