Skip to content

Commit f38c8e5

Browse files
authored
Merge pull request #75 from rigdenlab/test_fixes
Test fixes
2 parents 6b4c4c3 + 271891c commit f38c8e5

5 files changed

Lines changed: 36 additions & 7 deletions

File tree

ample/modelling/tests/test_rosetta_model.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import shutil
3+
import sys
34
import unittest
45

56
from ample import constants
@@ -38,10 +39,29 @@ def testMultimerConstraints(self):
3839
AtomPair CA 3B CA 3C FLAT_HARMONIC 10.00 3.00 5.00
3940
AtomPair CA 4B CA 4C FLAT_HARMONIC 10.00 3.00 5.00
4041
"""
42+
ref_windows = 'AtomPair CA 1 CA 4 FLAT_HARMONIC 6.00 3.00 5.00\r\n' \
43+
'AtomPair CA 1A CA 1B FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
44+
'AtomPair CA 2A CA 2B FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
45+
'AtomPair CA 3A CA 3B FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
46+
'AtomPair CA 4A CA 4B FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
47+
'AtomPair CA 1 CA 4 FLAT_HARMONIC 6.00 3.00 5.00\r\n' \
48+
'AtomPair CA 1A CA 1C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
49+
'AtomPair CA 2A CA 2C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
50+
'AtomPair CA 3A CA 3C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
51+
'AtomPair CA 4A CA 4C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
52+
'AtomPair CA 1 CA 4 FLAT_HARMONIC 6.00 3.00 5.00\r\n' \
53+
'AtomPair CA 1B CA 1C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
54+
'AtomPair CA 2B CA 2C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
55+
'AtomPair CA 3B CA 3C FLAT_HARMONIC 10.00 3.00 5.00\r\n' \
56+
'AtomPair CA 4B CA 4C FLAT_HARMONIC 10.00 3.00 5.00\r\n'
57+
4158
with open(cfile) as f:
4259
fstr = f.read()
4360
# self.assertEquals(fstr, ref, "Contents of constraints files don't match: {}".format(cfile))
44-
self.assertEquals(fstr, ref)
61+
if sys.platform.startswith("win"):
62+
self.assertEquals(fstr, ref_windows)
63+
else:
64+
self.assertEquals(fstr, ref)
4565
os.unlink(cfile)
4666

4767
def XtestMakeFragments(self):

ample/util/mtz_util.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,13 @@ def processReflectionFile(amoptd):
165165
exit_util.exit_error(msg)
166166

167167
cp = cif_parser.CifParser()
168+
mtz = cp.sfcif2mtz(amoptd['sf_cif'])
168169
# See if reflections have been set aside for Rfree or if we need to calculate
169-
if cp.hasRfree and cp.reflnStatus:
170+
if cp.hasRfree:
170171
logger.info("sfcif2mtz: no valid RFREE data so removing FREE column added by mtz2cif")
171-
mtz = cp.sfcif2mtz(amoptd['sf_cif'])
172172
amoptd['mtz'] = del_column(mtz, 'FREE')
173+
else:
174+
amoptd['mtz'] = mtz
173175

174176
# Now have an mtz so check it's valid
175177
if not amoptd['mtz'] or not os.path.isfile(amoptd['mtz']):

ample/util/rio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,14 +455,14 @@ def parseNcontLog(self, contactData, logfile=None, clean_up=True):
455455
aa1 = c[11:14]
456456
# Will get key error for all-atom if there is solvent etc.
457457
try:
458-
d['aa1'] = pdb_edit.three2one[aa1] # get amino acid and convert to single letter code
458+
d['aa1'] = ample_util.three2one[aa1] # get amino acid and convert to single letter code
459459
except KeyError:
460460
d['aa1'] = 'X'
461461
d['chainId2'] = c[32]
462462
d['resSeq2'] = int(c[34:38].strip())
463463
aa2 = c[39:42]
464464
try:
465-
d['aa2'] = pdb_edit.three2one[aa2]
465+
d['aa2'] = ample_util.three2one[aa2]
466466
except KeyError:
467467
d['aa2'] = 'X'
468468
d['dist'] = float(c[56:62].strip())

ample/util/tests/test_reference_manager.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test functions for util.ample_util"""
2+
import sys
23
import unittest
34
from ample.util import reference_manager
45

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

1516
refMgr = reference_manager.ReferenceManager(options.d)
1617
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'
18+
19+
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'
20+
1721
# We may not run (e.g.) arpwarp, so need to be tolerant of missing citations.
18-
self.assertGreaterEqual(ref_references.index(refMgr.citation_list_as_text), 0)
22+
if sys.platform.startswith("win"):
23+
self.assertGreaterEqual(ref_references_windows.index(refMgr.citation_list_as_text), 0)
24+
else:
25+
self.assertGreaterEqual(ref_references.index(refMgr.citation_list_as_text), 0)
1926

2027
options.d['nmr_model_in'] = 'foo'
2128
options.d['transmembrane'] = True

ample/util/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version_info__ = (1, 5, 0)
1+
__version_info__ = (1, 5, 1)
22
__version__ = '.'.join(str(v) for v in __version_info__)
33
__git_revno__ = "b350b9257de3481d7787ba8993a672245dd29549"

0 commit comments

Comments
 (0)