Skip to content

Commit

Permalink
Test multimodel mmCIF, clean up outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Aug 19, 2024
1 parent 2a76b3a commit 66755a6
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
3 changes: 3 additions & 0 deletions modules/foxs/test/input/6lyz.cif
Original file line number Diff line number Diff line change
Expand Up @@ -1165,3 +1165,6 @@ ATOM C CG . LEU A A 129 129 ? -13.595 21.390 7.436 1.000 3.740 1 998 1
ATOM C CD1 . LEU A A 129 129 ? -12.954 22.586 8.097 1.000 3.020 1 999 1
ATOM C CD2 . LEU A A 129 129 ? -12.974 20.117 7.959 1.000 3.020 1 1000 1
ATOM O OXT . LEU A A 129 129 ? -17.840 19.891 8.551 1.000 4.690 1 1001 1
ATOM C CA . VAL A A 2 2 ? 2.396 13.826 7.425 1.000 9.160 1 1003 9
ATOM C CA . LYS A A 1 1 ? 2.445 10.457 9.182 1.000 8.160 1 1005 8
ATOM C CA . PHE A A 3 3 ? -1.200 15.052 7.311 1.000 7.490 1 1004 9
49 changes: 41 additions & 8 deletions modules/foxs/test/test_saxs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ def test_simple(self):
out, err = p.communicate()
sys.stderr.write(err)
self.assertApplicationExitedCleanly(p.returncode, err)
m = re.search(r'Chi\^2\s+=\s+([\d\.]+)\r?', out)
m = re.search(r'6lyz\.pdb.*Chi\^2\s+=\s+([\d\.]+)\r?', out)
self.assertIsNotNone(m, msg="Chi output not found in " + str(out))
self.assertAlmostEqual(float(m.group(1)), 0.20, delta=0.01)
for out in ('6lyz.pdb.dat', '6lyz_lyzexp.dat', '6lyz_lyzexp.plt', '6lyz.plt'):
for out in ('6lyz.pdb.dat', '6lyz_lyzexp.dat', '6lyz_lyzexp.plt',
'6lyz.plt', '6lyz_lyzexp.fit'):
os.unlink(self.get_input_file_name(out))

def test_simple_cif(self):
Expand All @@ -32,13 +33,44 @@ def test_simple_cif(self):
out, err = p.communicate()
sys.stderr.write(err)
self.assertApplicationExitedCleanly(p.returncode, err)
m = re.search(r'Chi\^2\s+=\s+([\d\.]+)\r?', out)
m = re.search(r'6lyz\.cif.*Chi\^2\s+=\s+([\d\.]+)\r?', out)
self.assertIsNotNone(m, msg="Chi output not found in " + str(out))
self.assertAlmostEqual(float(m.group(1)), 0.20, delta=0.01)
for out in ('6lyz.cif.dat', '6lyz_lyzexp.dat', '6lyz_lyzexp.plt',
'6lyz.plt'):
'6lyz.plt', '6lyz_lyzexp.fit'):
os.unlink(self.get_input_file_name(out))

def test_simple_cif_multimodel(self):
"""Test of SAXS profile application with multimodel mmCIF input"""
p = self.run_application('foxs',
['-g', '-m', '2',
self.get_input_file_name('6lyz.cif'),
self.get_input_file_name('lyzexp.dat')])
out, err = p.communicate()
sys.stderr.write(err)
self.assertApplicationExitedCleanly(p.returncode, err)
# Should have three fits for the three models
m = re.search(r'6lyz_m1.cif.*Chi\^2\s+=\s+([\d\.]+)\r?', out)
self.assertIsNotNone(m, msg="Chi output not found in " + str(out))
self.assertAlmostEqual(float(m.group(1)), 0.20, delta=0.01)

m = re.search(r'6lyz_m2.cif.*Chi\^2\s+=\s+([\d\.]+)\r?', out)
self.assertIsNotNone(m, msg="Chi output not found in " + str(out))
self.assertAlmostEqual(float(m.group(1)), 149.67, delta=0.01)

m = re.search(r'6lyz_m3.cif.*Chi\^2\s+=\s+([\d\.]+)\r?', out)
self.assertIsNotNone(m, msg="Chi output not found in " + str(out))
self.assertAlmostEqual(float(m.group(1)), 134.08, delta=0.01)

for model in ('_m1', '_m2', '_m3'):
for out in ('6lyz%s.cif.dat' % model, '6lyz%s_lyzexp.dat' % model,
'6lyz%s_lyzexp.fit' % model,
'6lyz%s_lyzexp.plt' % model,
'6lyz%s.plt' % model):
os.unlink(self.get_input_file_name(out))
os.unlink('fit.plt')
os.unlink('profiles.plt')

def test_simple_exp_data_nm(self):
"""Simple test of SAXS profile application"""
print(self.get_input_file_name('6lyz.pdb'))
Expand All @@ -53,7 +85,8 @@ def test_simple_exp_data_nm(self):
m = re.search(r'Chi\^2\s+=\s+([\d\.]+)\r?', out)
self.assertIsNotNone(m, msg="Chi output not found in " + str(out))
self.assertAlmostEqual(float(m.group(1)), 0.20, delta=0.01)
for out in ('6lyz.pdb.dat', '6lyz_lyzexp_nm.dat', '6lyz_lyzexp_nm.plt', '6lyz.plt'):
for out in ('6lyz.pdb.dat', '6lyz_lyzexp_nm.dat', '6lyz_lyzexp_nm.plt',
'6lyz.plt', '6lyz_lyzexp_nm.fit'):
os.unlink(self.get_input_file_name(out))

def test_simple_no_fit(self):
Expand All @@ -70,7 +103,7 @@ def test_simple_no_fit(self):
m = re.search(r'Chi\^2\s+=\s+([\d\.]+)\r?', out)
self.assertIsNotNone(m, msg="Chi output not found in " + str(out))
self.assertAlmostEqual(float(m.group(1)), 0.289, delta=0.01)
for out in ('6lyz.pdb.dat', '6lyz_lyzexp.dat'):
for out in ('6lyz.pdb.dat', '6lyz_lyzexp.dat', '6lyz_lyzexp.fit'):
os.unlink(self.get_input_file_name(out))

def test_simple_residue(self):
Expand All @@ -87,7 +120,7 @@ def test_simple_residue(self):
m = re.search(r'Chi\^2\s+=\s+([\d\.]+)\r?', out)
self.assertIsNotNone(m, msg="Chi output not found in " + str(out))
self.assertAlmostEqual(float(m.group(1)), 0.67, delta=0.01)
for out in ('6lyz.pdb.dat', '6lyz_lyzexp.dat'):
for out in ('6lyz.pdb.dat', '6lyz_lyzexp.dat', '6lyz_lyzexp.fit'):
os.unlink(self.get_input_file_name(out))

def test_simple_js(self):
Expand All @@ -104,7 +137,7 @@ def test_simple_js(self):
m = re.search(r'Chi\^2\s+=\s+([\d\.]+)\r?', out)
self.assertIsNotNone(m, msg="Chi output not found in " + str(out))
self.assertAlmostEqual(float(m.group(1)), 0.20, delta=0.01)
for out in ('6lyz.pdb.dat', '6lyz_lyzexp.dat'):
for out in ('6lyz.pdb.dat', '6lyz_lyzexp.dat', '6lyz_lyzexp.fit'):
os.unlink(self.get_input_file_name(out))

for out in ('jmoltable.pdb', 'jmoltable.html', 'canvas.plt'):
Expand Down

0 comments on commit 66755a6

Please sign in to comment.