Dear all,

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:

$hydphb='GAFIVL'; $polar='DEHAW'; $charged='DGYAH'; $_ =~ /[$polar.$charged]([$hydphb]|[$polar]| H[$hydphb][$polar][$hydphb]W){18-24}[$polar.$charged]/;
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:

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:

$_ =~ /[$polar.$charged] ([$hydphb]|[$polar]){18-24} [$polar.$charged]/; $_ =~ /H[$hydphb][$polar][$hydphb]W/;
If the sequence matches both times, and I count the number of polar to be 4 then I can return true.

What do you think?

Cheers
Sam


In reply to Searching for character classes of various quantities AND a motif by seaver

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.