Skip to content

Commit

Permalink
protect when n is too small for the calculation, still need documenta…
Browse files Browse the repository at this point in the history
…tion improvement
  • Loading branch information
hyphaltip committed Nov 15, 2011
1 parent 68d033c commit c0f50eb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Bio/PopGen/Statistics.pm
Expand Up @@ -277,6 +277,10 @@ sub fu_and_li_D {
sub fu_and_li_D_counts {
my ($self,$n,$seg_sites, $external_mut) = @_;
my $a_n = 0;
if( $n <= 3 ) {
$self->warn("n is $n, too small, must be > 3\n");
return;
}
for(my $k= 1; $k < $n; $k++ ) {
$a_n += ( 1 / $k );
}
Expand Down

0 comments on commit c0f50eb

Please sign in to comment.