Skip to content

Commit

Permalink
Merge pull request #75 from rigdenlab/test_fixes
Browse files Browse the repository at this point in the history
Test fixes
  • Loading branch information
hlasimpk authored Feb 17, 2020
2 parents 6b4c4c3 + 271891c commit f38c8e5
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 7 deletions.
22 changes: 21 additions & 1 deletion ample/modelling/tests/test_rosetta_model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import shutil
import sys
import unittest

from ample import constants
Expand Down Expand Up @@ -38,10 +39,29 @@ def testMultimerConstraints(self):
AtomPair CA 3B CA 3C FLAT_HARMONIC 10.00 3.00 5.00
AtomPair CA 4B CA 4C FLAT_HARMONIC 10.00 3.00 5.00
"""
ref_windows = 'AtomPair CA 1 CA 4 FLAT_HARMONIC 6.00 3.00 5.00\r\n' \
'AtomPair CA 1A CA 1B FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
'AtomPair CA 2A CA 2B FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
'AtomPair CA 3A CA 3B FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
'AtomPair CA 4A CA 4B FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
'AtomPair CA 1 CA 4 FLAT_HARMONIC 6.00 3.00 5.00\r\n' \
'AtomPair CA 1A CA 1C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
'AtomPair CA 2A CA 2C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
'AtomPair CA 3A CA 3C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
'AtomPair CA 4A CA 4C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
'AtomPair CA 1 CA 4 FLAT_HARMONIC 6.00 3.00 5.00\r\n' \
'AtomPair CA 1B CA 1C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
'AtomPair CA 2B CA 2C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
'AtomPair CA 3B CA 3C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
'AtomPair CA 4B CA 4C FLAT_HARMONIC 10.00 3.00 5.00\r\n'

with open(cfile) as f:
fstr = f.read()
# self.assertEquals(fstr, ref, "Contents of constraints files don't match: {}".format(cfile))
self.assertEquals(fstr, ref)
if sys.platform.startswith("win"):
self.assertEquals(fstr, ref_windows)
else:
self.assertEquals(fstr, ref)
os.unlink(cfile)

def XtestMakeFragments(self):
Expand Down
6 changes: 4 additions & 2 deletions ample/util/mtz_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,13 @@ def processReflectionFile(amoptd):
exit_util.exit_error(msg)

cp = cif_parser.CifParser()
mtz = cp.sfcif2mtz(amoptd['sf_cif'])
# See if reflections have been set aside for Rfree or if we need to calculate
if cp.hasRfree and cp.reflnStatus:
if cp.hasRfree:
logger.info("sfcif2mtz: no valid RFREE data so removing FREE column added by mtz2cif")
mtz = cp.sfcif2mtz(amoptd['sf_cif'])
amoptd['mtz'] = del_column(mtz, 'FREE')
else:
amoptd['mtz'] = mtz

# Now have an mtz so check it's valid
if not amoptd['mtz'] or not os.path.isfile(amoptd['mtz']):
Expand Down
4 changes: 2 additions & 2 deletions ample/util/rio.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,14 +455,14 @@ def parseNcontLog(self, contactData, logfile=None, clean_up=True):
aa1 = c[11:14]
# Will get key error for all-atom if there is solvent etc.
try:
d['aa1'] = pdb_edit.three2one[aa1] # get amino acid and convert to single letter code
d['aa1'] = ample_util.three2one[aa1] # get amino acid and convert to single letter code
except KeyError:
d['aa1'] = 'X'
d['chainId2'] = c[32]
d['resSeq2'] = int(c[34:38].strip())
aa2 = c[39:42]
try:
d['aa2'] = pdb_edit.three2one[aa2]
d['aa2'] = ample_util.three2one[aa2]
except KeyError:
d['aa2'] = 'X'
d['dist'] = float(c[56:62].strip())
Expand Down
9 changes: 8 additions & 1 deletion ample/util/tests/test_reference_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test functions for util.ample_util"""
import sys
import unittest
from ample.util import reference_manager

Expand All @@ -14,8 +15,14 @@ def test_construct_references(self):

refMgr = reference_manager.ReferenceManager(options.d)
ref_references = '* Bibby et al. (2012). AMPLE: A cluster-and-truncate approach to solve the crystal structures of small proteins using rapidly computed ab initio models. Acta Crystallogr. Sect. D Biol. Crystallogr. 68(12), 1622-1631. [doi:10.1107/S0907444912039194]\n\n* Winn et al. (2011). Overview of the CCP4 suite and current developments. Acta Crystallographica Section D 67(4), 235-242. [doi:10.1107/S0907444910045749]\n\n* Thomas et al. (2015). Routine phasing of coiled-coil protein crystal structures with AMPLE. IUCrJ 2(2), 198-206. [doi:10.1107/S2052252515002080]\n\n* Simkovic et al. (2016). Residue contacts predicted by evolutionary covariance extend the application of ab initio molecular replacement to larger and more challenging protein folds. IUCrJ 3(4), 259-270. [doi:10.1107/S2052252516008113]\n\n* Bradley et al. (2005). Toward High-Resolution de Novo Structure Prediction for Small Proteins. Science 309(5742), 1868-1871. [doi:10.1126/science.1113801]\n\n* Grosse-Kunstleve et al. (2002). The Computational Crystallography Toolbox: crystallographic algorithms in a reusable software framework. Journal of Applied Crystallography 35(1), 126-136. [doi:10.1107/S0021889801017824]\n\n* Theobald et al. (2006). THESEUS: maximum likelihood superpositioning and analysis of macromolecular structures. Bioinformatics 22(17), 2171-2172. [doi:10.1093/bioinformatics/btl332]\n\n* Krissinel et al. (2012). Enhanced fold recognition using efficient short fragment clustering. Journal of molecular biochemistry 1(2), 76-85. [doi:]\n\n* Zhang et al. (2004). SPICKER: A clustering approach to identify near-native protein folds. Journal of Computational Chemistry 25(6), 865-871. [doi:10.1002/jcc.20011]\n\n* Keegan et al. (2018). Recent developments in MrBUMP: better search-model preparation, graphical interaction with search models, and solution improvement and assessment. Acta Crystallographica Section D 74(3), 167-182. [doi:10.1107/S2059798318003455]\n\n* Murshudov et al. (1997). Refinement of macromolecular structures by the maximum-likelihood method. Acta Crystallogr. Sect. D Biol. Crystallogr. 53(3), 240-255. [doi:10.1107/S0907444996012255]\n\n* Thorn et al. (2013). Extending molecular-replacement solutions with SHELXE. Acta Crystallogr. Sect. D Biol. Crystallogr. 69(11), 2251-2256. [doi:10.1107/S0907444913027534]\n\n* Cohen et al. (2008). ARP/wARP and molecular replacement: the next generation. Acta Crystallogr. Sect. D Biol. Crystallogr. 64(1), 49-60. [doi:10.1107/S0907444907047580]\n\n'

ref_references_windows = '* Bibby et al. (2012). AMPLE: A cluster-and-truncate approach to solve the crystal structures of small proteins using rapidly computed ab initio models. Acta Crystallogr. Sect. D Biol. Crystallogr. 68(12), 1622-1631. [doi:10.1107/S0907444912039194]\r\n\r\n* Winn et al. (2011). Overview of the CCP4 suite and current developments. Acta Crystallographica Section D 67(4), 235-242. [doi:10.1107/S0907444910045749]\r\n\r\n* Thomas et al. (2015). Routine phasing of coiled-coil protein crystal structures with AMPLE. IUCrJ 2(2), 198-206. [doi:10.1107/S2052252515002080]\r\n\r\n* Simkovic et al. (2016). Residue contacts predicted by evolutionary covariance extend the application of ab initio molecular replacement to larger and more challenging protein folds. IUCrJ 3(4), 259-270. [doi:10.1107/S2052252516008113]\r\n\r\n* Bradley et al. (2005). Toward High-Resolution de Novo Structure Prediction for Small Proteins. Science 309(5742), 1868-1871. [doi:10.1126/science.1113801]\r\n\r\n* Grosse-Kunstleve et al. (2002). The Computational Crystallography Toolbox: crystallographic algorithms in a reusable software framework. Journal of Applied Crystallography 35(1), 126-136. [doi:10.1107/S0021889801017824]\r\n\r\n* Theobald et al. (2006). THESEUS: maximum likelihood superpositioning and analysis of macromolecular structures. Bioinformatics 22(17), 2171-2172. [doi:10.1093/bioinformatics/btl332]\r\n\r\n* Krissinel et al. (2012). Enhanced fold recognition using efficient short fragment clustering. Journal of molecular biochemistry 1(2), 76-85. [doi:]\r\n\r\n* Zhang et al. (2004). SPICKER: A clustering approach to identify near-native protein folds. Journal of Computational Chemistry 25(6), 865-871. [doi:10.1002/jcc.20011]\r\n\r\n* Keegan et al. (2018). Recent developments in MrBUMP: better search-model preparation, graphical interaction with search models, and solution improvement and assessment. Acta Crystallographica Section D 74(3), 167-182. [doi:10.1107/S2059798318003455]\r\n\r\n* Murshudov et al. (1997). Refinement of macromolecular structures by the maximum-likelihood method. Acta Crystallogr. Sect. D Biol. Crystallogr. 53(3), 240-255. [doi:10.1107/S0907444996012255]\r\n\r\n* Thorn et al. (2013). Extending molecular-replacement solutions with SHELXE. Acta Crystallogr. Sect. D Biol. Crystallogr. 69(11), 2251-2256. [doi:10.1107/S0907444913027534]\r\n\r\n* Cohen et al. (2008). ARP/wARP and molecular replacement: the next generation. Acta Crystallogr. Sect. D Biol. Crystallogr. 64(1), 49-60. [doi:10.1107/S0907444907047580]\r\n\r\n'

# We may not run (e.g.) arpwarp, so need to be tolerant of missing citations.
self.assertGreaterEqual(ref_references.index(refMgr.citation_list_as_text), 0)
if sys.platform.startswith("win"):
self.assertGreaterEqual(ref_references_windows.index(refMgr.citation_list_as_text), 0)
else:
self.assertGreaterEqual(ref_references.index(refMgr.citation_list_as_text), 0)

options.d['nmr_model_in'] = 'foo'
options.d['transmembrane'] = True
Expand Down
2 changes: 1 addition & 1 deletion ample/util/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version_info__ = (1, 5, 0)
__version_info__ = (1, 5, 1)
__version__ = '.'.join(str(v) for v in __version_info__)
__git_revno__ = "b350b9257de3481d7787ba8993a672245dd29549"

0 comments on commit f38c8e5

Please sign in to comment.