Ramya715 has asked for the wisdom of the Perl Monks concerning the following question:
I am a perl beginner and need some help with regex Input for this code is : aatgatgataaggtaaggtatgatgatgatgatgatagtagannnnnnnnnatgcatga'/atgca.atgactagca/atgactagcaaggtaaggtaaggtaaggtaaggtatgatgatgannnn./atgatgactagactgacaaggtaaggtaaggtatgatgatgatcgatgacgat... and so on
Here i am trying to assign input file as a scalar variable and trying to find a match of "aaggtaaggt" and then skip some 100 characters whether they are alphabets or symbols or any wildcard characters after skipping exact 100 characters, i am again asking code to start search for match again and every time it finds a match , i am counting and asking to print..
As of my knowledge i have tried using substr of match as pos1 and had set offset for 100 and then assigned that as initial pos for reading second match , but failed to get the correct output, then tried here post match as $' but doubt whether it is correct or not.
Please, help me figuring out this task. Thanks#!/usr/bin/perl $count1 = 0; open (FILE, "INPUT") || die "cannot open $!\n"; while ($line = <FILE>){ if(($line=~m/(aaggt){2}/ig)&&($'=~m/([atgcn]{100,})/i)) { $count1 ++ ; print " " ,$1, "\t"; print "count1 \t " ,$count1 , "\n" ; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need Help with reg ex
by GrandFather (Saint) on Oct 28, 2009 at 04:07 UTC | |
|
Re: Need Help with reg ex
by bichonfrise74 (Vicar) on Oct 28, 2009 at 04:07 UTC |