[Bioperl-l] Search for sequence inside sequence

Carnë Draug carandraug+dev at gmail.com
Tue Feb 21 05:18:37 EST 2012


On 21 February 2012 02:28, Fields, Christopher J <cjfields at illinois.edu> wrote:
> There is a BioPerl-ish way of doing this, namely Bio::Tools::SeqPattern.  Might be worth a look (though a simple regex should also suffice).

Thank you both.

I looked into this class and into the code in
examples/tools/seq_pattern.pl. It seems this module is more to create
a regexp from other string which can then be used on a normal regexp.

$pattern = "SS";
$regex = new Bio::Tools::SeqPattern(-seq =>$pattern, -type =>'Dna');

print "Found in $file" if $seq->seq =~ /$regex->expand/i;
print "Found in $file" if $seq->seq =~ /$regex->revcom(1)->str/i;
## to also search on the revcom

Do you think it is acceptable to add a method that would allow for:

say "Found in $file" if $seq->match(-seq-> $pattern );

maybe have an extra option that will also check the revcom of:

say "Found in $file" if $seq->match(-seq-> $pattern -revcom-> 1);

Carnë



More information about the Bioperl-l mailing list