[Bioperl-l] Pattern search with gap

khoueiry khoueiry at ibdm.univ-mrs.fr
Wed Jun 22 12:02:32 EDT 2005


Thanks,

In fact, after posting my mail, I tried another loop by. It detect
position (by pos()) without the gaps and then I loop on the gapped
sequence counting nucleotides and gaps till i get to the pos() already
detected thus. the new start is the number of nucleotides and gaps... 

Tamas, I tried your loop and it is  a lot faster than my new one ..
Thanks,, I will go for it..

Pierre





Le mercredi 22 juin 2005 à 16:26 +0200, Tamas Horvath a écrit :

> And a slightly different code for multiple recognition:
> 
> my $seqstring ="--------------------CAAAATAAATAGGTTATACAGAAACA---------------------AGATAAAAATTACA--CAAG-AT-A----";
> my $qseq    = "CAAGATA";
> 
> my @qqq = split (//,$qseq);
> my $pat = join('-*', at qqq);
> 
> my $pat_rege = qr/$pat/;
> 
> while ($seqstring =~ /$pat_rege/g) {
> my $before = $`;
> my $match_seq = $&;
> my $before_length = length $before;
> my $mseq_length = length $match_seq;
> my $start = 1 + $before_length;
> my $end = $before_length + $mseq_length;
> print "Start:$start End:$end\n";
> }
> #Start:45 End:72
> #Start:84 End:92


More information about the Bioperl-l mailing list