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