| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Chemistry::MacroMol; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = '0.06'; |
|
4
|
|
|
|
|
|
|
# $Id: MacroMol.pm,v 1.6 2004/07/03 19:19:44 itubert Exp $ |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6150
|
use 5.006; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
49
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
47
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
37
|
|
|
9
|
1
|
|
|
1
|
|
7
|
use base qw(Chemistry::Mol); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1098
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Chemistry::MacroMol - Perl module for macromolecules |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Chemistry::MacroMol; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $mol = Chemistry::MacroMol->new(name => 'my big molecule'); |
|
20
|
|
|
|
|
|
|
$mol->new_domain(name => "ASP"); # see Chemistry::Domain for details |
|
21
|
|
|
|
|
|
|
my @domains = $mol->domains; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
For the purposes of this module, a macromolecule is just a molecule that |
|
26
|
|
|
|
|
|
|
consists of several "domains". For example, a protein consists of aminoacid |
|
27
|
|
|
|
|
|
|
residues, or a nucleic acid consists of bases. Therefore Chemistry::MacroMol |
|
28
|
|
|
|
|
|
|
is derived from Chemistry::Mol, with additional methods to handle the domains. |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
The way things are currently structured, an atom in a macromolecule "belong" |
|
31
|
|
|
|
|
|
|
both to the MacroMol object and to a Domain object. This way you can get all the |
|
32
|
|
|
|
|
|
|
atoms in $protein via $protein->atoms, or to the atoms in residue 123 via |
|
33
|
|
|
|
|
|
|
$protein->domain(123)->atoms. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Remember that this class inherits all the methods from Chemistry::Mol. They |
|
38
|
|
|
|
|
|
|
won't be repeated here. |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=over 4 |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item Chemistry::MacroMol->new(name => value, ...) |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Create a new MacroMol object with the specified attributes. You can use the |
|
45
|
|
|
|
|
|
|
same attributes as for Chemistry::Mol->new. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub new { |
|
50
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
51
|
0
|
|
|
|
|
|
my %args = @_; |
|
52
|
0
|
|
|
|
|
|
my $self = bless $class->SUPER::new(), $class; |
|
53
|
0
|
|
|
|
|
|
$self->{domains} = []; |
|
54
|
0
|
|
|
|
|
|
$self->$_($args{$_}) for (keys %args); |
|
55
|
0
|
|
|
|
|
|
return $self; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item $mol->add_domain($domain, ...) |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Add one or more Domain objects to the molecule. Returns the last domain added. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub add_domain { |
|
65
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
66
|
0
|
|
|
|
|
|
for my $b (@_){ |
|
67
|
0
|
|
|
|
|
|
push @{$self->{domains}}, $b; |
|
|
0
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
$self->{byId}{$b->{id}} = $b; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
0
|
|
|
|
|
|
$_[-1]; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item $mol->domain_class |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Returns the domain class that a macromolecule class expects to use by default. |
|
76
|
|
|
|
|
|
|
Chemistry::MacroMol objects return "Chemistry::Domain", but subclasses will |
|
77
|
|
|
|
|
|
|
likely override this method. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
|
|
0
|
1
|
|
sub domain_class { "Chemistry::Domain" } |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item $mol->new_domain(name => value, ...) |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Shorthand for $mol->add_domain($mol->domain_class->new(parent => $mol, name => value, ...)); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub new_domain { |
|
90
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
91
|
0
|
|
|
|
|
|
$self->add_domain(Chemistry::Domain->new(parent => $self, @_)); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item $mol->domains($n1, ...) |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Returns the domains with the given indices, or all by default. NOTE: |
|
97
|
|
|
|
|
|
|
the indices start from one (1), not from zero. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub domains { |
|
102
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
103
|
0
|
0
|
|
|
|
|
if (@_) { |
|
104
|
0
|
|
|
|
|
|
my @doms = map {$_ - 1} @_; |
|
|
0
|
|
|
|
|
|
|
|
105
|
0
|
0
|
|
|
|
|
wantarray ? @{$self->{domains}}[@doms] : $self->{domains}[$doms[-1]]; |
|
|
0
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
} else { |
|
107
|
0
|
|
|
|
|
|
@{$self->{domains}}; # return all |
|
|
0
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=back |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 VERSION |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
0.06 |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
L, L |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 AUTHOR |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Ivan Tubert, Eitub@cpan.orgE |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Copyright 2004 by Ivan Tubert |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
133
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
|
136
|
|
|
|
|
|
|
|