Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: find all repeating sequences

by kennethk (Abbot)
on Dec 20, 2016 at 20:45 UTC ( [id://1178249]=note: print w/replies, xml ) Need Help??


in reply to find all repeating sequences

Please read Markup in the Monastery. Note how your square backets have been turned into a link. I see the bare </code> in your post, but that should have been written (I think) as
<code> if($seqR =~m/\G([A-Z]{3,7})+?$_/g) { #print "All repeated sequences $_\n"; }; </code>

This also sounds a bit like homework, and a bit like you are getting ahead of yourself. As discussed in How do I post a question effectively?, think about what you are trying to do and where you are hitting issues. Are you sure your randomly generated strings contain what you think they do?.

Where did you get the code you've posted. You have a \G in there, which does not really make sense in the context you're calling here. See Assertions in perlre for documentation. You are also inlining $_ into your regex, which makes no sense to me. And going for a non-greedy match, which is strange as well (see Metacharacters). What was the source material for this construction? Have you read perlretut for a basic description of what regular expression do?

You probably want to use backreferences -- see Capture groups in perlre. Perhaps you confused \G and \g? You also probably want to use pos, $& and/or $-[0] in some combination to figure out positions, however you'd like to define that. So ending up with something like:

while($seqR =~m/([ATGC])\g1{2,6})+/g) { my $position = pos; print "$& found at $position\n" };

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-26 02:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found