Clean up test: use the $db in scope and reuse variable
[bioperl-live.git] / examples / contributed / prosite2perl.pl
blob6b00182a1203ee26b9a6388057fe0ac9d1e9cf4b
1 #!/usr/bin/perl
2 # prosite2perl -- convert Prosite patterns to Perl regular expressions
4 # Jordan Dimov (jdimov@cis.clarion.edu)
6 # Submitted to bioperl scripts project 2001/08/03
8 # Description:
9 # Prosite patterns to Perl regular expressions.
10 # The prositeRegEx($) sub accepts a string
11 # containing a Prosite pattern and returns a
12 # string containing a valid Perl regex. The code
13 # is self-explanatory.
15 sub prositeRegEx($);
17 while (<>) {
18 chomp ($_);
19 print prositeRegEx ($_), "\n";
22 sub prositeRegEx ($) {
23 my $regex = shift;
24 $regex =~ s/[\-\.]//g;
25 $regex =~ s/\{/[^/g;
26 $regex =~ tr/x()<>}/.{}^$]/;
27 return ($regex);