PageRenderTime 30ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/test/unit/bio/db/pdb/test_pdb.rb

https://github.com/phylogenomics/bioruby
Ruby | 3430 lines | 2552 code | 816 blank | 62 comment | 0 complexity | f60e586bd9f9e92cd321d7b91bbb065c MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1

Large files files are truncated, but you can click here to view the full file

  1. #
  2. # = test/unit/bio/db/pdb/test_pdb.rb - Unit test for Bio::PDB classes
  3. #
  4. # Copyright:: Copyright (C) 2010 Kazuhiro Hayashi <k.hayashi.info@gmail.com>
  5. # Copyright:: Copyright (C) 2006 Naohisa Goto <ng@bioruby.org>
  6. #
  7. # License:: The Ruby License
  8. #
  9. # $Id:$
  10. #
  11. # loading helper routine for testing bioruby
  12. require 'pathname'
  13. require 'matrix'
  14. load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
  15. 'bioruby_test_helper.rb')).cleanpath.to_s
  16. # libraries needed for the tests
  17. require 'test/unit'
  18. require 'bio'
  19. module Bio
  20. #This class tests Bio::PDB class.
  21. #The sample record isn't sufficient because it cannot pass through all of the case statement...
  22. class TestPDB < Test::Unit::TestCase
  23. def setup
  24. str =<<EOF
  25. HEADER OXIDOREDUCTASE 12-AUG-09 3INJ
  26. TITLE HUMAN MITOCHONDRIAL ALDEHYDE DEHYDROGENASE COMPLEXED WITH
  27. DBREF 3INJ A 1 500 UNP P05091 ALDH2_HUMAN 18 517
  28. HELIX 1 1 ASP A 55 PHE A 70 1 16
  29. KEYWDS OXIDOREDUCTASE, ALDH, E487K, ROSSMANN FOLD, ALDA-1,
  30. SEQRES 1 A 500 SER ALA ALA ALA THR GLN ALA VAL PRO ALA PRO ASN GLN
  31. SHEET 1 A 2 ILE A 22 ILE A 24 0
  32. SSBOND 1 CYS B 301 CYS B 303 1555 1555 2.97
  33. REVDAT 1 12-JAN-10 3INJ
  34. MODEL 1
  35. ATOM 1 N ALA A 7 23.484 -35.866 44.510 1.00 28.52 N
  36. ANISOU 1 N ALA A 7 2406 1892 1614 198 519 -328 N
  37. SIGUIJ 1 N ALA A 7 10 10 10 10 10 10 N
  38. SIGATM 1 N ALA 7 0.040 0.030 0.030 0.00 0.00 N
  39. ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C
  40. ANISOU 2 CA ALA A 7 2748 2004 1679 -21 155 -419 C
  41. SIGUIJ 2 CA ALA A 7 10 10 10 10 10 10 C
  42. SIGATM 2 CA ALA 7 0.040 0.030 0.030 0.00 0.00 C
  43. ATOM 3 C ALA A 7 23.102 -34.082 46.159 1.00 26.68 C
  44. ANISOU 3 C ALA A 7 2555 1955 1468 87 357 -109 C
  45. SIGUIJ 3 C ALA A 7 10 10 10 10 10 10 C
  46. SIGATM 3 N ALA 7 0.040 0.030 0.030 0.00 0.00 C
  47. ATOM 4 O ALA A 7 23.097 -32.903 46.524 1.00 30.02 O
  48. ANISOU 4 O ALA A 7 2555 1955 1468 87 357 -109 O
  49. SIGUIJ 4 O ALA A 7 10 10 10 10 10 10 O
  50. SIGATM 4 O ALA 7 0.040 0.030 0.030 0.00 0.00 O
  51. ATOM 5 CB ALA A 7 23.581 -33.526 43.770 1.00 31.41 C
  52. ANISOU 5 CB ALA A 7 2555 1955 1468 87 357 -109 C
  53. SIGUIJ 5 CB ALA A 7 10 10 10 10 10 10 C
  54. SIGATM 1 CB ALA 7 0.040 0.030 0.030 0.00 0.00 C
  55. MODEL 2
  56. ATOM 1 N ALA A 7 23.484 -35.866 44.510 1.00 28.52 N
  57. TER 3821 SER A 500
  58. HETATM30582 C1 EDO A 701 -0.205 -27.262 49.961 1.00 34.45 C
  59. HETATM30583 O1 EDO A 701 -1.516 -26.859 49.587 1.00 35.20 O
  60. HETATM30584 C2 EDO A 701 -0.275 -28.124 51.219 1.00 34.49 C
  61. HETATM30585 O2 EDO A 701 -1.442 -28.941 51.167 1.00 33.95 O
  62. HETATM30586 C1 EDO A 702 2.792 7.449 67.655 1.00 17.09 C
  63. HETATM30587 O1 EDO A 702 1.451 7.273 67.213 1.00 15.74 O
  64. HETATM30588 C2 EDO A 702 3.678 7.589 66.425 1.00 15.31 C
  65. HETATM30589 O2 EDO A 702 3.391 6.512 65.550 1.00 17.67 O
  66. HETATM30857 O HOH A 502 13.654 -16.451 49.711 1.00 12.79 O
  67. EOF
  68. @pdb = Bio::PDB.new(str)
  69. end
  70. def test_accession
  71. assert_equal("3INJ", @pdb.accession)
  72. end
  73. def test_addModel
  74. assert_nothing_raised{@pdb.addModel(Bio::PDB::Model.new(1,nil))}
  75. end
  76. def test_authors
  77. assert_equal([],@pdb.authors)
  78. end
  79. def test_classification
  80. assert_equal("OXIDOREDUCTASE",@pdb.classification)
  81. end
  82. def test_dbref
  83. assert_instance_of(Bio::PDB::Record::DBREF,@pdb.dbref.first)
  84. assert_instance_of(Bio::PDB::Record::DBREF,@pdb.dbref("A").first)
  85. end
  86. def test_definition
  87. assert_equal("HUMAN MITOCHONDRIAL ALDEHYDE DEHYDROGENASE COMPLEXED WITH",@pdb.definition)
  88. end
  89. def test_each
  90. expected = [nil, 1, 2, 3]
  91. pdb = Bio::PDB.new(" ")
  92. pdb.addModel(Bio::PDB::Model.new(1,nil))
  93. pdb.addModel(Bio::PDB::Model.new(2,nil))
  94. pdb.addModel(Bio::PDB::Model.new(3,nil))
  95. actual = []
  96. pdb.each do |model|
  97. actual << model.serial
  98. end
  99. assert_equal(expected,actual)
  100. end
  101. def test_each_model
  102. expected = [nil, 1, 2, 3]
  103. pdb = Bio::PDB.new("")
  104. pdb.addModel(Bio::PDB::Model.new(1,nil))
  105. pdb.addModel(Bio::PDB::Model.new(2,nil))
  106. pdb.addModel(Bio::PDB::Model.new(3,nil))
  107. actual = []
  108. pdb.each_model do |model|
  109. actual << model.serial
  110. end
  111. assert_equal(expected,actual)
  112. end
  113. def test_entry_id
  114. assert_equal("3INJ", @pdb.entry_id)
  115. end
  116. def test_helix
  117. assert_instance_of(Array, @pdb.helix)
  118. assert_equal(nil,@pdb.helix(1))
  119. end
  120. def test_inspect
  121. assert_equal("#<Bio::PDB entry_id=\"3INJ\">",@pdb.inspect)
  122. end
  123. def test_jrnl
  124. assert_instance_of(Hash, @pdb.jrnl)
  125. end
  126. def test_keywords
  127. assert_equal(["OXIDOREDUCTASE", "ALDH", "E487K", "ROSSMANN FOLD", "ALDA-1"],@pdb.keywords)
  128. end
  129. def test_remark
  130. str =<<EOS
  131. REMARK 1 REFERENCE 1
  132. REMARK 1 AUTH C.H.CHEN,G.R.BUDAS,E.N.CHURCHILL,M.H.DISATNIK
  133. REMARK 2
  134. REMARK 3
  135. EOS
  136. expected =
  137. { 1 => {:remarkNum=>1,
  138. :sub_record=>"AUTH",
  139. :authorList=>["C.H.CHEN", "G.R.BUDAS", "E.N.CHURCHILL", "M.H.DISATNIK"]},
  140. 2=>[],
  141. 3=>[]}
  142. obj = Bio::PDB.new(str)
  143. actual =
  144. { 1 => {:remarkNum=>obj.remark[1][0].remarkNum,
  145. :sub_record=>obj.remark[1][0].sub_record,
  146. :authorList=>obj.remark[1][0].authorList},
  147. 2=>obj.remark[2],
  148. 3=>obj.remark[3]}
  149. assert_equal(actual,expected)
  150. end
  151. def test_record
  152. assert_instance_of(Hash, @pdb.record)
  153. end
  154. def test_seqres
  155. assert_equal({"A"=>"SAAATQAVPAPNQ"},@pdb.seqres)
  156. assert_equal(nil,@pdb.seqres(7)) #I'm not sure why this returns nil
  157. str =<<EOS
  158. SEQRES 1 X 39 U C C C C C G U G C C C A
  159. EOS
  160. obj = Bio::PDB.new(str)
  161. assert_equal({"X"=>"ucccccgugccca"},obj.seqres)
  162. end
  163. # too redundant?
  164. def test_sheet
  165. seq =<<EOS
  166. SHEET 2 BS8 3 LYS 639 LYS 648 -1 N PHE 643 O HIS 662
  167. SHEET 3 BS8 3 ASN 596 VAL 600 -1 N TYR 598 O ILE 646
  168. EOS
  169. s = Bio::PDB.new(seq)
  170. actual = []
  171. s.sheet.each do |obj2|
  172. obj2.each do |obj|
  173. actual <<
  174. {:strand=>obj.strand,
  175. :sheetID=>obj.sheetID,
  176. :numStrands=>obj.numStrands,
  177. :initResName=>obj.initResName,
  178. :initChainID=>obj.initChainID,
  179. :initSeqNum=>obj.initSeqNum,
  180. :initICode=>obj.initICode,
  181. :endResName=>obj.endResName,
  182. :endChainID=>obj.endChainID,
  183. :endSeqNum=>obj.endSeqNum,
  184. :endICode=>obj.endICode,
  185. :sense=>obj.sense,
  186. :curAtom=>obj.curAtom,
  187. :curResName=>obj.curResName,
  188. :curChainId=>obj.curChainId,
  189. :curResSeq=>obj.curResSeq,
  190. :curICode=>obj.curICode,
  191. :prevAtom=>obj.prevAtom,
  192. :prevResName=>obj.prevResName,
  193. :prevChainId=>obj.prevChainId,
  194. :prevResSeq=>obj.prevResSeq,
  195. :prevICode=>obj.prevICode}
  196. end
  197. end
  198. expected =
  199. [
  200. {:strand=>2,
  201. :sheetID=>"BS8",
  202. :numStrands=>3,
  203. :initResName=>"LYS",
  204. :initChainID=>" ",
  205. :initSeqNum=>639,
  206. :initICode=>"",
  207. :endResName=>"LYS",
  208. :endChainID=>" ",
  209. :endSeqNum=>648,
  210. :endICode=>"",
  211. :sense=>-1,
  212. :curAtom=>" N",
  213. :curResName=>"PHE",
  214. :curChainId=>" ",
  215. :curResSeq=>643,
  216. :curICode=>"",
  217. :prevAtom=>" O",
  218. :prevResName=>"HIS",
  219. :prevChainId=>" ",
  220. :prevResSeq=>662,
  221. :prevICode=>""},
  222. {:strand=>3,
  223. :sheetID=>"BS8",
  224. :numStrands=>3,
  225. :initResName=>"ASN",
  226. :initChainID=>" ",
  227. :initSeqNum=>596,
  228. :initICode=>"",
  229. :endResName=>"VAL",
  230. :endChainID=>" ",
  231. :endSeqNum=>600,
  232. :endICode=>"",
  233. :sense=>-1,
  234. :curAtom=>" N",
  235. :curResName=>"TYR",
  236. :curChainId=>" ",
  237. :curResSeq=>598,
  238. :curICode=>"",
  239. :prevAtom=>" O",
  240. :prevResName=>"ILE",
  241. :prevChainId=>" ",
  242. :prevResSeq=>646,
  243. :prevICode=>""}]
  244. actual2 = []
  245. s.sheet("BS8").each do |obj2|
  246. obj2.each do |obj|
  247. actual2 <<
  248. {:strand=>obj.strand,
  249. :sheetID=>obj.sheetID,
  250. :numStrands=>obj.numStrands,
  251. :initResName=>obj.initResName,
  252. :initChainID=>obj.initChainID,
  253. :initSeqNum=>obj.initSeqNum,
  254. :initICode=>obj.initICode,
  255. :endResName=>obj.endResName,
  256. :endChainID=>obj.endChainID,
  257. :endSeqNum=>obj.endSeqNum,
  258. :endICode=>obj.endICode,
  259. :sense=>obj.sense,
  260. :curAtom=>obj.curAtom,
  261. :curResName=>obj.curResName,
  262. :curChainId=>obj.curChainId,
  263. :curResSeq=>obj.curResSeq,
  264. :curICode=>obj.curICode,
  265. :prevAtom=>obj.prevAtom,
  266. :prevResName=>obj.prevResName,
  267. :prevChainId=>obj.prevChainId,
  268. :prevResSeq=>obj.prevResSeq,
  269. :prevICode=>obj.prevICode}
  270. end
  271. end
  272. assert_equal(expected,actual)
  273. assert_equal(expected,actual2)
  274. end
  275. def test_ssbond
  276. assert_instance_of(Bio::PDB::Record::SSBOND,@pdb.ssbond.first)
  277. end
  278. #is this method correct?
  279. def test_to_s
  280. 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)
  281. end
  282. def test_turn
  283. assert_equal([],@pdb.turn)
  284. assert_equal(nil,@pdb.turn(1))
  285. end
  286. def test_version
  287. assert_equal(1,@pdb.version)
  288. end
  289. def test_bracket #test for []
  290. assert_equal(1,@pdb[1].serial)
  291. end
  292. end
  293. #TestPDBRecord::Test* are unit tests for pdb field classes.
  294. #each test class uses one line or several lines of PDB record.
  295. #they tests all the methods described or generated in Bio::PDB::Record.
  296. module TestPDBRecord
  297. # test of Bio::PDB::Record::ATOM
  298. class TestATOM < Test::Unit::TestCase
  299. def setup
  300. # the data is taken from
  301. # http://www.rcsb.org/pdb/file_formats/pdb/pdbguide2.2/part_62.html
  302. @str = 'ATOM 154 CG2BVAL A 25 29.909 16.996 55.922 0.72 13.25 A1 C '
  303. @atom = Bio::PDB::Record::ATOM.new.initialize_from_string(@str)
  304. end
  305. def test_record_name
  306. assert_equal('ATOM', @atom.record_name)
  307. end
  308. def test_serial
  309. assert_equal(154, @atom.serial)
  310. end
  311. def test_name
  312. assert_equal('CG2', @atom.name)
  313. end
  314. def test_altLoc
  315. assert_equal('B', @atom.altLoc)
  316. end
  317. def test_resName
  318. assert_equal('VAL', @atom.resName)
  319. end
  320. def test_chainID
  321. assert_equal('A', @atom.chainID)
  322. end
  323. def test_resSeq
  324. assert_equal(25, @atom.resSeq)
  325. end
  326. def test_iCode
  327. assert_equal('', @atom.iCode)
  328. end
  329. def test_x
  330. assert_in_delta(29.909, @atom.x, 0.0001)
  331. end
  332. def test_y
  333. assert_in_delta(16.996, @atom.y, 0.0001)
  334. end
  335. def test_z
  336. assert_in_delta(55.922, @atom.z, 0.0001)
  337. end
  338. def test_occupancy
  339. assert_in_delta(0.72, @atom.occupancy, 0.001)
  340. end
  341. def test_tempFactor
  342. assert_in_delta(13.25, @atom.tempFactor, 0.001)
  343. end
  344. def test_segID
  345. assert_equal('A1', @atom.segID)
  346. end
  347. def test_element
  348. assert_equal('C', @atom.element)
  349. end
  350. def test_charge
  351. assert_equal('', @atom.charge)
  352. end
  353. def test_xyz
  354. assert_equal(Bio::PDB::Coordinate[
  355. "29.909".to_f,
  356. "16.996".to_f,
  357. "55.922".to_f ], @atom.xyz)
  358. end
  359. def test_to_a
  360. assert_equal([ "29.909".to_f,
  361. "16.996".to_f,
  362. "55.922".to_f ], @atom.to_a)
  363. end
  364. def test_comparable
  365. a = Bio::PDB::Record::ATOM.new
  366. a.serial = 999
  367. assert_equal(-1, @atom <=> a)
  368. a.serial = 154
  369. assert_equal( 0, @atom <=> a)
  370. a.serial = 111
  371. assert_equal( 1, @atom <=> a)
  372. end
  373. def test_to_s
  374. assert_equal(@str + "\n", @atom.to_s)
  375. end
  376. def test_original_data
  377. assert_equal([ @str ], @atom.original_data)
  378. end
  379. def test_do_parse
  380. assert_equal(@atom, @atom.do_parse)
  381. end
  382. def test_residue
  383. assert_equal(nil, @atom.residue)
  384. end
  385. def test_sigatm
  386. assert_equal(nil, @atom.sigatm)
  387. end
  388. def test_anisou
  389. assert_equal(nil, @atom.anisou)
  390. end
  391. def test_ter
  392. assert_equal(nil, @atom.ter)
  393. end
  394. end #class TestATOM
  395. # test of Bio::PDB::Record::ATOM
  396. class TestHETATM < Test::Unit::TestCase
  397. def setup
  398. # the data is taken from
  399. # http://www.rcsb.org/pdb/file_formats/pdb/pdbguide2.2/part_62.html
  400. @str = 'HETATM30581 NA NA A 601 5.037 -39.853 62.809 1.00 17.37 NA '
  401. @hetatm = Bio::PDB::Record::HETATM.new.initialize_from_string(@str)
  402. end
  403. def test_record_name
  404. assert_equal('HETATM', @hetatm.record_name)
  405. end
  406. def test_serial
  407. assert_equal(30581, @hetatm.serial)
  408. end
  409. def test_name
  410. assert_equal('NA', @hetatm.name)
  411. end
  412. def test_altLoc
  413. assert_equal(' ', @hetatm.altLoc)
  414. end
  415. def test_resName
  416. assert_equal('NA', @hetatm.resName)
  417. end
  418. def test_chainID
  419. assert_equal('A', @hetatm.chainID)
  420. end
  421. def test_resSeq
  422. assert_equal(601, @hetatm.resSeq)
  423. end
  424. def test_iCode
  425. assert_equal('', @hetatm.iCode)
  426. end
  427. def test_x
  428. assert_in_delta(5.037, @hetatm.x, 0.0001)
  429. end
  430. def test_y
  431. assert_in_delta(-39.853, @hetatm.y, 0.0001)
  432. end
  433. def test_z
  434. assert_in_delta(62.809, @hetatm.z, 0.0001)
  435. end
  436. def test_occupancy
  437. assert_in_delta(1.00, @hetatm.occupancy, 0.001)
  438. end
  439. def test_tempFactor
  440. assert_in_delta(17.37, @hetatm.tempFactor, 0.001)
  441. end
  442. def test_segID
  443. assert_equal('', @hetatm.segID)
  444. end
  445. def test_element
  446. assert_equal('NA', @hetatm.element)
  447. end
  448. def test_charge
  449. assert_equal('', @hetatm.charge)
  450. end
  451. def test_xyz
  452. assert_equal(Bio::PDB::Coordinate[
  453. "5.037".to_f,
  454. "-39.853".to_f,
  455. "62.809".to_f ], @hetatm.xyz)
  456. end
  457. def test_to_a
  458. assert_equal([ "5.037".to_f,
  459. "-39.853".to_f,
  460. "62.809".to_f ], @hetatm.to_a)
  461. end
  462. def test_comparable
  463. a = Bio::PDB::Record::HETATM.new
  464. a.serial = 40000
  465. assert_equal(-1, @hetatm <=> a)
  466. a.serial = 30581
  467. assert_equal( 0, @hetatm <=> a)
  468. a.serial = 30000
  469. assert_equal( 1, @hetatm <=> a)
  470. end
  471. def test_to_s
  472. assert_equal(@str + "\n", @hetatm.to_s)
  473. end
  474. def test_original_data
  475. assert_equal([ @str ], @hetatm.original_data)
  476. end
  477. def test_do_parse
  478. assert_equal(@hetatm, @hetatm.do_parse)
  479. end
  480. def test_residue
  481. assert_equal(nil, @hetatm.residue)
  482. end
  483. def test_sigatm
  484. assert_equal(nil, @hetatm.sigatm)
  485. end
  486. def test_anisou
  487. assert_equal(nil, @hetatm.anisou)
  488. end
  489. def test_ter
  490. assert_equal(nil, @hetatm.ter)
  491. end
  492. end #class TestATOM
  493. class TestHEADER < Test::Unit::TestCase
  494. def setup
  495. @str = 'HEADER OXIDOREDUCTASE 12-AUG-09 3INJ '
  496. @header = Bio::PDB::Record::HEADER.new.initialize_from_string(@str)
  497. end
  498. def test_classification
  499. assert_equal('OXIDOREDUCTASE', @header.classification)
  500. end
  501. def test_depDate
  502. assert_equal('12-AUG-09', @header.depDate)
  503. end
  504. def test_idCode
  505. assert_equal('3INJ', @header.idCode)
  506. end
  507. end
  508. class TestOBSLTE < Test::Unit::TestCase
  509. def setup
  510. @str = 'OBSLTE 31-JAN-94 1MBP 2MBP '
  511. @obslte = Bio::PDB::Record::OBSLTE.new.initialize_from_string(@str)
  512. end
  513. def test_repDate
  514. assert_equal('31-JAN-94', @obslte.repDate)
  515. end
  516. def test_idCode
  517. assert_equal('1MBP', @obslte.idCode)
  518. end
  519. def test_rIdCode
  520. assert_equal(["2MBP"], @obslte.rIdCode)
  521. end
  522. end
  523. #Is this unit test correct?
  524. class TestTITLE < Test::Unit::TestCase
  525. def setup
  526. @str =
  527. "TITLE HUMAN MITOCHONDRIAL ALDEHYDE DEHYDROGENASE COMPLEXED WITH \n
  528. TITLE 2 AGONIST ALDA-1 "
  529. @title = Bio::PDB::Record::TITLE.new.initialize_from_string(@str)
  530. end
  531. def test_title
  532. assert_equal('HUMAN MITOCHONDRIAL ALDEHYDE DEHYDROGENASE COMPLEXED WITH', @title.title)
  533. end
  534. end
  535. class TestCAVEAT < Test::Unit::TestCase
  536. def setup
  537. @str = 'CAVEAT 1ABC INCORRECT'
  538. @caveat = Bio::PDB::Record::CAVEAT.new.initialize_from_string(@str)
  539. end
  540. def test_idcode
  541. assert_equal('1ABC', @caveat.idcode)
  542. end
  543. def test_comment
  544. assert_equal('INCORRECT', @caveat.comment)
  545. end
  546. end
  547. class TestCOMPND < Test::Unit::TestCase
  548. def setup
  549. @str =<<EOS
  550. COMPND MOL_ID: 1;
  551. COMPND 2 MOLECULE: ALDEHYDE DEHYDROGENASE, MITOCHONDRIAL;
  552. COMPND 3 CHAIN: A, B, C, D, E, F, G, H;
  553. COMPND 4 SYNONYM: ALDH CLASS 2, ALDHI, ALDH-E2;
  554. COMPND 5 EC: 1.2.1.3;
  555. COMPND 6 ENGINEERED: YES
  556. EOS
  557. @compnd = Bio::PDB::Record::COMPND.new.initialize_from_string(@str)
  558. end
  559. def test_compound
  560. assert_equal([["MOL_ID", "1"]], @compnd.compound)
  561. end
  562. end
  563. class TestSOURCE < Test::Unit::TestCase
  564. def setup
  565. @str =<<EOS
  566. SOURCE MOL_ID: 1;
  567. SOURCE 2 ORGANISM_SCIENTIFIC: HOMO SAPIENS;
  568. SOURCE 3 ORGANISM_COMMON: HUMAN;
  569. SOURCE 4 ORGANISM_TAXID: 9606;
  570. SOURCE 5 GENE: ALDH2, ALDM;
  571. SOURCE 6 EXPRESSION_SYSTEM: ESCHERICHIA COLI;
  572. SOURCE 7 EXPRESSION_SYSTEM_TAXID: 562;
  573. SOURCE 8 EXPRESSION_SYSTEM_STRAIN: BL21(DE3);
  574. SOURCE 9 EXPRESSION_SYSTEM_VECTOR_TYPE: PLASMID;
  575. SOURCE 10 EXPRESSION_SYSTEM_PLASMID: PT-7-7
  576. EOS
  577. @source = Bio::PDB::Record::SOURCE.new.initialize_from_string(@str)
  578. end
  579. def test_srcName
  580. expected =
  581. [["MOL_ID", "1"], ["SOURCE 2 ORGANISM_SCIENTIFIC", "HOMO SAPIENS"], ["SOU"]]
  582. assert_equal(expected, @source.srcName)
  583. end
  584. end
  585. class TestKEYWDS < Test::Unit::TestCase
  586. def setup
  587. @str =<<EOF
  588. KEYWDS OXIDOREDUCTASE, ALDH, E487K, ROSSMANN FOLD, ALDA-1,
  589. KEYWDS 2 ACTIVATOR, ACETYLATION, MITOCHONDRION, NAD, POLYMORPHISM,
  590. KEYWDS 3 TRANSIT PEPTIDE
  591. EOF
  592. @keywds = Bio::PDB::Record::KEYWDS.new.initialize_from_string(@str)
  593. end
  594. def test_keywds
  595. assert_equal(["OXIDOREDUCTASE", "ALDH", "E487K", "ROSSMANN FOLD", "ALDA-1", "KEYWDS"], @keywds.keywds)
  596. end
  597. end
  598. class TestEXPDTA < Test::Unit::TestCase
  599. def setup
  600. @str = <<EOF
  601. EXPDTA X-RAY DIFFRACTION
  602. EOF
  603. @expdta = Bio::PDB::Record::EXPDTA.new.initialize_from_string(@str)
  604. end
  605. def test_technique
  606. assert_equal(["X-RAY DIFFRACTION"], @expdta.technique)
  607. end
  608. end
  609. class TestAUTHOR < Test::Unit::TestCase
  610. def setup
  611. @str = 'AUTHOR S.PEREZ-MILLER,T.D.HURLEY'
  612. @author = Bio::PDB::Record::AUTHOR.new.initialize_from_string(@str)
  613. end
  614. def test_authorList
  615. assert_equal(["S.PEREZ-MILLER", "T.D.HURLEY"], @author.authorList)
  616. end
  617. end
  618. class TestREVDAT < Test::Unit::TestCase
  619. def setup
  620. @str = 'REVDAT 1 12-JAN-10 3INJ 0'
  621. @revdat = Bio::PDB::Record::REVDAT.new.initialize_from_string(@str)
  622. end
  623. def test_modNum
  624. assert_equal(1, @revdat.modNum )
  625. end
  626. def test_modDate
  627. assert_equal('12-JAN-10', @revdat.modDate)
  628. end
  629. def test_modId
  630. assert_equal('3INJ', @revdat.modId )
  631. end
  632. def test_modType
  633. assert_equal(0, @revdat.modType)
  634. end
  635. def test_record
  636. assert_equal([], @revdat.record )
  637. end
  638. end
  639. class TestSPRSDE < Test::Unit::TestCase
  640. def setup
  641. @str = 'SPRSDE 17-JUL-84 4HHB 1HHB '
  642. @sprsde = Bio::PDB::Record::SPRSDE.new.initialize_from_string(@str)
  643. end
  644. def test_sprsdeDate
  645. assert_equal('17-JUL-84', @sprsde.sprsdeDate)
  646. end
  647. def test_idCode
  648. assert_equal('4HHB', @sprsde.idCode)
  649. end
  650. def test_sIdCode
  651. assert_equal(["1HHB"], @sprsde.sIdCode)
  652. end
  653. end
  654. class TestDBREF < Test::Unit::TestCase
  655. def setup
  656. @str =<<EOS
  657. DBREF 3INJ A 1 500 UNP P05091 ALDH2_HUMAN 18 517
  658. DBREF 3INJ B 1 500 UNP P05091 ALDH2_HUMAN 18 517
  659. DBREF 3INJ C 1 500 UNP P05091 ALDH2_HUMAN 18 517
  660. DBREF 3INJ D 1 500 UNP P05091 ALDH2_HUMAN 18 517
  661. DBREF 3INJ E 1 500 UNP P05091 ALDH2_HUMAN 18 517
  662. DBREF 3INJ F 1 500 UNP P05091 ALDH2_HUMAN 18 517
  663. DBREF 3INJ G 1 500 UNP P05091 ALDH2_HUMAN 18 517
  664. DBREF 3INJ H 1 500 UNP P05091 ALDH2_HUMAN 18 517
  665. EOS
  666. @dbref = Bio::PDB::Record::DBREF.new.initialize_from_string(@str)
  667. end
  668. def test_idCode
  669. assert_equal('3INJ', @dbref.idCode )
  670. end
  671. def test_chainID
  672. assert_equal('A', @dbref.chainID )
  673. end
  674. def test_seqBegin
  675. assert_equal(1, @dbref.seqBegin )
  676. end
  677. def test_insertBegin
  678. assert_equal('', @dbref.insertBegin)
  679. end
  680. def test_seqEnd
  681. assert_equal(500, @dbref.seqEnd )
  682. end
  683. def test_insertEnd
  684. assert_equal('', @dbref.insertEnd )
  685. end
  686. def test_database
  687. assert_equal('UNP', @dbref.database )
  688. end
  689. def test_dbAccession
  690. assert_equal('P05091', @dbref.dbAccession)
  691. end
  692. def test_dbIdCode
  693. assert_equal('ALDH2_HUMAN', @dbref.dbIdCode )
  694. end
  695. def test_dbseqBegin
  696. assert_equal(18, @dbref.dbseqBegin )
  697. end
  698. def test_idbnsBeg
  699. assert_equal('', @dbref.idbnsBeg )
  700. end
  701. def test_dbseqEnd
  702. assert_equal(517, @dbref.dbseqEnd )
  703. end
  704. end
  705. class TestSEQADV < Test::Unit::TestCase
  706. def setup
  707. @str = 'SEQADV 3ABC MET A -1 UNP P10725 EXPRESSION TAG'
  708. @seqadv = Bio::PDB::Record::SEQADV.new.initialize_from_string(@str)
  709. end
  710. def test_idCode
  711. assert_equal('3ABC', @seqadv.idCode )
  712. end
  713. def test_resName
  714. assert_equal('MET', @seqadv.resName )
  715. end
  716. def test_chainID
  717. assert_equal('A', @seqadv.chainID )
  718. end
  719. def test_seqNum
  720. assert_equal(-1, @seqadv.seqNum )
  721. end
  722. def test_iCode
  723. assert_equal('', @seqadv.iCode )
  724. end
  725. def test_database
  726. assert_equal('UNP', @seqadv.database)
  727. end
  728. def test_dbIdCode
  729. assert_equal('P10725', @seqadv.dbIdCode)
  730. end
  731. def test_dbRes
  732. assert_equal('', @seqadv.dbRes )
  733. end
  734. def test_dbSeq
  735. assert_equal(0, @seqadv.dbSeq )
  736. end
  737. def test_conflict
  738. assert_equal('EXPRESSION TAG', @seqadv.conflict)
  739. end
  740. end
  741. class TestSEQRES < Test::Unit::TestCase
  742. def setup
  743. @str =<<EOS
  744. SEQRES 1 A 500 SER ALA ALA ALA THR GLN ALA VAL PRO ALA PRO ASN GLN
  745. SEQRES 2 A 500 GLN PRO GLU VAL PHE CYS ASN GLN ILE PHE ILE ASN ASN
  746. SEQRES 3 A 500 GLU TRP HIS ASP ALA VAL SER ARG LYS THR PHE PRO THR
  747. SEQRES 4 A 500 VAL ASN PRO SER THR GLY GLU VAL ILE CYS GLN VAL ALA
  748. SEQRES 5 A 500 GLU GLY ASP LYS GLU ASP VAL ASP LYS ALA VAL LYS ALA
  749. SEQRES 6 A 500 ALA ARG ALA ALA PHE GLN LEU GLY SER PRO TRP ARG ARG
  750. SEQRES 7 A 500 MET ASP ALA SER HIS ARG GLY ARG LEU LEU ASN ARG LEU
  751. SEQRES 8 A 500 ALA ASP LEU ILE GLU ARG ASP ARG THR TYR LEU ALA ALA
  752. SEQRES 9 A 500 LEU GLU THR LEU ASP ASN GLY LYS PRO TYR VAL ILE SER
  753. EOS
  754. @seqres = Bio::PDB::Record::SEQRES.new.initialize_from_string(@str)
  755. end
  756. def test_chainID
  757. assert_equal('A', @seqres.chainID)
  758. end
  759. def test_numRes
  760. assert_equal(500, @seqres.numRes )
  761. end
  762. def test_resName
  763. expected =
  764. ["SER",
  765. "ALA",
  766. "ALA",
  767. "ALA",
  768. "THR",
  769. "GLN",
  770. "ALA",
  771. "VAL",
  772. "PRO",
  773. "ALA",
  774. "PRO",
  775. "ASN",
  776. "GLN"]
  777. assert_equal(expected, @seqres.resName)
  778. end
  779. end
  780. class TestMODRES < Test::Unit::TestCase
  781. def setup
  782. @str = 'MODRES 2R0L ASN A 74 ASN GLYCOSYLATION SITE '
  783. @modres = Bio::PDB::Record::MODRES.new.initialize_from_string(@str)
  784. end
  785. def test_idCode
  786. assert_equal('2R0L', @modres.idCode)
  787. end
  788. def test_resName
  789. assert_equal('ASN', @modres.resName)
  790. end
  791. def test_chainID
  792. assert_equal('A', @modres.chainID)
  793. end
  794. def test_seqNum
  795. assert_equal(74, @modres.seqNum)
  796. end
  797. def test_iCode
  798. assert_equal('', @modres.iCode)
  799. end
  800. def test_stdRes
  801. assert_equal('ASN', @modres.stdRes)
  802. end
  803. def test_comment
  804. assert_equal('GLYCOSYLATION SITE', @modres.comment)
  805. end
  806. end
  807. class TestHET < Test::Unit::TestCase
  808. def setup
  809. @str = 'HET NA A 601 1 '
  810. @het = Bio::PDB::Record::HET.new.initialize_from_string(@str)
  811. end
  812. def test_hetID
  813. assert_equal(' NA', @het.hetID)
  814. end
  815. def test_ChainID
  816. assert_equal('A', @het.ChainID)
  817. end
  818. def test_seqNum
  819. assert_equal(601, @het.seqNum)
  820. end
  821. def test_iCode
  822. assert_equal('', @het.iCode)
  823. end
  824. def test_numHetAtoms
  825. assert_equal(1, @het.numHetAtoms)
  826. end
  827. def test_text
  828. assert_equal('', @het.text)
  829. end
  830. end
  831. class TestSHEET < Test::Unit::TestCase
  832. def setup
  833. @str =<<EOS
  834. SHEET 1 A 2 ILE A 22 ILE A 24 0
  835. SHEET 2 A 2 GLU A 27 HIS A 29 -1 O HIS A 29 N ILE A 22
  836. SHEET 1 B 2 THR A 36 VAL A 40 0
  837. EOS
  838. @sheet = Bio::PDB::Record::SHEET.new.initialize_from_string(@str)
  839. end
  840. def test_strand
  841. assert_equal(1, @sheet.strand)
  842. end
  843. def test_sheetID
  844. assert_equal('A', @sheet.sheetID)
  845. end
  846. def test_numStrands
  847. assert_equal(2, @sheet.numStrands)
  848. end
  849. def test_initResName
  850. assert_equal('ILE', @sheet.initResName)
  851. end
  852. def test_initChainID
  853. assert_equal('A', @sheet.initChainID)
  854. end
  855. def test_initSeqNum
  856. assert_equal(22, @sheet.initSeqNum)
  857. end
  858. def test_initICode
  859. assert_equal('', @sheet.initICode)
  860. end
  861. def test_endResName
  862. assert_equal('ILE', @sheet.endResName)
  863. end
  864. def test_endChainID
  865. assert_equal('A', @sheet.endChainID)
  866. end
  867. def test_endSeqNum
  868. assert_equal(24, @sheet.endSeqNum)
  869. end
  870. def test_endICode
  871. assert_equal('', @sheet.endICode)
  872. end
  873. def test_sense
  874. assert_equal(0, @sheet.sense)
  875. end
  876. def test_curAtom
  877. assert_equal('', @sheet.curAtom)
  878. end
  879. def test_curResName
  880. assert_equal('', @sheet.curResName)
  881. end
  882. def test_curChainId
  883. assert_equal(' ', @sheet.curChainId)
  884. end
  885. def test_curResSeq
  886. assert_equal(0, @sheet.curResSeq)
  887. end
  888. def test_curICode
  889. assert_equal('', @sheet.curICode)
  890. end
  891. def test_prevAtom
  892. assert_equal('', @sheet.prevAtom)
  893. end
  894. def test_prevResName
  895. assert_equal('', @sheet.prevResName)
  896. end
  897. def test_prevChainId
  898. assert_equal(' ', @sheet.prevChainId)
  899. end
  900. def test_prevResSeq
  901. assert_equal(0, @sheet.prevResSeq)
  902. end
  903. def test_prevICode
  904. assert_equal('', @sheet.prevICode)
  905. end
  906. end
  907. class TestLINK < Test::Unit::TestCase
  908. def setup
  909. @str = 'LINK O VAL A 40 NA NA A 601 1555 1555 2.41 '
  910. @link = Bio::PDB::Record::LINK.new.initialize_from_string(@str)
  911. end
  912. def test_name1
  913. assert_equal(' O', @link.name1)
  914. end
  915. def test_altLoc1
  916. assert_equal(' ', @link.altLoc1)
  917. end
  918. def test_resName1
  919. assert_equal('VAL', @link.resName1)
  920. end
  921. def test_chainID1
  922. assert_equal('A', @link.chainID1)
  923. end
  924. def test_resSeq1
  925. assert_equal(40, @link.resSeq1)
  926. end
  927. def test_iCode1
  928. assert_equal('', @link.iCode1)
  929. end
  930. def test_name2
  931. assert_equal("NA", @link.name2)
  932. end
  933. def test_altLoc2
  934. assert_equal(' ', @link.altLoc2)
  935. end
  936. def test_resName2
  937. assert_equal(' NA', @link.resName2)
  938. end
  939. def test_chainID2
  940. assert_equal('A', @link.chainID2)
  941. end
  942. def test_resSeq2
  943. assert_equal(601, @link.resSeq2)
  944. end
  945. def test_iCode2
  946. assert_equal('', @link.iCode2)
  947. end
  948. def test_sym1
  949. assert_equal(' 1555', @link.sym1)
  950. end
  951. def test_sym2
  952. assert_equal(' 1555', @link.sym2)
  953. end
  954. end
  955. class TestHYDBND < Test::Unit::TestCase
  956. def setup
  957. @str = 'HYDBND O PHE A 2 A 4 1HN AIB A 4 '
  958. @hydbnd = Bio::PDB::Record::HYDBND.new.initialize_from_string(@str)
  959. end
  960. def test_name1
  961. assert_equal(' O', @hydbnd.name1)
  962. end
  963. def test_altLoc1
  964. assert_equal(' ', @hydbnd.altLoc1)
  965. end
  966. def test_resName1
  967. assert_equal('PHE', @hydbnd.resName1)
  968. end
  969. def test_Chain1
  970. assert_equal('A', @hydbnd.Chain1)
  971. end
  972. def test_resSeq1
  973. assert_equal(2, @hydbnd.resSeq1)
  974. end
  975. def test_ICode1
  976. assert_equal('', @hydbnd.ICode1)
  977. end
  978. def test_nameH
  979. assert_equal('', @hydbnd.nameH)
  980. end
  981. def test_altLocH
  982. assert_equal(' ', @hydbnd.altLocH)
  983. end
  984. def test_ChainH
  985. assert_equal('A', @hydbnd.ChainH)
  986. end
  987. def test_resSeqH
  988. assert_equal(4, @hydbnd.resSeqH)
  989. end
  990. def test_iCodeH
  991. assert_equal('', @hydbnd.iCodeH)
  992. end
  993. def test_name2
  994. assert_equal('1HN', @hydbnd.name2)
  995. end
  996. def test_altLoc2
  997. assert_equal(' ', @hydbnd.altLoc2)
  998. end
  999. def test_resName2
  1000. assert_equal('AIB', @hydbnd.resName2)
  1001. end
  1002. def test_chainID2
  1003. assert_equal('A', @hydbnd.chainID2)
  1004. end
  1005. def test_resSeq2
  1006. assert_equal(4, @hydbnd.resSeq2)
  1007. end
  1008. def test_iCode2
  1009. assert_equal('', @hydbnd.iCode2)
  1010. end
  1011. def test_sym1
  1012. assert_equal('', @hydbnd.sym1)
  1013. end
  1014. def test_sym2
  1015. assert_equal('', @hydbnd.sym2)
  1016. end
  1017. end
  1018. #SLTBRG field is deprecated.
  1019. class TestSLTBRG < Test::Unit::TestCase
  1020. def setup
  1021. @str = ''
  1022. @sltbrg = Bio::PDB::Record::SLTBRG.new.initialize_from_string(@str)
  1023. end
  1024. def test_atom1
  1025. assert_equal('', @sltbrg.atom1)
  1026. end
  1027. def test_altLoc1
  1028. assert_equal("", @sltbrg.altLoc1)
  1029. end
  1030. def test_resName1
  1031. assert_equal("", @sltbrg.resName1)
  1032. end
  1033. def test_chainID1
  1034. assert_equal('', @sltbrg.chainID1)
  1035. end
  1036. def test_resSeq1
  1037. assert_equal(0, @sltbrg.resSeq1)
  1038. end
  1039. def test_iCode1
  1040. assert_equal('', @sltbrg.iCode1)
  1041. end
  1042. def test_atom2
  1043. assert_equal('', @sltbrg.atom2)
  1044. end
  1045. def test_altLoc2
  1046. assert_equal('', @sltbrg.altLoc2)
  1047. end
  1048. def test_resName2
  1049. assert_equal('', @sltbrg.resName2)
  1050. end
  1051. def test_chainID2
  1052. assert_equal('', @sltbrg.chainID2)
  1053. end
  1054. def test_resSeq2
  1055. assert_equal(0, @sltbrg.resSeq2)
  1056. end
  1057. def test_iCode2
  1058. assert_equal('', @sltbrg.iCode2)
  1059. end
  1060. def test_sym1
  1061. assert_equal('', @sltbrg.sym1)
  1062. end
  1063. def test_sym2
  1064. assert_equal('', @sltbrg.sym2)
  1065. end
  1066. end
  1067. class TestCISPEP < Test::Unit::TestCase
  1068. def setup
  1069. @str = 'CISPEP 1 GLY A 116 GLY A 117 0 18.50 '
  1070. @cispep = Bio::PDB::Record::CISPEP.new.initialize_from_string(@str)
  1071. end
  1072. def test_serNum
  1073. assert_equal(1, @cispep.serNum)
  1074. end
  1075. def test_pep1
  1076. assert_equal("GLY", @cispep.pep1)
  1077. end
  1078. def test_chainID1
  1079. assert_equal('A', @cispep.chainID1)
  1080. end
  1081. def test_seqNum1
  1082. assert_equal(116, @cispep.seqNum1)
  1083. end
  1084. def test_icode1
  1085. assert_equal('', @cispep.icode1)
  1086. end
  1087. def test_pep2
  1088. assert_equal('GLY', @cispep.pep2)
  1089. end
  1090. def test_chainID2
  1091. assert_equal('A', @cispep.chainID2)
  1092. end
  1093. def test_seqNum2
  1094. assert_equal(117, @cispep.seqNum2)
  1095. end
  1096. def test_icode2
  1097. assert_equal('', @cispep.icode2)
  1098. end
  1099. def test_modNum
  1100. assert_equal(0, @cispep.modNum)
  1101. end
  1102. def test_measure
  1103. assert_equal(18.5, @cispep.measure)
  1104. end
  1105. end
  1106. class TestSITE < Test::Unit::TestCase
  1107. def setup
  1108. @str =<<EOS
  1109. SITE 1 AC1 5 THR A 39 VAL A 40 ASP A 109 GLN A 196
  1110. SITE 2 AC1 5 HOH A4009
  1111. EOS
  1112. @site = Bio::PDB::Record::SITE.new.initialize_from_string(@str)
  1113. end
  1114. def test_seqNum
  1115. assert_equal(1, @site.seqNum )
  1116. end
  1117. def test_siteID
  1118. assert_equal('AC1', @site.siteID )
  1119. end
  1120. def test_numRes
  1121. assert_equal(5, @site.numRes )
  1122. end
  1123. def test_resName1
  1124. assert_equal('THR', @site.resName1 )
  1125. end
  1126. def test_chainID1
  1127. assert_equal('A', @site.chainID1 )
  1128. end
  1129. def test_seq1
  1130. assert_equal(39, @site.seq1 )
  1131. end
  1132. def test_iCode1
  1133. assert_equal('', @site.iCode1 )
  1134. end
  1135. def test_resName2
  1136. assert_equal('VAL', @site.resName2 )
  1137. end
  1138. def test_chainID2
  1139. assert_equal('A', @site.chainID2 )
  1140. end
  1141. def test_seq2
  1142. assert_equal(40, @site.seq2 )
  1143. end
  1144. def test_iCode2
  1145. assert_equal('', @site.iCode2 )
  1146. end
  1147. def test_resName3
  1148. assert_equal('ASP', @site.resName3 )
  1149. end
  1150. def test_chainID3
  1151. assert_equal('A', @site.chainID3 )
  1152. end
  1153. def test_seq3
  1154. assert_equal(109, @site.seq3 )
  1155. end
  1156. def test_iCode3
  1157. assert_equal('', @site.iCode3 )
  1158. end
  1159. def test_resName4
  1160. assert_equal('GLN', @site.resName4 )
  1161. end
  1162. def test_chainID4
  1163. assert_equal('A', @site.chainID4 )
  1164. end
  1165. def test_seq4
  1166. assert_equal(196, @site.seq4 )
  1167. end
  1168. def test_iCode4
  1169. assert_equal('', @site.iCode4 )
  1170. end
  1171. end
  1172. class TestCRYST1 < Test::Unit::TestCase
  1173. def setup
  1174. @str = 'CRYST1 117.000 15.000 39.000 90.00 90.00 90.00 P 21 21 21 8'
  1175. @cryst1 = Bio::PDB::Record::CRYST1.new.initialize_from_string(@str)
  1176. end
  1177. def test_a
  1178. assert_equal(117.0, @cryst1.a)
  1179. end
  1180. def test_b
  1181. assert_equal(15.0, @cryst1.b)
  1182. end
  1183. def test_c
  1184. assert_equal(39.0, @cryst1.c)
  1185. end
  1186. def test_alpha
  1187. assert_equal(90.0, @cryst1.alpha)
  1188. end
  1189. def test_beta
  1190. assert_equal(90.0, @cryst1.beta)
  1191. end
  1192. def test_gamma
  1193. assert_equal(90.0, @cryst1.gamma)
  1194. end
  1195. def test_sGroup
  1196. assert_equal("P 21 21 21 ", @cryst1.sGroup)
  1197. end
  1198. def test_z
  1199. assert_equal(8, @cryst1.z)
  1200. end
  1201. end
  1202. class TestORIGX1 < Test::Unit::TestCase
  1203. def setup
  1204. @str = 'ORIGX1 1.000000 0.000000 0.000000 0.00000 '
  1205. @origx1 = Bio::PDB::Record::ORIGX1.new.initialize_from_string(@str)
  1206. end
  1207. def test_On1
  1208. assert_equal(1.0, @origx1.On1)
  1209. end
  1210. def test_On2
  1211. assert_equal(0.0, @origx1.On2)
  1212. end
  1213. def test_On3
  1214. assert_equal(0.0, @origx1.On3)
  1215. end
  1216. def test_Tn
  1217. assert_equal(0.0, @origx1.Tn)
  1218. end
  1219. end
  1220. class TestSCALE1 < Test::Unit::TestCase
  1221. def setup
  1222. @str = 'SCALE1 0.019231 0.000000 0.000000 0.00000 '
  1223. @scale1 = Bio::PDB::Record::SCALE1.new.initialize_from_string(@str)
  1224. end
  1225. def test_Sn1
  1226. assert_equal(0.019231, @scale1.Sn1)
  1227. end
  1228. def test_Sn2
  1229. assert_equal(0.0, @scale1.Sn2)
  1230. end
  1231. def test_Sn3
  1232. assert_equal(0.0, @scale1.Sn3)
  1233. end
  1234. def test_Un
  1235. assert_equal(0.0, @scale1.Un)
  1236. end
  1237. end
  1238. class TestSCALE2 < Test::Unit::TestCase
  1239. def setup
  1240. @str = 'SCALE2 0.000000 0.017065 0.000000 0.00000 '
  1241. @scale2 = Bio::PDB::Record::SCALE2.new.initialize_from_string(@str)
  1242. end
  1243. def test_Sn1
  1244. assert_equal(0.0, @scale2.Sn1)
  1245. end
  1246. def test_Sn2
  1247. assert_equal(0.017065, @scale2.Sn2)
  1248. end
  1249. def test_Sn3
  1250. assert_equal(0.0, @scale2.Sn3)
  1251. end
  1252. def test_Un
  1253. assert_equal(0.0, @scale2.Un)
  1254. end
  1255. end
  1256. class TestSCALE3 < Test::Unit::TestCase
  1257. def setup
  1258. @str = 'SCALE3 0.000000 0.000000 0.016155 0.00000 '
  1259. @scale3 = Bio::PDB::Record::SCALE3.new.initialize_from_string(@str)
  1260. end
  1261. def test_Sn1
  1262. assert_equal(0.0, @scale3.Sn1)
  1263. end
  1264. def test_Sn2
  1265. assert_equal(0.0, @scale3.Sn2)
  1266. end
  1267. def test_Sn3
  1268. assert_equal(0.016155, @scale3.Sn3)
  1269. end
  1270. def test_Un
  1271. assert_equal(0.0, @scale3.Un)
  1272. end
  1273. end
  1274. class TestMTRIX1 < Test::Unit::TestCase
  1275. def setup
  1276. @str = 'MTRIX1 1 -1.000000 0.000000 -0.000000 0.00001 1 '
  1277. @mtrix1 = Bio::PDB::Record::MTRIX1.new.initialize_from_string(@str)
  1278. end
  1279. def test_serial
  1280. assert_equal(1, @mtrix1.serial)
  1281. end
  1282. def test_Mn1
  1283. assert_equal(-1.0, @mtrix1.Mn1)
  1284. end
  1285. def test_Mn2
  1286. assert_equal(0.0, @mtrix1.Mn2)
  1287. end
  1288. def test_Mn3
  1289. assert_equal(-0.0, @mtrix1.Mn3)
  1290. end
  1291. def test_Vn
  1292. assert_equal(1.0e-05, @mtrix1.Vn)
  1293. end
  1294. def test_iGiven
  1295. assert_equal(1, @mtrix1.iGiven)
  1296. end
  1297. end
  1298. class TestMTRIX2 < Test::Unit::TestCase
  1299. def setup
  1300. @str = 'MTRIX2 1 -0.000000 1.000000 0.000000 0.00002 1 '
  1301. @mtrix2 = Bio::PDB::Record::MTRIX2.new.initialize_from_string(@str)
  1302. end
  1303. def test_serial
  1304. assert_equal(1, @mtrix2.serial)
  1305. end
  1306. def test_Mn1
  1307. assert_equal(-0.0, @mtrix2.Mn1)
  1308. end
  1309. def test_Mn2
  1310. assert_equal(1.0, @mtrix2.Mn2)
  1311. end
  1312. def test_Mn3
  1313. assert_equal(0.0, @mtrix2.Mn3)
  1314. end
  1315. def test_Vn
  1316. assert_equal(2.0e-05, @mtrix2.Vn)
  1317. end
  1318. def test_iGiven
  1319. assert_equal(1, @mtrix2.iGiven)
  1320. end
  1321. end
  1322. class TestMTRIX3 < Test::Unit::TestCase
  1323. def setup
  1324. @str = 'MTRIX3 1 0.000000 -0.000000 -1.000000 0.00002 1 '
  1325. @mtrix3 = Bio::PDB::Record::MTRIX3.new.initialize_from_string(@str)
  1326. end
  1327. def test_serial
  1328. assert_equal(1, @mtrix3.serial)
  1329. end
  1330. def test_Mn1
  1331. assert_equal(0.0, @mtrix3.Mn1)
  1332. end
  1333. def test_Mn2
  1334. assert_equal(-0.0, @mtrix3.Mn2)
  1335. end
  1336. def test_Mn3
  1337. assert_equal(-1.0, @mtrix3.Mn3)
  1338. end
  1339. def test_Vn
  1340. assert_equal(2.0e-05, @mtrix3.Vn)
  1341. end
  1342. def test_iGiven
  1343. assert_equal(1, @mtrix3.iGiven)
  1344. end
  1345. end
  1346. class TestTVECT < Test::Unit::TestCase
  1347. def setup
  1348. @str = 'TVECT 1 0.00000 0.00000 28.30000 '
  1349. @tvect = Bio::PDB::Record::TVECT.new.initialize_from_string(@str)
  1350. end
  1351. def test_serial
  1352. assert_equal(1, @tvect.serial)
  1353. end
  1354. def test_t1
  1355. assert_equal(0.0, @tvect.t1)
  1356. end
  1357. def test_t2
  1358. assert_equal(0.0, @tvect.t2)
  1359. end
  1360. def test_t3
  1361. assert_equal(28.3, @tvect.t3)
  1362. end
  1363. def test_text
  1364. assert_equal('', @tvect.text)
  1365. end
  1366. end
  1367. class TestMODEL < Test::Unit::TestCase
  1368. def setup
  1369. @str = 'MODEL 1'
  1370. @model = Bio::PDB::Record::MODEL.new.initialize_from_string(@str)
  1371. end
  1372. def test_serial
  1373. assert_equal(1, @model.serial)
  1374. end
  1375. end
  1376. class TestSIGATM < Test::Unit::TestCase
  1377. def setup
  1378. @str = 'SIGATM 230 N PRO 15 0.040 0.030 0.030 0.00 0.00 N'
  1379. @sigatm = Bio::PDB::Record::SIGATM.new.initialize_from_string(@str)
  1380. end
  1381. def test_serial
  1382. assert_equal(230, @sigatm.serial)
  1383. end
  1384. def test_name
  1385. assert_equal(' N', @sigatm.name)
  1386. end
  1387. def test_altLoc
  1388. assert_equal(' ', @sigatm.altLoc)
  1389. end
  1390. def test_resName
  1391. assert_equal('PRO', @sigatm.resName)
  1392. end
  1393. def test_chainID
  1394. assert_equal(' ', @sigatm.chainID)
  1395. end
  1396. def test_resSeq
  1397. assert_equal(15, @sigatm.resSeq)
  1398. end
  1399. def test_iCode
  1400. assert_equal('', @sigatm.iCode)
  1401. end
  1402. def test_sigX
  1403. assert_equal(0.04, @sigatm.sigX)
  1404. end
  1405. def test_sigY
  1406. assert_equal(0.03, @sigatm.sigY)
  1407. end
  1408. def test_sigZ
  1409. assert_equal(0.03, @sigatm.sigZ)
  1410. end
  1411. def test_sigOcc
  1412. assert_equal(0.0, @sigatm.sigOcc)
  1413. end
  1414. def test_sigTemp
  1415. assert_equal(0.0, @sigatm.sigTemp)
  1416. end
  1417. def test_segID
  1418. assert_equal(' ', @sigatm.segID)
  1419. end
  1420. def test_element
  1421. assert_equal(' N', @sigatm.element)
  1422. end
  1423. def test_charge
  1424. assert_equal(' ', @sigatm.charge)
  1425. end
  1426. end
  1427. class TestANISOU < Test::Unit::TestCase
  1428. def setup
  1429. @str = 'ANISOU 107 N GLY 13 2406 1892 1614 198 519 -328 N'
  1430. @anisou = Bio::PDB::Record::ANISOU.new.initialize_from_string(@str)
  1431. end
  1432. def test_serial
  1433. assert_equal(107, @anisou.serial)
  1434. end
  1435. def test_name
  1436. assert_equal(' N', @anisou.name)
  1437. end
  1438. def test_altLoc
  1439. assert_equal(' ', @anisou.altLoc)
  1440. end
  1441. def test_resName
  1442. assert_equal('GLY', @anisou.resName)
  1443. end
  1444. def test_chainID
  1445. assert_equal(' ', @anisou.chainID)
  1446. end
  1447. def test_resSeq
  1448. assert_equal(13, @anisou.resSeq)
  1449. end
  1450. def test_iCode
  1451. assert_equal('', @anisou.iCode)
  1452. end
  1453. def test_U11
  1454. assert_equal(2406, @anisou.U11)
  1455. end
  1456. def test_U22
  1457. assert_equal(1892, @anisou.U22)
  1458. end
  1459. def test_U33
  1460. assert_equal(1614, @anisou.U33)
  1461. end
  1462. def test_U12
  1463. assert_equal(198, @anisou.U12)
  1464. end
  1465. def test_U13
  1466. assert_equal(519, @anisou.U13)
  1467. end
  1468. def test_U23
  1469. assert_equal(-328, @anisou.U23)
  1470. end
  1471. def test_segID
  1472. assert_equal(' ', @anisou.segID)
  1473. end
  1474. def test_element
  1475. assert_equal(' N', @anisou.element)
  1476. end
  1477. def test_charge
  1478. assert_equal(' ', @anisou.charge)
  1479. end
  1480. end
  1481. class TestSIGUIJ < Test::Unit::TestCase
  1482. def setup
  1483. @str = 'SIGUIJ 107 N GLY 13 10 10 10 10 10 10 N'
  1484. @siguij = Bio::PDB::Record::SIGUIJ.new.initialize_from_string(@str)
  1485. end
  1486. def test_serial
  1487. assert_equal(107, @siguij.serial)
  1488. end
  1489. def test_name
  1490. assert_equal(' N', @siguij.name)
  1491. end
  1492. def test_altLoc
  1493. assert_equal(' ', @siguij.altLoc)
  1494. end
  1495. def test_resName
  1496. assert_equal("GLY", @siguij.resName)
  1497. end
  1498. def test_chainID
  1499. assert_equal(" ", @siguij.chainID)
  1500. end
  1501. def test_resSeq
  1502. assert_equal(13, @siguij.resSeq)
  1503. end
  1504. def test_iCode
  1505. assert_equal('', @siguij.iCode)
  1506. end
  1507. def test_SigmaU11
  1508. assert_equal(10, @siguij.SigmaU11)
  1509. end
  1510. def test_SigmaU22
  1511. assert_equal(10, @siguij.SigmaU22)
  1512. end
  1513. def test_SigmaU33
  1514. assert_equal(10, @siguij.SigmaU33)
  1515. end
  1516. def test_SigmaU12
  1517. assert_equal(10, @siguij.SigmaU12)
  1518. end
  1519. def test_SigmaU13
  1520. assert_equal(10, @siguij.SigmaU13)
  1521. end
  1522. def test_SigmaU23
  1523. assert_equal(10, @siguij.SigmaU23)
  1524. end
  1525. def test_segID
  1526. assert_equal(' ', @siguij.segID)
  1527. end
  1528. def test_element
  1529. assert_equal(' N', @siguij.element)
  1530. end
  1531. def test_charge
  1532. assert_equal(' ', @siguij.charge)
  1533. end
  1534. end
  1535. class TestTER < Test::Unit::TestCase
  1536. def setup
  1537. @str = 'TER 3821 SER A 500 '
  1538. @ter = Bio::PDB::Record::TER.new.initialize_from_string(@str)
  1539. end
  1540. def test_serial
  1541. assert_equal(3821, @ter.serial)
  1542. end
  1543. def test_resName
  1544. assert_equal('SER', @ter.resName)
  1545. end
  1546. def test_chainID
  1547. assert_equal('A', @ter.chainID)
  1548. end
  1549. def test_resSeq
  1550. assert_equal(500, @ter.resSeq)
  1551. end
  1552. def test_iCode
  1553. assert_equal('', @ter.iCode)
  1554. end
  1555. end
  1556. class TestENDMDL < Test::Unit::TestCase
  1557. def setup
  1558. @str = 'ENDMDL'
  1559. @endmdl = Bio::PDB::Record::ENDMDL.new.initialize_from_string(@str)
  1560. end
  1561. def test_serial
  1562. assert_equal(0, @endmdl.serial)
  1563. end
  1564. end
  1565. class TestCONECT < Test::Unit::TestCase
  1566. def setup
  1567. @str = 'CONECT 27230581 '
  1568. @conect = Bio::PDB::Record::CONECT.new.initialize_from_string(@str)
  1569. end
  1570. def test_serial
  1571. assert_equal([272, 30581], @conect.serial)
  1572. end
  1573. end
  1574. class TestMASTER < Test::Unit::TestCase
  1575. def setup
  1576. @str = 'MASTER 589 0 41 150 164 0 77 634857 8 322 312 '
  1577. @master = Bio::PDB::Record::MASTER.new.initialize_from_string(@str)
  1578. end
  1579. def test_numRemark
  1580. assert_equal(589, @master.numRemark)
  1581. end
  1582. def test_numHet
  1583. assert_equal(41, @master.numHet)
  1584. end
  1585. def test_numHelix
  1586. assert_equal(150, @master.numHelix)
  1587. end
  1588. def test_numSheet
  1589. assert_equal(164, @master.numSheet)
  1590. end
  1591. def test_numTurn
  1592. assert_equal(0, @master.numTurn)
  1593. end
  1594. def test_numSite
  1595. assert_equal(77, @master.numSite)
  1596. end
  1597. def test_numXform
  1598. assert_equal(6, @master.numXform)
  1599. end
  1600. def test_numCoord
  1601. assert_equal(34857, @master.numCoord)
  1602. end
  1603. def test_numTer
  1604. assert_equal(8, @master.numTer)
  1605. end
  1606. def test_numConect
  1607. assert_equal(322, @master.numConect)
  1608. end
  1609. def test_numSeq
  1610. assert_equal(312, @master.numSeq)
  1611. end
  1612. end
  1613. class TestRemarkN < Test::Unit::TestCase
  1614. def setup
  1615. @str =<

Large files files are truncated, but you can click here to view the full file