File Coverage

blib/lib/Bio/Protease/Role/Specificity/Regex.pm
Criterion Covered Total %
statement 12 12 100.0
branch 2 2 100.0
condition n/a
subroutine 3 3 100.0
pod n/a
total 17 17 100.0


line stmt bran cond sub pod time code
1             package Bio::Protease::Role::Specificity::Regex;
2             {
3             $Bio::Protease::Role::Specificity::Regex::VERSION = '1.112900'; # TRIAL
4             }
5              
6             # ABSTRACT: A role that implements a regex-based specificity
7              
8 5     5   2247 use Moose::Role;
  5         7  
  5         26  
9 5     5   16939 use Bio::Protease::Types 'ProteaseRegex';
  5         8085  
  5         29  
10              
11             has regex => (
12             is => 'ro',
13             isa => ProteaseRegex,
14             coerce => 1,
15             );
16              
17             sub _cuts {
18 54733     54733   35937 my ($self, $peptide) = @_;
19              
20 54733 100       34331 if ( grep { $peptide !~ /$_/ } @{$self->regex} ) {
  109767         522316  
  54733         1043075  
21 49389         100668 return;
22             }
23              
24 5344         11912 return 'yes, it cuts';
25             }
26              
27              
28             1;
29              
30             __END__
31             =pod
32              
33             =head1 NAME
34              
35             Bio::Protease::Role::Specificity::Regex - A role that implements a regex-based specificity
36              
37             =head1 VERSION
38              
39             version 1.112900
40              
41             =head1 SYNOPSIS
42              
43             package My::Protease;
44             use Moose;
45              
46             with qw(Bio::ProteaseI Bio::Protease::Role::Specificity::Regex);
47              
48             package main;
49              
50             my $p = My::Protease->new( regex => qr/.{3}AC.{3}/ ); # coerces to [ qr/.../ ];
51              
52             my @products = $p->digest( 'AAAACCCC' );
53              
54             # @products: ('AAAA', 'CCCC')
55              
56             =head1 DESCRIPTION
57              
58             This role implements a regexp-based specificity for a class that also
59             consumes the L<Bio::ProteaseI> role. A peptide will be cleaved if any of
60             the regexes provided at construction time matches it. The regexes should
61             be tailored for 8-residue-long peptides, the cleavage site being between
62             the fourth and fifth residues.
63              
64             For instance, if the specificity could be described as "cuts after
65             lysine or arginine", the appropriate regular expression would be
66             C<qr/.{3}[KR].{4}/>.
67              
68             =head1 ATTRIBUTES
69              
70             =head2 regex
71              
72             A C<ProteaseRegex>, which is basically an array reference of regular
73             expressions that describe the protease specificity. It can coerce from a
74             single regular expression into a single-element array of regexps. Any
75             of the regexes in the array should match a given substrate for it to be
76             cleavable.
77              
78             =head1 AUTHOR
79              
80             Bruno Vecchi <vecchi.b gmail.com>
81              
82             =head1 COPYRIGHT AND LICENSE
83              
84             This software is copyright (c) 2011 by Bruno Vecchi.
85              
86             This is free software; you can redistribute it and/or modify it under
87             the same terms as the Perl 5 programming language system itself.
88              
89             =cut
90