File: prosite2perl.pl

package info (click to toggle)
bioperl 1.7.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,964 kB
  • sloc: perl: 94,019; xml: 14,811; makefile: 15
file content (28 lines) | stat: -rw-r--r-- 644 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl
# prosite2perl -- convert Prosite patterns to Perl regular expressions
#
# Jordan Dimov (jdimov@cis.clarion.edu)
#
# Submitted to bioperl scripts project 2001/08/03 
#
# Description: 
# Prosite patterns to Perl regular expressions.
# The prositeRegEx($) sub accepts a string
# containing a Prosite pattern and returns a
# string containing a valid Perl regex.  The code
# is self-explanatory.

sub prositeRegEx($);

while (<>) {
  chomp ($_);
  print prositeRegEx ($_), "\n";
}

sub prositeRegEx ($) {
  my $regex = shift;
  $regex =~ s/[\-\.]//g;    
  $regex =~ s/\{/[^/g; 
  $regex =~ tr/x()<>}/.{}^$]/;
  return ($regex);
}