Commit fc191ebd by John Chodera (MSKCC)

Removed debug code.

parent f902ca3d
...@@ -10,9 +10,8 @@ install: ...@@ -10,9 +10,8 @@ install:
script: script:
- python setup.py install - python setup.py install
# - nosetests tests/test_build.py - nosetests tests/test_build.py
# - nosetests tests/test_simulate.py - nosetests tests/test_simulate.py
- python tests/test_build.py
after_script: after_script:
- pyflakes pdbfixer/*.py - pyflakes pdbfixer/*.py
......
...@@ -7,7 +7,7 @@ import sys ...@@ -7,7 +7,7 @@ import sys
def test_build(): def test_build():
# These are tough PDB codes from http://www.umass.edu/microbio/chime/pe_beta/pe/protexpl/badpdbs.htm # These are tough PDB codes from http://www.umass.edu/microbio/chime/pe_beta/pe/protexpl/badpdbs.htm
pdbcodes = ['1AS5', '1CBN', '1DPO', '1IGY', '1HAG', '1IAO', '4CPA', '1QCQ'] pdbcodes = ['1AS5', '1CBN', '1DPO', '1IGY', '1HAG', '1IAO', '4CPA', '1QCQ']
pdbcodes = ['1VII'] # DEBUG pdbcodes = ['1VII'] # DEBUG: just use one
# Set up PDB retrieval. # Set up PDB retrieval.
pdblist = PDBList(server=PDBList.alternative_download_url) pdblist = PDBList(server=PDBList.alternative_download_url)
...@@ -35,34 +35,22 @@ def test_build(): ...@@ -35,34 +35,22 @@ def test_build():
positiveIon = 'Na+' positiveIon = 'Na+'
negativeIon = 'Cl-' negativeIon = 'Cl-'
print "Running PDBFixer..."
infile = open(input_pdb_filename) infile = open(input_pdb_filename)
outfile = open(output_pdb_filename, 'w') outfile = open(output_pdb_filename, 'w')
try: try:
print "Creating PDBFixer..."
fixer = PDBFixer(PdbStructure(infile)) fixer = PDBFixer(PdbStructure(infile))
print "Finding missing residues..."
fixer.findMissingResidues() fixer.findMissingResidues()
print "Finding nonstandard residues..."
fixer.findNonstandardResidues() fixer.findNonstandardResidues()
print "Replacing nonstandard residues..."
fixer.replaceNonstandardResidues() fixer.replaceNonstandardResidues()
print "Finding missing atoms..."
fixer.findMissingAtoms() fixer.findMissingAtoms()
print "Adding missing atoms..."
fixer.addMissingAtoms() fixer.addMissingAtoms()
print "Removing heterogens..."
fixer.removeHeterogens(False) fixer.removeHeterogens(False)
print "Adding missing hydrogens..."
fixer.addMissingHydrogens(pH) fixer.addMissingHydrogens(pH)
#fixer.addSolvent(box*unit.nanometer, positiveIon, negativeIon, ionic*unit.molar) #fixer.addSolvent(box*unit.nanometer, positiveIon, negativeIon, ionic*unit.molar)
print "Writing PDB file..."
app.PDBFile.writeFile(fixer.topology, fixer.positions, outfile) app.PDBFile.writeFile(fixer.topology, fixer.positions, outfile)
infile.close() infile.close()
outfile.close() outfile.close()
print "Done."fg
# Delete input file. # Delete input file.
os.remove(input_pdb_filename) os.remove(input_pdb_filename)
...@@ -75,4 +63,3 @@ def test_build(): ...@@ -75,4 +63,3 @@ def test_build():
if not success: if not success:
raise Exception("build test failed on one or more PDB files.") raise Exception("build test failed on one or more PDB files.")
test_build()
...@@ -4,20 +4,37 @@ from pdbfixer.pdbfixer import * ...@@ -4,20 +4,37 @@ from pdbfixer.pdbfixer import *
import os import os
import sys import sys
pdbcodes = ['1PGB', '1VII'] def test_build():
# These are tough PDB codes from http://www.umass.edu/microbio/chime/pe_beta/pe/protexpl/badpdbs.htm
pdbcodes = ['1AS5', '1CBN', '1DPO', '1IGY', '1HAG', '1IAO', '4CPA', '1QCQ']
pdbcodes = ['1VII'] # DEBUG: just use one
for pdbcode in pdbcodes: # Set up PDB retrieval.
pdblist = PDBList() pdblist = PDBList(server=PDBList.alternative_download_url)
success = True
for pdbcode in pdbcodes:
print pdbcode
try:
print "Attempting to retrieve PDB code '%s' from %s..." % (pdbcode, PDBList.alternative_download_url)
input_pdb_filename = pdblist.retrieve_pdb_file(pdbcode, pdir='.') input_pdb_filename = pdblist.retrieve_pdb_file(pdbcode, pdir='.')
except Exception as e:
print str(e)
print "Could not download PDB code '%s'" % pdbcode
continue
output_pdb_filename = 'output.pdb' output_pdb_filename = 'output.pdb'
# PDB setup parameters.
# TODO: Try several combinations?
pH = 7.0 pH = 7.0
ionic = 50.0 * unit.millimolar ionic = 50.0 * unit.millimolar
box = 10.0 * unit.angstrom box = 10.0 * unit.angstrom
positiveIon = 'Na+' positiveIon = 'Na+'
negativeIon = 'Cl-' negativeIon = 'Cl-'
print "Running PDBFixer..."
infile = open(input_pdb_filename) infile = open(input_pdb_filename)
outfile = open(output_pdb_filename, 'w') outfile = open(output_pdb_filename, 'w')
...@@ -41,10 +58,8 @@ for pdbcode in pdbcodes: ...@@ -41,10 +58,8 @@ for pdbcode in pdbcodes:
except Exception as e: except Exception as e:
print str(e) print str(e)
sys.exit(1) success = False
# Signal success.
sys.exit(0)
if not success:
raise Exception("build test failed on one or more PDB files.")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment