Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: how to find this substring?

by ckj (Chaplain)
on Jun 08, 2012 at 12:24 UTC ( #975154=note: print w/replies, xml ) Need Help??

in reply to how to find this substring?

Assuming $seq as the string provided by you. Try this:
$seq='GTGGCAAATGCAGAACGTTTTCTGCGTGTTGCCGATATTCTGG..........GGAGTT'; $a = 'ATG'; $b = '(TAA|TAG|TGA)'; while($seq =~ /($a(.*?)$b)/g) { print $1."\n\n\n"; }

Replies are listed 'Best First'.
Re^2: how to find this substring?
by Not_a_Number (Parson) on Jun 08, 2012 at 14:08 UTC

    From the OP:

    I need to read some DNA sequences and check if they start with 'ATG' and end in 'TAA', 'TAG' or 'TGA'

    Given the sequence:


    your code outputs:


    whereas it should print the whole string (or 'true', or whatever).


      So, why can't you change line 6 to be print "whatever\n\n";?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://975154]
[trippledubs]: stevie are you still ignoring me
[trippledubs]: either way; sorry.
[trippledubs]: Someone please tell Steveie that I humbly and sincerely apologize
[trippledubs]: i'll try again later. wink

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2017-03-27 03:25 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (315 votes). Check out past polls.