sinlam has asked for the wisdom of the Perl Monks concerning the following question:
The protein names are sorted to match the longest protein name first and I store all protein names into one big string separated by delimiter '|'. The code is shown below:
Each sentence is read and put in a variable '$line'. The regular expression on the 2nd line in the code will take from 0.2 sec to 9.5 sec to process each sentence, varies for each sentence. If I have many sentences to tag, it will take many minutes. I would like to know if there is any alternative to speed up the regular expression searching? Thanks for any suggestion!$sortedproteinnamesstring = join '|', reverse sort map { quotemeta } @ +proteinnames; $line =~ s/($sortedproteinnamesstring)/\*\*$1\*\*/ig;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tag protein names in sentences
by BrowserUk (Patriarch) on Feb 12, 2010 at 19:41 UTC | |
|
Re: Tag protein names in sentences
by BioLion (Curate) on Feb 12, 2010 at 19:04 UTC | |
|
Re: Tag protein names in sentences
by zwon (Abbot) on Feb 12, 2010 at 18:57 UTC | |
|
Re: Tag protein names in sentences
by sinlam (Novice) on Feb 12, 2010 at 19:56 UTC | |
by GrandFather (Saint) on Feb 12, 2010 at 22:44 UTC | |
by sinlam (Novice) on Feb 17, 2010 at 23:11 UTC | |
by GrandFather (Saint) on Feb 18, 2010 at 02:58 UTC | |
by sinlam (Novice) on Feb 18, 2010 at 19:34 UTC | |
| |
by sinlam (Novice) on Feb 16, 2010 at 17:13 UTC | |
by Anonymous Monk on Feb 15, 2010 at 21:19 UTC | |
by GrandFather (Saint) on Feb 15, 2010 at 21:39 UTC | |
by sinlam (Novice) on Feb 16, 2010 at 22:38 UTC | |
|