Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: pattern match, speed problem

by hipowls (Curate)
on Feb 20, 2008 at 06:42 UTC ( [id://668958]=note: print w/replies, xml ) Need Help??


in reply to pattern match, speed problem

For matching fixed substrings index is faster. It just requires a slight modification to the code

my $position = index $chrom, $_; if ( $position != -1 ) { # we matched }

Replies are listed 'Best First'.
Re^2: pattern match, speed problem
by ysth (Canon) on Feb 20, 2008 at 07:37 UTC

      Or lower case each probe string, that's probably cheaper. Of course if the original data was all the same case then some overhead can be avoided. If the probe strings or the large string are used multiple times then it may be worthwhile preprocessing the data.

      perl -pe'tr/acgt/ACGT/' -i big_string_file
      or
      perl -pe'tr/ACGT/acgt/' -i probe_string_file

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://668958]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-19 22:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found