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!
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.my %table = ( 561231 => 'whatever', 700000 => 'whatevr2', ... ); my @thresh = sort { $a <=> $b } keys %table; $_ = pop(@thresh) while $thresh[0] < $numbers; my $contig = $table{$_};
--
[ e d @ h a l l e y . c c ]
|
---|