The following code works on my current version of perl. Array taxR could have 4,000 entries, there will be about 5 million different curEntry. The purpose of this is to check the taxonomic code of the current protein being read to see if it is included in an array of taxonomic codes to allow.
my @taxR = ("PLRV1", "PMTVS", "PVXHB");
my $curEntry = "PMTVS";
if($curEntry ~~ @taxR){
print "do rest of stuff";
}
With this code my entire program takes about 20 seconds to run on my test data set and 30 minutes on the real thing.
I've tried this
my @taxR = ("PLRV1", "PMTVS", "PVXHB");
my $curEntry = "PMTVS";
if( first { $_ eq $curEntry } @taxR ){
print "do rest of stuff";
}
but the test data takes 3 minutes to run, so the real set would be unusably long.
I have draconian IT guys that will never agree to upgrade perl on the Macs, version 5.8.8, so I was hoping you could help me find a replacement method that doesn't take a million years to run.
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.