On Tuesday 14 June 2005 17:34, Jeff 'japhy' Pinyan wrote: > On Jun 14, Praedor Atrebates said: > > $dnakmotif = '[KRH][L{3,}V{3,}I{3,}F{3,}Y{3,}A{3,}][KRH]; > > > > I am just learning as I go here but there are two problems with this, one > > of which I understand but the other I do not. First, the one I do not > > understand. My intent with the value set to $dnakmotif was to search for > > K or R or H in a sequence followed by a string of 3 or more of any of the > > contents of the second bracket pair (L V I F Y A). When I run the > > program and run a search for "dnak" I get a string of hits in my test > > sequence they don't match what I am after. I get a series of hits, for > > instance, of a K followed by ONE A or ONE V followed by an H instead of > > at LEAST 3 of any of L or V or I, etc. Why doesn't this work? > > The [...] construct is a character class -- it represents a set of > characters, any of which can match. Thus, [KRH] matches a 'K', an 'R', or > an 'H'. But [A{3,}B{3,}] is really just the same as [AB3,{}] -- that is, > an 'A', a 'B', a '3', a ',', a '{', or a '}'. What you want is > > $dnakmotif = qr/[KRH](?:L{3,}|V{3,}|I{3,}|F{3,}|Y{3,}|A{3,})[KRH]/; > > That sounds like it should match what you're looking for. > > > The next problem is one I understand but have no idea how to correct. > > The value I set to $dnakmotif is too restrictive for the actual searches > > I need to do. What I want is to search for a sequence/character string [...]
I may add one or two more amino acids to the middle portion as possibles but for now that is the rule I am trying to get working. In what you offer, what does the leading "qr/" mean and what of the "?:L..."? None of the internal letters MUST repeat but the CAN. There could be no repeats with position filled by a unique 3, 4, or 5 characters from the list or it could be entirely one character repeated anywhere between 3 to 5 times to a combination of repeats and singles. praedor -- "Voice or no voice, the people can always be brought to the bidding of the leaders. That is easy. All you have to do is tell them they are being attacked, and denounce the peacemakers for lack of patriotism and exposing the country to danger. It works the same in any country." --Hermann Goering -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>