seaver has asked for the wisdom of the Perl Monks concerning the following question:
I'm searching a whole list of sequences of letters for a specific pattern. My problem is that the pattern isn't very specific by nature:
So basically, Im looking for a sequence bound by [$polar.$charged] with 18-24 letters in it, only 4 of the letters can be $polar, and this motif must be there too:$hydphb='GAFIVL'; $polar='DEHAW'; $charged='DGYAH'; $_ =~ /[$polar.$charged]([$hydphb]|[$polar]| H[$hydphb][$polar][$hydphb]W){18-24}[$polar.$charged]/;
H[$hydphb][$polar][$hydphb]W.
The letters in the motif are included in the total number of letters, and the $polar in the motif must be included in the 4 $polar limit.
I was thinking about doing it in two passes:
If the sequence matches both times, and I count the number of polar to be 4 then I can return true.$_ =~ /[$polar.$charged] ([$hydphb]|[$polar]){18-24} [$polar.$charged]/; $_ =~ /H[$hydphb][$polar][$hydphb]W/;
What do you think?
Cheers
Sam
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Searching for character classes of various quantities AND a motif
by davido (Cardinal) on Oct 08, 2003 at 19:23 UTC | |
|
Re: Searching for character classes of various quantities AND a motif
by BrowserUk (Patriarch) on Oct 08, 2003 at 21:06 UTC |