line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HackaMol::Roles::ReadPdbqtRole; |
2
|
|
|
|
|
|
|
$HackaMol::Roles::ReadPdbqtRole::VERSION = '0.051'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Read files with molecular information |
4
|
11
|
|
|
11
|
|
6076
|
use Moose::Role; |
|
11
|
|
|
|
|
41
|
|
|
11
|
|
|
|
|
96
|
|
5
|
11
|
|
|
11
|
|
58529
|
use HackaMol::PeriodicTable qw(_element_name _trim _qstring_num); |
|
11
|
|
|
|
|
33
|
|
|
11
|
|
|
|
|
651
|
|
6
|
11
|
|
|
11
|
|
84
|
use Math::Vector::Real; |
|
11
|
|
|
|
|
37
|
|
|
11
|
|
|
|
|
592
|
|
7
|
11
|
|
|
11
|
|
106
|
use Carp; |
|
11
|
|
|
|
|
28
|
|
|
11
|
|
|
|
|
7070
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub read_pdbqt_atoms { |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# this is too similar to reading pdb for it too exist separately... think about |
12
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
13
|
1
|
|
|
|
|
4
|
my $fh = shift; |
14
|
|
|
|
|
|
|
#my $file = shift; |
15
|
|
|
|
|
|
|
#my $fh = FileHandle->new("<$file") or croak "unable to open $file"; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# $RtBrnch{ROOT}{iatoms} = LIST integers of atoms in root |
18
|
|
|
|
|
|
|
# $RtBrnch{BRNCH1}{iatoms} = LIST integers of atoms in BRNCH1 |
19
|
|
|
|
|
|
|
# $RtBrnch{BRNCH1}{ROOT} = LIST two integers of rotable bond for BRNCH1 |
20
|
|
|
|
|
|
|
# $RtBrnch{BRNCH2}{iatoms} = LIST integers of atoms in BRNCH2 |
21
|
|
|
|
|
|
|
# $RtBrnch{BRNCH2}{SBRNCH1} iatoms} = LIST integers of atoms in BRNCH2 |
22
|
|
|
|
|
|
|
# each branch is rigid block of atoms |
23
|
|
|
|
|
|
|
# NONONONONO!!!! for now, just read in atoms. We'll figure out how to save the tree later |
24
|
1
|
|
|
|
|
4
|
my %RtBrnch; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my @atoms; |
27
|
1
|
|
|
|
|
4
|
my ( $n, $t ) = ( 0, 0 ); |
28
|
1
|
|
|
|
|
3
|
my $q_tbad = 0; |
29
|
1
|
|
|
|
|
4
|
my $something_dirty = 0; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
97
|
while (<$fh>) { |
32
|
|
|
|
|
|
|
|
33
|
378
|
100
|
|
|
|
1703
|
if (/^(?:MODEL\s+(\d+))/) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
34
|
9
|
|
|
|
|
21
|
$n = 0; |
35
|
9
|
|
|
|
|
37
|
$q_tbad = 0; # flag a bad model and never read again! |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
elsif (/^(?:ENDMDL)/) { |
38
|
9
|
|
|
|
|
53
|
$t++; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
elsif (/^(?:HETATM|ATOM)/) { |
41
|
252
|
50
|
|
|
|
601
|
next if $q_tbad; |
42
|
|
|
|
|
|
|
my ( |
43
|
252
|
|
|
|
|
2115
|
$record_name, $serial, $name, $altloc, $resName, |
44
|
|
|
|
|
|
|
$chainID, $resSeq, $icod, $x, $y, |
45
|
|
|
|
|
|
|
$z, $occ, $B, $charge, $ADTtype |
46
|
|
|
|
|
|
|
) = unpack "A6A5x1A4A1A3x1A1A4A1x3A8A8A8A6A6x4A6x1A2", $_; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
#ATOM 1 O LIG d 1 8.299 4.799 79.371 0.00 0.00 -0.292 OA |
49
|
|
|
|
|
|
|
#-----|----|x---||--|x|---||xxx-------|-------|-------|-----|-----|xxxx-----|x-| |
50
|
|
|
|
|
|
|
|
51
|
252
|
50
|
|
|
|
846
|
if ( $chainID =~ m/\w/ ) { $chainID = uc( _trim($chainID) ) } |
|
252
|
|
|
|
|
717
|
|
52
|
0
|
|
|
|
|
0
|
else { $chainID = ' ' } |
53
|
|
|
|
|
|
|
|
54
|
252
|
|
|
|
|
649
|
$name = _trim($name); |
55
|
252
|
|
|
|
|
564
|
$resName = _trim($resName); |
56
|
252
|
|
|
|
|
480
|
$resSeq = _trim($resSeq); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
#$resSeq = 0 if ( $resSeq < 0 ); |
59
|
252
|
|
|
|
|
500
|
$serial = _trim($serial); |
60
|
252
|
|
|
|
|
498
|
$charge = _trim($charge); |
61
|
252
|
|
|
|
|
517
|
$ADTtype = _trim($ADTtype); |
62
|
|
|
|
|
|
|
|
63
|
252
|
|
|
|
|
609
|
my ( $element, $qdirt ) = _element_name($ADTtype); |
64
|
252
|
100
|
|
|
|
547
|
$something_dirty++ if ($qdirt); |
65
|
252
|
|
|
|
|
1277
|
my $xyz = V( $x, $y, $z ); |
66
|
|
|
|
|
|
|
|
67
|
252
|
100
|
|
|
|
552
|
if ( $t == 0 ) { |
68
|
28
|
|
|
|
|
885
|
$atoms[$n] = HackaMol::Atom->new( |
69
|
|
|
|
|
|
|
name => $name, |
70
|
|
|
|
|
|
|
record_name => $record_name, |
71
|
|
|
|
|
|
|
serial => $serial, |
72
|
|
|
|
|
|
|
chain => $chainID, |
73
|
|
|
|
|
|
|
symbol => $element, |
74
|
|
|
|
|
|
|
charges => [$charge], |
75
|
|
|
|
|
|
|
coords => [$xyz], |
76
|
|
|
|
|
|
|
occ => $occ * 1, |
77
|
|
|
|
|
|
|
bfact => $B * 1, |
78
|
|
|
|
|
|
|
resname => $resName, |
79
|
|
|
|
|
|
|
resid => $resSeq, |
80
|
|
|
|
|
|
|
segid => $ADTtype, |
81
|
|
|
|
|
|
|
altloc => $altloc, |
82
|
|
|
|
|
|
|
); |
83
|
28
|
50
|
|
|
|
717
|
$atoms[$n]->is_dirty($qdirt) unless $atoms[$n]->is_dirty; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
else { |
86
|
|
|
|
|
|
|
#croak condition if atom changes between models |
87
|
224
|
50
|
33
|
|
|
6787
|
if ( $n > $#atoms or $name ne $atoms[$n]->name |
|
|
|
33
|
|
|
|
|
88
|
|
|
|
|
|
|
or $element ne $atoms[$n]->symbol ) |
89
|
|
|
|
|
|
|
{ |
90
|
0
|
|
|
|
|
0
|
my $carp_message = |
91
|
|
|
|
|
|
|
"BAD t->$t PDB Atom $n " |
92
|
|
|
|
|
|
|
. "serial $serial resname $resName " |
93
|
|
|
|
|
|
|
. "has changed"; |
94
|
0
|
|
|
|
|
0
|
carp $carp_message; |
95
|
0
|
|
|
|
|
0
|
$q_tbad = $t; # this is a bad model! |
96
|
|
|
|
|
|
|
#wipe out all the coords prior |
97
|
0
|
|
|
|
|
0
|
$atoms[$_]->delete_coords($t) foreach 0 .. $n - 1; |
98
|
0
|
|
|
|
|
0
|
$t--; |
99
|
0
|
|
|
|
|
0
|
next; |
100
|
|
|
|
|
|
|
} |
101
|
224
|
|
|
|
|
7571
|
$atoms[$n]->set_coords( $t, $xyz ); |
102
|
|
|
|
|
|
|
} |
103
|
252
|
|
|
|
|
1913
|
$n++; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# set iatom to track the array. diff from serial which refers to pdb |
108
|
1
|
|
|
|
|
52
|
$atoms[$_]->iatom($_) foreach ( 0 .. $#atoms ); |
109
|
1
|
50
|
|
|
|
7
|
if ($something_dirty) { |
110
|
1
|
50
|
|
|
|
34
|
unless ( $self->hush_read ) { |
111
|
1
|
|
|
|
|
5
|
my $message = "MolReadRole> found $something_dirty dirty atoms. "; |
112
|
1
|
|
|
|
|
4
|
$message .= "Check symbols and lookup names"; |
113
|
1
|
|
|
|
|
32
|
carp $message; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
1
|
|
|
|
|
693
|
return (\@atoms); |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
11
|
|
|
11
|
|
117
|
no Moose::Role; |
|
11
|
|
|
|
|
35
|
|
|
11
|
|
|
|
|
75
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
__END__ |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=pod |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 NAME |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
HackaMol::Roles::ReadPdbqtRole - Read files with molecular information |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 VERSION |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
version 0.051 |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 SYNOPSIS |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
my @atoms = HackaMol->new |
138
|
|
|
|
|
|
|
->read_pdbqt_atoms("some.pdbqt"); |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 DESCRIPTION |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
The HackaMol::Roles::ReadPdbqtRole provides read_pdbqt_atoms for reading docking files. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 METHODS |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 read_pdbqt_atoms |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
One argument: the filename |
149
|
|
|
|
|
|
|
Returns a list of HackaMol::Atom objects. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 Additional information |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Similar format to PDB but even trickier... whoa. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 SEE ALSO |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=over 4 |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
L<HackaMol> |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=item * |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
L<HackaMol::Atom> |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item * |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
L<HackaMol::Roles::MolReadRole> |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item * |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
L<Protein Data Bank|http://pdb.org> |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=back |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 AUTHOR |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Demian Riccardi <demianriccardi@gmail.com> |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Demian Riccardi. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
186
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=cut |