Files
propka/Tests/runtest.py
Mike Beachy 61bb875248 add test framework
- add the ability to run tests from the top level directory via
  'python setup.py test'
- translate runtest.py into a test that runs under this framework
- add a __main__ section to Tests/runtest.py and change its indent to 4
  spaces; make no other changes to this script
2014-02-22 17:51:04 -05:00

48 lines
1.2 KiB
Python
Executable File

#!/usr/bin/env python
""" Run test for test pdbs """
from __future__ import division
from __future__ import print_function
from subprocess import call
import os, re
import sys
if __name__ == "__main__":
pdbs = ['1FTJ-Chain-A',
'1HPX',
'4DFR']
for pdb in pdbs:
print('')
print('RUNNING '+pdb)
# Run pka calculation
call([sys.executable, '../scripts/propka31.py','pdb/'+pdb+'.pdb'], stdout = open(pdb+'.out', 'w+'))
# Test pka predictiona
result = open('results/'+pdb+'.dat','r')
atpka = False
for line in open(pdb+'.pka', 'r').readlines():
if not atpka:
if "model-pKa" in line:
# test pka
atpka = True
continue
else:
continue
if "-" in line:
# done testing
atpka = False
continue
r = float(result.readline())
m = re.search('([0-9]+\.[0-9]+)', line)
if(float(m.group(0)) != r):
print(" ERR:")
print(line)
print(" "+"should be: "+str(r))