in reply to Re: Selecting a random number, and back calculating to chromosome and contig!
in thread Selecting a random number, and back calculating to chromosome and contig!

Or a lookup table?
my %table = ( 561231 => 'whatever', 700000 => 'whatevr2', ... ); my @thresh = sort { $a <=> $b } keys %table; $_ = pop(@thresh) while $thresh[0] < $numbers; my $contig = $table{$_};
Even this can be improved if there's more than ~200 thresholds by using a binary search method instead. I wouldn't bother with that unless it proves to be a bottleneck, though.

--
[ e d @ h a l l e y . c c ]

  • Comment on Re: Re: Selecting a random number, and back calculating to chromosome and contig!
  • Download Code