Your code here:
@{$sets{$fasta_id}[$setscounter]{$sitekey}} = ();
foreach ( sort @{$matches{$fasta_id}{$sitekey}} ) {
last if $_ > $upperlimit;
next if $_ < $lowerlimit;
push @{$sets{$fasta_id}[$setscounter]{$sitekey}}, $_;
Looks a lot like my original code, in the first bit, here:
for my $hit (@{$matches{$fasta_id}{$sitekey}}) {
next unless ($hit >= $lowerlimit);
last unless ($hit <= $upperlimit);
my $ggg = $hit + 0;
push (@arrayA, $ggg);
And indeed, it does have a speed advantage. I don't need the sort, as the elements are already sorted in numerical order, so I can (and do) leave that out. As for
knowing thy data, this here's the tricky part. I am going through the numbers in the arrays, and basically setting aside clusters of EVERY group of numbers
$span distance apart. Starting from the lowest element, and proceeding all the way to the highest. So, how many elements there are above
$upperlimit is as variable as possible. It goes from all to none.
Thanks for the input, though.
Matt
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.