HackaMol/Roles/PdbRole.pm

filter: Statementstmt 97.9% 47 / 48 Branchbran 62.5% 5 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 93.6% 59 / 63 CC 5 SCAR 9.6
CC
5
Cov
93%
aa321
4.1
pdb_rename
2.0
BEGIN
1.0
CRAP 2.6
« HackaMol/Roles/NERFRole.pm ↑ Summary HackaMol/Roles/SelectionRole.pm »
1 package HackaMol::Roles::PdbRole;
2 19 $HackaMol::Roles::PdbRole::VERSION = '0.053';
3 #ABSTRACT: PdbRole of lazy attributes for HackaMol atoms
4 19 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 19 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 19 has 'record_name', is => 'rw', isa => 'Str', lazy => 1, default => 'HETATM';
9 19 has 'occ', is => 'rw', isa => 'Num', lazy => 1, default => 1.0;
10 19 has 'bfact', is => 'rw', isa => 'Num', lazy => 1, default => 20.0;
11 # b_iso
12 # b_aniso (vector) would be better here
13 19 has 'bfp', is => 'rw', isa => 'Num' ; # bfactor profile
14 # (10.1016/j.jmb.2015.09.024)
15 19 has 'resname', is => 'rw', isa => 'Str', lazy => 1, default => 'UNK';
16 # cif label_asym_id
17 19 has 'chain', is => 'rw', isa => 'Str', lazy => 1, default => ' ';
18 # cif label_alt_id
19 19 has 'altloc', is => 'rw', isa => 'Str', lazy => 1, default => ' ';
20 19 has 'icode', is => 'rw', isa => 'Str', lazy => 1, default => ' ';
21 19 has 'pdbid', is => 'rw', isa => 'Str', lazy => 1, default => ' ';
22 # cif label_seq_id
23 19 has 'segid', is => 'rw', isa => 'Str', lazy => 1, default => ' ';
24 19 has 'iatom', is => 'rw', isa => 'Int', lazy => 1, default => 0;
25 19 has 'resid', is => 'rw', isa => 'Str', lazy => 1, default => 1;
26 19 has 'serial', is => 'rw', isa => 'Int', lazy => 1, default => 1;
27 19 has 'sasa', is => 'rw', isa => 'Num', lazy => 1, default => 0.0;
28 19 has 'model_num', is => 'rw', isa => 'Num'; # cif
29 19 has 'auth_seq_id', is => 'rw', isa => 'Int'; # cif, -> author fudged resid
30 19 has 'auth_comp_id', is => 'rw', isa => 'Str'; # cif, -> author fudged resname
31 19 has 'auth_asym_id', is => 'rw', isa => 'Str'; # cif
32 19 has 'auth_atom_id', is => 'rw', isa => 'Str'; # cif -> author fudged name
33 19 has 'entity_id', is => 'rw', isa => 'Int'; # cif, e.g. virus, main chains of 1 entity
34 19 has 'pdb_formal_charge', is => 'rw', isa => 'Num'; # cif, e.g. virus, main chains of 1 entity
35  
36 19 my %aa321 = (
37 ALA=>'A', ARG=>'R', ASN=>'N', ASP=>'D', CYS=>'C',
38 GLU=>'E', GLN=>'Q', GLY=>'G', HIS=>'H', ILE=>'I',
39 LEU=>'L', LYS=>'K', MET=>'M', PHE=>'F', PRO=>'P',
40 SER=>'S', THR=>'T', TRP=>'W', TYR=>'Y', VAL=>'V',
41 SEC=>'U',
42 );
43  
44 43 ▶sub aa321 {
Subroutine aa321: called CC=4 SCAR=14.2
Pod documented
45 43 my $self = shift;
46 43 my $x_flag = shift;
47 43 ▶ $x_flag = 1 unless defined($x_flag);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $x_flag 43 0 43
48  
49 43 my $resname = uc($self->resname);
50
51 43 ▶ unless ( exists($aa321{$resname}) ){
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $aa321{$resname}) 1 42 43
52 1 carp "PDBRole> residue $resname name has no 1 letter code";
53 1 ▶ return ('X') if $x_flag;
Branch: 1 branch
BranchTrueFalseTotal
if $x_flag 1 0 1
54 0 return ("($resname)");
55 }
56 42 return ($aa321{$resname});
57 }
58 #following map lifted from Bio::PDB::Structure::Atom
59  
60 19 my %pdb_atom_names = (
61 'C' => ' C ',
62 'C1' => ' C1 ',
63 'C1A' => ' C1A',
64 'C1B' => ' C1B',
65 'C1C' => ' C1C',
66 'C1D' => ' C1D',
67 'C2' => ' C2 ',
68 'C2A' => ' C2A',
69 'C2B' => ' C2B',
70 'C2C' => ' C2C',
71 'C2D' => ' C2D',
72 'C3' => ' C3 ',
73 'C3A' => ' C3A',
74 'C3B' => ' C3B',
75 'C3C' => ' C3C',
76 'C3D' => ' C3D',
77 'C4' => ' C4 ',
78 'C4A' => ' C4A',
79 'C4A' => ' C4A',
80 'C4B' => ' C4B',
81 'C4C' => ' C4C',
82 'C4D' => ' C4D',
83 'C5' => ' C5 ',
84 'C6' => ' C6 ',
85 'CA' => ' CA ',
86 'CAA' => ' CAA',
87 'CAB' => ' CAB',
88 'CAC' => ' CAC',
89 'CAD' => ' CAD',
90 'CB' => ' CB ',
91 'CBA' => ' CBA',
92 'CBB' => ' CBB',
93 'CBC' => ' CBC',
94 'CBD' => ' CBD',
95 'CD' => ' CD ',
96 'CD1' => ' CD1',
97 'CD2' => ' CD2',
98 'CE' => ' CE ',
99 'CE1' => ' CE1',
100 'CE2' => ' CE2',
101 'CE3' => ' CE3',
102 'CG' => ' CG ',
103 'CG1' => ' CG1',
104 'CG2' => ' CG2',
105 'CGA' => ' CGA',
106 'CGD' => ' CGD',
107 'CH2' => ' CH2',
108 'CHA' => ' CHA',
109 'CHB' => ' CHB',
110 'CHC' => ' CHC',
111 'CHD' => ' CHD',
112 'CMA' => ' CMA',
113 'CMB' => ' CMB',
114 'CMC' => ' CMC',
115 'CMD' => ' CMD',
116 'CZ' => ' CZ ',
117 'CZ2' => ' CZ2',
118 'CZ3' => ' CZ3',
119 'FE' => 'FE ',
120 'H' => ' H ',
121 'HA' => ' HA ',
122 'HB' => ' HB ',
123 'HG' => ' HG ',
124 'HE' => ' HE ',
125 'HZ' => ' HZ ',
126 'HH' => ' HH ',
127 '1H' => '1H ',
128 '2H' => '2H ',
129 '3H' => '3H ',
130 '1HA' => '1HA ',
131 '1HB' => '1HB ',
132 '1HD' => '1HD ',
133 '1HE' => '1HE ',
134 '1HG' => '1HG ',
135 '1HZ' => '1HZ ',
136 '2HA' => '2HA ',
137 '2HB' => '2HB ',
138 '2HD' => '2HD ',
139 '2HE' => '2HE ',
140 '2HG' => '2HG ',
141 '1HZ' => '1HZ ',
142 '2HZ' => '2HZ ',
143 '3HB' => '3HB ',
144 '3HE' => '3HE ',
145 '3HZ' => '3HZ ',
146 'N' => ' N ',
147 'NA' => ' NA ',
148 'NB' => ' NB ',
149 'NC' => ' NC ',
150 'ND' => ' ND ',
151 'N A' => ' N A',
152 'N B' => ' N B',
153 'N C' => ' N C',
154 'N D' => ' N D',
155 'N1' => ' N1 ',
156 'N2' => ' N2 ',
157 'N3' => ' N3 ',
158 'ND1' => ' ND1',
159 'ND2' => ' ND2',
160 'NE' => ' NE ',
161 'NE1' => ' NE1',
162 'NE2' => ' NE2',
163 'NH1' => ' NH1',
164 'NH2' => ' NH2',
165 'NZ' => ' NZ ',
166 'O' => ' O ',
167 'O1' => ' O1 ',
168 'O1A' => ' O1A',
169 'O1D' => ' O1D',
170 'O2' => ' O2 ',
171 'O2A' => ' O2A',
172 'O2D' => ' O2D',
173 'O3' => ' O3 ',
174 'O4' => ' O4 ',
175 'O5' => ' O5 ',
176 'O6' => ' O6 ',
177 'OD1' => ' OD1',
178 'OD2' => ' OD2',
179 'OE1' => ' OE1',
180 'OE2' => ' OE2',
181 'OG' => ' OG ',
182 'OG1' => ' OG1',
183 'OH' => ' OH ',
184 'OXT' => ' OXT',
185 'S' => ' S ',
186 'SD' => ' SD ',
187 'SG' => ' SG '
188 );
189  
190 5 ▶sub pdb_rename{
Subroutine pdb_rename: called CC=2 SCAR=7.0
Pod documented
191 5 my $self = shift;
192 5 my $name = $self->name;
193 5 ▶ if(exists($pdb_atom_names{$self->name})){
Branch: 1 branch
BranchTrueFalseTotal
if (exists $pdb_atom_names{$self->name}) 5 0 5
194 5 $self->name($pdb_atom_names{$self->name});
195 }
196 5 return $name;
197 }
198  
199 19 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
200 19 1;
201  
202 # added attributes for parsing a PDB file
203 # Histidine 64 for Human Carbonic Anhydrase II from pdbid: 2CBA
204 #some lines for reference that did not translate well into POD
205 #my $lines_H64_2cba = '
206 # 1 2 3 4 5 6 7 8
207 #12345678901234567890123456789012345678901234567890123456789012345678901234567890
208 #ATOM 504 N HIS A 64 -0.822 -1.995 6.439 1.00 10.63 N
209 #ATOM 505 CA HIS A 64 -0.847 -2.773 7.721 1.00 10.22 C
210 #ATOM 506 C HIS A 64 -2.270 -3.278 7.949 1.00 9.51 C
211 #ATOM 507 O HIS A 64 -2.449 -4.225 8.736 1.00 11.94 O
212 #ATOM 508 CB AHIS A 64 -0.335 -2.173 8.991 0.70 10.98 C
213 #ATOM 509 CB BHIS A 64 -0.409 -1.888 8.917 0.20 9.21 C
214 #ATOM 510 CG AHIS A 64 -0.736 -0.782 9.258 0.70 12.16 C
215 #ATOM 511 CG BHIS A 64 0.714 -0.964 8.521 0.20 8.70 C
216 #ATOM 512 ND1AHIS A 64 -1.795 -0.353 10.014 0.70 14.34 N
217 #ATOM 513 ND1BHIS A 64 0.513 0.338 8.162 0.20 8.57 N
218 #ATOM 514 CD2AHIS A 64 -0.117 0.344 8.805 0.70 12.79 C
219 #ATOM 515 CD2BHIS A 64 2.037 -1.198 8.364 0.20 8.90 C
220 #ATOM 516 CE1AHIS A 64 -1.809 0.971 10.061 0.70 13.80 C
221 #ATOM 517 CE1BHIS A 64 1.691 0.868 7.814 0.20 8.65 C
222 #ATOM 518 NE2AHIS A 64 -0.844 1.403 9.281 0.70 15.45 N
223 #ATOM 519 NE2BHIS A 64 2.615 -0.026 7.936 0.20 6.94 N
224 #';
225 #
226 #my $ATOM_record_format = '
227 #Record Format: http://www.wwpdb.org/documentation/format23/sect9.html
228 #COLUMNS DATA TYPE FIELD DEFINITION
229 #------------------------------------------------------
230 # 1 - 6 Record name "ATOM "
231 # 7 - 11 Integer serial Atom serial number.
232 #13 - 16 Atom name Atom name.
233 #17 Character altLoc Alternate location indicator.
234 #18 - 20 Residue name resName Residue name.
235 #22 Character chainID Chain identifier.
236 #23 - 26 Integer resSeq Residue sequence number.
237 #27 AChar iCode Code for insertion of residues.
238 #31 - 38 Real(8.3) x Orthogonal coordinates for X in
239 # Angstroms
240 #39 - 46 Real(8.3) y Orthogonal coordinates for Y in
241 # Angstroms
242 #47 - 54 Real(8.3) z Orthogonal coordinates for Z in
243 # Angstroms
244 #55 - 60 Real(6.2) occupancy Occupancy.
245 #61 - 66 Real(6.2) tempFactor Temperature factor.
246 #77 - 78 LString(2) element Element symbol, right-justified.
247 #79 - 80 LString(2) charge Charge on the atom.
248 #';
249 #
250 # we will add support for reading two code chains using column 21
251 #
252  
253 __END__
« HackaMol/Roles/NERFRole.pm ↑ Summary HackaMol/Roles/SelectionRole.pm »