Skip to content

Commit

Permalink
unobs header tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Oct 12, 2023
1 parent 709014a commit 6713df2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions prody/tests/datafiles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,15 @@
'file': 'mmcif_3o21.cif',
'atoms': 12793,
'bm0_atoms': 6281,
'num_chains_united': 4,
'bm_chains_united': [2, 2],
'bm_chains_alone': [9, 10],
'chainA_atoms_united': 3170,
'chainA_atoms_alone': 3025,
'ca_atoms': 1489,
'bb_atoms': 5956,
'models': 1,
'unobs_B_start': 'G-------------------------------NQNTTEK-'
},
'long_chid_cif': {
'pdb': '6zu5',
Expand Down
26 changes: 25 additions & 1 deletion prody/tests/proteins/test_ciffile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This module contains unit tests for :mod:`~prody.proteins`."""

from collections import OrderedDict
import os

import numpy as np
Expand Down Expand Up @@ -203,6 +204,29 @@ def testAgArgMultiModel(self):
ag = parseMMCIF(path, ag=ag)
self.assertEqual(ag.numCoordsets(), ncsets*2,
'parseMMCIF failed to append coordinate sets to given ag')
assert_equal(coords, ag.getCoordsets(np.arange(ncsets, ncsets*2)))
self.assertEqual(coords, ag.getCoordsets(np.arange(ncsets, ncsets*2)),
'parseMMCIF failed to have the right coordinates')

def testUnobsHeaderArgument(self):
"""Test outcome of valid and invalid *subset* arguments."""

path = pathDatafile(self.biomols['file'])
header = parseCIFHeader(path)
self.assertIsInstance(header, dict,
'parseCIFHeader failed to return an dict instance')
self.assertTrue('unobserved' in header,
'parseCIFHeader failed to return a header containing '
'unobserved')

unobs_header = parseCIFHeader(path, 'unobserved')
self.assertIsInstance(unobs_header, OrderedDict,
'parseCIFHeader failed to return an OrderedDict instance when '
'providing a key')
self.assertEqual(len(unobs_header),
self.biomols['num_chains_united'],
'failed to parse unobserved for correct number of chains')
self.assertEqual(unobs_header['B'][0][:39],
self.biomols['unobs_B_start'],
'failed to parse unobserved alignment correctly')

unobs_header_B = unobs_header[1]

0 comments on commit 6713df2

Please sign in to comment.