Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

Commit

Permalink
Added setup processing to the APBS tester Python script to support ad…
Browse files Browse the repository at this point in the history
…ding the protein RNA tests. Closes issues #149.
  • Loading branch information
keith923 committed Jan 6, 2016
1 parent 3dc4ad5 commit 6dfd5b3
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 15 deletions.
23 changes: 23 additions & 0 deletions apbs/examples/protein-rna/apbs_unix_dx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/python

my_list = ('0.025', '0.050', '0.075', '0.100', '0.125', '0.150', '0.175', '0.200', '0.225', '0.250', '0.275', '0.300', '0.325', '0.400', '0.500', '0.600', '0.700', '0.800')

with open("template.txt", "r") as temp:
template_text = temp.read()

for item in my_list:
input_txt = template_text.replace("IONSTR", item)
file_name = "apbs-" + item + ".in"
print "Creating file now:", file_name
with open(file_name, "w") as temp:
temp.write(input_txt)

with open("dxmath.txt", "r") as temp:
template_2_text = temp.read()

for item in my_list:
input_2_txt = template_2_text.replace("IONSTR", item)
file_2_name = "dxmath-" + item + ".in"
print "Creating file_2 now:", file_2_name
with open(file_2_name, "w") as temp:
temp.write(input_2_txt)
16 changes: 8 additions & 8 deletions apbs/examples/protein-rna/apbs_win_dx.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
from subprocess import call

my_list = (0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.225, 0.275,
0.325, 0.4, 0.5, 0.6, 0.7, 0.8)
my_list = ('0.025', '0.050', '0.075', '0.100', '0.125', '0.150', '0.175', '0.200', '0.225', '0.250', '0.275', '0.300', '0.325', '0.400', '0.500', '0.600', '0.700', '0.800')

with open("template.txt", "r") as temp:
template_text = temp.read()

for item in my_list:
input_txt = template_text.replace("IONSTR",str(item))
file_name = "apbs-" + str(item) + ".in"
input_txt = template_text.replace("IONSTR", item)
file_name = "apbs-" + item + ".in"
print "Creating file now:", file_name
with open(file_name, "w") as temp:
temp.write(input_txt)
call(["apbs", "apbs-" + str(item) + ".in"])
call(["apbs", "apbs-" + item + ".in"])

with open("dxmath.txt", "r") as temp:
template_2_text = temp.read()

for item in my_list:
input_2_txt = template_2_text.replace("IONSTR",str(item))
file_2_name = "dxmath-" + str(item) + ".in"
input_2_txt = template_2_text.replace("IONSTR", item)
file_2_name = "dxmath-" + item + ".in"
print "Creating file_2 now:", file_2_name
with open(file_2_name, "w") as temp:
temp.write(input_2_txt)
call(["dxmath", "dxmath-" + str(item) + ".in"])
call(["dxmath", "dxmath-" + item + ".in"])
2 changes: 1 addition & 1 deletion apbs/externals/fetk
Submodule fetk updated 1 files
+1 −10 maloc/src/psh/vcom.c
22 changes: 17 additions & 5 deletions apbs/tests/apbs_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import sys, os, re, datetime, subprocess, operator
from optparse import OptionParser
from ConfigParser import ConfigParser
from ConfigParser import ConfigParser, NoOptionError

# The inputgen utility needs to be accessible, so we add its path
sys.path.insert( 0, "../tools/manip" )
Expand Down Expand Up @@ -115,7 +115,7 @@ def process_parallel( binary, input_file, procs, logger ):



def run_test( binary, test_files, test_name, test_directory, logger, ocd ):
def run_test( binary, test_files, test_name, test_directory, setup, logger, ocd ):
"""
Runs a given test from the test cases file
"""
Expand All @@ -131,6 +131,10 @@ def run_test( binary, test_files, test_name, test_directory, logger, ocd ):
# Change the current working directory to the test directory
os.chdir( test_directory )

# Run the setup, if any
if setup:
subprocess.call(setup.split())

for ( base_name, expected_results ) in test_files:

# Get the name of the input file from the base name
Expand Down Expand Up @@ -281,13 +285,21 @@ def main():
print " " + test_name + " section not found in " + options.test_config
print " skipping..."
continue
# As each test runs, remove the value so it can't be run twice

# Grab the test directory
test_directory = config.get( test_name, 'input_dir' )
config.remove_option( test_name, 'input_dir' )

# Check if there is a setup step.
test_setup = None
try:
test_setup = config.get(test_name, 'setup')
config.remove_option(test_name, 'setup')
except NoOptionError:
pass

# Run the test!
run_test( binary, config.items( test_name ), test_name, test_directory, logger, options.ocd )
run_test( binary, config.items( test_name ), test_name, test_directory, test_setup, logger, options.ocd )



Expand Down
24 changes: 23 additions & 1 deletion apbs/tests/test_cases.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,26 @@ apbs-smol : -3.757593797629E+01 -3.912388198513E+02 -3.536628818750E+02

[geoflow]
input_dir : ../examples/geoflow
geoflow : -1.04893133E+01 5.417419E-01
imidazole : -1.030222099963E+01 5.417419E-01

[protein-rna]
input_dir : ../examples/protein-rna
setup : python apbs_unix_dx.py
apbs-0.025 : 8.674116429353E+01
apbs-0.050 : 9.606836713866E+01
apbs-0.075 : 1.011537214883E+02
apbs-0.100 : 1.046142116108E+02
apbs-0.125 : 1.072226817610E+02
apbs-0.150 : 1.093084123761E+02
apbs-0.175 : 1.110412443877E+02
apbs-0.200 : 1.125199716537E+02
apbs-0.225 : 1.138070465620E+02
apbs-0.250 : 1.149444369078E+02
apbs-0.275 : 1.159616972338E+02
apbs-0.300 : 1.168804254687E+02
apbs-0.325 : 1.177168854906E+02
apbs-0.400 : 1.198456038803E+02
apbs-0.500 : 1.220607673699E+02
apbs-0.600 : 1.238080564885E+02
apbs-0.700 : 1.252364090878E+02
apbs-0.800 : 1.264340604647E+02

0 comments on commit 6dfd5b3

Please sign in to comment.