
riya
New User
Oct 26, 2009, 4:50 PM
Post #1 of 1
(1329 views)
|
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. #!/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" ; } } Please, help me figuring out this task. Thanks
|