Skip to content

Commit

Permalink
tests for unite chains and biomols
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Oct 12, 2023
1 parent 3dccd38 commit 39feb39
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
3 changes: 3 additions & 0 deletions prody/tests/datafiles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@
'pdb': '3o21',
'file': 'mmcif_3o21.cif',
'atoms': 12793,
'bm0_atoms': 6281,
'bm_chains_united': [2, 2],
'bm_chains_alone': [9, 10],
'chainA_atoms_united': 3170,
'chainA_atoms_alone': 3025,
'ca_atoms': 1489,
Expand Down
53 changes: 53 additions & 0 deletions prody/tests/proteins/test_ciffile.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,59 @@ def testLongChainArgument(self):
self.no_pdb['segment_SX0_atoms'],
'parseMMCIF failed to parse correct number of atoms '
'when segment SX0 is specified')

def testUniteChainsArgument(self):
"""Test outcome of valid and invalid *segment* arguments."""

path = pathDatafile(self.biomols['file'])
self.assertEqual(parseMMCIF(path, chain='A').numAtoms(),
self.biomols['chainA_atoms_united'],
'parseMMCIF failed to parse correct number of atoms '
'when chain A is specified with unite_chain default (True)')
self.assertEqual(parseMMCIF(path, chain='A', unite_chains=False).numAtoms(),
self.biomols['chainA_atoms_alone'],
'parseMMCIF failed to parse correct number of atoms '
'when chain A is specified with unite_chain False')
self.assertEqual(parseMMCIF(path, chain='A', header=True)[0].numAtoms(),
self.biomols['chainA_atoms_united'],
'parseMMCIF failed to parse correct number of atoms '
'when chain A is specified with unite_chain default (True) '
'with header True')

def testUniteChainsAndBiomolArguments(self):
"""Test outcome of valid and invalid *segment* arguments."""

path = pathDatafile(self.biomols['file'])

bm_united = parseMMCIF(path, biomol=True)
self.assertEqual(bm_united[0].numAtoms(),
self.biomols['bm0_atoms'],
'parseMMCIF failed to parse correct number of atoms '
'with biomol True and unite_chain default (True)')
self.assertEqual([b.numChains() for b in bm_united],
self.biomols['bm_chains_united'],
'parseMMCIF failed to parse correct numbers of chains '
'with biomol True and unite_chain default (True)')

bm_non_united = parseMMCIF(path, biomol=True, unite_chains=False)
self.assertEqual(bm_non_united[0].numAtoms(),
self.biomols['bm0_atoms'],
'parseMMCIF failed to parse correct number of atoms '
'when chain A is specified with unite_chain False')
self.assertEqual([b.numChains() for b in bm_non_united],
self.biomols['bm_chains_alone'],
'parseMMCIF failed to parse correct numbers of chains '
'with biomol True and unite_chain False')

bm_header = parseMMCIF(path, biomol=True)[0]
self.assertEqual(bm_header[0].numAtoms(),
self.biomols['bm0_atoms'],
'parseMMCIF failed to parse correct number of atoms '
'with biomol True and unite_chain default (True)')
self.assertEqual([b.numChains() for b in bm_header],
self.biomols['bm_chains_united'],
'parseMMCIF failed to parse correct numbers of chains '
'with biomol True and unite_chain default (True)')

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

0 comments on commit 39feb39

Please sign in to comment.