[Bioperl-l] regular expression help!
Madeleine Lemieux
mlemieux at bioinfo.ca
Sun Jan 16 14:00:45 EST 2005
I'm not sure if this is the sort of thing you mean:
#!/usr/bin/perl -w
my @test_strings = ("acgttgcaacgt", "acgtacgt", "acgttgca", "ata");
foreach my $seq (@test_strings) {
# force case change here, if necessary
$seq =~ /([acgt]+)(?=([acgt]+)\1)/;
my $fwd = $1;
(my $rev = $2) =~ tr/acgt/tgca/;
if ($fwd eq $rev) {
print $seq, ' ', $fwd, ' ', $2, "\n";
}
}
HTH,
Madeleine
> Hi, Everybody,
> I was trying to use a regex recognizing a patter of inverted repeat
> DNA seq flanked by direct repeats (see below), it returns errors
> saying "(?{...}) not terminated or {...} not balanced. Can anybody
> help me sorting this out?
> The regex I have is:
> $regex =~ /\S+(\S+)(\S{10}).*(??{$rev=reverse(\2 =~
> tr/ATCG/TAGC/i);})\1.*/i;
> Thank you,
> Yang
>
>
More information about the Bioperl-l
mailing list