line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BioX::CLPM::Enzyme; |
2
|
1
|
|
|
1
|
|
1338
|
use base qw(BioX::CLPM::Base); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
86
|
|
3
|
|
|
|
|
|
|
use Class::Std; |
4
|
|
|
|
|
|
|
use Class::Std::Utils; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use warnings; |
7
|
|
|
|
|
|
|
use strict; |
8
|
|
|
|
|
|
|
use Carp; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use version; our $VERSION = qv('0.0.1'); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
{ |
13
|
|
|
|
|
|
|
my %enzyme_id_of :ATTR( :get :set :default<''> :init_arg ); |
14
|
|
|
|
|
|
|
my %name_of :ATTR( :get :set :default<''> :init_arg ); |
15
|
|
|
|
|
|
|
my %clvg_sites_of :ATTR( :get :set :default<''> :init_arg ); |
16
|
|
|
|
|
|
|
my %clvg_position_of :ATTR( :get :set :default<''> :init_arg ); |
17
|
|
|
|
|
|
|
my %rule_of :ATTR( :get :set :default<''> :init_arg ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub START { |
20
|
|
|
|
|
|
|
my ( $self, $ident, $arg_ref ) = @_; |
21
|
|
|
|
|
|
|
if ( $arg_ref ) { $self->_load( $arg_ref ); } |
22
|
|
|
|
|
|
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _load { |
26
|
|
|
|
|
|
|
my ( $self, $arg_ref ) = @_; |
27
|
|
|
|
|
|
|
# Update new enzyme_id if exists |
28
|
|
|
|
|
|
|
if ( defined $arg_ref->{enzyme_id} ) { |
29
|
|
|
|
|
|
|
my $enzyme_id = $arg_ref->{enzyme_id}; |
30
|
|
|
|
|
|
|
$self->set_enzyme_id($enzyme_id); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Load other enzyme data from db |
33
|
|
|
|
|
|
|
my $sql = 'select name, clvg_sites, clvg_position, rule '; |
34
|
|
|
|
|
|
|
$sql .= "from enzymes where enzyme_id = '$enzyme_id'"; |
35
|
|
|
|
|
|
|
my ( $enzyme_name, $clvg_sites, $clvg_position, $rule ) = $self->sqlexec( $sql, '@' ); |
36
|
|
|
|
|
|
|
$self->set_name($enzyme_name); |
37
|
|
|
|
|
|
|
$self->set_clvg_sites($clvg_sites); |
38
|
|
|
|
|
|
|
$self->set_clvg_position($clvg_position); |
39
|
|
|
|
|
|
|
$self->set_rule($rule); |
40
|
|
|
|
|
|
|
warn "ENZYME _load() ( $enzyme_id, $enzyme_name, $clvg_sites, $clvg_position, $rule )\n"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
elsif ( defined $arg_ref->{enzyme_name} ) { |
43
|
|
|
|
|
|
|
my $enzyme_name = $arg_ref->{enzyme_name}; |
44
|
|
|
|
|
|
|
$self->set_name($enzyme_name); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Load other enzyme data from db |
47
|
|
|
|
|
|
|
my $sql = 'select enzyme_id, clvg_sites, clvg_position, rule '; |
48
|
|
|
|
|
|
|
$sql .= "from enzymes where name = '$enzyme_name'"; |
49
|
|
|
|
|
|
|
my ( $enzyme_id, $clvg_sites, $clvg_position, $rule ) = $self->sqlexec( $sql, '@' ); |
50
|
|
|
|
|
|
|
$self->set_enzyme_id($enzyme_id); |
51
|
|
|
|
|
|
|
$self->set_clvg_sites($clvg_sites); |
52
|
|
|
|
|
|
|
$self->set_clvg_position($clvg_position); |
53
|
|
|
|
|
|
|
$self->set_rule($rule); |
54
|
|
|
|
|
|
|
warn "ENZYME _load() ( $enzyme_id, $enzyme_name, $clvg_sites, $clvg_position, $rule )\n"; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# API READ ONLY |
59
|
|
|
|
|
|
|
sub clvg_sites { my ( $self ) = @_; return split( //, $self->get_clvg_sites() ); } |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub generate_fragments { |
62
|
|
|
|
|
|
|
my ($self, $arg_ref) = @_; |
63
|
|
|
|
|
|
|
my @clvg_sites; |
64
|
|
|
|
|
|
|
foreach my $sequence (@$arg_ref->{sequences}){ |
65
|
|
|
|
|
|
|
my @sequence = split(//, $sequence); |
66
|
|
|
|
|
|
|
my $fragment; |
67
|
|
|
|
|
|
|
my @initial_fragments; |
68
|
|
|
|
|
|
|
foreach my $amino_acid (@sequence){ |
69
|
|
|
|
|
|
|
$fragment .= $amino_acid; |
70
|
|
|
|
|
|
|
foreach my $clvg_site(@clvg_sites){ |
71
|
|
|
|
|
|
|
if (uc($amino_acid) eq $clvg_site){ |
72
|
|
|
|
|
|
|
push(@initial_fragments, $fragment); |
73
|
|
|
|
|
|
|
$fragment=''; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
my @all_fragments = @initial_fragments; |
78
|
|
|
|
|
|
|
for ( my $i = @initial_fragments - 1; $i > 1; $i--){ |
79
|
|
|
|
|
|
|
for ( my $j=0; $j<@initial_fragments-$i+1; $j++){ |
80
|
|
|
|
|
|
|
my $new_fragment = ''; |
81
|
|
|
|
|
|
|
$new_fragment.=$initial_fragments[$j]; |
82
|
|
|
|
|
|
|
for ( my $k=0; $k<$i-1; $k++){ |
83
|
|
|
|
|
|
|
$new_fragment.=$initial_fragments[$j+$k+1]; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
push (@all_fragments, $new_fragment); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
foreach $fragment(@all_fragments){ |
89
|
|
|
|
|
|
|
if ($fragment=~m/.*[a-z]+.*/){ |
90
|
|
|
|
|
|
|
#&SQLExec("insert into fragments(sequence_id, fragment_sequence) values ($sequence_id, '$fragment')"); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
98
|
|
|
|
|
|
|
__END__ |