-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathZEALtest.m
223 lines (138 loc) · 8 KB
/
ZEALtest.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
classdef ZEALtest < matlab.unittest.TestCase
%ZEALTEST class-based unit tests for ZEAL
% unit = smallest piece of code that can be logically isolated in a system
% = function, subroutine, method or property
%
% USAGE
%
% Run all tests
% ----------------------------------------------
% testCase = ZEALtest;
% res = run(testCase)
%
% Run single test method
% ----------------------------------------------
% testCase = ZEALtest;
% res = run(testCase, 'testPDBread'
%
% Run groups of test based on category
% ----------------------------------------------
% results = runtests('ZEALtest','Tag','PDB');
%
% Available tests
% ----------------------------------------------
% name description
% |-> option different from default behaviour
% ----------------------------------------------
%
% |-> option different from default behaviour
% testPDB_default Test reading PDB file
% testPDB_chain |-> specific chain
% testPDB_hetatoms |-> include hetatoms
% testCIF_default Test reading CIF files
% testCIF_chain |-> specific chain
% testCIF_hetatoms |-> include hetatoms
% testDownload_default Test downloading (cif) structures from https://www.rcsb.org/
% testDownload_chain |-> specific chain
% testDownload_hetatoms |-> include hetatoms
% testDownload_chain_auto |-> specific chain assumed from 5th letter
% testDownload_auto_Hatoms |-> try download if file doesn't exist,
% include hydrogen atoms
% testAlignment_default Test performing an alignment
% testAlignment_funevals |-> change stopping criterium
% testAlignment_alignlater |-> hold alignment
% ----------------------------------------------
% Test everything
methods (Test)
end
% Test importing data
% --------------------------------------------------------------------
% PDB
methods (Test, TestTags = {'class','PDB', 'import'})
function testPDB_default(testCase)
% read PDB file containing
PDBstruct = PDB('sample_data/5mok.pdb');
% assert default selection criteria expected for ZEAL
testCase.assertFalse(PDBstruct.Selection.includeHatoms, 'HETATM should not be selected by default');
testCase.assertFalse(PDBstruct.Selection.includeHetatoms, 'Hydrogen atoms should not be selected by default');
testCase.assertEqual(PDBstruct.Selection.chainID,'all', 'All chains in file should be selected by default');
testCase.assertEqual(PDBstruct.Selection.altLocID, 'all', 'All altlocs should be selected by default');
% assert data contains expected number of atoms
nAtoms = length(PDBstruct.Data.X);
testCase.assertEqual(nAtoms, 6358, 'Number of ATOM records differ from expected');
end
function testPDB_chain(testCase)
PDBstruct = PDB('sample_data/5mok.pdb', 'chainID', 'B');
nAtoms = length(PDBstruct.Data.X);
testCase.assertEqual(nAtoms, 1594, 'Number of ATOM records differ from expected');
end
function testPDB_hetatoms(testCase)
PDBstruct = PDB('sample_data/5mok.pdb', 'includeHetatoms', true);
nAtoms = length(PDBstruct.Data.X);
testCase.assertEqual(nAtoms, 6358+815, 'Number of ATOM+HETATM records differ from expected');
end
end
% CIF
methods (Test, TestTags = {'class' 'CIF', 'import'})
function testCIF_default(testCase)
% read PDB file containing
PDBstruct = PDB('sample_data/5mok.cif');
% assert default selection criteria expected for ZEAL
testCase.assertFalse(PDBstruct.Selection.includeHatoms, 'HETATM should not be selected by default');
testCase.assertFalse(PDBstruct.Selection.includeHetatoms, 'Hydrogen atoms should not be selected by default');
testCase.assertEqual(PDBstruct.Selection.chainID,'all', 'All chains in file should be selected by default');
testCase.assertEqual(PDBstruct.Selection.altLocID, 'all', 'All altlocs should be selected by default');
% assert data contains expected number of atoms
nAtoms = length(PDBstruct.Data.X);
testCase.assertEqual(nAtoms, 6358, 'Number of ATOM records differ from expected');
end
function testCIF_chain(testCase)
PDBstruct = PDB('sample_data/5mok.cif', 'chainID', 'B');
nAtoms = length(PDBstruct.Data.X);
testCase.assertEqual(nAtoms, 1594, 'Number of ATOM records differ from expected');
end
function testCIF_hetatoms(testCase)
PDBstruct = PDB('sample_data/5mok.cif', 'includeHetatoms', true);
nAtoms = length(PDBstruct.Data.X);
testCase.assertEqual(nAtoms, 6358+815, 'Number of ATOM+HETATM records differ from expected');
end
end
% Download
methods (Test, TestTags = {'class', 'Download', 'import'})
function testDownload_default(testCase)
% read PDB file containing
PDBstruct = PDB('5mok');
% assert default selection criteria expected for ZEAL
testCase.assertFalse(PDBstruct.Selection.includeHatoms, 'HETATM should not be selected by default');
testCase.assertFalse(PDBstruct.Selection.includeHetatoms, 'Hydrogen atoms should not be selected by default');
testCase.assertEqual(PDBstruct.Selection.chainID,'all', 'All chains in file should be selected by default');
testCase.assertEqual(PDBstruct.Selection.altLocID, 'all', 'All altlocs should be selected by default');
% assert data contains expected number of atoms
nAtoms = length(PDBstruct.Data.X);
testCase.assertEqual(nAtoms, 6358, 'Number of ATOM records differ from expected');
end
function testDownload_chain(testCase)
PDBstruct = PDB('sample_data/5mok', 'chainID', 'B');
nAtoms = length(PDBstruct.Data.X);
testCase.assertEqual(nAtoms, 1594, 'Number of ATOM records differ from expected');
end
function testDownload_chain_auto(testCase)
PDBstruct = PDB('sample_data/5mokB');
nAtoms = length(PDBstruct.Data.X);
testCase.assertEqual(nAtoms, 1594, 'Number of ATOM records differ from expected');
end
function testDownload_auto_Hatoms(testCase)
PDBstruct = PDB('sample_data/5PTI.pdb', 'includeHatoms', true);
nAtoms = length(PDBstruct.Data.X);
testCase.assertEqual(nAtoms, 909, 'Number of ATOM records differ from expected');
end
function testDownload_hetatoms(testCase)
PDBstruct = PDB('sample_data/5mok', 'includeHetatoms', true);
nAtoms = length(PDBstruct.Data.X);
testCase.assertEqual(nAtoms, 6358+815, 'Number of ATOM+HETATM records differ from expected');
end
end
% Test alignment
methods (Test, TestTags = {'class', 'Alignment'})
end
end