bio 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +954 -0
- data/KNOWN_ISSUES.rdoc +40 -5
- data/README.rdoc +36 -35
- data/RELEASE_NOTES.rdoc +87 -59
- data/bioruby.gemspec +24 -2
- data/doc/RELEASE_NOTES-1.4.1.rdoc +104 -0
- data/doc/Tutorial.rd +162 -200
- data/doc/Tutorial.rd.html +149 -146
- data/lib/bio.rb +1 -0
- data/lib/bio/appl/blast.rb +1 -1
- data/lib/bio/appl/blast/ddbj.rb +26 -34
- data/lib/bio/appl/blast/genomenet.rb +21 -11
- data/lib/bio/db/embl/sptr.rb +193 -21
- data/lib/bio/db/fasta.rb +1 -1
- data/lib/bio/db/fastq.rb +14 -0
- data/lib/bio/db/fastq/format_fastq.rb +2 -2
- data/lib/bio/db/genbank/ddbj.rb +1 -2
- data/lib/bio/db/genbank/format_genbank.rb +1 -1
- data/lib/bio/db/medline.rb +1 -0
- data/lib/bio/db/newick.rb +3 -1
- data/lib/bio/db/pdb/pdb.rb +9 -9
- data/lib/bio/db/pdb/residue.rb +2 -2
- data/lib/bio/io/ddbjrest.rb +344 -0
- data/lib/bio/io/ncbirest.rb +121 -1
- data/lib/bio/location.rb +2 -2
- data/lib/bio/reference.rb +3 -4
- data/lib/bio/shell/plugin/entry.rb +7 -3
- data/lib/bio/shell/plugin/ncbirest.rb +5 -1
- data/lib/bio/util/restriction_enzyme.rb +3 -0
- data/lib/bio/util/restriction_enzyme/dense_int_array.rb +195 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +7 -7
- data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +57 -18
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb +2 -2
- data/lib/bio/util/restriction_enzyme/sorted_num_array.rb +219 -0
- data/lib/bio/version.rb +1 -1
- data/sample/test_restriction_enzyme_long.rb +4403 -0
- data/test/data/fasta/EFTU_BACSU.fasta +8 -0
- data/test/data/genbank/CAA35997.gp +48 -0
- data/test/data/genbank/SCU49845.gb +167 -0
- data/test/data/litdb/1717226.litdb +13 -0
- data/test/data/pir/CRAB_ANAPL.pir +6 -0
- data/test/functional/bio/appl/blast/test_remote.rb +93 -0
- data/test/functional/bio/appl/test_blast.rb +61 -0
- data/test/functional/bio/io/test_ddbjrest.rb +47 -0
- data/test/functional/bio/test_command.rb +3 -3
- data/test/unit/bio/db/embl/test_sptr.rb +6 -6
- data/test/unit/bio/db/embl/test_uniprot_new_part.rb +208 -0
- data/test/unit/bio/db/genbank/test_common.rb +274 -0
- data/test/unit/bio/db/genbank/test_genbank.rb +401 -0
- data/test/unit/bio/db/genbank/test_genpept.rb +81 -0
- data/test/unit/bio/db/pdb/test_pdb.rb +3287 -11
- data/test/unit/bio/db/test_fasta.rb +34 -12
- data/test/unit/bio/db/test_fastq.rb +26 -0
- data/test/unit/bio/db/test_litdb.rb +95 -0
- data/test/unit/bio/db/test_medline.rb +1 -0
- data/test/unit/bio/db/test_nbrf.rb +82 -0
- data/test/unit/bio/db/test_newick.rb +22 -4
- data/test/unit/bio/test_reference.rb +35 -0
- data/test/unit/bio/util/restriction_enzyme/test_dense_int_array.rb +201 -0
- data/test/unit/bio/util/restriction_enzyme/test_sorted_num_array.rb +281 -0
- metadata +44 -38
@@ -1,8 +1,8 @@
|
|
1
1
|
#
|
2
2
|
# = test/unit/bio/db/pdb/test_pdb.rb - Unit test for Bio::PDB classes
|
3
3
|
#
|
4
|
-
# Copyright:: Copyright (C)
|
5
|
-
#
|
4
|
+
# Copyright:: Copyright (C) 2010 Kazuhiro Hayashi <k.hayashi.info@gmail.com>
|
5
|
+
# Copyright:: Copyright (C) 2006 Naohisa Goto <ng@bioruby.org>
|
6
6
|
#
|
7
7
|
# License:: The Ruby License
|
8
8
|
#
|
@@ -11,6 +11,7 @@
|
|
11
11
|
|
12
12
|
# loading helper routine for testing bioruby
|
13
13
|
require 'pathname'
|
14
|
+
require 'matrix'
|
14
15
|
load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
|
15
16
|
'bioruby_test_helper.rb')).cleanpath.to_s
|
16
17
|
|
@@ -19,8 +20,296 @@ require 'test/unit'
|
|
19
20
|
require 'bio'
|
20
21
|
|
21
22
|
module Bio
|
22
|
-
|
23
|
-
#
|
23
|
+
|
24
|
+
#This class tests Bio::PDB class.
|
25
|
+
#The sample record isn't sufficient because it cannot pass through all of the case statement...
|
26
|
+
class TestPDB < Test::Unit::TestCase
|
27
|
+
def setup
|
28
|
+
str =<<EOF
|
29
|
+
HEADER OXIDOREDUCTASE 12-AUG-09 3INJ
|
30
|
+
TITLE HUMAN MITOCHONDRIAL ALDEHYDE DEHYDROGENASE COMPLEXED WITH
|
31
|
+
DBREF 3INJ A 1 500 UNP P05091 ALDH2_HUMAN 18 517
|
32
|
+
HELIX 1 1 ASP A 55 PHE A 70 1 16
|
33
|
+
KEYWDS OXIDOREDUCTASE, ALDH, E487K, ROSSMANN FOLD, ALDA-1,
|
34
|
+
SEQRES 1 A 500 SER ALA ALA ALA THR GLN ALA VAL PRO ALA PRO ASN GLN
|
35
|
+
SHEET 1 A 2 ILE A 22 ILE A 24 0
|
36
|
+
SSBOND 1 CYS B 301 CYS B 303 1555 1555 2.97
|
37
|
+
REVDAT 1 12-JAN-10 3INJ
|
38
|
+
MODEL 1
|
39
|
+
ATOM 1 N ALA A 7 23.484 -35.866 44.510 1.00 28.52 N
|
40
|
+
ANISOU 1 N ALA A 7 2406 1892 1614 198 519 -328 N
|
41
|
+
SIGUIJ 1 N ALA A 7 10 10 10 10 10 10 N
|
42
|
+
SIGATM 1 N ALA 7 0.040 0.030 0.030 0.00 0.00 N
|
43
|
+
ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C
|
44
|
+
ANISOU 2 CA ALA A 7 2748 2004 1679 -21 155 -419 C
|
45
|
+
SIGUIJ 2 CA ALA A 7 10 10 10 10 10 10 C
|
46
|
+
SIGATM 2 CA ALA 7 0.040 0.030 0.030 0.00 0.00 C
|
47
|
+
ATOM 3 C ALA A 7 23.102 -34.082 46.159 1.00 26.68 C
|
48
|
+
ANISOU 3 C ALA A 7 2555 1955 1468 87 357 -109 C
|
49
|
+
SIGUIJ 3 C ALA A 7 10 10 10 10 10 10 C
|
50
|
+
SIGATM 3 N ALA 7 0.040 0.030 0.030 0.00 0.00 C
|
51
|
+
ATOM 4 O ALA A 7 23.097 -32.903 46.524 1.00 30.02 O
|
52
|
+
ANISOU 4 O ALA A 7 2555 1955 1468 87 357 -109 O
|
53
|
+
SIGUIJ 4 O ALA A 7 10 10 10 10 10 10 O
|
54
|
+
SIGATM 4 O ALA 7 0.040 0.030 0.030 0.00 0.00 O
|
55
|
+
ATOM 5 CB ALA A 7 23.581 -33.526 43.770 1.00 31.41 C
|
56
|
+
ANISOU 5 CB ALA A 7 2555 1955 1468 87 357 -109 C
|
57
|
+
SIGUIJ 5 CB ALA A 7 10 10 10 10 10 10 C
|
58
|
+
SIGATM 1 CB ALA 7 0.040 0.030 0.030 0.00 0.00 C
|
59
|
+
MODEL 2
|
60
|
+
ATOM 1 N ALA A 7 23.484 -35.866 44.510 1.00 28.52 N
|
61
|
+
TER 3821 SER A 500
|
62
|
+
HETATM30582 C1 EDO A 701 -0.205 -27.262 49.961 1.00 34.45 C
|
63
|
+
HETATM30583 O1 EDO A 701 -1.516 -26.859 49.587 1.00 35.20 O
|
64
|
+
HETATM30584 C2 EDO A 701 -0.275 -28.124 51.219 1.00 34.49 C
|
65
|
+
HETATM30585 O2 EDO A 701 -1.442 -28.941 51.167 1.00 33.95 O
|
66
|
+
HETATM30586 C1 EDO A 702 2.792 7.449 67.655 1.00 17.09 C
|
67
|
+
HETATM30587 O1 EDO A 702 1.451 7.273 67.213 1.00 15.74 O
|
68
|
+
HETATM30588 C2 EDO A 702 3.678 7.589 66.425 1.00 15.31 C
|
69
|
+
HETATM30589 O2 EDO A 702 3.391 6.512 65.550 1.00 17.67 O
|
70
|
+
HETATM30857 O HOH A 502 13.654 -16.451 49.711 1.00 12.79 O
|
71
|
+
EOF
|
72
|
+
@pdb = Bio::PDB.new(str)
|
73
|
+
end
|
74
|
+
def test_accession
|
75
|
+
assert_equal("3INJ", @pdb.accession)
|
76
|
+
end
|
77
|
+
def test_addModel
|
78
|
+
assert_nothing_raised{@pdb.addModel(Bio::PDB::Model.new(1,nil))}
|
79
|
+
end
|
80
|
+
def test_authors
|
81
|
+
assert_equal([],@pdb.authors)
|
82
|
+
end
|
83
|
+
def test_classification
|
84
|
+
assert_equal("OXIDOREDUCTASE",@pdb.classification)
|
85
|
+
end
|
86
|
+
def test_dbref
|
87
|
+
assert_instance_of(Bio::PDB::Record::DBREF,@pdb.dbref.first)
|
88
|
+
assert_instance_of(Bio::PDB::Record::DBREF,@pdb.dbref("A").first)
|
89
|
+
end
|
90
|
+
def test_definition
|
91
|
+
assert_equal("HUMAN MITOCHONDRIAL ALDEHYDE DEHYDROGENASE COMPLEXED WITH",@pdb.definition)
|
92
|
+
end
|
93
|
+
def test_each
|
94
|
+
expected = [nil, 1, 2, 3]
|
95
|
+
pdb = Bio::PDB.new(" ")
|
96
|
+
pdb.addModel(Bio::PDB::Model.new(1,nil))
|
97
|
+
pdb.addModel(Bio::PDB::Model.new(2,nil))
|
98
|
+
pdb.addModel(Bio::PDB::Model.new(3,nil))
|
99
|
+
actual = []
|
100
|
+
pdb.each do |model|
|
101
|
+
actual << model.serial
|
102
|
+
end
|
103
|
+
assert_equal(expected,actual)
|
104
|
+
end
|
105
|
+
def test_each_model
|
106
|
+
expected = [nil, 1, 2, 3]
|
107
|
+
pdb = Bio::PDB.new("")
|
108
|
+
pdb.addModel(Bio::PDB::Model.new(1,nil))
|
109
|
+
pdb.addModel(Bio::PDB::Model.new(2,nil))
|
110
|
+
pdb.addModel(Bio::PDB::Model.new(3,nil))
|
111
|
+
actual = []
|
112
|
+
pdb.each_model do |model|
|
113
|
+
actual << model.serial
|
114
|
+
end
|
115
|
+
assert_equal(expected,actual)
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_entry_id
|
119
|
+
assert_equal("3INJ", @pdb.entry_id)
|
120
|
+
end
|
121
|
+
def test_helix
|
122
|
+
assert_instance_of(Array, @pdb.helix)
|
123
|
+
assert_equal(nil,@pdb.helix(1))
|
124
|
+
end
|
125
|
+
def test_inspect
|
126
|
+
assert_equal("#<Bio::PDB entry_id=\"3INJ\">",@pdb.inspect)
|
127
|
+
end
|
128
|
+
def test_jrnl
|
129
|
+
assert_instance_of(Hash, @pdb.jrnl)
|
130
|
+
end
|
131
|
+
def test_keywords
|
132
|
+
assert_equal(["OXIDOREDUCTASE", "ALDH", "E487K", "ROSSMANN FOLD", "ALDA-1"],@pdb.keywords)
|
133
|
+
end
|
134
|
+
def test_remark
|
135
|
+
str =<<EOS
|
136
|
+
REMARK 1 REFERENCE 1
|
137
|
+
REMARK 1 AUTH C.H.CHEN,G.R.BUDAS,E.N.CHURCHILL,M.H.DISATNIK
|
138
|
+
REMARK 2
|
139
|
+
REMARK 3
|
140
|
+
EOS
|
141
|
+
|
142
|
+
expected =
|
143
|
+
{ 1 => {:remarkNum=>1,
|
144
|
+
:sub_record=>"AUTH",
|
145
|
+
:authorList=>["C.H.CHEN", "G.R.BUDAS", "E.N.CHURCHILL", "M.H.DISATNIK"]},
|
146
|
+
2=>[],
|
147
|
+
3=>[]}
|
148
|
+
obj = Bio::PDB.new(str)
|
149
|
+
actual =
|
150
|
+
{ 1 => {:remarkNum=>obj.remark[1][0].remarkNum,
|
151
|
+
:sub_record=>obj.remark[1][0].sub_record,
|
152
|
+
:authorList=>obj.remark[1][0].authorList},
|
153
|
+
2=>obj.remark[2],
|
154
|
+
3=>obj.remark[3]}
|
155
|
+
|
156
|
+
assert_equal(actual,expected)
|
157
|
+
end
|
158
|
+
def test_record
|
159
|
+
assert_instance_of(Hash, @pdb.record)
|
160
|
+
end
|
161
|
+
def test_seqres
|
162
|
+
assert_equal({"A"=>"SAAATQAVPAPNQ"},@pdb.seqres)
|
163
|
+
assert_equal(nil,@pdb.seqres(7)) #I'm not sure why this returns nil
|
164
|
+
str =<<EOS
|
165
|
+
SEQRES 1 X 39 U C C C C C G U G C C C A
|
166
|
+
EOS
|
167
|
+
obj = Bio::PDB.new(str)
|
168
|
+
assert_equal({"X"=>"ucccccgugccca"},obj.seqres)
|
169
|
+
end
|
170
|
+
# too redundant?
|
171
|
+
def test_sheet
|
172
|
+
seq =<<EOS
|
173
|
+
SHEET 2 BS8 3 LYS 639 LYS 648 -1 N PHE 643 O HIS 662
|
174
|
+
SHEET 3 BS8 3 ASN 596 VAL 600 -1 N TYR 598 O ILE 646
|
175
|
+
EOS
|
176
|
+
s = Bio::PDB.new(seq)
|
177
|
+
actual = []
|
178
|
+
s.sheet.each do |obj2|
|
179
|
+
obj2.each do |obj|
|
180
|
+
|
181
|
+
actual <<
|
182
|
+
{:strand=>obj.strand,
|
183
|
+
:sheetID=>obj.sheetID,
|
184
|
+
:numStrands=>obj.numStrands,
|
185
|
+
:initResName=>obj.initResName,
|
186
|
+
:initChainID=>obj.initChainID,
|
187
|
+
:initSeqNum=>obj.initSeqNum,
|
188
|
+
:initICode=>obj.initICode,
|
189
|
+
:endResName=>obj.endResName,
|
190
|
+
:endChainID=>obj.endChainID,
|
191
|
+
:endSeqNum=>obj.endSeqNum,
|
192
|
+
:endICode=>obj.endICode,
|
193
|
+
:sense=>obj.sense,
|
194
|
+
:curAtom=>obj.curAtom,
|
195
|
+
:curResName=>obj.curResName,
|
196
|
+
:curChainId=>obj.curChainId,
|
197
|
+
:curResSeq=>obj.curResSeq,
|
198
|
+
:curICode=>obj.curICode,
|
199
|
+
:prevAtom=>obj.prevAtom,
|
200
|
+
:prevResName=>obj.prevResName,
|
201
|
+
:prevChainId=>obj.prevChainId,
|
202
|
+
:prevResSeq=>obj.prevResSeq,
|
203
|
+
:prevICode=>obj.prevICode}
|
204
|
+
end
|
205
|
+
end
|
206
|
+
expected =
|
207
|
+
[
|
208
|
+
{:strand=>2,
|
209
|
+
:sheetID=>"BS8",
|
210
|
+
:numStrands=>3,
|
211
|
+
:initResName=>"LYS",
|
212
|
+
:initChainID=>" ",
|
213
|
+
:initSeqNum=>639,
|
214
|
+
:initICode=>"",
|
215
|
+
:endResName=>"LYS",
|
216
|
+
:endChainID=>" ",
|
217
|
+
:endSeqNum=>648,
|
218
|
+
:endICode=>"",
|
219
|
+
:sense=>-1,
|
220
|
+
:curAtom=>" N",
|
221
|
+
:curResName=>"PHE",
|
222
|
+
:curChainId=>" ",
|
223
|
+
:curResSeq=>643,
|
224
|
+
:curICode=>"",
|
225
|
+
:prevAtom=>" O",
|
226
|
+
:prevResName=>"HIS",
|
227
|
+
:prevChainId=>" ",
|
228
|
+
:prevResSeq=>662,
|
229
|
+
:prevICode=>""},
|
230
|
+
|
231
|
+
{:strand=>3,
|
232
|
+
:sheetID=>"BS8",
|
233
|
+
:numStrands=>3,
|
234
|
+
:initResName=>"ASN",
|
235
|
+
:initChainID=>" ",
|
236
|
+
:initSeqNum=>596,
|
237
|
+
:initICode=>"",
|
238
|
+
:endResName=>"VAL",
|
239
|
+
:endChainID=>" ",
|
240
|
+
:endSeqNum=>600,
|
241
|
+
:endICode=>"",
|
242
|
+
:sense=>-1,
|
243
|
+
:curAtom=>" N",
|
244
|
+
:curResName=>"TYR",
|
245
|
+
:curChainId=>" ",
|
246
|
+
:curResSeq=>598,
|
247
|
+
:curICode=>"",
|
248
|
+
:prevAtom=>" O",
|
249
|
+
:prevResName=>"ILE",
|
250
|
+
:prevChainId=>" ",
|
251
|
+
:prevResSeq=>646,
|
252
|
+
:prevICode=>""}]
|
253
|
+
actual2 = []
|
254
|
+
s.sheet("BS8").each do |obj2|
|
255
|
+
obj2.each do |obj|
|
256
|
+
|
257
|
+
actual2 <<
|
258
|
+
{:strand=>obj.strand,
|
259
|
+
:sheetID=>obj.sheetID,
|
260
|
+
:numStrands=>obj.numStrands,
|
261
|
+
:initResName=>obj.initResName,
|
262
|
+
:initChainID=>obj.initChainID,
|
263
|
+
:initSeqNum=>obj.initSeqNum,
|
264
|
+
:initICode=>obj.initICode,
|
265
|
+
:endResName=>obj.endResName,
|
266
|
+
:endChainID=>obj.endChainID,
|
267
|
+
:endSeqNum=>obj.endSeqNum,
|
268
|
+
:endICode=>obj.endICode,
|
269
|
+
:sense=>obj.sense,
|
270
|
+
:curAtom=>obj.curAtom,
|
271
|
+
:curResName=>obj.curResName,
|
272
|
+
:curChainId=>obj.curChainId,
|
273
|
+
:curResSeq=>obj.curResSeq,
|
274
|
+
:curICode=>obj.curICode,
|
275
|
+
:prevAtom=>obj.prevAtom,
|
276
|
+
:prevResName=>obj.prevResName,
|
277
|
+
:prevChainId=>obj.prevChainId,
|
278
|
+
:prevResSeq=>obj.prevResSeq,
|
279
|
+
:prevICode=>obj.prevICode}
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
assert_equal(expected,actual)
|
284
|
+
assert_equal(expected,actual2)
|
285
|
+
end
|
286
|
+
def test_ssbond
|
287
|
+
assert_instance_of(Bio::PDB::Record::SSBOND,@pdb.ssbond.first)
|
288
|
+
end
|
289
|
+
|
290
|
+
#is this method correct?
|
291
|
+
def test_to_s
|
292
|
+
assert_equal("MODEL 1\nATOM 1 N ALA A 7 23.484 -35.866 44.510 1.00 28.52 N \nATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C \nATOM 3 C ALA A 7 23.102 -34.082 46.159 1.00 26.68 C \nATOM 4 O ALA A 7 23.097 -32.903 46.524 1.00 30.02 O \nATOM 5 CB ALA A 7 23.581 -33.526 43.770 1.00 31.41 C \nTER\nENDMDL\nMODEL 2\nATOM 1 N ALA A 7 23.484 -35.866 44.510 1.00 28.52 N \nTER\nHETATM30582 C1 EDO A 701 -0.205 -27.262 49.961 1.00 34.45 C \nHETATM30583 O1 EDO A 701 -1.516 -26.859 49.587 1.00 35.20 O \nHETATM30584 C2 EDO A 701 -0.275 -28.124 51.219 1.00 34.49 C \nHETATM30585 O2 EDO A 701 -1.442 -28.941 51.167 1.00 33.95 O \nHETATM30586 C1 EDO A 702 2.792 7.449 67.655 1.00 17.09 C \nHETATM30587 O1 EDO A 702 1.451 7.273 67.213 1.00 15.74 O \nHETATM30588 C2 EDO A 702 3.678 7.589 66.425 1.00 15.31 C \nHETATM30589 O2 EDO A 702 3.391 6.512 65.550 1.00 17.67 O \nHETATM30857 O HOH A 502 13.654 -16.451 49.711 1.00 12.79 O \nENDMDL\nEND\n",@pdb.to_s)
|
293
|
+
end
|
294
|
+
def test_turn
|
295
|
+
assert_equal([],@pdb.turn)
|
296
|
+
assert_equal(nil,@pdb.turn(1))
|
297
|
+
|
298
|
+
end
|
299
|
+
def test_version
|
300
|
+
assert_equal(1,@pdb.version)
|
301
|
+
end
|
302
|
+
|
303
|
+
def test_bracket #test for []
|
304
|
+
assert_equal(1,@pdb[1].serial)
|
305
|
+
end
|
306
|
+
|
307
|
+
|
308
|
+
end
|
309
|
+
|
310
|
+
#TestPDBRecord::Test* are unit tests for pdb field classes.
|
311
|
+
#each test class uses one line or several lines of PDB record.
|
312
|
+
#they tests all the methods described or generated in Bio::PDB::Record.
|
24
313
|
|
25
314
|
module TestPDBRecord
|
26
315
|
|
@@ -66,23 +355,23 @@ module Bio
|
|
66
355
|
end
|
67
356
|
|
68
357
|
def test_x
|
69
|
-
assert_in_delta(29.909, @atom.x,
|
358
|
+
assert_in_delta(29.909, @atom.x, 0.0001)
|
70
359
|
end
|
71
360
|
|
72
361
|
def test_y
|
73
|
-
assert_in_delta(16.996, @atom.y,
|
362
|
+
assert_in_delta(16.996, @atom.y, 0.0001)
|
74
363
|
end
|
75
364
|
|
76
365
|
def test_z
|
77
|
-
assert_in_delta(55.922, @atom.z,
|
366
|
+
assert_in_delta(55.922, @atom.z, 0.0001)
|
78
367
|
end
|
79
368
|
|
80
369
|
def test_occupancy
|
81
|
-
assert_in_delta(0.72, @atom.occupancy,
|
370
|
+
assert_in_delta(0.72, @atom.occupancy, 0.001)
|
82
371
|
end
|
83
372
|
|
84
373
|
def test_tempFactor
|
85
|
-
assert_in_delta(13.25, @atom.tempFactor,
|
374
|
+
assert_in_delta(13.25, @atom.tempFactor, 0.001)
|
86
375
|
end
|
87
376
|
|
88
377
|
def test_segID
|
@@ -121,9 +410,10 @@ module Bio
|
|
121
410
|
end
|
122
411
|
|
123
412
|
def test_to_s
|
124
|
-
assert_equal(@str + "\n", @atom.to_s)
|
413
|
+
assert_equal(@str + "\n", @atom.to_s)
|
125
414
|
end
|
126
415
|
|
416
|
+
|
127
417
|
def test_original_data
|
128
418
|
assert_equal([ @str ], @atom.original_data)
|
129
419
|
end
|
@@ -147,8 +437,2994 @@ module Bio
|
|
147
437
|
def test_ter
|
148
438
|
assert_equal(nil, @atom.ter)
|
149
439
|
end
|
440
|
+
|
441
|
+
|
150
442
|
end #class TestATOM
|
151
443
|
|
152
|
-
|
444
|
+
# test of Bio::PDB::Record::ATOM
|
445
|
+
class TestHETATM < Test::Unit::TestCase
|
446
|
+
def setup
|
447
|
+
# the data is taken from
|
448
|
+
# http://www.rcsb.org/pdb/file_formats/pdb/pdbguide2.2/part_62.html
|
449
|
+
@str = 'HETATM30581 NA NA A 601 5.037 -39.853 62.809 1.00 17.37 NA '
|
450
|
+
@hetatm = Bio::PDB::Record::HETATM.new.initialize_from_string(@str)
|
451
|
+
end
|
452
|
+
|
453
|
+
def test_record_name
|
454
|
+
assert_equal('HETATM', @hetatm.record_name)
|
455
|
+
end
|
456
|
+
|
457
|
+
def test_serial
|
458
|
+
assert_equal(30581, @hetatm.serial)
|
459
|
+
end
|
460
|
+
|
461
|
+
def test_name
|
462
|
+
assert_equal('NA', @hetatm.name)
|
463
|
+
end
|
464
|
+
|
465
|
+
def test_altLoc
|
466
|
+
assert_equal(' ', @hetatm.altLoc)
|
467
|
+
end
|
468
|
+
|
469
|
+
def test_resName
|
470
|
+
assert_equal('NA', @hetatm.resName)
|
471
|
+
end
|
472
|
+
|
473
|
+
def test_chainID
|
474
|
+
assert_equal('A', @hetatm.chainID)
|
475
|
+
end
|
476
|
+
|
477
|
+
def test_resSeq
|
478
|
+
assert_equal(601, @hetatm.resSeq)
|
479
|
+
end
|
480
|
+
|
481
|
+
def test_iCode
|
482
|
+
assert_equal('', @hetatm.iCode)
|
483
|
+
end
|
484
|
+
|
485
|
+
def test_x
|
486
|
+
assert_in_delta(5.037, @hetatm.x, 0.0001)
|
487
|
+
end
|
488
|
+
|
489
|
+
def test_y
|
490
|
+
assert_in_delta(-39.853, @hetatm.y, 0.0001)
|
491
|
+
end
|
492
|
+
|
493
|
+
def test_z
|
494
|
+
assert_in_delta(62.809, @hetatm.z, 0.0001)
|
495
|
+
end
|
496
|
+
|
497
|
+
def test_occupancy
|
498
|
+
assert_in_delta(1.00, @hetatm.occupancy, 0.001)
|
499
|
+
end
|
500
|
+
|
501
|
+
def test_tempFactor
|
502
|
+
assert_in_delta(17.37, @hetatm.tempFactor, 0.001)
|
503
|
+
end
|
504
|
+
|
505
|
+
def test_segID
|
506
|
+
assert_equal('', @hetatm.segID)
|
507
|
+
end
|
508
|
+
|
509
|
+
def test_element
|
510
|
+
assert_equal('NA', @hetatm.element)
|
511
|
+
end
|
512
|
+
|
513
|
+
def test_charge
|
514
|
+
assert_equal('', @hetatm.charge)
|
515
|
+
end
|
516
|
+
|
517
|
+
def test_xyz
|
518
|
+
assert_equal(Bio::PDB::Coordinate[
|
519
|
+
"5.037".to_f,
|
520
|
+
"-39.853".to_f,
|
521
|
+
"62.809".to_f ], @hetatm.xyz)
|
522
|
+
end
|
523
|
+
|
524
|
+
def test_to_a
|
525
|
+
assert_equal([ "5.037".to_f,
|
526
|
+
"-39.853".to_f,
|
527
|
+
"62.809".to_f ], @hetatm.to_a)
|
528
|
+
end
|
529
|
+
|
530
|
+
def test_comparable
|
531
|
+
a = Bio::PDB::Record::HETATM.new
|
532
|
+
a.serial = 40000
|
533
|
+
assert_equal(-1, @hetatm <=> a)
|
534
|
+
a.serial = 30581
|
535
|
+
assert_equal( 0, @hetatm <=> a)
|
536
|
+
a.serial = 30000
|
537
|
+
assert_equal( 1, @hetatm <=> a)
|
538
|
+
end
|
539
|
+
|
540
|
+
def test_to_s
|
541
|
+
assert_equal(@str + "\n", @hetatm.to_s)
|
542
|
+
end
|
543
|
+
|
544
|
+
def test_original_data
|
545
|
+
assert_equal([ @str ], @hetatm.original_data)
|
546
|
+
end
|
547
|
+
|
548
|
+
def test_do_parse
|
549
|
+
assert_equal(@hetatm, @hetatm.do_parse)
|
550
|
+
end
|
551
|
+
|
552
|
+
def test_residue
|
553
|
+
assert_equal(nil, @hetatm.residue)
|
554
|
+
end
|
555
|
+
|
556
|
+
def test_sigatm
|
557
|
+
assert_equal(nil, @hetatm.sigatm)
|
558
|
+
end
|
559
|
+
|
560
|
+
def test_anisou
|
561
|
+
assert_equal(nil, @hetatm.anisou)
|
562
|
+
end
|
563
|
+
|
564
|
+
def test_ter
|
565
|
+
assert_equal(nil, @hetatm.ter)
|
566
|
+
end
|
567
|
+
end #class TestATOM
|
568
|
+
|
569
|
+
class TestHEADER < Test::Unit::TestCase
|
570
|
+
def setup
|
571
|
+
@str = 'HEADER OXIDOREDUCTASE 12-AUG-09 3INJ '
|
572
|
+
@header = Bio::PDB::Record::HEADER.new.initialize_from_string(@str)
|
573
|
+
end
|
574
|
+
|
575
|
+
|
576
|
+
def test_classification
|
577
|
+
assert_equal('OXIDOREDUCTASE', @header.classification)
|
578
|
+
end
|
579
|
+
|
580
|
+
|
581
|
+
def test_depDate
|
582
|
+
assert_equal('12-AUG-09', @header.depDate)
|
583
|
+
end
|
584
|
+
|
585
|
+
|
586
|
+
def test_idCode
|
587
|
+
assert_equal('3INJ', @header.idCode)
|
588
|
+
end
|
589
|
+
|
590
|
+
|
591
|
+
end
|
592
|
+
|
593
|
+
class TestOBSLTE < Test::Unit::TestCase
|
594
|
+
def setup
|
595
|
+
@str = 'OBSLTE 31-JAN-94 1MBP 2MBP '
|
596
|
+
@obslte = Bio::PDB::Record::OBSLTE.new.initialize_from_string(@str)
|
597
|
+
end
|
598
|
+
|
599
|
+
|
600
|
+
def test_repDate
|
601
|
+
assert_equal('31-JAN-94', @obslte.repDate)
|
602
|
+
end
|
603
|
+
|
604
|
+
|
605
|
+
def test_idCode
|
606
|
+
assert_equal('1MBP', @obslte.idCode)
|
607
|
+
end
|
608
|
+
|
609
|
+
|
610
|
+
def test_rIdCode
|
611
|
+
assert_equal(["2MBP"], @obslte.rIdCode)
|
612
|
+
end
|
613
|
+
|
614
|
+
end
|
615
|
+
|
616
|
+
#Is this unit test correct?
|
617
|
+
class TestTITLE < Test::Unit::TestCase
|
618
|
+
def setup
|
619
|
+
@str =
|
620
|
+
"TITLE HUMAN MITOCHONDRIAL ALDEHYDE DEHYDROGENASE COMPLEXED WITH \n
|
621
|
+
TITLE 2 AGONIST ALDA-1 "
|
622
|
+
@title = Bio::PDB::Record::TITLE.new.initialize_from_string(@str)
|
623
|
+
end
|
624
|
+
|
625
|
+
|
626
|
+
def test_title
|
627
|
+
assert_equal('HUMAN MITOCHONDRIAL ALDEHYDE DEHYDROGENASE COMPLEXED WITH', @title.title)
|
628
|
+
end
|
629
|
+
|
630
|
+
|
631
|
+
end
|
632
|
+
|
633
|
+
class TestCAVEAT < Test::Unit::TestCase
|
634
|
+
def setup
|
635
|
+
@str = 'CAVEAT 1ABC INCORRECT'
|
636
|
+
@caveat = Bio::PDB::Record::CAVEAT.new.initialize_from_string(@str)
|
637
|
+
end
|
638
|
+
|
639
|
+
|
640
|
+
def test_idcode
|
641
|
+
assert_equal('1ABC', @caveat.idcode)
|
642
|
+
end
|
643
|
+
|
644
|
+
|
645
|
+
def test_comment
|
646
|
+
assert_equal('INCORRECT', @caveat.comment)
|
647
|
+
end
|
648
|
+
|
649
|
+
|
650
|
+
end
|
651
|
+
|
652
|
+
class TestCOMPND < Test::Unit::TestCase
|
653
|
+
def setup
|
654
|
+
@str =<<EOS
|
655
|
+
COMPND MOL_ID: 1;
|
656
|
+
COMPND 2 MOLECULE: ALDEHYDE DEHYDROGENASE, MITOCHONDRIAL;
|
657
|
+
COMPND 3 CHAIN: A, B, C, D, E, F, G, H;
|
658
|
+
COMPND 4 SYNONYM: ALDH CLASS 2, ALDHI, ALDH-E2;
|
659
|
+
COMPND 5 EC: 1.2.1.3;
|
660
|
+
COMPND 6 ENGINEERED: YES
|
661
|
+
|
662
|
+
EOS
|
663
|
+
@compnd = Bio::PDB::Record::COMPND.new.initialize_from_string(@str)
|
664
|
+
end
|
665
|
+
|
666
|
+
|
667
|
+
def test_compound
|
668
|
+
assert_equal([["MOL_ID", "1"]], @compnd.compound)
|
669
|
+
end
|
670
|
+
|
671
|
+
|
672
|
+
end
|
673
|
+
|
674
|
+
class TestSOURCE < Test::Unit::TestCase
|
675
|
+
def setup
|
676
|
+
@str =<<EOS
|
677
|
+
SOURCE MOL_ID: 1;
|
678
|
+
SOURCE 2 ORGANISM_SCIENTIFIC: HOMO SAPIENS;
|
679
|
+
SOURCE 3 ORGANISM_COMMON: HUMAN;
|
680
|
+
SOURCE 4 ORGANISM_TAXID: 9606;
|
681
|
+
SOURCE 5 GENE: ALDH2, ALDM;
|
682
|
+
SOURCE 6 EXPRESSION_SYSTEM: ESCHERICHIA COLI;
|
683
|
+
SOURCE 7 EXPRESSION_SYSTEM_TAXID: 562;
|
684
|
+
SOURCE 8 EXPRESSION_SYSTEM_STRAIN: BL21(DE3);
|
685
|
+
SOURCE 9 EXPRESSION_SYSTEM_VECTOR_TYPE: PLASMID;
|
686
|
+
SOURCE 10 EXPRESSION_SYSTEM_PLASMID: PT-7-7
|
687
|
+
EOS
|
688
|
+
@source = Bio::PDB::Record::SOURCE.new.initialize_from_string(@str)
|
689
|
+
end
|
690
|
+
|
691
|
+
|
692
|
+
def test_srcName
|
693
|
+
expected =
|
694
|
+
[["MOL_ID", "1"], ["SOURCE 2 ORGANISM_SCIENTIFIC", "HOMO SAPIENS"], ["SOU"]]
|
695
|
+
assert_equal(expected, @source.srcName)
|
696
|
+
end
|
697
|
+
end
|
698
|
+
|
699
|
+
class TestKEYWDS < Test::Unit::TestCase
|
700
|
+
def setup
|
701
|
+
@str =<<EOF
|
702
|
+
KEYWDS OXIDOREDUCTASE, ALDH, E487K, ROSSMANN FOLD, ALDA-1,
|
703
|
+
KEYWDS 2 ACTIVATOR, ACETYLATION, MITOCHONDRION, NAD, POLYMORPHISM,
|
704
|
+
KEYWDS 3 TRANSIT PEPTIDE
|
705
|
+
EOF
|
706
|
+
@keywds = Bio::PDB::Record::KEYWDS.new.initialize_from_string(@str)
|
707
|
+
end
|
708
|
+
|
709
|
+
|
710
|
+
def test_keywds
|
711
|
+
assert_equal(["OXIDOREDUCTASE", "ALDH", "E487K", "ROSSMANN FOLD", "ALDA-1", "KEYWDS"], @keywds.keywds)
|
712
|
+
end
|
713
|
+
|
714
|
+
end
|
715
|
+
|
716
|
+
class TestEXPDTA < Test::Unit::TestCase
|
717
|
+
def setup
|
718
|
+
@str = <<EOF
|
719
|
+
EXPDTA X-RAY DIFFRACTION
|
720
|
+
EOF
|
721
|
+
@expdta = Bio::PDB::Record::EXPDTA.new.initialize_from_string(@str)
|
722
|
+
end
|
723
|
+
|
724
|
+
|
725
|
+
def test_technique
|
726
|
+
assert_equal(["X-RAY DIFFRACTION"], @expdta.technique)
|
727
|
+
end
|
728
|
+
|
729
|
+
|
730
|
+
end
|
731
|
+
|
732
|
+
class TestAUTHOR < Test::Unit::TestCase
|
733
|
+
def setup
|
734
|
+
@str = 'AUTHOR S.PEREZ-MILLER,T.D.HURLEY'
|
735
|
+
@author = Bio::PDB::Record::AUTHOR.new.initialize_from_string(@str)
|
736
|
+
end
|
737
|
+
|
738
|
+
|
739
|
+
def test_authorList
|
740
|
+
assert_equal(["S.PEREZ-MILLER", "T.D.HURLEY"], @author.authorList)
|
741
|
+
end
|
742
|
+
|
743
|
+
|
744
|
+
end
|
745
|
+
|
746
|
+
class TestREVDAT < Test::Unit::TestCase
|
747
|
+
def setup
|
748
|
+
@str = 'REVDAT 1 12-JAN-10 3INJ 0'
|
749
|
+
@revdat = Bio::PDB::Record::REVDAT.new.initialize_from_string(@str)
|
750
|
+
end
|
751
|
+
|
752
|
+
|
753
|
+
def test_modNum
|
754
|
+
assert_equal(1, @revdat.modNum )
|
755
|
+
end
|
756
|
+
|
757
|
+
|
758
|
+
def test_modDate
|
759
|
+
assert_equal('12-JAN-10', @revdat.modDate)
|
760
|
+
end
|
761
|
+
|
762
|
+
|
763
|
+
def test_modId
|
764
|
+
assert_equal('3INJ', @revdat.modId )
|
765
|
+
end
|
766
|
+
|
767
|
+
|
768
|
+
def test_modType
|
769
|
+
assert_equal(0, @revdat.modType)
|
770
|
+
end
|
771
|
+
|
772
|
+
|
773
|
+
def test_record
|
774
|
+
assert_equal([], @revdat.record )
|
775
|
+
end
|
776
|
+
|
777
|
+
|
778
|
+
end
|
779
|
+
|
780
|
+
class TestSPRSDE < Test::Unit::TestCase
|
781
|
+
def setup
|
782
|
+
@str = 'SPRSDE 17-JUL-84 4HHB 1HHB '
|
783
|
+
@sprsde = Bio::PDB::Record::SPRSDE.new.initialize_from_string(@str)
|
784
|
+
end
|
785
|
+
|
786
|
+
|
787
|
+
def test_sprsdeDate
|
788
|
+
assert_equal('17-JUL-84', @sprsde.sprsdeDate)
|
789
|
+
end
|
790
|
+
|
791
|
+
|
792
|
+
def test_idCode
|
793
|
+
assert_equal('4HHB', @sprsde.idCode)
|
794
|
+
end
|
795
|
+
|
796
|
+
|
797
|
+
def test_sIdCode
|
798
|
+
assert_equal(["1HHB"], @sprsde.sIdCode)
|
799
|
+
end
|
800
|
+
|
801
|
+
end
|
802
|
+
|
803
|
+
class TestDBREF < Test::Unit::TestCase
|
804
|
+
def setup
|
805
|
+
@str =<<EOS
|
806
|
+
DBREF 3INJ A 1 500 UNP P05091 ALDH2_HUMAN 18 517
|
807
|
+
DBREF 3INJ B 1 500 UNP P05091 ALDH2_HUMAN 18 517
|
808
|
+
DBREF 3INJ C 1 500 UNP P05091 ALDH2_HUMAN 18 517
|
809
|
+
DBREF 3INJ D 1 500 UNP P05091 ALDH2_HUMAN 18 517
|
810
|
+
DBREF 3INJ E 1 500 UNP P05091 ALDH2_HUMAN 18 517
|
811
|
+
DBREF 3INJ F 1 500 UNP P05091 ALDH2_HUMAN 18 517
|
812
|
+
DBREF 3INJ G 1 500 UNP P05091 ALDH2_HUMAN 18 517
|
813
|
+
DBREF 3INJ H 1 500 UNP P05091 ALDH2_HUMAN 18 517
|
814
|
+
EOS
|
815
|
+
@dbref = Bio::PDB::Record::DBREF.new.initialize_from_string(@str)
|
816
|
+
end
|
817
|
+
|
818
|
+
|
819
|
+
def test_idCode
|
820
|
+
assert_equal('3INJ', @dbref.idCode )
|
821
|
+
end
|
822
|
+
|
823
|
+
|
824
|
+
def test_chainID
|
825
|
+
assert_equal('A', @dbref.chainID )
|
826
|
+
end
|
827
|
+
|
828
|
+
|
829
|
+
def test_seqBegin
|
830
|
+
assert_equal(1, @dbref.seqBegin )
|
831
|
+
end
|
832
|
+
|
833
|
+
|
834
|
+
def test_insertBegin
|
835
|
+
assert_equal('', @dbref.insertBegin)
|
836
|
+
end
|
837
|
+
|
838
|
+
|
839
|
+
def test_seqEnd
|
840
|
+
assert_equal(500, @dbref.seqEnd )
|
841
|
+
end
|
842
|
+
|
843
|
+
|
844
|
+
def test_insertEnd
|
845
|
+
assert_equal('', @dbref.insertEnd )
|
846
|
+
end
|
847
|
+
|
848
|
+
|
849
|
+
def test_database
|
850
|
+
assert_equal('UNP', @dbref.database )
|
851
|
+
end
|
852
|
+
|
853
|
+
|
854
|
+
def test_dbAccession
|
855
|
+
assert_equal('P05091', @dbref.dbAccession)
|
856
|
+
end
|
857
|
+
|
858
|
+
|
859
|
+
def test_dbIdCode
|
860
|
+
assert_equal('ALDH2_HUMAN', @dbref.dbIdCode )
|
861
|
+
end
|
862
|
+
|
863
|
+
|
864
|
+
def test_dbseqBegin
|
865
|
+
assert_equal(18, @dbref.dbseqBegin )
|
866
|
+
end
|
867
|
+
|
868
|
+
|
869
|
+
def test_idbnsBeg
|
870
|
+
assert_equal('', @dbref.idbnsBeg )
|
871
|
+
end
|
872
|
+
|
873
|
+
|
874
|
+
def test_dbseqEnd
|
875
|
+
assert_equal(517, @dbref.dbseqEnd )
|
876
|
+
end
|
877
|
+
end
|
878
|
+
|
879
|
+
class TestSEQADV < Test::Unit::TestCase
|
880
|
+
def setup
|
881
|
+
@str = 'SEQADV 3ABC MET A -1 UNP P10725 EXPRESSION TAG'
|
882
|
+
@seqadv = Bio::PDB::Record::SEQADV.new.initialize_from_string(@str)
|
883
|
+
end
|
884
|
+
|
885
|
+
|
886
|
+
def test_idCode
|
887
|
+
assert_equal('3ABC', @seqadv.idCode )
|
888
|
+
end
|
889
|
+
|
890
|
+
|
891
|
+
def test_resName
|
892
|
+
assert_equal('MET', @seqadv.resName )
|
893
|
+
end
|
894
|
+
|
895
|
+
|
896
|
+
def test_chainID
|
897
|
+
assert_equal('A', @seqadv.chainID )
|
898
|
+
end
|
899
|
+
|
900
|
+
|
901
|
+
def test_seqNum
|
902
|
+
assert_equal(-1, @seqadv.seqNum )
|
903
|
+
end
|
904
|
+
|
905
|
+
|
906
|
+
def test_iCode
|
907
|
+
assert_equal('', @seqadv.iCode )
|
908
|
+
end
|
909
|
+
|
910
|
+
|
911
|
+
def test_database
|
912
|
+
assert_equal('UNP', @seqadv.database)
|
913
|
+
end
|
914
|
+
|
915
|
+
|
916
|
+
def test_dbIdCode
|
917
|
+
assert_equal('P10725', @seqadv.dbIdCode)
|
918
|
+
end
|
919
|
+
|
920
|
+
|
921
|
+
def test_dbRes
|
922
|
+
assert_equal('', @seqadv.dbRes )
|
923
|
+
end
|
924
|
+
|
925
|
+
|
926
|
+
def test_dbSeq
|
927
|
+
assert_equal(0, @seqadv.dbSeq )
|
928
|
+
end
|
929
|
+
|
930
|
+
|
931
|
+
def test_conflict
|
932
|
+
assert_equal('EXPRESSION TAG', @seqadv.conflict)
|
933
|
+
end
|
934
|
+
|
935
|
+
|
936
|
+
end
|
937
|
+
|
938
|
+
class TestSEQRES < Test::Unit::TestCase
|
939
|
+
def setup
|
940
|
+
@str =<<EOS
|
941
|
+
SEQRES 1 A 500 SER ALA ALA ALA THR GLN ALA VAL PRO ALA PRO ASN GLN
|
942
|
+
SEQRES 2 A 500 GLN PRO GLU VAL PHE CYS ASN GLN ILE PHE ILE ASN ASN
|
943
|
+
SEQRES 3 A 500 GLU TRP HIS ASP ALA VAL SER ARG LYS THR PHE PRO THR
|
944
|
+
SEQRES 4 A 500 VAL ASN PRO SER THR GLY GLU VAL ILE CYS GLN VAL ALA
|
945
|
+
SEQRES 5 A 500 GLU GLY ASP LYS GLU ASP VAL ASP LYS ALA VAL LYS ALA
|
946
|
+
SEQRES 6 A 500 ALA ARG ALA ALA PHE GLN LEU GLY SER PRO TRP ARG ARG
|
947
|
+
SEQRES 7 A 500 MET ASP ALA SER HIS ARG GLY ARG LEU LEU ASN ARG LEU
|
948
|
+
SEQRES 8 A 500 ALA ASP LEU ILE GLU ARG ASP ARG THR TYR LEU ALA ALA
|
949
|
+
SEQRES 9 A 500 LEU GLU THR LEU ASP ASN GLY LYS PRO TYR VAL ILE SER
|
950
|
+
EOS
|
951
|
+
|
952
|
+
@seqres = Bio::PDB::Record::SEQRES.new.initialize_from_string(@str)
|
953
|
+
end
|
954
|
+
|
955
|
+
|
956
|
+
def test_chainID
|
957
|
+
assert_equal('A', @seqres.chainID)
|
958
|
+
end
|
959
|
+
|
960
|
+
|
961
|
+
def test_numRes
|
962
|
+
assert_equal(500, @seqres.numRes )
|
963
|
+
end
|
964
|
+
|
965
|
+
|
966
|
+
def test_resName
|
967
|
+
expected =
|
968
|
+
["SER",
|
969
|
+
"ALA",
|
970
|
+
"ALA",
|
971
|
+
"ALA",
|
972
|
+
"THR",
|
973
|
+
"GLN",
|
974
|
+
"ALA",
|
975
|
+
"VAL",
|
976
|
+
"PRO",
|
977
|
+
"ALA",
|
978
|
+
"PRO",
|
979
|
+
"ASN",
|
980
|
+
"GLN"]
|
981
|
+
assert_equal(expected, @seqres.resName)
|
982
|
+
end
|
983
|
+
|
984
|
+
end
|
985
|
+
|
986
|
+
class TestMODRES < Test::Unit::TestCase
|
987
|
+
def setup
|
988
|
+
@str = 'MODRES 2R0L ASN A 74 ASN GLYCOSYLATION SITE '
|
989
|
+
@modres = Bio::PDB::Record::MODRES.new.initialize_from_string(@str)
|
990
|
+
end
|
991
|
+
|
992
|
+
|
993
|
+
def test_idCode
|
994
|
+
assert_equal('2R0L', @modres.idCode)
|
995
|
+
end
|
996
|
+
|
997
|
+
|
998
|
+
def test_resName
|
999
|
+
assert_equal('ASN', @modres.resName)
|
1000
|
+
end
|
1001
|
+
|
1002
|
+
|
1003
|
+
def test_chainID
|
1004
|
+
assert_equal('A', @modres.chainID)
|
1005
|
+
end
|
1006
|
+
|
1007
|
+
|
1008
|
+
def test_seqNum
|
1009
|
+
assert_equal(74, @modres.seqNum)
|
1010
|
+
end
|
1011
|
+
|
1012
|
+
|
1013
|
+
def test_iCode
|
1014
|
+
assert_equal('', @modres.iCode)
|
1015
|
+
end
|
1016
|
+
|
1017
|
+
|
1018
|
+
def test_stdRes
|
1019
|
+
assert_equal('ASN', @modres.stdRes)
|
1020
|
+
end
|
1021
|
+
|
1022
|
+
|
1023
|
+
def test_comment
|
1024
|
+
assert_equal('GLYCOSYLATION SITE', @modres.comment)
|
1025
|
+
end
|
1026
|
+
|
1027
|
+
|
1028
|
+
end
|
1029
|
+
|
1030
|
+
class TestHET < Test::Unit::TestCase
|
1031
|
+
def setup
|
1032
|
+
@str = 'HET NA A 601 1 '
|
1033
|
+
@het = Bio::PDB::Record::HET.new.initialize_from_string(@str)
|
1034
|
+
end
|
1035
|
+
|
1036
|
+
|
1037
|
+
def test_hetID
|
1038
|
+
assert_equal(' NA', @het.hetID)
|
1039
|
+
end
|
1040
|
+
|
1041
|
+
|
1042
|
+
def test_ChainID
|
1043
|
+
assert_equal('A', @het.ChainID)
|
1044
|
+
end
|
1045
|
+
|
1046
|
+
|
1047
|
+
def test_seqNum
|
1048
|
+
assert_equal(601, @het.seqNum)
|
1049
|
+
end
|
1050
|
+
|
1051
|
+
|
1052
|
+
def test_iCode
|
1053
|
+
assert_equal('', @het.iCode)
|
1054
|
+
end
|
1055
|
+
|
1056
|
+
|
1057
|
+
def test_numHetAtoms
|
1058
|
+
assert_equal(1, @het.numHetAtoms)
|
1059
|
+
end
|
1060
|
+
|
1061
|
+
|
1062
|
+
def test_text
|
1063
|
+
assert_equal('', @het.text)
|
1064
|
+
end
|
1065
|
+
|
1066
|
+
|
1067
|
+
end
|
1068
|
+
|
1069
|
+
class TestSHEET < Test::Unit::TestCase
|
1070
|
+
def setup
|
1071
|
+
@str =<<EOS
|
1072
|
+
SHEET 1 A 2 ILE A 22 ILE A 24 0
|
1073
|
+
SHEET 2 A 2 GLU A 27 HIS A 29 -1 O HIS A 29 N ILE A 22
|
1074
|
+
SHEET 1 B 2 THR A 36 VAL A 40 0
|
1075
|
+
EOS
|
1076
|
+
@sheet = Bio::PDB::Record::SHEET.new.initialize_from_string(@str)
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
|
1080
|
+
def test_strand
|
1081
|
+
assert_equal(1, @sheet.strand)
|
1082
|
+
end
|
1083
|
+
|
1084
|
+
|
1085
|
+
def test_sheetID
|
1086
|
+
assert_equal('A', @sheet.sheetID)
|
1087
|
+
end
|
1088
|
+
|
1089
|
+
|
1090
|
+
def test_numStrands
|
1091
|
+
assert_equal(2, @sheet.numStrands)
|
1092
|
+
end
|
1093
|
+
|
1094
|
+
|
1095
|
+
def test_initResName
|
1096
|
+
assert_equal('ILE', @sheet.initResName)
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
|
1100
|
+
def test_initChainID
|
1101
|
+
assert_equal('A', @sheet.initChainID)
|
1102
|
+
end
|
1103
|
+
|
1104
|
+
|
1105
|
+
def test_initSeqNum
|
1106
|
+
assert_equal(22, @sheet.initSeqNum)
|
1107
|
+
end
|
1108
|
+
|
1109
|
+
|
1110
|
+
def test_initICode
|
1111
|
+
assert_equal('', @sheet.initICode)
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
|
1115
|
+
def test_endResName
|
1116
|
+
assert_equal('ILE', @sheet.endResName)
|
1117
|
+
end
|
1118
|
+
|
1119
|
+
|
1120
|
+
def test_endChainID
|
1121
|
+
assert_equal('A', @sheet.endChainID)
|
1122
|
+
end
|
1123
|
+
|
1124
|
+
|
1125
|
+
def test_endSeqNum
|
1126
|
+
assert_equal(24, @sheet.endSeqNum)
|
1127
|
+
end
|
1128
|
+
|
1129
|
+
|
1130
|
+
def test_endICode
|
1131
|
+
assert_equal('', @sheet.endICode)
|
1132
|
+
end
|
1133
|
+
|
1134
|
+
|
1135
|
+
def test_sense
|
1136
|
+
assert_equal(0, @sheet.sense)
|
1137
|
+
end
|
1138
|
+
|
1139
|
+
|
1140
|
+
def test_curAtom
|
1141
|
+
assert_equal('', @sheet.curAtom)
|
1142
|
+
end
|
1143
|
+
|
1144
|
+
|
1145
|
+
def test_curResName
|
1146
|
+
assert_equal('', @sheet.curResName)
|
1147
|
+
end
|
1148
|
+
|
1149
|
+
|
1150
|
+
def test_curChainId
|
1151
|
+
assert_equal(' ', @sheet.curChainId)
|
1152
|
+
end
|
1153
|
+
|
1154
|
+
|
1155
|
+
def test_curResSeq
|
1156
|
+
assert_equal(0, @sheet.curResSeq)
|
1157
|
+
end
|
1158
|
+
|
1159
|
+
|
1160
|
+
def test_curICode
|
1161
|
+
assert_equal('', @sheet.curICode)
|
1162
|
+
end
|
1163
|
+
|
1164
|
+
|
1165
|
+
def test_prevAtom
|
1166
|
+
assert_equal('', @sheet.prevAtom)
|
1167
|
+
end
|
1168
|
+
|
1169
|
+
|
1170
|
+
def test_prevResName
|
1171
|
+
assert_equal('', @sheet.prevResName)
|
1172
|
+
end
|
1173
|
+
|
1174
|
+
|
1175
|
+
def test_prevChainId
|
1176
|
+
assert_equal(' ', @sheet.prevChainId)
|
1177
|
+
end
|
1178
|
+
|
1179
|
+
|
1180
|
+
def test_prevResSeq
|
1181
|
+
assert_equal(0, @sheet.prevResSeq)
|
1182
|
+
end
|
1183
|
+
|
1184
|
+
|
1185
|
+
def test_prevICode
|
1186
|
+
assert_equal('', @sheet.prevICode)
|
1187
|
+
end
|
1188
|
+
|
1189
|
+
|
1190
|
+
end
|
1191
|
+
|
1192
|
+
class TestLINK < Test::Unit::TestCase
|
1193
|
+
def setup
|
1194
|
+
@str = 'LINK O VAL A 40 NA NA A 601 1555 1555 2.41 '
|
1195
|
+
@link = Bio::PDB::Record::LINK.new.initialize_from_string(@str)
|
1196
|
+
end
|
1197
|
+
|
1198
|
+
|
1199
|
+
def test_name1
|
1200
|
+
assert_equal(' O', @link.name1)
|
1201
|
+
end
|
1202
|
+
|
1203
|
+
|
1204
|
+
def test_altLoc1
|
1205
|
+
assert_equal(' ', @link.altLoc1)
|
1206
|
+
end
|
1207
|
+
|
1208
|
+
|
1209
|
+
def test_resName1
|
1210
|
+
assert_equal('VAL', @link.resName1)
|
1211
|
+
end
|
1212
|
+
|
1213
|
+
|
1214
|
+
def test_chainID1
|
1215
|
+
assert_equal('A', @link.chainID1)
|
1216
|
+
end
|
1217
|
+
|
1218
|
+
|
1219
|
+
def test_resSeq1
|
1220
|
+
assert_equal(40, @link.resSeq1)
|
1221
|
+
end
|
1222
|
+
|
1223
|
+
|
1224
|
+
def test_iCode1
|
1225
|
+
assert_equal('', @link.iCode1)
|
1226
|
+
end
|
1227
|
+
|
1228
|
+
|
1229
|
+
def test_name2
|
1230
|
+
assert_equal("NA", @link.name2)
|
1231
|
+
end
|
1232
|
+
|
1233
|
+
|
1234
|
+
def test_altLoc2
|
1235
|
+
assert_equal(' ', @link.altLoc2)
|
1236
|
+
end
|
1237
|
+
|
1238
|
+
|
1239
|
+
def test_resName2
|
1240
|
+
assert_equal(' NA', @link.resName2)
|
1241
|
+
end
|
1242
|
+
|
1243
|
+
|
1244
|
+
def test_chainID2
|
1245
|
+
assert_equal('A', @link.chainID2)
|
1246
|
+
end
|
1247
|
+
|
1248
|
+
|
1249
|
+
def test_resSeq2
|
1250
|
+
assert_equal(601, @link.resSeq2)
|
1251
|
+
end
|
1252
|
+
|
1253
|
+
|
1254
|
+
def test_iCode2
|
1255
|
+
assert_equal('', @link.iCode2)
|
1256
|
+
end
|
1257
|
+
|
1258
|
+
|
1259
|
+
def test_sym1
|
1260
|
+
assert_equal(' 1555', @link.sym1)
|
1261
|
+
end
|
1262
|
+
|
1263
|
+
|
1264
|
+
def test_sym2
|
1265
|
+
assert_equal(' 1555', @link.sym2)
|
1266
|
+
end
|
1267
|
+
|
1268
|
+
|
1269
|
+
end
|
1270
|
+
|
1271
|
+
class TestHYDBND < Test::Unit::TestCase
|
1272
|
+
def setup
|
1273
|
+
@str = 'HYDBND O PHE A 2 A 4 1HN AIB A 4 '
|
1274
|
+
@hydbnd = Bio::PDB::Record::HYDBND.new.initialize_from_string(@str)
|
1275
|
+
end
|
1276
|
+
|
1277
|
+
|
1278
|
+
def test_name1
|
1279
|
+
assert_equal(' O', @hydbnd.name1)
|
1280
|
+
end
|
1281
|
+
|
1282
|
+
|
1283
|
+
def test_altLoc1
|
1284
|
+
assert_equal(' ', @hydbnd.altLoc1)
|
1285
|
+
end
|
1286
|
+
|
1287
|
+
|
1288
|
+
def test_resName1
|
1289
|
+
assert_equal('PHE', @hydbnd.resName1)
|
1290
|
+
end
|
1291
|
+
|
1292
|
+
|
1293
|
+
def test_Chain1
|
1294
|
+
assert_equal('A', @hydbnd.Chain1)
|
1295
|
+
end
|
1296
|
+
|
1297
|
+
|
1298
|
+
def test_resSeq1
|
1299
|
+
assert_equal(2, @hydbnd.resSeq1)
|
1300
|
+
end
|
1301
|
+
|
1302
|
+
|
1303
|
+
def test_ICode1
|
1304
|
+
assert_equal('', @hydbnd.ICode1)
|
1305
|
+
end
|
1306
|
+
|
1307
|
+
|
1308
|
+
def test_nameH
|
1309
|
+
assert_equal('', @hydbnd.nameH)
|
1310
|
+
end
|
1311
|
+
|
1312
|
+
|
1313
|
+
def test_altLocH
|
1314
|
+
assert_equal(' ', @hydbnd.altLocH)
|
1315
|
+
end
|
1316
|
+
|
1317
|
+
|
1318
|
+
def test_ChainH
|
1319
|
+
assert_equal('A', @hydbnd.ChainH)
|
1320
|
+
end
|
1321
|
+
|
1322
|
+
|
1323
|
+
def test_resSeqH
|
1324
|
+
assert_equal(4, @hydbnd.resSeqH)
|
1325
|
+
end
|
1326
|
+
|
1327
|
+
|
1328
|
+
def test_iCodeH
|
1329
|
+
assert_equal('', @hydbnd.iCodeH)
|
1330
|
+
end
|
1331
|
+
|
1332
|
+
|
1333
|
+
def test_name2
|
1334
|
+
assert_equal('1HN', @hydbnd.name2)
|
1335
|
+
end
|
1336
|
+
|
1337
|
+
|
1338
|
+
def test_altLoc2
|
1339
|
+
assert_equal(' ', @hydbnd.altLoc2)
|
1340
|
+
end
|
1341
|
+
|
1342
|
+
|
1343
|
+
def test_resName2
|
1344
|
+
assert_equal('AIB', @hydbnd.resName2)
|
1345
|
+
end
|
1346
|
+
|
1347
|
+
|
1348
|
+
def test_chainID2
|
1349
|
+
assert_equal('A', @hydbnd.chainID2)
|
1350
|
+
end
|
1351
|
+
|
1352
|
+
|
1353
|
+
def test_resSeq2
|
1354
|
+
assert_equal(4, @hydbnd.resSeq2)
|
1355
|
+
end
|
1356
|
+
|
1357
|
+
|
1358
|
+
def test_iCode2
|
1359
|
+
assert_equal('', @hydbnd.iCode2)
|
1360
|
+
end
|
1361
|
+
|
1362
|
+
|
1363
|
+
def test_sym1
|
1364
|
+
assert_equal('', @hydbnd.sym1)
|
1365
|
+
end
|
1366
|
+
|
1367
|
+
|
1368
|
+
def test_sym2
|
1369
|
+
assert_equal('', @hydbnd.sym2)
|
1370
|
+
end
|
1371
|
+
|
1372
|
+
|
1373
|
+
end
|
1374
|
+
|
1375
|
+
#SLTBRG field is deprecated.
|
1376
|
+
class TestSLTBRG < Test::Unit::TestCase
|
1377
|
+
def setup
|
1378
|
+
@str = ''
|
1379
|
+
@sltbrg = Bio::PDB::Record::SLTBRG.new.initialize_from_string(@str)
|
1380
|
+
end
|
1381
|
+
|
1382
|
+
|
1383
|
+
def test_atom1
|
1384
|
+
assert_equal('', @sltbrg.atom1)
|
1385
|
+
end
|
1386
|
+
|
1387
|
+
|
1388
|
+
def test_altLoc1
|
1389
|
+
assert_equal("", @sltbrg.altLoc1)
|
1390
|
+
end
|
1391
|
+
|
1392
|
+
|
1393
|
+
def test_resName1
|
1394
|
+
assert_equal("", @sltbrg.resName1)
|
1395
|
+
end
|
1396
|
+
|
1397
|
+
|
1398
|
+
def test_chainID1
|
1399
|
+
assert_equal('', @sltbrg.chainID1)
|
1400
|
+
end
|
1401
|
+
|
1402
|
+
|
1403
|
+
def test_resSeq1
|
1404
|
+
assert_equal(0, @sltbrg.resSeq1)
|
1405
|
+
end
|
1406
|
+
|
1407
|
+
|
1408
|
+
def test_iCode1
|
1409
|
+
assert_equal('', @sltbrg.iCode1)
|
1410
|
+
end
|
1411
|
+
|
1412
|
+
|
1413
|
+
def test_atom2
|
1414
|
+
assert_equal('', @sltbrg.atom2)
|
1415
|
+
end
|
1416
|
+
|
1417
|
+
|
1418
|
+
def test_altLoc2
|
1419
|
+
assert_equal('', @sltbrg.altLoc2)
|
1420
|
+
end
|
1421
|
+
|
1422
|
+
|
1423
|
+
def test_resName2
|
1424
|
+
assert_equal('', @sltbrg.resName2)
|
1425
|
+
end
|
1426
|
+
|
1427
|
+
|
1428
|
+
def test_chainID2
|
1429
|
+
assert_equal('', @sltbrg.chainID2)
|
1430
|
+
end
|
1431
|
+
|
1432
|
+
|
1433
|
+
def test_resSeq2
|
1434
|
+
assert_equal(0, @sltbrg.resSeq2)
|
1435
|
+
end
|
1436
|
+
|
1437
|
+
|
1438
|
+
def test_iCode2
|
1439
|
+
assert_equal('', @sltbrg.iCode2)
|
1440
|
+
end
|
1441
|
+
|
1442
|
+
|
1443
|
+
def test_sym1
|
1444
|
+
assert_equal('', @sltbrg.sym1)
|
1445
|
+
end
|
1446
|
+
|
1447
|
+
|
1448
|
+
def test_sym2
|
1449
|
+
assert_equal('', @sltbrg.sym2)
|
1450
|
+
end
|
1451
|
+
|
1452
|
+
|
1453
|
+
end
|
1454
|
+
|
1455
|
+
class TestCISPEP < Test::Unit::TestCase
|
1456
|
+
def setup
|
1457
|
+
@str = 'CISPEP 1 GLY A 116 GLY A 117 0 18.50 '
|
1458
|
+
@cispep = Bio::PDB::Record::CISPEP.new.initialize_from_string(@str)
|
1459
|
+
end
|
1460
|
+
|
1461
|
+
|
1462
|
+
def test_serNum
|
1463
|
+
assert_equal(1, @cispep.serNum)
|
1464
|
+
end
|
1465
|
+
|
1466
|
+
|
1467
|
+
def test_pep1
|
1468
|
+
assert_equal("GLY", @cispep.pep1)
|
1469
|
+
end
|
1470
|
+
|
1471
|
+
|
1472
|
+
def test_chainID1
|
1473
|
+
assert_equal('A', @cispep.chainID1)
|
1474
|
+
end
|
1475
|
+
|
1476
|
+
|
1477
|
+
def test_seqNum1
|
1478
|
+
assert_equal(116, @cispep.seqNum1)
|
1479
|
+
end
|
1480
|
+
|
1481
|
+
|
1482
|
+
def test_icode1
|
1483
|
+
assert_equal('', @cispep.icode1)
|
1484
|
+
end
|
1485
|
+
|
1486
|
+
|
1487
|
+
def test_pep2
|
1488
|
+
assert_equal('GLY', @cispep.pep2)
|
1489
|
+
end
|
1490
|
+
|
1491
|
+
|
1492
|
+
def test_chainID2
|
1493
|
+
assert_equal('A', @cispep.chainID2)
|
1494
|
+
end
|
1495
|
+
|
1496
|
+
|
1497
|
+
def test_seqNum2
|
1498
|
+
assert_equal(117, @cispep.seqNum2)
|
1499
|
+
end
|
1500
|
+
|
1501
|
+
|
1502
|
+
def test_icode2
|
1503
|
+
assert_equal('', @cispep.icode2)
|
1504
|
+
end
|
1505
|
+
|
1506
|
+
|
1507
|
+
def test_modNum
|
1508
|
+
assert_equal(0, @cispep.modNum)
|
1509
|
+
end
|
1510
|
+
|
1511
|
+
|
1512
|
+
def test_measure
|
1513
|
+
assert_equal(18.5, @cispep.measure)
|
1514
|
+
end
|
1515
|
+
|
1516
|
+
|
1517
|
+
end
|
1518
|
+
|
1519
|
+
class TestSITE < Test::Unit::TestCase
|
1520
|
+
def setup
|
1521
|
+
@str =<<EOS
|
1522
|
+
SITE 1 AC1 5 THR A 39 VAL A 40 ASP A 109 GLN A 196
|
1523
|
+
SITE 2 AC1 5 HOH A4009
|
1524
|
+
EOS
|
1525
|
+
@site = Bio::PDB::Record::SITE.new.initialize_from_string(@str)
|
1526
|
+
end
|
1527
|
+
|
1528
|
+
|
1529
|
+
def test_seqNum
|
1530
|
+
assert_equal(1, @site.seqNum )
|
1531
|
+
end
|
1532
|
+
|
1533
|
+
|
1534
|
+
def test_siteID
|
1535
|
+
assert_equal('AC1', @site.siteID )
|
1536
|
+
end
|
1537
|
+
|
1538
|
+
|
1539
|
+
def test_numRes
|
1540
|
+
assert_equal(5, @site.numRes )
|
1541
|
+
end
|
1542
|
+
|
1543
|
+
|
1544
|
+
def test_resName1
|
1545
|
+
assert_equal('THR', @site.resName1 )
|
1546
|
+
end
|
1547
|
+
|
1548
|
+
|
1549
|
+
def test_chainID1
|
1550
|
+
assert_equal('A', @site.chainID1 )
|
1551
|
+
end
|
1552
|
+
|
1553
|
+
|
1554
|
+
def test_seq1
|
1555
|
+
assert_equal(39, @site.seq1 )
|
1556
|
+
end
|
1557
|
+
|
1558
|
+
|
1559
|
+
def test_iCode1
|
1560
|
+
assert_equal('', @site.iCode1 )
|
1561
|
+
end
|
1562
|
+
|
1563
|
+
|
1564
|
+
def test_resName2
|
1565
|
+
assert_equal('VAL', @site.resName2 )
|
1566
|
+
end
|
1567
|
+
|
1568
|
+
|
1569
|
+
def test_chainID2
|
1570
|
+
assert_equal('A', @site.chainID2 )
|
1571
|
+
end
|
1572
|
+
|
1573
|
+
|
1574
|
+
def test_seq2
|
1575
|
+
assert_equal(40, @site.seq2 )
|
1576
|
+
end
|
1577
|
+
|
1578
|
+
|
1579
|
+
def test_iCode2
|
1580
|
+
assert_equal('', @site.iCode2 )
|
1581
|
+
end
|
1582
|
+
|
1583
|
+
|
1584
|
+
def test_resName3
|
1585
|
+
assert_equal('ASP', @site.resName3 )
|
1586
|
+
end
|
1587
|
+
|
1588
|
+
|
1589
|
+
def test_chainID3
|
1590
|
+
assert_equal('A', @site.chainID3 )
|
1591
|
+
end
|
1592
|
+
|
1593
|
+
|
1594
|
+
def test_seq3
|
1595
|
+
assert_equal(109, @site.seq3 )
|
1596
|
+
end
|
1597
|
+
|
1598
|
+
|
1599
|
+
def test_iCode3
|
1600
|
+
assert_equal('', @site.iCode3 )
|
1601
|
+
end
|
1602
|
+
|
1603
|
+
|
1604
|
+
def test_resName4
|
1605
|
+
assert_equal('GLN', @site.resName4 )
|
1606
|
+
end
|
1607
|
+
|
1608
|
+
|
1609
|
+
def test_chainID4
|
1610
|
+
assert_equal('A', @site.chainID4 )
|
1611
|
+
end
|
1612
|
+
|
1613
|
+
|
1614
|
+
def test_seq4
|
1615
|
+
assert_equal(196, @site.seq4 )
|
1616
|
+
end
|
1617
|
+
|
1618
|
+
|
1619
|
+
def test_iCode4
|
1620
|
+
assert_equal('', @site.iCode4 )
|
1621
|
+
end
|
1622
|
+
|
1623
|
+
|
1624
|
+
end
|
1625
|
+
|
1626
|
+
class TestCRYST1 < Test::Unit::TestCase
|
1627
|
+
def setup
|
1628
|
+
@str = 'CRYST1 117.000 15.000 39.000 90.00 90.00 90.00 P 21 21 21 8'
|
1629
|
+
@cryst1 = Bio::PDB::Record::CRYST1.new.initialize_from_string(@str)
|
1630
|
+
end
|
1631
|
+
|
1632
|
+
|
1633
|
+
def test_a
|
1634
|
+
assert_equal(117.0, @cryst1.a)
|
1635
|
+
end
|
1636
|
+
|
1637
|
+
|
1638
|
+
def test_b
|
1639
|
+
assert_equal(15.0, @cryst1.b)
|
1640
|
+
end
|
1641
|
+
|
1642
|
+
|
1643
|
+
def test_c
|
1644
|
+
assert_equal(39.0, @cryst1.c)
|
1645
|
+
end
|
1646
|
+
|
1647
|
+
|
1648
|
+
def test_alpha
|
1649
|
+
assert_equal(90.0, @cryst1.alpha)
|
1650
|
+
end
|
1651
|
+
|
1652
|
+
|
1653
|
+
def test_beta
|
1654
|
+
assert_equal(90.0, @cryst1.beta)
|
1655
|
+
end
|
1656
|
+
|
1657
|
+
|
1658
|
+
def test_gamma
|
1659
|
+
assert_equal(90.0, @cryst1.gamma)
|
1660
|
+
end
|
1661
|
+
|
1662
|
+
|
1663
|
+
def test_sGroup
|
1664
|
+
assert_equal("P 21 21 21 ", @cryst1.sGroup)
|
1665
|
+
end
|
1666
|
+
|
1667
|
+
|
1668
|
+
def test_z
|
1669
|
+
assert_equal(8, @cryst1.z)
|
1670
|
+
end
|
1671
|
+
|
1672
|
+
|
1673
|
+
end
|
1674
|
+
|
1675
|
+
class TestORIGX1 < Test::Unit::TestCase
|
1676
|
+
def setup
|
1677
|
+
@str = 'ORIGX1 1.000000 0.000000 0.000000 0.00000 '
|
1678
|
+
@origx1 = Bio::PDB::Record::ORIGX1.new.initialize_from_string(@str)
|
1679
|
+
end
|
1680
|
+
|
1681
|
+
|
1682
|
+
def test_On1
|
1683
|
+
assert_equal(1.0, @origx1.On1)
|
1684
|
+
end
|
1685
|
+
|
1686
|
+
|
1687
|
+
def test_On2
|
1688
|
+
assert_equal(0.0, @origx1.On2)
|
1689
|
+
end
|
1690
|
+
|
1691
|
+
|
1692
|
+
def test_On3
|
1693
|
+
assert_equal(0.0, @origx1.On3)
|
1694
|
+
end
|
1695
|
+
|
1696
|
+
|
1697
|
+
def test_Tn
|
1698
|
+
assert_equal(0.0, @origx1.Tn)
|
1699
|
+
end
|
1700
|
+
|
1701
|
+
|
1702
|
+
end
|
1703
|
+
|
1704
|
+
class TestSCALE1 < Test::Unit::TestCase
|
1705
|
+
def setup
|
1706
|
+
@str = 'SCALE1 0.019231 0.000000 0.000000 0.00000 '
|
1707
|
+
@scale1 = Bio::PDB::Record::SCALE1.new.initialize_from_string(@str)
|
1708
|
+
end
|
1709
|
+
|
1710
|
+
|
1711
|
+
def test_Sn1
|
1712
|
+
assert_equal(0.019231, @scale1.Sn1)
|
1713
|
+
end
|
1714
|
+
|
1715
|
+
|
1716
|
+
def test_Sn2
|
1717
|
+
assert_equal(0.0, @scale1.Sn2)
|
1718
|
+
end
|
1719
|
+
|
1720
|
+
|
1721
|
+
def test_Sn3
|
1722
|
+
assert_equal(0.0, @scale1.Sn3)
|
1723
|
+
end
|
1724
|
+
|
1725
|
+
|
1726
|
+
def test_Un
|
1727
|
+
assert_equal(0.0, @scale1.Un)
|
1728
|
+
end
|
1729
|
+
|
1730
|
+
|
1731
|
+
end
|
1732
|
+
|
1733
|
+
class TestSCALE2 < Test::Unit::TestCase
|
1734
|
+
def setup
|
1735
|
+
@str = 'SCALE2 0.000000 0.017065 0.000000 0.00000 '
|
1736
|
+
@scale2 = Bio::PDB::Record::SCALE2.new.initialize_from_string(@str)
|
1737
|
+
end
|
1738
|
+
|
1739
|
+
|
1740
|
+
def test_Sn1
|
1741
|
+
assert_equal(0.0, @scale2.Sn1)
|
1742
|
+
end
|
1743
|
+
|
1744
|
+
|
1745
|
+
def test_Sn2
|
1746
|
+
assert_equal(0.017065, @scale2.Sn2)
|
1747
|
+
end
|
1748
|
+
|
1749
|
+
|
1750
|
+
def test_Sn3
|
1751
|
+
assert_equal(0.0, @scale2.Sn3)
|
1752
|
+
end
|
1753
|
+
|
1754
|
+
|
1755
|
+
def test_Un
|
1756
|
+
assert_equal(0.0, @scale2.Un)
|
1757
|
+
end
|
1758
|
+
|
1759
|
+
|
1760
|
+
end
|
1761
|
+
|
1762
|
+
class TestSCALE3 < Test::Unit::TestCase
|
1763
|
+
def setup
|
1764
|
+
@str = 'SCALE3 0.000000 0.000000 0.016155 0.00000 '
|
1765
|
+
@scale3 = Bio::PDB::Record::SCALE3.new.initialize_from_string(@str)
|
1766
|
+
end
|
1767
|
+
|
1768
|
+
|
1769
|
+
def test_Sn1
|
1770
|
+
assert_equal(0.0, @scale3.Sn1)
|
1771
|
+
end
|
1772
|
+
|
1773
|
+
|
1774
|
+
def test_Sn2
|
1775
|
+
assert_equal(0.0, @scale3.Sn2)
|
1776
|
+
end
|
1777
|
+
|
1778
|
+
|
1779
|
+
def test_Sn3
|
1780
|
+
assert_equal(0.016155, @scale3.Sn3)
|
1781
|
+
end
|
1782
|
+
|
1783
|
+
|
1784
|
+
def test_Un
|
1785
|
+
assert_equal(0.0, @scale3.Un)
|
1786
|
+
end
|
1787
|
+
|
1788
|
+
|
1789
|
+
end
|
1790
|
+
|
1791
|
+
class TestMTRIX1 < Test::Unit::TestCase
|
1792
|
+
def setup
|
1793
|
+
@str = 'MTRIX1 1 -1.000000 0.000000 -0.000000 0.00001 1 '
|
1794
|
+
@mtrix1 = Bio::PDB::Record::MTRIX1.new.initialize_from_string(@str)
|
1795
|
+
end
|
1796
|
+
|
1797
|
+
|
1798
|
+
def test_serial
|
1799
|
+
assert_equal(1, @mtrix1.serial)
|
1800
|
+
end
|
1801
|
+
|
1802
|
+
|
1803
|
+
def test_Mn1
|
1804
|
+
assert_equal(-1.0, @mtrix1.Mn1)
|
1805
|
+
end
|
1806
|
+
|
1807
|
+
|
1808
|
+
def test_Mn2
|
1809
|
+
assert_equal(0.0, @mtrix1.Mn2)
|
1810
|
+
end
|
1811
|
+
|
1812
|
+
|
1813
|
+
def test_Mn3
|
1814
|
+
assert_equal(-0.0, @mtrix1.Mn3)
|
1815
|
+
end
|
1816
|
+
|
1817
|
+
|
1818
|
+
def test_Vn
|
1819
|
+
assert_equal(1.0e-05, @mtrix1.Vn)
|
1820
|
+
end
|
1821
|
+
|
1822
|
+
|
1823
|
+
def test_iGiven
|
1824
|
+
assert_equal(1, @mtrix1.iGiven)
|
1825
|
+
end
|
1826
|
+
|
1827
|
+
|
1828
|
+
end
|
1829
|
+
|
1830
|
+
class TestMTRIX2 < Test::Unit::TestCase
|
1831
|
+
def setup
|
1832
|
+
@str = 'MTRIX2 1 -0.000000 1.000000 0.000000 0.00002 1 '
|
1833
|
+
@mtrix2 = Bio::PDB::Record::MTRIX2.new.initialize_from_string(@str)
|
1834
|
+
end
|
1835
|
+
|
1836
|
+
|
1837
|
+
def test_serial
|
1838
|
+
assert_equal(1, @mtrix2.serial)
|
1839
|
+
end
|
1840
|
+
|
1841
|
+
|
1842
|
+
def test_Mn1
|
1843
|
+
assert_equal(-0.0, @mtrix2.Mn1)
|
1844
|
+
end
|
1845
|
+
|
1846
|
+
|
1847
|
+
def test_Mn2
|
1848
|
+
assert_equal(1.0, @mtrix2.Mn2)
|
1849
|
+
end
|
1850
|
+
|
1851
|
+
|
1852
|
+
def test_Mn3
|
1853
|
+
assert_equal(0.0, @mtrix2.Mn3)
|
1854
|
+
end
|
1855
|
+
|
1856
|
+
|
1857
|
+
def test_Vn
|
1858
|
+
assert_equal(2.0e-05, @mtrix2.Vn)
|
1859
|
+
end
|
1860
|
+
|
1861
|
+
|
1862
|
+
def test_iGiven
|
1863
|
+
assert_equal(1, @mtrix2.iGiven)
|
1864
|
+
end
|
1865
|
+
|
1866
|
+
|
1867
|
+
end
|
1868
|
+
|
1869
|
+
class TestMTRIX3 < Test::Unit::TestCase
|
1870
|
+
def setup
|
1871
|
+
@str = 'MTRIX3 1 0.000000 -0.000000 -1.000000 0.00002 1 '
|
1872
|
+
@mtrix3 = Bio::PDB::Record::MTRIX3.new.initialize_from_string(@str)
|
1873
|
+
end
|
1874
|
+
|
1875
|
+
|
1876
|
+
def test_serial
|
1877
|
+
assert_equal(1, @mtrix3.serial)
|
1878
|
+
end
|
1879
|
+
|
1880
|
+
|
1881
|
+
def test_Mn1
|
1882
|
+
assert_equal(0.0, @mtrix3.Mn1)
|
1883
|
+
end
|
1884
|
+
|
1885
|
+
|
1886
|
+
def test_Mn2
|
1887
|
+
assert_equal(-0.0, @mtrix3.Mn2)
|
1888
|
+
end
|
1889
|
+
|
1890
|
+
|
1891
|
+
def test_Mn3
|
1892
|
+
assert_equal(-1.0, @mtrix3.Mn3)
|
1893
|
+
end
|
1894
|
+
|
1895
|
+
|
1896
|
+
def test_Vn
|
1897
|
+
assert_equal(2.0e-05, @mtrix3.Vn)
|
1898
|
+
end
|
1899
|
+
|
1900
|
+
|
1901
|
+
def test_iGiven
|
1902
|
+
assert_equal(1, @mtrix3.iGiven)
|
1903
|
+
end
|
1904
|
+
|
1905
|
+
|
1906
|
+
end
|
1907
|
+
|
1908
|
+
class TestTVECT < Test::Unit::TestCase
|
1909
|
+
def setup
|
1910
|
+
@str = 'TVECT 1 0.00000 0.00000 28.30000 '
|
1911
|
+
@tvect = Bio::PDB::Record::TVECT.new.initialize_from_string(@str)
|
1912
|
+
end
|
1913
|
+
|
1914
|
+
|
1915
|
+
def test_serial
|
1916
|
+
assert_equal(1, @tvect.serial)
|
1917
|
+
end
|
1918
|
+
|
1919
|
+
|
1920
|
+
def test_t1
|
1921
|
+
assert_equal(0.0, @tvect.t1)
|
1922
|
+
end
|
1923
|
+
|
1924
|
+
|
1925
|
+
def test_t2
|
1926
|
+
assert_equal(0.0, @tvect.t2)
|
1927
|
+
end
|
1928
|
+
|
1929
|
+
|
1930
|
+
def test_t3
|
1931
|
+
assert_equal(28.3, @tvect.t3)
|
1932
|
+
end
|
1933
|
+
|
1934
|
+
|
1935
|
+
def test_text
|
1936
|
+
assert_equal('', @tvect.text)
|
1937
|
+
end
|
1938
|
+
|
1939
|
+
|
1940
|
+
end
|
1941
|
+
|
1942
|
+
class TestMODEL < Test::Unit::TestCase
|
1943
|
+
def setup
|
1944
|
+
@str = 'MODEL 1'
|
1945
|
+
@model = Bio::PDB::Record::MODEL.new.initialize_from_string(@str)
|
1946
|
+
end
|
1947
|
+
|
1948
|
+
|
1949
|
+
def test_serial
|
1950
|
+
assert_equal(1, @model.serial)
|
1951
|
+
end
|
1952
|
+
|
1953
|
+
|
1954
|
+
end
|
1955
|
+
|
1956
|
+
class TestSIGATM < Test::Unit::TestCase
|
1957
|
+
|
1958
|
+
def setup
|
1959
|
+
@str = 'SIGATM 230 N PRO 15 0.040 0.030 0.030 0.00 0.00 N'
|
1960
|
+
@sigatm = Bio::PDB::Record::SIGATM.new.initialize_from_string(@str)
|
1961
|
+
end
|
1962
|
+
|
1963
|
+
|
1964
|
+
def test_serial
|
1965
|
+
assert_equal(230, @sigatm.serial)
|
1966
|
+
end
|
1967
|
+
|
1968
|
+
|
1969
|
+
def test_name
|
1970
|
+
assert_equal(' N', @sigatm.name)
|
1971
|
+
end
|
1972
|
+
|
1973
|
+
|
1974
|
+
def test_altLoc
|
1975
|
+
assert_equal(' ', @sigatm.altLoc)
|
1976
|
+
end
|
1977
|
+
|
1978
|
+
|
1979
|
+
def test_resName
|
1980
|
+
assert_equal('PRO', @sigatm.resName)
|
1981
|
+
end
|
1982
|
+
|
1983
|
+
|
1984
|
+
def test_chainID
|
1985
|
+
assert_equal(' ', @sigatm.chainID)
|
1986
|
+
end
|
1987
|
+
|
1988
|
+
|
1989
|
+
def test_resSeq
|
1990
|
+
assert_equal(15, @sigatm.resSeq)
|
1991
|
+
end
|
1992
|
+
|
1993
|
+
|
1994
|
+
def test_iCode
|
1995
|
+
assert_equal('', @sigatm.iCode)
|
1996
|
+
end
|
1997
|
+
|
1998
|
+
|
1999
|
+
def test_sigX
|
2000
|
+
assert_equal(0.04, @sigatm.sigX)
|
2001
|
+
end
|
2002
|
+
|
2003
|
+
|
2004
|
+
def test_sigY
|
2005
|
+
assert_equal(0.03, @sigatm.sigY)
|
2006
|
+
end
|
2007
|
+
|
2008
|
+
|
2009
|
+
def test_sigZ
|
2010
|
+
assert_equal(0.03, @sigatm.sigZ)
|
2011
|
+
end
|
2012
|
+
|
2013
|
+
|
2014
|
+
def test_sigOcc
|
2015
|
+
assert_equal(0.0, @sigatm.sigOcc)
|
2016
|
+
end
|
2017
|
+
|
2018
|
+
|
2019
|
+
def test_sigTemp
|
2020
|
+
assert_equal(0.0, @sigatm.sigTemp)
|
2021
|
+
end
|
2022
|
+
|
2023
|
+
|
2024
|
+
def test_segID
|
2025
|
+
assert_equal(' ', @sigatm.segID)
|
2026
|
+
end
|
2027
|
+
|
2028
|
+
|
2029
|
+
def test_element
|
2030
|
+
assert_equal(' N', @sigatm.element)
|
2031
|
+
end
|
2032
|
+
|
2033
|
+
|
2034
|
+
def test_charge
|
2035
|
+
assert_equal(' ', @sigatm.charge)
|
2036
|
+
end
|
2037
|
+
|
2038
|
+
|
2039
|
+
end
|
2040
|
+
|
2041
|
+
class TestANISOU < Test::Unit::TestCase
|
2042
|
+
def setup
|
2043
|
+
@str = 'ANISOU 107 N GLY 13 2406 1892 1614 198 519 -328 N'
|
2044
|
+
@anisou = Bio::PDB::Record::ANISOU.new.initialize_from_string(@str)
|
2045
|
+
end
|
2046
|
+
|
2047
|
+
|
2048
|
+
def test_serial
|
2049
|
+
assert_equal(107, @anisou.serial)
|
2050
|
+
end
|
2051
|
+
|
2052
|
+
|
2053
|
+
def test_name
|
2054
|
+
assert_equal(' N', @anisou.name)
|
2055
|
+
end
|
2056
|
+
|
2057
|
+
|
2058
|
+
def test_altLoc
|
2059
|
+
assert_equal(' ', @anisou.altLoc)
|
2060
|
+
end
|
2061
|
+
|
2062
|
+
|
2063
|
+
def test_resName
|
2064
|
+
assert_equal('GLY', @anisou.resName)
|
2065
|
+
end
|
2066
|
+
|
2067
|
+
|
2068
|
+
def test_chainID
|
2069
|
+
assert_equal(' ', @anisou.chainID)
|
2070
|
+
end
|
2071
|
+
|
2072
|
+
|
2073
|
+
def test_resSeq
|
2074
|
+
assert_equal(13, @anisou.resSeq)
|
2075
|
+
end
|
2076
|
+
|
2077
|
+
|
2078
|
+
def test_iCode
|
2079
|
+
assert_equal('', @anisou.iCode)
|
2080
|
+
end
|
2081
|
+
|
2082
|
+
|
2083
|
+
def test_U11
|
2084
|
+
assert_equal(2406, @anisou.U11)
|
2085
|
+
end
|
2086
|
+
|
2087
|
+
|
2088
|
+
def test_U22
|
2089
|
+
assert_equal(1892, @anisou.U22)
|
2090
|
+
end
|
2091
|
+
|
2092
|
+
|
2093
|
+
def test_U33
|
2094
|
+
assert_equal(1614, @anisou.U33)
|
2095
|
+
end
|
2096
|
+
|
2097
|
+
|
2098
|
+
def test_U12
|
2099
|
+
assert_equal(198, @anisou.U12)
|
2100
|
+
end
|
2101
|
+
|
2102
|
+
|
2103
|
+
def test_U13
|
2104
|
+
assert_equal(519, @anisou.U13)
|
2105
|
+
end
|
2106
|
+
|
2107
|
+
|
2108
|
+
def test_U23
|
2109
|
+
assert_equal(-328, @anisou.U23)
|
2110
|
+
end
|
2111
|
+
|
2112
|
+
|
2113
|
+
def test_segID
|
2114
|
+
assert_equal(' ', @anisou.segID)
|
2115
|
+
end
|
2116
|
+
|
2117
|
+
|
2118
|
+
def test_element
|
2119
|
+
assert_equal(' N', @anisou.element)
|
2120
|
+
end
|
2121
|
+
|
2122
|
+
|
2123
|
+
def test_charge
|
2124
|
+
assert_equal(' ', @anisou.charge)
|
2125
|
+
end
|
2126
|
+
|
2127
|
+
|
2128
|
+
end
|
2129
|
+
|
2130
|
+
class TestSIGUIJ < Test::Unit::TestCase
|
2131
|
+
def setup
|
2132
|
+
@str = 'SIGUIJ 107 N GLY 13 10 10 10 10 10 10 N'
|
2133
|
+
@siguij = Bio::PDB::Record::SIGUIJ.new.initialize_from_string(@str)
|
2134
|
+
end
|
2135
|
+
|
2136
|
+
|
2137
|
+
def test_serial
|
2138
|
+
assert_equal(107, @siguij.serial)
|
2139
|
+
end
|
2140
|
+
|
2141
|
+
|
2142
|
+
def test_name
|
2143
|
+
assert_equal(' N', @siguij.name)
|
2144
|
+
end
|
2145
|
+
|
2146
|
+
|
2147
|
+
def test_altLoc
|
2148
|
+
assert_equal(' ', @siguij.altLoc)
|
2149
|
+
end
|
2150
|
+
|
2151
|
+
|
2152
|
+
def test_resName
|
2153
|
+
assert_equal("GLY", @siguij.resName)
|
2154
|
+
end
|
2155
|
+
|
2156
|
+
|
2157
|
+
def test_chainID
|
2158
|
+
assert_equal(" ", @siguij.chainID)
|
2159
|
+
end
|
2160
|
+
|
2161
|
+
|
2162
|
+
def test_resSeq
|
2163
|
+
assert_equal(13, @siguij.resSeq)
|
2164
|
+
end
|
2165
|
+
|
2166
|
+
|
2167
|
+
def test_iCode
|
2168
|
+
assert_equal('', @siguij.iCode)
|
2169
|
+
end
|
2170
|
+
|
2171
|
+
|
2172
|
+
def test_SigmaU11
|
2173
|
+
assert_equal(10, @siguij.SigmaU11)
|
2174
|
+
end
|
2175
|
+
|
2176
|
+
|
2177
|
+
def test_SigmaU22
|
2178
|
+
assert_equal(10, @siguij.SigmaU22)
|
2179
|
+
end
|
2180
|
+
|
2181
|
+
|
2182
|
+
def test_SigmaU33
|
2183
|
+
assert_equal(10, @siguij.SigmaU33)
|
2184
|
+
end
|
2185
|
+
|
2186
|
+
|
2187
|
+
def test_SigmaU12
|
2188
|
+
assert_equal(10, @siguij.SigmaU12)
|
2189
|
+
end
|
2190
|
+
|
2191
|
+
|
2192
|
+
def test_SigmaU13
|
2193
|
+
assert_equal(10, @siguij.SigmaU13)
|
2194
|
+
end
|
2195
|
+
|
2196
|
+
|
2197
|
+
def test_SigmaU23
|
2198
|
+
assert_equal(10, @siguij.SigmaU23)
|
2199
|
+
end
|
2200
|
+
|
2201
|
+
|
2202
|
+
def test_segID
|
2203
|
+
assert_equal(' ', @siguij.segID)
|
2204
|
+
end
|
2205
|
+
|
2206
|
+
|
2207
|
+
def test_element
|
2208
|
+
assert_equal(' N', @siguij.element)
|
2209
|
+
end
|
2210
|
+
|
2211
|
+
|
2212
|
+
def test_charge
|
2213
|
+
assert_equal(' ', @siguij.charge)
|
2214
|
+
end
|
2215
|
+
|
2216
|
+
|
2217
|
+
end
|
2218
|
+
|
2219
|
+
class TestTER < Test::Unit::TestCase
|
2220
|
+
def setup
|
2221
|
+
@str = 'TER 3821 SER A 500 '
|
2222
|
+
@ter = Bio::PDB::Record::TER.new.initialize_from_string(@str)
|
2223
|
+
end
|
2224
|
+
|
2225
|
+
|
2226
|
+
def test_serial
|
2227
|
+
assert_equal(3821, @ter.serial)
|
2228
|
+
end
|
2229
|
+
|
2230
|
+
|
2231
|
+
def test_resName
|
2232
|
+
assert_equal('SER', @ter.resName)
|
2233
|
+
end
|
2234
|
+
|
2235
|
+
|
2236
|
+
def test_chainID
|
2237
|
+
assert_equal('A', @ter.chainID)
|
2238
|
+
end
|
2239
|
+
|
2240
|
+
|
2241
|
+
def test_resSeq
|
2242
|
+
assert_equal(500, @ter.resSeq)
|
2243
|
+
end
|
2244
|
+
|
2245
|
+
|
2246
|
+
def test_iCode
|
2247
|
+
assert_equal('', @ter.iCode)
|
2248
|
+
end
|
2249
|
+
|
2250
|
+
|
2251
|
+
end
|
2252
|
+
|
2253
|
+
class TestENDMDL < Test::Unit::TestCase
|
2254
|
+
def setup
|
2255
|
+
@str = 'ENDMDL'
|
2256
|
+
@endmdl = Bio::PDB::Record::ENDMDL.new.initialize_from_string(@str)
|
2257
|
+
end
|
2258
|
+
|
2259
|
+
|
2260
|
+
def test_serial
|
2261
|
+
assert_equal(0, @endmdl.serial)
|
2262
|
+
end
|
2263
|
+
|
2264
|
+
|
2265
|
+
end
|
2266
|
+
|
2267
|
+
class TestCONECT < Test::Unit::TestCase
|
2268
|
+
def setup
|
2269
|
+
@str = 'CONECT 27230581 '
|
2270
|
+
@conect = Bio::PDB::Record::CONECT.new.initialize_from_string(@str)
|
2271
|
+
end
|
2272
|
+
|
2273
|
+
|
2274
|
+
def test_serial
|
2275
|
+
assert_equal([272, 30581], @conect.serial)
|
2276
|
+
end
|
2277
|
+
|
2278
|
+
|
2279
|
+
end
|
2280
|
+
|
2281
|
+
class TestMASTER < Test::Unit::TestCase
|
2282
|
+
def setup
|
2283
|
+
@str = 'MASTER 589 0 41 150 164 0 77 634857 8 322 312 '
|
2284
|
+
@master = Bio::PDB::Record::MASTER.new.initialize_from_string(@str)
|
2285
|
+
end
|
2286
|
+
|
2287
|
+
|
2288
|
+
def test_numRemark
|
2289
|
+
assert_equal(589, @master.numRemark)
|
2290
|
+
end
|
2291
|
+
|
2292
|
+
|
2293
|
+
def test_numHet
|
2294
|
+
assert_equal(41, @master.numHet)
|
2295
|
+
end
|
2296
|
+
|
2297
|
+
|
2298
|
+
def test_numHelix
|
2299
|
+
assert_equal(150, @master.numHelix)
|
2300
|
+
end
|
2301
|
+
|
2302
|
+
|
2303
|
+
def test_numSheet
|
2304
|
+
assert_equal(164, @master.numSheet)
|
2305
|
+
end
|
2306
|
+
|
2307
|
+
|
2308
|
+
def test_numTurn
|
2309
|
+
assert_equal(0, @master.numTurn)
|
2310
|
+
end
|
2311
|
+
|
2312
|
+
|
2313
|
+
def test_numSite
|
2314
|
+
assert_equal(77, @master.numSite)
|
2315
|
+
end
|
2316
|
+
|
2317
|
+
|
2318
|
+
def test_numXform
|
2319
|
+
assert_equal(6, @master.numXform)
|
2320
|
+
end
|
2321
|
+
|
2322
|
+
|
2323
|
+
def test_numCoord
|
2324
|
+
assert_equal(34857, @master.numCoord)
|
2325
|
+
end
|
2326
|
+
|
2327
|
+
|
2328
|
+
def test_numTer
|
2329
|
+
assert_equal(8, @master.numTer)
|
2330
|
+
end
|
2331
|
+
|
2332
|
+
|
2333
|
+
def test_numConect
|
2334
|
+
assert_equal(322, @master.numConect)
|
2335
|
+
end
|
2336
|
+
|
2337
|
+
|
2338
|
+
def test_numSeq
|
2339
|
+
assert_equal(312, @master.numSeq)
|
2340
|
+
end
|
2341
|
+
|
2342
|
+
|
2343
|
+
end
|
2344
|
+
|
2345
|
+
class TestRemarkN < Test::Unit::TestCase
|
2346
|
+
def setup
|
2347
|
+
@str =<<EOS
|
2348
|
+
REMARK 3 REFINEMENT.
|
2349
|
+
REMARK 3 PROGRAM : PHENIX (PHENIX.REFINE: 1.4_4)
|
2350
|
+
REMARK 3 AUTHORS : PAUL ADAMS,PAVEL AFONINE,VICENT CHEN,IAN
|
2351
|
+
REMARK 3 : DAVIS,KRESHNA GOPAL,RALF GROSSE-
|
2352
|
+
REMARK 3 : KUNSTLEVE,LI-WEI HUNG,ROBERT IMMORMINO,
|
2353
|
+
REMARK 3 : TOM IOERGER,AIRLIE MCCOY,ERIK MCKEE,NIGEL
|
2354
|
+
REMARK 3 : MORIARTY,REETAL PAI,RANDY READ,JANE
|
2355
|
+
REMARK 3 : RICHARDSON,DAVID RICHARDSON,TOD ROMO,JIM
|
2356
|
+
REMARK 3 : SACCHETTINI,NICHOLAS SAUTER,JACOB SMITH,
|
2357
|
+
REMARK 3 : LAURENT STORONI,TOM TERWILLIGER,PETER
|
2358
|
+
REMARK 3 : ZWART
|
2359
|
+
REMARK 3
|
2360
|
+
REMARK 3 REFINEMENT TARGET : TWIN_LSQ_F
|
2361
|
+
EOS
|
2362
|
+
@remarkn = Bio::PDB::Record::RemarkN.new.initialize_from_string(@str)
|
2363
|
+
end
|
2364
|
+
|
2365
|
+
|
2366
|
+
def test_remarkNum
|
2367
|
+
assert_equal(3, @remarkn.remarkNum)
|
2368
|
+
end
|
2369
|
+
|
2370
|
+
#Is the output correct?
|
2371
|
+
def test_text
|
2372
|
+
assert_equal("REFINEMENT.\nREMARK 3 PROGRAM : PHENIX (PHENIX.REFIN", @remarkn.text)
|
2373
|
+
end
|
2374
|
+
|
2375
|
+
|
2376
|
+
end
|
2377
|
+
|
2378
|
+
#What is this record?
|
2379
|
+
class TestDefault < Test::Unit::TestCase
|
2380
|
+
def setup
|
2381
|
+
@str = ''
|
2382
|
+
@default = Bio::PDB::Record::Default.new.initialize_from_string(@str)
|
2383
|
+
end
|
2384
|
+
|
2385
|
+
|
2386
|
+
def test_text
|
2387
|
+
assert_equal('', @default.text)
|
2388
|
+
end
|
2389
|
+
|
2390
|
+
|
2391
|
+
end
|
2392
|
+
|
2393
|
+
class TestEnd < Test::Unit::TestCase
|
2394
|
+
def setup
|
2395
|
+
@str = "END "
|
2396
|
+
@end = Bio::PDB::Record::End.new.initialize_from_string(@str)
|
2397
|
+
end
|
2398
|
+
|
2399
|
+
|
2400
|
+
def test_serial
|
2401
|
+
assert_equal(0, @end.serial)
|
2402
|
+
end
|
2403
|
+
|
2404
|
+
|
2405
|
+
end
|
2406
|
+
|
2407
|
+
|
2408
|
+
#end
|
2409
|
+
end #module TestPDBRecord
|
2410
|
+
|
2411
|
+
#This class tests the behaviors of the complex types defined and used only in Bio::PDB classes.
|
2412
|
+
class TestDataType < Test::Unit::TestCase
|
2413
|
+
|
2414
|
+
def test_pdb_integer
|
2415
|
+
actual = Bio::PDB::DataType::Pdb_Integer.new("1")
|
2416
|
+
assert_equal(1, actual)
|
2417
|
+
end
|
2418
|
+
def test_pdb_slist
|
2419
|
+
actual = Bio::PDB::DataType::Pdb_SList.new("hoge; foo; bar")
|
2420
|
+
assert_equal(["hoge", "foo", "bar"], actual)
|
2421
|
+
end
|
2422
|
+
def test_pdb_list
|
2423
|
+
actual = Bio::PDB::DataType::Pdb_List.new("hoge, foo, bar")
|
2424
|
+
assert_equal(["hoge", "foo", "bar"], actual)
|
2425
|
+
end
|
2426
|
+
def test_specification_list
|
2427
|
+
actual = Bio::PDB::DataType::Pdb_Specification_list.new("hoge: 1; foo: 2; bar: 3;")
|
2428
|
+
assert_equal([["hoge", "1"], ["foo", "2"], ["bar","3"]], actual)
|
2429
|
+
end
|
2430
|
+
|
2431
|
+
def test_pdb_string
|
2432
|
+
actual = Bio::PDB::DataType::Pdb_String.new("hoge \n ")
|
2433
|
+
assert_equal("hoge", actual)
|
2434
|
+
actual =Bio::PDB::DataType::Pdb_String[10].new("hoge")
|
2435
|
+
assert_equal("hoge ", actual)
|
2436
|
+
end
|
2437
|
+
def test_pdb_lstring
|
2438
|
+
actual = Bio::PDB::DataType::Pdb_LString.new("hoge")
|
2439
|
+
assert_equal("hoge", actual)
|
2440
|
+
actual =Bio::PDB::DataType::Pdb_LString[10].new("hoge")
|
2441
|
+
assert_equal("hoge ", actual)
|
2442
|
+
end
|
2443
|
+
def test_pdb_real
|
2444
|
+
actual = Bio::PDB::DataType::Pdb_Real.new("1.25")
|
2445
|
+
assert_equal(1.25, actual)
|
2446
|
+
actual =Bio::PDB::DataType::Pdb_Real[10]
|
2447
|
+
#include actual
|
2448
|
+
#assert_equal(10, @@format)
|
2449
|
+
end
|
2450
|
+
|
2451
|
+
def test_pdb_stringrj
|
2452
|
+
actual = Bio::PDB::DataType::Pdb_StringRJ.new(" hoge")
|
2453
|
+
assert_equal("hoge", actual)
|
2454
|
+
end
|
2455
|
+
|
2456
|
+
def test_pdb_date
|
2457
|
+
actual = Bio::PDB::DataType::Pdb_Date.new("hoge")
|
2458
|
+
assert_equal("hoge", actual)
|
2459
|
+
actual =Bio::PDB::DataType::Pdb_Date[10].new("hoge")
|
2460
|
+
assert_equal("hoge ", actual)
|
2461
|
+
end
|
2462
|
+
|
2463
|
+
def test_pdb_idcode
|
2464
|
+
actual = Bio::PDB::DataType::Pdb_IDcode.new("hoge")
|
2465
|
+
assert_equal("hoge", actual)
|
2466
|
+
actual =Bio::PDB::DataType::Pdb_IDcode[10].new("hoge")
|
2467
|
+
assert_equal("hoge ", actual)
|
2468
|
+
end
|
2469
|
+
|
2470
|
+
def test_pdb_resudue_name
|
2471
|
+
actual = Bio::PDB::DataType::Pdb_Residue_name.new("hoge \n ")
|
2472
|
+
assert_equal("hoge", actual)
|
2473
|
+
actual =Bio::PDB::DataType::Pdb_Residue_name[10].new("hoge")
|
2474
|
+
assert_equal("hoge ", actual)
|
2475
|
+
end
|
2476
|
+
|
2477
|
+
def test_pdb_symop
|
2478
|
+
actual = Bio::PDB::DataType::Pdb_Residue_name.new("hoge")
|
2479
|
+
assert_equal("hoge", actual)
|
2480
|
+
actual =Bio::PDB::DataType::Pdb_Residue_name[10].new("hoge")
|
2481
|
+
assert_equal("hoge ", actual)
|
2482
|
+
end
|
2483
|
+
|
2484
|
+
def test_pdb_atom
|
2485
|
+
actual = Bio::PDB::DataType::Pdb_Residue_name.new("hoge")
|
2486
|
+
assert_equal("hoge", actual)
|
2487
|
+
actual =Bio::PDB::DataType::Pdb_Residue_name[10].new("hoge")
|
2488
|
+
assert_equal("hoge ", actual)
|
2489
|
+
end
|
2490
|
+
|
2491
|
+
def test_pdb_achar
|
2492
|
+
actual = Bio::PDB::DataType::Pdb_Residue_name.new("hoge")
|
2493
|
+
assert_equal("hoge", actual)
|
2494
|
+
actual =Bio::PDB::DataType::Pdb_Residue_name[10].new("hoge")
|
2495
|
+
assert_equal("hoge ", actual)
|
2496
|
+
end
|
2497
|
+
|
2498
|
+
def test_pdb_character
|
2499
|
+
actual = Bio::PDB::DataType::Pdb_Residue_name.new("hoge")
|
2500
|
+
assert_equal("hoge", actual)
|
2501
|
+
actual =Bio::PDB::DataType::Pdb_Residue_name[10].new("hoge")
|
2502
|
+
assert_equal("hoge ", actual)
|
2503
|
+
end
|
2504
|
+
|
2505
|
+
def test_const_like_method
|
2506
|
+
extend Bio::PDB::DataType::ConstLikeMethod
|
2507
|
+
actual = Pdb_LString(5).new("aaa")
|
2508
|
+
assert_equal("aaa ", actual)
|
2509
|
+
actual = Pdb_String(5).new("aaa")
|
2510
|
+
assert_equal("aaa ", actual)
|
2511
|
+
actual = Pdb_Real(3).new("1.25")
|
2512
|
+
assert_equal(1.25, actual)
|
2513
|
+
end
|
2514
|
+
|
2515
|
+
end
|
2516
|
+
|
2517
|
+
# test of Bio::PDB::Record::ATOM
|
2518
|
+
class TestResidue < Test::Unit::TestCase
|
2519
|
+
def setup
|
2520
|
+
@res = Bio::PDB::Residue.new(resName="ALA",resSeq = 7, iCode = "", chain = nil)
|
2521
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 1 N ALA A 7 23.484 -35.866 44.510 1.00 28.52 N"))
|
2522
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"))
|
2523
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 3 C ALA A 7 23.102 -34.082 46.159 1.00 26.68 C"))
|
2524
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 4 O ALA A 7 23.097 -32.903 46.524 1.00 30.02 O"))
|
2525
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 5 CB ALA A 7 23.581 -33.526 43.770 1.00 31.41 C"))
|
2526
|
+
|
2527
|
+
end
|
2528
|
+
def test_get_residue_id_from_atom
|
2529
|
+
id = Bio::PDB::Residue.get_residue_id_from_atom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 1 N ALA A 7 23.48 4 -35.866 44.510 1.00 28.52 N"))
|
2530
|
+
assert_equal("7",id)
|
2531
|
+
end
|
2532
|
+
|
2533
|
+
def test_addAtom
|
2534
|
+
assert_nothing_raised {
|
2535
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 1 N ALA A 7 23.484 -35.866 44.510 1.00 28.52 N"))
|
2536
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string(" ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"))
|
2537
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 3 C ALA A 7 23.102 -34.082 46.159 1.00 26.68 C"))
|
2538
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 4 O ALA A 7 23.097 -32.903 46.524 1.00 30.02 O"))
|
2539
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 5 CB ALA A 7 23.581 -33.526 43.770 1.00 31.41 C"))
|
2540
|
+
}
|
2541
|
+
end
|
2542
|
+
def test_square_bracket
|
2543
|
+
expected = {:tempFactor=>27.89,
|
2544
|
+
:iCode=>"",
|
2545
|
+
:serial=>2,
|
2546
|
+
:charge=>"",
|
2547
|
+
:z=>44.904,
|
2548
|
+
:chainID=>"A",
|
2549
|
+
:segID=>"",
|
2550
|
+
:x=>23.849,
|
2551
|
+
:altLoc=>" ",
|
2552
|
+
:occupancy=>1.0,
|
2553
|
+
:resSeq=>7,
|
2554
|
+
:element=>"C",
|
2555
|
+
:name=>"CA",
|
2556
|
+
:y=>-34.509,
|
2557
|
+
:resName=>"ALA"}
|
2558
|
+
actual = {}
|
2559
|
+
@res["CA"].each_pair do |m, v|
|
2560
|
+
actual[m] = v
|
2561
|
+
end
|
2562
|
+
assert_equal(expected, actual)
|
2563
|
+
end
|
2564
|
+
|
2565
|
+
def test_each_atom
|
2566
|
+
expected = [{:serial=>1, :name=>"N", :altLoc=>" ", :resName=>"ALA", :chainID=>"A", :resSeq=>7, :iCode=>"", :x=>23.484, :y=>-35.866, :z=>44.51, :occupancy=>1.0, :tempFactor=>28.52, :segID=>"", :element=>"N", :charge=>""},
|
2567
|
+
{:serial=>2, :name=>"CA", :altLoc=>" ", :resName=>"ALA", :chainID=>"A", :resSeq=>7, :iCode=>"", :x=>23.849, :y=>-34.509, :z=>44.904, :occupancy=>1.0, :tempFactor=>27.89, :segID=>"", :element=>"C", :charge=>""},
|
2568
|
+
{:serial=>3, :name=>"C", :altLoc=>" ", :resName=>"ALA", :chainID=>"A", :resSeq=>7, :iCode=>"", :x=>23.102, :y=>-34.082, :z=>46.159, :occupancy=>1.0, :tempFactor=>26.68, :segID=>"", :element=>"C", :charge=>""},{:serial=>4, :name=>"O", :altLoc=>" ", :resName=>"ALA", :chainID=>"A", :resSeq=>7, :iCode=>"", :x=>23.097, :y=>-32.903, :z=>46.524, :occupancy=>1.0, :tempFactor=>30.02, :segID=>"", :element=>"O", :charge=>""},
|
2569
|
+
{:serial=>5, :name=>"CB", :altLoc=>" ", :resName=>"ALA", :chainID=>"A", :resSeq=>7, :iCode=>"", :x=>23.581, :y=>-33.526, :z=>43.77, :occupancy=>1.0, :tempFactor=>31.41, :segID=>"", :element=>"C", :charge=>""}]
|
2570
|
+
actual = []
|
2571
|
+
@res.each_atom do |atom|
|
2572
|
+
actual << {:serial=>atom.serial, :name=>atom.name, :altLoc=>atom.altLoc, :resName=>atom.resName, :chainID=>atom.chainID, :resSeq=>atom.resSeq, :iCode=>atom.iCode, :x=>atom.x, :y=>atom.y, :z=>atom.z, :occupancy=>atom.occupancy, :tempFactor=>atom.tempFactor, :segID=>atom.segID, :element=>atom.element, :charge=>atom.charge}
|
2573
|
+
end
|
2574
|
+
assert_equal(expected, actual)
|
2575
|
+
end
|
2576
|
+
|
2577
|
+
def test_each
|
2578
|
+
expected = [{:serial=>1, :name=>"N", :altLoc=>" ", :resName=>"ALA", :chainID=>"A", :resSeq=>7, :iCode=>"", :x=>23.484, :y=>-35.866, :z=>44.51, :occupancy=>1.0, :tempFactor=>28.52, :segID=>"", :element=>"N", :charge=>""},
|
2579
|
+
{:serial=>2, :name=>"CA", :altLoc=>" ", :resName=>"ALA", :chainID=>"A", :resSeq=>7, :iCode=>"", :x=>23.849, :y=>-34.509, :z=>44.904, :occupancy=>1.0, :tempFactor=>27.89, :segID=>"", :element=>"C", :charge=>""},
|
2580
|
+
{:serial=>3, :name=>"C", :altLoc=>" ", :resName=>"ALA", :chainID=>"A", :resSeq=>7, :iCode=>"", :x=>23.102, :y=>-34.082, :z=>46.159, :occupancy=>1.0, :tempFactor=>26.68, :segID=>"", :element=>"C", :charge=>""},{:serial=>4, :name=>"O", :altLoc=>" ", :resName=>"ALA", :chainID=>"A", :resSeq=>7, :iCode=>"", :x=>23.097, :y=>-32.903, :z=>46.524, :occupancy=>1.0, :tempFactor=>30.02, :segID=>"", :element=>"O", :charge=>""},
|
2581
|
+
{:serial=>5, :name=>"CB", :altLoc=>" ", :resName=>"ALA", :chainID=>"A", :resSeq=>7, :iCode=>"", :x=>23.581, :y=>-33.526, :z=>43.77, :occupancy=>1.0, :tempFactor=>31.41, :segID=>"", :element=>"C", :charge=>""}]
|
2582
|
+
actual = []
|
2583
|
+
@res.each do |atom|
|
2584
|
+
actual << {:serial=>atom.serial, :name=>atom.name, :altLoc=>atom.altLoc, :resName=>atom.resName, :chainID=>atom.chainID, :resSeq=>atom.resSeq, :iCode=>atom.iCode, :x=>atom.x, :y=>atom.y, :z=>atom.z, :occupancy=>atom.occupancy, :tempFactor=>atom.tempFactor, :segID=>atom.segID, :element=>atom.element, :charge=>atom.charge}
|
2585
|
+
end
|
2586
|
+
assert_equal(expected, actual)
|
2587
|
+
end
|
2588
|
+
def test_het_atom
|
2589
|
+
assert_equal(false, @res.hetatm)
|
2590
|
+
end
|
2591
|
+
def test_iCode
|
2592
|
+
assert_equal( 1, @res.iCode=1)
|
2593
|
+
end
|
2594
|
+
def test_resSeq
|
2595
|
+
assert_equal( 1, @res.resSeq=1)
|
2596
|
+
end
|
2597
|
+
def test_to_s
|
2598
|
+
expected ="ATOM 1 N ALA A 7 23.484 -35.866 44.510 1.00 28.52 N \nATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C \nATOM 3 C ALA A 7 23.102 -34.082 46.159 1.00 26.68 C \nATOM 4 O ALA A 7 23.097 -32.903 46.524 1.00 30.02 O \nATOM 5 CB ALA A 7 23.581 -33.526 43.770 1.00 31.41 C \n"
|
2599
|
+
assert_equal(expected, @res.to_s)
|
2600
|
+
end
|
2601
|
+
def test_inspect
|
2602
|
+
expected = "#<Bio::PDB::Residue resName=\"ALA\" id=\"7\" chain.id=nil resSeq=7 iCode=\"\" atoms.size=5>"
|
2603
|
+
assert_equal(expected,@res.inspect)
|
2604
|
+
end
|
2605
|
+
def test_sort #<=>
|
2606
|
+
expected = [Bio::PDB::Residue.new(resName="ALA",resSeq = 6, iCode = 2, chain = nil),
|
2607
|
+
Bio::PDB::Residue.new(resName="ALA",resSeq = 7, iCode = 1, chain = nil),
|
2608
|
+
Bio::PDB::Residue.new(resName="ALA",resSeq = 7, iCode = 3, chain = nil)]
|
2609
|
+
ress = [Bio::PDB::Residue.new(resName="ALA",resSeq = 7, iCode = 1, chain = nil)]
|
2610
|
+
ress << Bio::PDB::Residue.new(resName="ALA",resSeq = 6, iCode = 2, chain = nil)
|
2611
|
+
ress << Bio::PDB::Residue.new(resName="ALA",resSeq = 7, iCode = 3, chain = nil)
|
2612
|
+
actual = ress.sort do |a, b|
|
2613
|
+
a <=> b
|
2614
|
+
end
|
2615
|
+
assert_equal(expected,actual)
|
2616
|
+
end
|
2617
|
+
def test_update_resudue_id
|
2618
|
+
res = Bio::PDB::Residue.new(resName="ALA", resSeq = nil, iCode = nil, chain = nil)
|
2619
|
+
assert_equal(nil, res.residue_id)
|
2620
|
+
end
|
2621
|
+
end
|
2622
|
+
|
2623
|
+
class TestHeterogen < Test::Unit::TestCase
|
2624
|
+
def setup
|
2625
|
+
@res = Bio::PDB::Heterogen.new(resName="EDO",resSeq = 701, iCode = "", chain = nil)
|
2626
|
+
@res.addAtom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30583 O1 EDO A 701 -1.516 -26.859 49.587 1.00 35.20 O"))
|
2627
|
+
@res.addAtom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30584 C2 EDO A 701 -0.275 -28.124 51.219 1.00 34.49 C"))
|
2628
|
+
@res.addAtom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30585 O2 EDO A 701 -1.442 -28.941 51.167 1.00 33.95 O"))
|
2629
|
+
@res.addAtom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30586 C1 EDO A 702 2.792 7.449 67.655 1.00 17.09 C"))
|
2630
|
+
@res.addAtom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30587 O1 EDO A 702 1.451 7.273 67.213 1.00 15.74 O"))
|
2631
|
+
|
2632
|
+
end
|
2633
|
+
def test_get_residue_id_from_atom
|
2634
|
+
id = Bio::PDB::Residue.get_residue_id_from_atom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30582 C1 EDO A 701 -0.205 -27.262 49.961 1.00 34.45 C"))
|
2635
|
+
assert_equal("701",id)
|
2636
|
+
end
|
2637
|
+
|
2638
|
+
def test_addAtom
|
2639
|
+
assert_nothing_raised {
|
2640
|
+
@res.addAtom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30583 O1 EDO A 701 -1.516 -26.859 49.587 1.00 35.20 O"))
|
2641
|
+
@res.addAtom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30584 C2 EDO A 701 -0.275 -28.124 51.219 1.00 34.49 C"))
|
2642
|
+
@res.addAtom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30585 O2 EDO A 701 -1.442 -28.941 51.167 1.00 33.95 O"))
|
2643
|
+
@res.addAtom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30586 C1 EDO A 702 2.792 7.449 67.655 1.00 17.09 C"))
|
2644
|
+
@res.addAtom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30587 O1 EDO A 702 1.451 7.273 67.213 1.00 15.74 O"))
|
2645
|
+
}
|
2646
|
+
end
|
2647
|
+
def test_square_bracket
|
2648
|
+
expected = {
|
2649
|
+
:serial=>30586,
|
2650
|
+
:name=>"C1",
|
2651
|
+
:altLoc=>" ",
|
2652
|
+
:resName=>"EDO",
|
2653
|
+
:chainID=>"A",
|
2654
|
+
:resSeq=>702,
|
2655
|
+
:iCode=>"",
|
2656
|
+
:x=>2.792,
|
2657
|
+
:y=>7.449,
|
2658
|
+
:z=>67.655,
|
2659
|
+
:occupancy=>1.0,
|
2660
|
+
:tempFactor=>17.09,
|
2661
|
+
:segID=>"",
|
2662
|
+
:element=>"C",
|
2663
|
+
:charge=>""
|
2664
|
+
}
|
2665
|
+
actual = {}
|
2666
|
+
@res["C1"].each_pair do |m, v|
|
2667
|
+
actual[m] = v
|
2668
|
+
end
|
2669
|
+
assert_equal(expected, actual)
|
2670
|
+
end
|
2671
|
+
|
2672
|
+
def test_each_hetatm
|
2673
|
+
expected = [{:z=>49.587, :resName=>"EDO", :altLoc=>" ", :resSeq=>701, :occupancy=>1.0, :iCode=>"", :tempFactor=>35.2, :chainID=>"A", :y=>-26.859, :segID=>"", :x=>-1.516, :name=>"O1", :charge=>"", :element=>"O", :serial=>30583}, {:z=>51.219, :resName=>"EDO", :altLoc=>" ", :resSeq=>701, :occupancy=>1.0, :iCode=>"", :tempFactor=>34.49, :chainID=>"A", :y=>-28.124, :segID=>"", :x=>-0.275, :name=>"C2", :charge=>"", :element=>"C", :serial=>30584}, {:z=>51.167, :resName=>"EDO", :altLoc=>" ", :resSeq=>701, :occupancy=>1.0, :iCode=>"", :tempFactor=>33.95, :chainID=>"A", :y=>-28.941, :segID=>"", :x=>-1.442, :name=>"O2", :charge=>"", :element=>"O", :serial=>30585}, {:z=>67.655, :resName=>"EDO", :altLoc=>" ", :resSeq=>702, :occupancy=>1.0, :iCode=>"", :tempFactor=>17.09, :chainID=>"A", :y=>7.449, :segID=>"", :x=>2.792, :name=>"C1", :charge=>"", :element=>"C", :serial=>30586}, {:z=>67.213, :resName=>"EDO", :altLoc=>" ", :resSeq=>702, :occupancy=>1.0, :iCode=>"", :tempFactor=>15.74, :chainID=>"A", :y=>7.273, :segID=>"", :x=>1.451, :name=>"O1", :charge=>"", :element=>"O", :serial=>30587}]
|
2674
|
+
actual = []
|
2675
|
+
@res.each_hetatm do |hetatm|
|
2676
|
+
actual << {:serial=>hetatm.serial, :name=>hetatm.name, :altLoc=>hetatm.altLoc, :resName=>hetatm.resName, :chainID=>hetatm.chainID, :resSeq=>hetatm.resSeq, :iCode=>hetatm.iCode, :x=>hetatm.x, :y=>hetatm.y, :z=>hetatm.z, :occupancy=>hetatm.occupancy, :tempFactor=>hetatm.tempFactor, :segID=>hetatm.segID, :element=>hetatm.element, :charge=>hetatm.charge}
|
2677
|
+
end
|
2678
|
+
assert_equal(expected, actual)
|
2679
|
+
end
|
2680
|
+
def test_each
|
2681
|
+
expected = [{:z=>49.587, :resName=>"EDO", :altLoc=>" ", :resSeq=>701, :occupancy=>1.0, :iCode=>"", :tempFactor=>35.2, :chainID=>"A", :y=>-26.859, :segID=>"", :x=>-1.516, :name=>"O1", :charge=>"", :element=>"O", :serial=>30583}, {:z=>51.219, :resName=>"EDO", :altLoc=>" ", :resSeq=>701, :occupancy=>1.0, :iCode=>"", :tempFactor=>34.49, :chainID=>"A", :y=>-28.124, :segID=>"", :x=>-0.275, :name=>"C2", :charge=>"", :element=>"C", :serial=>30584}, {:z=>51.167, :resName=>"EDO", :altLoc=>" ", :resSeq=>701, :occupancy=>1.0, :iCode=>"", :tempFactor=>33.95, :chainID=>"A", :y=>-28.941, :segID=>"", :x=>-1.442, :name=>"O2", :charge=>"", :element=>"O", :serial=>30585}, {:z=>67.655, :resName=>"EDO", :altLoc=>" ", :resSeq=>702, :occupancy=>1.0, :iCode=>"", :tempFactor=>17.09, :chainID=>"A", :y=>7.449, :segID=>"", :x=>2.792, :name=>"C1", :charge=>"", :element=>"C", :serial=>30586}, {:z=>67.213, :resName=>"EDO", :altLoc=>" ", :resSeq=>702, :occupancy=>1.0, :iCode=>"", :tempFactor=>15.74, :chainID=>"A", :y=>7.273, :segID=>"", :x=>1.451, :name=>"O1", :charge=>"", :element=>"O", :serial=>30587}]
|
2682
|
+
actual = []
|
2683
|
+
@res.each do |hetatm|
|
2684
|
+
actual << {:serial=>hetatm.serial, :name=>hetatm.name, :altLoc=>hetatm.altLoc, :resName=>hetatm.resName, :chainID=>hetatm.chainID, :resSeq=>hetatm.resSeq, :iCode=>hetatm.iCode, :x=>hetatm.x, :y=>hetatm.y, :z=>hetatm.z, :occupancy=>hetatm.occupancy, :tempFactor=>hetatm.tempFactor, :segID=>hetatm.segID, :element=>hetatm.element, :charge=>hetatm.charge}
|
2685
|
+
end
|
2686
|
+
assert_equal(expected, actual)
|
2687
|
+
end
|
2688
|
+
|
2689
|
+
def test_het_atom
|
2690
|
+
assert_equal(true, @res.hetatm)
|
2691
|
+
end
|
2692
|
+
def test_iCode
|
2693
|
+
assert_equal( 1, @res.iCode=1)
|
2694
|
+
end
|
2695
|
+
def test_resSeq
|
2696
|
+
assert_equal( 1, @res.resSeq=1)
|
2697
|
+
end
|
2698
|
+
def test_to_s
|
2699
|
+
expected = "HETATM30583 O1 EDO A 701 -1.516 -26.859 49.587 1.00 35.20 O \nHETATM30584 C2 EDO A 701 -0.275 -28.124 51.219 1.00 34.49 C \nHETATM30585 O2 EDO A 701 -1.442 -28.941 51.167 1.00 33.95 O \nHETATM30586 C1 EDO A 702 2.792 7.449 67.655 1.00 17.09 C \nHETATM30587 O1 EDO A 702 1.451 7.273 67.213 1.00 15.74 O \n"
|
2700
|
+
assert_equal(expected, @res.to_s)
|
2701
|
+
end
|
2702
|
+
def test_inspect
|
2703
|
+
expected = "#<Bio::PDB::Heterogen resName=\"EDO\" id=\"701\" chain.id=nil resSeq=701 iCode=\"\" atoms.size=5>"
|
2704
|
+
assert_equal(expected,@res.inspect)
|
2705
|
+
end
|
2706
|
+
def test_sort #<=>
|
2707
|
+
expected = [Bio::PDB::Heterogen.new(resName="EDD",resSeq = 1, iCode = 2, chain = nil),
|
2708
|
+
Bio::PDB::Heterogen.new(resName="EDD",resSeq = 1, iCode = 3, chain = nil),
|
2709
|
+
Bio::PDB::Heterogen.new(resName="EDD",resSeq = 2, iCode = 1, chain = nil)]
|
2710
|
+
ress = [Bio::PDB::Heterogen.new(resName="EDD",resSeq = 1, iCode = 2, chain = nil)]
|
2711
|
+
ress << Bio::PDB::Heterogen.new(resName="EDD",resSeq = 1, iCode = 3, chain = nil)
|
2712
|
+
ress << Bio::PDB::Heterogen.new(resName="EDD",resSeq = 2, iCode = 1, chain = nil)
|
2713
|
+
actual = ress.sort do |a, b|
|
2714
|
+
a <=> b
|
2715
|
+
end
|
2716
|
+
assert_equal(expected,actual)
|
2717
|
+
end
|
2718
|
+
def test_update_resudue_id
|
2719
|
+
res = Bio::PDB::Heterogen.new(resName="EDD", resSeq = nil, iCode = nil, chain = nil)
|
2720
|
+
assert_equal(nil, res.residue_id)
|
2721
|
+
end
|
2722
|
+
end
|
2723
|
+
|
2724
|
+
class TestChain < Test::Unit::TestCase
|
2725
|
+
def setup
|
2726
|
+
@chain = Bio::PDB::Chain.new('A',nil)
|
2727
|
+
@chain.addResidue(Bio::PDB::Residue.new(resName="ALA",resSeq = 7, iCode = 1, chain = @chain))
|
2728
|
+
@chain.addResidue(Bio::PDB::Residue.new(resName="ALA",resSeq = 6, iCode = 2, chain = @chain))
|
2729
|
+
@chain.addResidue(Bio::PDB::Residue.new(resName="ALA",resSeq = 7, iCode = 3, chain = @chain))
|
2730
|
+
@chain.addLigand(Bio::PDB::Heterogen.new(resName="EDD",resSeq = 1, iCode = 2, chain = @chain))
|
2731
|
+
end
|
2732
|
+
|
2733
|
+
def test_square_brace #[]
|
2734
|
+
expected = {:iCode=>1,
|
2735
|
+
:chain_id=>'A',
|
2736
|
+
:atoms_size=>0,
|
2737
|
+
:resSeq=>7,
|
2738
|
+
:id=>"71",
|
2739
|
+
:resName=>"ALA"}
|
2740
|
+
residue = @chain["71"]
|
2741
|
+
actual = {:resName => residue.resName, :id => residue.id, :chain_id => residue.chain.id, :resSeq => residue.resSeq, :iCode => residue.iCode, :atoms_size => residue.atoms.size}
|
2742
|
+
assert_equal(expected, actual)
|
2743
|
+
end
|
2744
|
+
def test_comp #<=>
|
2745
|
+
expected = [{:iCode=>2,
|
2746
|
+
:chain_id=>'A',
|
2747
|
+
:atoms_size=>0,
|
2748
|
+
:resSeq=>6,
|
2749
|
+
:id=>"62",
|
2750
|
+
:resName=>"ALA"},
|
2751
|
+
{:iCode=>1,
|
2752
|
+
:chain_id=>'A',
|
2753
|
+
:atoms_size=>0,
|
2754
|
+
:resSeq=>7,
|
2755
|
+
:id=>"71",
|
2756
|
+
:resName=>"ALA"},
|
2757
|
+
{:iCode=>3,
|
2758
|
+
:chain_id=>'A',
|
2759
|
+
:atoms_size=>0,
|
2760
|
+
:resSeq=>7,
|
2761
|
+
:id=>"73",
|
2762
|
+
:resName=>"ALA"}]
|
2763
|
+
sorted = @chain.sort do |a, b|
|
2764
|
+
a<=>b
|
2765
|
+
end
|
2766
|
+
actual = []
|
2767
|
+
sorted.each do |residue|
|
2768
|
+
actual << {:resName => residue.resName, :id => residue.id, :chain_id => residue.chain.id, :resSeq => residue.resSeq, :iCode => residue.iCode, :atoms_size => residue.atoms.size}
|
2769
|
+
end
|
2770
|
+
assert_equal(expected, actual)
|
2771
|
+
end
|
2772
|
+
def test_addResidue
|
2773
|
+
assert_nothing_raised{ @chain.addResidue(Bio::PDB::Residue.new(resName="ALA",resSeq = 9, iCode = 1, chain = @chain))}
|
2774
|
+
end
|
2775
|
+
def test_aaseq
|
2776
|
+
assert_equal("AAA", @chain.aaseq)
|
2777
|
+
end
|
2778
|
+
def test_addLigand
|
2779
|
+
assert_nothing_raised{ @chain.addLigand(Bio::PDB::Heterogen.new(resName="EDD",resSeq = 10, iCode = 2, chain = @chain)) }
|
2780
|
+
end
|
2781
|
+
def test_atom_seq
|
2782
|
+
assert_equal("AAA", @chain.atom_seq)
|
2783
|
+
end
|
2784
|
+
def test_each
|
2785
|
+
expected = [{:atoms_size=>0, :resSeq=>7, :chain_id=>'A', :iCode=>1, :id=>"71", :resName=>"ALA"}, {:atoms_size=>0, :resSeq=>6, :chain_id=>'A', :iCode=>2, :id=>"62", :resName=>"ALA"}, {:atoms_size=>0, :resSeq=>7, :chain_id=>'A', :iCode=>3, :id=>"73", :resName=>"ALA"}]
|
2786
|
+
actual = []
|
2787
|
+
@chain.each do |residue|
|
2788
|
+
actual << {:resName => residue.resName, :id => residue.id, :chain_id => residue.chain.id, :resSeq => residue.resSeq, :iCode => residue.iCode, :atoms_size => residue.atoms.size}
|
2789
|
+
end
|
2790
|
+
assert_equal(expected, actual)
|
2791
|
+
end
|
2792
|
+
def test_each_residue
|
2793
|
+
expected = [{:atoms_size=>0, :resSeq=>7, :chain_id=>'A', :iCode=>1, :id=>"71", :resName=>"ALA"}, {:atoms_size=>0, :resSeq=>6, :chain_id=>'A', :iCode=>2, :id=>"62", :resName=>"ALA"}, {:atoms_size=>0, :resSeq=>7, :chain_id=>'A', :iCode=>3, :id=>"73", :resName=>"ALA"}]
|
2794
|
+
actual = []
|
2795
|
+
@chain.each do |residue|
|
2796
|
+
actual << {:resName => residue.resName, :id => residue.id, :chain_id => residue.chain.id, :resSeq => residue.resSeq, :iCode => residue.iCode, :atoms_size => residue.atoms.size}
|
2797
|
+
end
|
2798
|
+
assert_equal(expected, actual)
|
2799
|
+
end
|
2800
|
+
def test_each_heterogen
|
2801
|
+
expected = [{:iCode=>2,
|
2802
|
+
:chain_id=>'A',
|
2803
|
+
:resSeq=>1,
|
2804
|
+
:id=>"12",
|
2805
|
+
:atoms_size=>0,
|
2806
|
+
:resName=>"EDD"}]
|
2807
|
+
actual = []
|
2808
|
+
@chain.each_heterogen do |heterogen|
|
2809
|
+
actual << {:resName => heterogen.resName, :id => heterogen.id, :chain_id => heterogen.chain.id, :resSeq => heterogen.resSeq, :iCode => heterogen.iCode, :atoms_size => heterogen.atoms.size}
|
2810
|
+
end
|
2811
|
+
assert_equal(expected, actual)
|
2812
|
+
end
|
2813
|
+
def test_get_heterogen_by_id
|
2814
|
+
heterogen = @chain.get_heterogen_by_id("12")
|
2815
|
+
expected = {:iCode=>2,
|
2816
|
+
:chain_id=>'A',
|
2817
|
+
:resSeq=>1,
|
2818
|
+
:id=>"12",
|
2819
|
+
:atoms_size=>0,
|
2820
|
+
:resName=>"EDD"}
|
2821
|
+
actual = {:resName => heterogen.resName, :id => heterogen.id, :chain_id => heterogen.chain.id, :resSeq => heterogen.resSeq, :iCode => heterogen.iCode, :atoms_size => heterogen.atoms.size}
|
2822
|
+
assert_equal(expected, actual)
|
2823
|
+
end
|
2824
|
+
def test_get_residue_by_id
|
2825
|
+
residue = @chain.get_residue_by_id("71")
|
2826
|
+
expected = {:atoms_size=>0, :resSeq=>7, :chain_id=>'A', :iCode=>1, :id=>"71", :resName=>"ALA"}
|
2827
|
+
actual = {:resName => residue.resName, :id => residue.id, :chain_id => residue.chain.id, :resSeq => residue.resSeq, :iCode => residue.iCode, :atoms_size => residue.atoms.size}
|
2828
|
+
assert_equal(expected, actual)
|
2829
|
+
end
|
2830
|
+
def test_inspect
|
2831
|
+
expected = "#<Bio::PDB::Chain id=\"A\" model.serial=nil residues.size=3 heterogens.size=1 aaseq=\"AAA\">"
|
2832
|
+
assert_equal(expected, @chain.inspect)
|
2833
|
+
end
|
2834
|
+
def test_rehash
|
2835
|
+
assert_nothing_raised{@chain.rehash}
|
2836
|
+
end
|
2837
|
+
def test_rehash_heterogens
|
2838
|
+
assert_nothing_raised{@chain.rehash_heterogens}
|
2839
|
+
|
2840
|
+
#assert_raise{@chain.rehash_heterogens}
|
2841
|
+
end
|
2842
|
+
def test_rehash_residues
|
2843
|
+
assert_nothing_raised{@chain.rehash_residues}
|
2844
|
+
end
|
2845
|
+
def test_to_s
|
2846
|
+
assert_equal("TER\n",@chain.to_s)
|
2847
|
+
end
|
2848
|
+
end
|
2849
|
+
|
2850
|
+
class TestModel < Test::Unit::TestCase
|
2851
|
+
def setup
|
2852
|
+
@model = Bio::PDB::Model.new(1,nil)
|
2853
|
+
@model.addChain(Bio::PDB::Chain.new(1, @model))
|
2854
|
+
@model.addChain(Bio::PDB::Chain.new(2, @model))
|
2855
|
+
@model.addChain(Bio::PDB::Chain.new(3, @model))
|
2856
|
+
end
|
2857
|
+
|
2858
|
+
def test_square_brace #[]
|
2859
|
+
expected = {:id=>1, :model_serial=>1, :residues_size=>0, :heterogens_size=>0, :aaseq=>""}
|
2860
|
+
residue = @model[1]
|
2861
|
+
actual = {:id=>residue.id, :model_serial=>residue.model.serial, :residues_size=>residue.residues.size, :heterogens_size=>residue.heterogens.size, :aaseq=>residue.aaseq}
|
2862
|
+
|
2863
|
+
assert_equal(expected, actual)
|
2864
|
+
end
|
2865
|
+
def test_comp #<=>
|
2866
|
+
models = [Bio::PDB::Model.new(2,nil), Bio::PDB::Model.new(1,nil), Bio::PDB::Model.new(3,nil)]
|
2867
|
+
expected = [{:serial=>1, :chains_size=>0},
|
2868
|
+
{:serial=>2, :chains_size=>0},
|
2869
|
+
{:serial=>3, :chains_size=>0}]
|
2870
|
+
|
2871
|
+
sorted = models.sort do |a, b|
|
2872
|
+
a<=>b
|
2873
|
+
end
|
2874
|
+
actual = []
|
2875
|
+
sorted.each do |model|
|
2876
|
+
actual << {:serial => model.serial, :chains_size => model.chains.size }
|
2877
|
+
end
|
2878
|
+
assert_equal(expected, actual)
|
2879
|
+
end
|
2880
|
+
def test_addChain
|
2881
|
+
assert_nothing_raised{ @model.addChain(Bio::PDB::Chain.new("D", @model))}
|
2882
|
+
end
|
2883
|
+
def test_each
|
2884
|
+
expected = [{:model_serial=>1,
|
2885
|
+
:aaseq=>"",
|
2886
|
+
:residues_size=>0,
|
2887
|
+
:heterogens_size=>0,
|
2888
|
+
:id=>1},
|
2889
|
+
{:model_serial=>1,
|
2890
|
+
:aaseq=>"",
|
2891
|
+
:residues_size=>0,
|
2892
|
+
:heterogens_size=>0,
|
2893
|
+
:id=>2},
|
2894
|
+
{:model_serial=>1,
|
2895
|
+
:aaseq=>"",
|
2896
|
+
:residues_size=>0,
|
2897
|
+
:heterogens_size=>0,
|
2898
|
+
:id=>3}]
|
2899
|
+
actual = []
|
2900
|
+
@model.each do |m|
|
2901
|
+
actual << {:id => m.id, :model_serial => m.model.serial, :residues_size => m.residues.size, :heterogens_size => m.heterogens.size, :aaseq => m.aaseq }
|
2902
|
+
end
|
2903
|
+
assert_equal(expected, actual)
|
2904
|
+
end
|
2905
|
+
|
2906
|
+
def test_each_chain
|
2907
|
+
expected = [{:model_serial=>1,
|
2908
|
+
:aaseq=>"",
|
2909
|
+
:residues_size=>0,
|
2910
|
+
:heterogens_size=>0,
|
2911
|
+
:id=>1},
|
2912
|
+
{:model_serial=>1,
|
2913
|
+
:aaseq=>"",
|
2914
|
+
:residues_size=>0,
|
2915
|
+
:heterogens_size=>0,
|
2916
|
+
:id=>2},
|
2917
|
+
{:model_serial=>1,
|
2918
|
+
:aaseq=>"",
|
2919
|
+
:residues_size=>0,
|
2920
|
+
:heterogens_size=>0,
|
2921
|
+
:id=>3}]
|
2922
|
+
actual = []
|
2923
|
+
@model.each_chain do |m|
|
2924
|
+
actual << {:id => m.id, :model_serial => m.model.serial, :residues_size => m.residues.size, :heterogens_size => m.heterogens.size, :aaseq => m.aaseq }
|
2925
|
+
end
|
2926
|
+
assert_equal(expected, actual)
|
2927
|
+
end
|
2928
|
+
def test_inspect
|
2929
|
+
expected = "#<Bio::PDB::Model serial=1 chains.size=3>"
|
2930
|
+
assert_equal(expected, @model.inspect)
|
2931
|
+
end
|
2932
|
+
def test_rehash
|
2933
|
+
assert_nothing_raised{@model.rehash}
|
2934
|
+
end
|
2935
|
+
def test_to_s
|
2936
|
+
assert_equal("MODEL 1\nTER\nTER\nTER\nENDMDL\n",@model.to_s)
|
2937
|
+
end
|
2938
|
+
end
|
2939
|
+
|
2940
|
+
#this class tests Bio::PDB::Utils with Bio::PDB::Residue class witch is generated directly
|
2941
|
+
class TestUtils < Test::Unit::TestCase
|
2942
|
+
def setup
|
2943
|
+
@res = Bio::PDB::Residue.new(resName="ALA",resSeq = 7, iCode = "", chain = nil)
|
2944
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 1 N ALA A 7 23.484 -35.866 44.510 1.00 28.52 N"))
|
2945
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"))
|
2946
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 3 C ALA A 7 23.102 -34.082 46.159 1.00 26.68 C"))
|
2947
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 4 O ALA A 7 23.097 -32.903 46.524 1.00 30.02 O"))
|
2948
|
+
@res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 5 CB ALA A 7 23.581 -33.526 43.770 1.00 31.41 C"))
|
2949
|
+
end
|
2950
|
+
|
2951
|
+
def test_geometricCentre
|
2952
|
+
assert_instance_of(Bio::PDB::Coordinate,@res.geometricCentre())
|
2953
|
+
# assert_equal(Vector[23.4226, -34.1772, 45.1734], @res.geometricCentre())
|
2954
|
+
expected = [ 23.4226, -34.1772, 45.1734 ]
|
2955
|
+
@res.geometricCentre().to_a.each do |num|
|
2956
|
+
assert_in_delta(expected.shift, num, 0.001)
|
2957
|
+
end
|
2958
|
+
assert(expected.empty?)
|
2959
|
+
end
|
2960
|
+
|
2961
|
+
def test_centreOfGravity
|
2962
|
+
assert_instance_of(Bio::PDB::Coordinate,@res.centreOfGravity())
|
2963
|
+
expected = [ 23.4047272727273, -34.1511515151515, 45.2351515151515 ]
|
2964
|
+
@res.centreOfGravity().to_a.each do |num|
|
2965
|
+
assert_in_delta(expected.shift, num, 0.001)
|
2966
|
+
end
|
2967
|
+
assert(expected.empty?)
|
2968
|
+
end
|
2969
|
+
|
2970
|
+
def test_distance
|
2971
|
+
actual1 = Bio::PDB::Utils.distance(
|
2972
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
2973
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 7 CA VAL A 8 21.887 -34.822 48.124 1.00 23.78 C")
|
2974
|
+
)
|
2975
|
+
|
2976
|
+
actual2 = Bio::PDB::Utils.distance([23.849, -34.509, 44.904], [21.887, -34.822, 48.124])
|
2977
|
+
assert_in_delta(3.78362432067456, actual1, 0.001)
|
2978
|
+
assert_in_delta(3.78362432067456, actual2, 0.001)
|
2979
|
+
end
|
2980
|
+
def test_dihedral_angle
|
2981
|
+
actual1 = Bio::PDB::Utils.dihedral_angle(
|
2982
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
2983
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 7 CA VAL A 8 21.887 -34.822 48.124 1.00 23.78 C"),
|
2984
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 14 CA PRO A 9 24.180 -35.345 51.107 1.00 22.35 C"),
|
2985
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 21 CA ALA A 10 23.833 -38.844 52.579 1.00 23.41 C")
|
2986
|
+
)
|
2987
|
+
|
2988
|
+
|
2989
|
+
actual2 = Bio::PDB::Utils.dihedral_angle(
|
2990
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 34.509 44.904 1.00 27.89 C"),
|
2991
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 7 CA VAL A 8 21.887 34.822 48.124 1.00 23.78 C"),
|
2992
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 14 CA PRO A 9 24.180 35.345 51.107 1.00 22.35 C"),
|
2993
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 21 CA ALA A 10 23.833 38.844 52.579 1.00 23.41 C")
|
2994
|
+
)
|
2995
|
+
assert_in_delta(-1.94387328933899, actual1, 0.001)
|
2996
|
+
assert_in_delta( 1.94387328933899, actual2, 0.001)
|
2997
|
+
|
2998
|
+
end
|
2999
|
+
def test_rad2deg
|
3000
|
+
deg = Bio::PDB::Utils::rad2deg(3.14159265358979)
|
3001
|
+
assert_in_delta(180.0, deg, 0.0000000001)
|
3002
|
+
end
|
3003
|
+
|
3004
|
+
end #class Test_Utils
|
3005
|
+
|
3006
|
+
#The following classes is unit tests for Test_*Finder
|
3007
|
+
#The sample data are arrays generated from corresponding Bio::PDB::* classes, witch has Bio::PDB::Utils::*Finder
|
3008
|
+
|
3009
|
+
class TestModelFinder < Test::Unit::TestCase
|
3010
|
+
def setup
|
3011
|
+
@models = [Bio::PDB::Model.new(1), Bio::PDB::Model.new(2), Bio::PDB::Model.new(3)]
|
3012
|
+
def @models.each_model
|
3013
|
+
self.each do |model|
|
3014
|
+
yield model
|
3015
|
+
end
|
3016
|
+
end
|
3017
|
+
@models.extend(Bio::PDB::ModelFinder)
|
3018
|
+
end
|
3019
|
+
|
3020
|
+
def test_find_model
|
3021
|
+
expected = [Bio::PDB::Model.new(1), Bio::PDB::Model.new(2), Bio::PDB::Model.new(3)]
|
3022
|
+
actual = @models.find_model{|m| true}
|
3023
|
+
assert_equal(expected,actual)
|
3024
|
+
end
|
3025
|
+
|
3026
|
+
end
|
3027
|
+
|
3028
|
+
class TestChainFinder < Test::Unit::TestCase
|
3029
|
+
def setup
|
3030
|
+
@model = [Bio::PDB::Chain.new(1), Bio::PDB::Chain.new(2), Bio::PDB::Chain.new(3)]
|
3031
|
+
end
|
3032
|
+
|
3033
|
+
def test_find_chain
|
3034
|
+
def @model.each_chain
|
3035
|
+
self.each do |chain|
|
3036
|
+
yield chain
|
3037
|
+
end
|
3038
|
+
end
|
3039
|
+
@model.extend(Bio::PDB::ChainFinder)
|
3040
|
+
expected = [Bio::PDB::Chain.new(1), Bio::PDB::Chain.new(2), Bio::PDB::Chain.new(3)]
|
3041
|
+
actual = @model.find_chain{|m| true}
|
3042
|
+
assert_equal(expected,actual)
|
3043
|
+
end
|
3044
|
+
def test_each_chain
|
3045
|
+
expected = [Bio::PDB::Chain.new(1), Bio::PDB::Chain.new(2), Bio::PDB::Chain.new(3), Bio::PDB::Chain.new(1), Bio::PDB::Chain.new(2), Bio::PDB::Chain.new(3)]
|
3046
|
+
models = [@model,@model]
|
3047
|
+
def models.each_model
|
3048
|
+
self.each do |model|
|
3049
|
+
yield model
|
3050
|
+
end
|
3051
|
+
end
|
3052
|
+
models.extend(Bio::PDB::ChainFinder)
|
3053
|
+
actual = []
|
3054
|
+
models.each_chain{|chain| actual << chain}
|
3055
|
+
assert_equal(expected, actual)
|
3056
|
+
end
|
3057
|
+
|
3058
|
+
def test_chains
|
3059
|
+
expected = [Bio::PDB::Chain.new(1), Bio::PDB::Chain.new(2), Bio::PDB::Chain.new(3), Bio::PDB::Chain.new(1), Bio::PDB::Chain.new(2), Bio::PDB::Chain.new(3)]
|
3060
|
+
@model.instance_eval{
|
3061
|
+
def chains
|
3062
|
+
return self
|
3063
|
+
end
|
3064
|
+
}
|
3065
|
+
models = [@model,@model]
|
3066
|
+
def models.each_model
|
3067
|
+
self.each do |model|
|
3068
|
+
yield model
|
3069
|
+
end
|
3070
|
+
end
|
3071
|
+
models.extend(Bio::PDB::ChainFinder)
|
3072
|
+
models.extend(Bio::PDB::ModelFinder)
|
3073
|
+
actual = models.chains
|
3074
|
+
assert_equal(expected,actual)
|
3075
|
+
end
|
3076
|
+
end #TestChainFinder
|
3077
|
+
|
3078
|
+
class TestResidueFinder < Test::Unit::TestCase
|
3079
|
+
def setup
|
3080
|
+
@residues = [Bio::PDB::Residue.new("",1), Bio::PDB::Residue.new("",2), Bio::PDB::Residue.new("",3)]
|
3081
|
+
end
|
3082
|
+
|
3083
|
+
def test_find_residue
|
3084
|
+
def @residues.each_residue
|
3085
|
+
self.each do |residue|
|
3086
|
+
yield residue
|
3087
|
+
end
|
3088
|
+
end
|
3089
|
+
@residues.extend(Bio::PDB::ResidueFinder)
|
3090
|
+
# expected = [Bio::PDB::Residue.new("",1), Bio::PDB::Residue.new("",2), Bio::PDB::Residue.new("",3)]
|
3091
|
+
expected = [
|
3092
|
+
{:resName=>"", :id=>"1", :chain=>nil, :resSeq=>1, :iCode=>nil, :atoms_size=>0},
|
3093
|
+
{:resName=>"", :id=>"2", :chain=>nil, :resSeq=>2, :iCode=>nil, :atoms_size=>0},
|
3094
|
+
{:resName=>"", :id=>"3", :chain=>nil, :resSeq=>3, :iCode=>nil, :atoms_size=>0},
|
3095
|
+
]
|
3096
|
+
finded = @residues.find_residue{|m| true}
|
3097
|
+
actual = []
|
3098
|
+
finded.each do |res|
|
3099
|
+
actual << {:resName=> res.resName, :id=> res.id, :chain=> res.chain, :resSeq=> res.resSeq, :iCode=> res.iCode, :atoms_size=> res.atoms.size}
|
3100
|
+
end
|
3101
|
+
assert_equal(expected,actual)
|
3102
|
+
end
|
3103
|
+
|
3104
|
+
def test_each_residue
|
3105
|
+
# expected = [Bio::PDB::Residue.new("", 1), Bio::PDB::Residue.new("",2), Bio::PDB::Residue.new("",3), Bio::PDB::Residue.new("",1), Bio::PDB::Residue.new("",2), Bio::PDB::Residue.new("",3)]
|
3106
|
+
expected = [
|
3107
|
+
{:resName=>"", :id=>"1", :chain=>nil, :resSeq=>1, :iCode=>nil, :atoms_size=>0},
|
3108
|
+
{:resName=>"", :id=>"2", :chain=>nil, :resSeq=>2, :iCode=>nil, :atoms_size=>0},
|
3109
|
+
{:resName=>"", :id=>"3", :chain=>nil, :resSeq=>3, :iCode=>nil, :atoms_size=>0},
|
3110
|
+
{:resName=>"", :id=>"1", :chain=>nil, :resSeq=>1, :iCode=>nil, :atoms_size=>0},
|
3111
|
+
{:resName=>"", :id=>"2", :chain=>nil, :resSeq=>2, :iCode=>nil, :atoms_size=>0},
|
3112
|
+
{:resName=>"", :id=>"3", :chain=>nil, :resSeq=>3, :iCode=>nil, :atoms_size=>0}
|
3113
|
+
]
|
3114
|
+
chains = [@residues,@residues]
|
3115
|
+
def chains.each_chain
|
3116
|
+
self.each do |chain|
|
3117
|
+
yield chain
|
3118
|
+
end
|
3119
|
+
end
|
3120
|
+
chains.extend(Bio::PDB::ResidueFinder)
|
3121
|
+
actual = []
|
3122
|
+
chains.each_residue do |res|
|
3123
|
+
actual << {:resName=> res.resName, :id=> res.id, :chain=> res.chain, :resSeq=> res.resSeq, :iCode=> res.iCode, :atoms_size=> res.atoms.size}
|
3124
|
+
end
|
3125
|
+
assert_equal(expected, actual)
|
3126
|
+
end
|
3127
|
+
|
3128
|
+
def test_residues
|
3129
|
+
# expected = [Bio::PDB::Residue.new("", 1), Bio::PDB::Residue.new("",2), Bio::PDB::Residue.new("",3), Bio::PDB::Residue.new("",1), Bio::PDB::Residue.new("",2), Bio::PDB::Residue.new("",3)]
|
3130
|
+
expected = [
|
3131
|
+
{:resName=>"", :id=>"1", :chain=>nil, :resSeq=>1, :iCode=>nil, :atoms_size=>0},
|
3132
|
+
{:resName=>"", :id=>"2", :chain=>nil, :resSeq=>2, :iCode=>nil, :atoms_size=>0},
|
3133
|
+
{:resName=>"", :id=>"3", :chain=>nil, :resSeq=>3, :iCode=>nil, :atoms_size=>0},
|
3134
|
+
{:resName=>"", :id=>"1", :chain=>nil, :resSeq=>1, :iCode=>nil, :atoms_size=>0},
|
3135
|
+
{:resName=>"", :id=>"2", :chain=>nil, :resSeq=>2, :iCode=>nil, :atoms_size=>0},
|
3136
|
+
{:resName=>"", :id=>"3", :chain=>nil, :resSeq=>3, :iCode=>nil, :atoms_size=>0}]
|
3137
|
+
@residues.instance_eval{
|
3138
|
+
def residues
|
3139
|
+
return self
|
3140
|
+
end
|
3141
|
+
}
|
3142
|
+
chains = [@residues,@residues]
|
3143
|
+
def chains.each_chain
|
3144
|
+
self.each do |chain|
|
3145
|
+
yield chain
|
3146
|
+
end
|
3147
|
+
end
|
3148
|
+
chains.extend(Bio::PDB::ResidueFinder)
|
3149
|
+
chains.extend(Bio::PDB::ChainFinder)
|
3150
|
+
actual = []
|
3151
|
+
chains.residues.each do |res|
|
3152
|
+
actual << {:resName=> res.resName, :id=> res.id, :chain=> res.chain, :resSeq=> res.resSeq, :iCode=> res.iCode, :atoms_size=> res.atoms.size}
|
3153
|
+
end
|
3154
|
+
assert_equal(expected,actual)
|
3155
|
+
end
|
3156
|
+
end #TestResidueFinder
|
3157
|
+
|
3158
|
+
class TestAtomFinder < Test::Unit::TestCase
|
3159
|
+
def setup
|
3160
|
+
@atoms = [Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3161
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3162
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C")]
|
3163
|
+
end
|
3164
|
+
|
3165
|
+
def test_find_atom
|
3166
|
+
expected =
|
3167
|
+
[Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3168
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3169
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C")]
|
3170
|
+
def @atoms.each_atom
|
3171
|
+
self.each do |atom|
|
3172
|
+
yield atom
|
3173
|
+
end
|
3174
|
+
end
|
3175
|
+
@atoms.extend(Bio::PDB::AtomFinder)
|
3176
|
+
actual = @atoms.find_atom{|a| true}
|
3177
|
+
assert_equal(expected,actual)
|
3178
|
+
end
|
3179
|
+
|
3180
|
+
def test_each_atom
|
3181
|
+
expected = [
|
3182
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3183
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3184
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3185
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3186
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3187
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C")
|
3188
|
+
]
|
3189
|
+
residues = [@atoms,@atoms]
|
3190
|
+
def residues.each_residue
|
3191
|
+
self.each do |residue|
|
3192
|
+
yield residue
|
3193
|
+
end
|
3194
|
+
end
|
3195
|
+
residues.extend(Bio::PDB::AtomFinder)
|
3196
|
+
actual = []
|
3197
|
+
residues.each_atom{|atom| actual << atom}
|
3198
|
+
assert_equal(expected, actual)
|
3199
|
+
end
|
3200
|
+
|
3201
|
+
def test_atoms
|
3202
|
+
expected = [
|
3203
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3204
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3205
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3206
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3207
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"),
|
3208
|
+
Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C")
|
3209
|
+
]
|
3210
|
+
@atoms.instance_eval{
|
3211
|
+
def atoms
|
3212
|
+
return self
|
3213
|
+
end
|
3214
|
+
}
|
3215
|
+
residues = [@atoms,@atoms]
|
3216
|
+
def residues.each_residue
|
3217
|
+
self.each do |atom|
|
3218
|
+
yield atom
|
3219
|
+
end
|
3220
|
+
end
|
3221
|
+
residues.extend(Bio::PDB::AtomFinder)
|
3222
|
+
residues.extend(Bio::PDB::ResidueFinder)
|
3223
|
+
actual = residues.atoms
|
3224
|
+
assert_equal(expected,actual)
|
3225
|
+
end
|
3226
|
+
end #AtomFinder
|
3227
|
+
|
3228
|
+
class TestHetatmFinder < Test::Unit::TestCase
|
3229
|
+
def setup
|
3230
|
+
@hetatms =
|
3231
|
+
[Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30583 O1 EDO A 701 -1.516 -26.859 49.587 1.00 35.20 O"),
|
3232
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30584 C2 EDO A 701 -0.275 -28.124 51.219 1.00 34.49 C"),
|
3233
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30585 O2 EDO A 701 -1.442 -28.941 51.167 1.00 33.95 O"),
|
3234
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30586 C1 EDO A 702 2.792 7.449 67.655 1.00 17.09 C"),
|
3235
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30587 O1 EDO A 702 1.451 7.273 67.213 1.00 15.74 O")
|
3236
|
+
]
|
3237
|
+
end
|
3238
|
+
|
3239
|
+
def test_find_hetatm
|
3240
|
+
expected =
|
3241
|
+
[Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30583 O1 EDO A 701 -1.516 -26.859 49.587 1.00 35.20 O"),
|
3242
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30584 C2 EDO A 701 -0.275 -28.124 51.219 1.00 34.49 C"),
|
3243
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30585 O2 EDO A 701 -1.442 -28.941 51.167 1.00 33.95 O"),
|
3244
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30586 C1 EDO A 702 2.792 7.449 67.655 1.00 17.09 C"),
|
3245
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30587 O1 EDO A 702 1.451 7.273 67.213 1.00 15.74 O")
|
3246
|
+
]
|
3247
|
+
def @hetatms.each_hetatm
|
3248
|
+
self.each do |hetatm|
|
3249
|
+
yield hetatm
|
3250
|
+
end
|
3251
|
+
end
|
3252
|
+
@hetatms.extend(Bio::PDB::HetatmFinder)
|
3253
|
+
actual = @hetatms.find_hetatm{|a| true}
|
3254
|
+
|
3255
|
+
assert_equal(expected,actual)
|
3256
|
+
end
|
3257
|
+
|
3258
|
+
def test_each_hetatm
|
3259
|
+
expected = [
|
3260
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30583 O1 EDO A 701 -1.516 -26.859 49.587 1.00 35.20 O"),
|
3261
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30584 C2 EDO A 701 -0.275 -28.124 51.219 1.00 34.49 C"),
|
3262
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30585 O2 EDO A 701 -1.442 -28.941 51.167 1.00 33.95 O"),
|
3263
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30586 C1 EDO A 702 2.792 7.449 67.655 1.00 17.09 C"),
|
3264
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30587 O1 EDO A 702 1.451 7.273 67.213 1.00 15.74 O"),
|
3265
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30583 O1 EDO A 701 -1.516 -26.859 49.587 1.00 35.20 O"),
|
3266
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30584 C2 EDO A 701 -0.275 -28.124 51.219 1.00 34.49 C"),
|
3267
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30585 O2 EDO A 701 -1.442 -28.941 51.167 1.00 33.95 O"),
|
3268
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30586 C1 EDO A 702 2.792 7.449 67.655 1.00 17.09 C"),
|
3269
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30587 O1 EDO A 702 1.451 7.273 67.213 1.00 15.74 O")
|
3270
|
+
|
3271
|
+
]
|
3272
|
+
heterogens = [@hetatms,@hetatms]
|
3273
|
+
def heterogens.each_heterogen
|
3274
|
+
self.each do |heterogen|
|
3275
|
+
yield heterogen
|
3276
|
+
end
|
3277
|
+
end
|
3278
|
+
heterogens.extend(Bio::PDB::HetatmFinder)
|
3279
|
+
actual = []
|
3280
|
+
heterogens.each_hetatm{|hetatm| actual << hetatm}
|
3281
|
+
|
3282
|
+
assert_equal(expected, actual)
|
3283
|
+
end
|
3284
|
+
|
3285
|
+
def test_hetatms
|
3286
|
+
expected = [
|
3287
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30583 O1 EDO A 701 -1.516 -26.859 49.587 1.00 35.20 O"),
|
3288
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30584 C2 EDO A 701 -0.275 -28.124 51.219 1.00 34.49 C"),
|
3289
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30585 O2 EDO A 701 -1.442 -28.941 51.167 1.00 33.95 O"),
|
3290
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30586 C1 EDO A 702 2.792 7.449 67.655 1.00 17.09 C"),
|
3291
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30587 O1 EDO A 702 1.451 7.273 67.213 1.00 15.74 O"),
|
3292
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30583 O1 EDO A 701 -1.516 -26.859 49.587 1.00 35.20 O"),
|
3293
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30584 C2 EDO A 701 -0.275 -28.124 51.219 1.00 34.49 C"),
|
3294
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30585 O2 EDO A 701 -1.442 -28.941 51.167 1.00 33.95 O"),
|
3295
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30586 C1 EDO A 702 2.792 7.449 67.655 1.00 17.09 C"),
|
3296
|
+
Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30587 O1 EDO A 702 1.451 7.273 67.213 1.00 15.74 O")
|
3297
|
+
]
|
3298
|
+
@hetatms.instance_eval{
|
3299
|
+
def hetatms
|
3300
|
+
return self
|
3301
|
+
end
|
3302
|
+
}
|
3303
|
+
heterogens = [@hetatms,@hetatms]
|
3304
|
+
def heterogens.each_heterogen
|
3305
|
+
self.each do |heterogen|
|
3306
|
+
yield heterogen
|
3307
|
+
end
|
3308
|
+
end
|
3309
|
+
heterogens.extend(Bio::PDB::HetatmFinder)
|
3310
|
+
heterogens.extend(Bio::PDB::HeterogenFinder)
|
3311
|
+
actual = heterogens.hetatms
|
3312
|
+
assert_equal(expected,actual)
|
3313
|
+
end
|
3314
|
+
end #HetatmFinder
|
3315
|
+
|
3316
|
+
class TestHeterogenFinder < Test::Unit::TestCase
|
3317
|
+
def setup
|
3318
|
+
@heterogens =
|
3319
|
+
[Bio::PDB::Heterogen.new(),
|
3320
|
+
Bio::PDB::Heterogen.new(),
|
3321
|
+
Bio::PDB::Heterogen.new(),
|
3322
|
+
Bio::PDB::Heterogen.new()
|
3323
|
+
]
|
3324
|
+
end
|
3325
|
+
|
3326
|
+
def test_find_heterogen
|
3327
|
+
def @heterogens.each_heterogen
|
3328
|
+
self.each do |heterogen|
|
3329
|
+
yield heterogen
|
3330
|
+
end
|
3331
|
+
end
|
3332
|
+
@heterogens.extend(Bio::PDB::HeterogenFinder)
|
3333
|
+
expected = [
|
3334
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3335
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3336
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3337
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3338
|
+
]
|
3339
|
+
hets = @heterogens.find_heterogen{|a| true}
|
3340
|
+
actual = []
|
3341
|
+
hets.each do |het|
|
3342
|
+
actual << {:resName=> het.resName, :id=> het.id, :chain=> het.chain, :resSeq=> het.resSeq, :iCode=> het.iCode, :atoms_size=> het.atoms.size}
|
3343
|
+
end
|
3344
|
+
assert_equal(expected,actual)
|
3345
|
+
end
|
3346
|
+
|
3347
|
+
def test_each_heterogen
|
3348
|
+
# expected = [
|
3349
|
+
# Bio::PDB::Heterogen.new(),
|
3350
|
+
# Bio::PDB::Heterogen.new(),
|
3351
|
+
# Bio::PDB::Heterogen.new(),
|
3352
|
+
# Bio::PDB::Heterogen.new(),
|
3353
|
+
# Bio::PDB::Heterogen.new(),
|
3354
|
+
# Bio::PDB::Heterogen.new(),
|
3355
|
+
# Bio::PDB::Heterogen.new(),
|
3356
|
+
# Bio::PDB::Heterogen.new()
|
3357
|
+
# ]
|
3358
|
+
expected = [
|
3359
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3360
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3361
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3362
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3363
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3364
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3365
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3366
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0}
|
3367
|
+
]
|
3368
|
+
def @heterogens.each_heterogen
|
3369
|
+
self.each do |heterogen|
|
3370
|
+
yield heterogen
|
3371
|
+
end
|
3372
|
+
end
|
3373
|
+
chains = [@heterogens,@heterogens]
|
3374
|
+
def chains.each_chain
|
3375
|
+
self.each do |chain|
|
3376
|
+
yield chain
|
3377
|
+
end
|
3378
|
+
end
|
3379
|
+
chains.extend(Bio::PDB::HeterogenFinder)
|
3380
|
+
actual = []
|
3381
|
+
chains.each_heterogen do |het|
|
3382
|
+
actual << {:resName=> het.resName, :id=> het.id, :chain=> het.chain, :resSeq=> het.resSeq, :iCode=> het.iCode, :atoms_size=> het.atoms.size}
|
3383
|
+
end
|
3384
|
+
assert_equal(expected, actual)
|
3385
|
+
end
|
3386
|
+
|
3387
|
+
def test_heterogens
|
3388
|
+
# expected = [
|
3389
|
+
# Bio::PDB::Heterogen.new(),
|
3390
|
+
# Bio::PDB::Heterogen.new(),
|
3391
|
+
# Bio::PDB::Heterogen.new(),
|
3392
|
+
# Bio::PDB::Heterogen.new(),
|
3393
|
+
# Bio::PDB::Heterogen.new(),
|
3394
|
+
# Bio::PDB::Heterogen.new(),
|
3395
|
+
# Bio::PDB::Heterogen.new(),
|
3396
|
+
# Bio::PDB::Heterogen.new()
|
3397
|
+
# ]
|
3398
|
+
expected = [
|
3399
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3400
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3401
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3402
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3403
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3404
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3405
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0},
|
3406
|
+
{:resName=>nil, :id=>nil, :chain=>nil, :resSeq=>nil, :iCode=>nil, :atoms_size=>0}
|
3407
|
+
]
|
3408
|
+
@heterogens.instance_eval{
|
3409
|
+
def heterogens
|
3410
|
+
return self
|
3411
|
+
end
|
3412
|
+
}
|
3413
|
+
chains = [@heterogens,@heterogens]
|
3414
|
+
def chains.each_chain
|
3415
|
+
self.each do |chain|
|
3416
|
+
yield chain
|
3417
|
+
end
|
3418
|
+
end
|
3419
|
+
chains.extend(Bio::PDB::HeterogenFinder)
|
3420
|
+
chains.extend(Bio::PDB::ChainFinder)
|
3421
|
+
hets = chains.heterogens
|
3422
|
+
actual = []
|
3423
|
+
hets.each do |het|
|
3424
|
+
actual << {:resName=> het.resName, :id=> het.id, :chain=> het.chain, :resSeq=> het.resSeq, :iCode=> het.iCode, :atoms_size=> het.atoms.size}
|
3425
|
+
end
|
153
3426
|
|
3427
|
+
assert_equal(expected,actual)
|
3428
|
+
end
|
3429
|
+
end #HetatmFinder
|
154
3430
|
end #module Bio
|