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)
...@@ -74,5 +62,4 @@ def test_build(): ...@@ -74,5 +62,4 @@ 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,47 +4,62 @@ from pdbfixer.pdbfixer import * ...@@ -4,47 +4,62 @@ 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
for pdbcode in pdbcodes: pdbcodes = ['1AS5', '1CBN', '1DPO', '1IGY', '1HAG', '1IAO', '4CPA', '1QCQ']
pdblist = PDBList() pdbcodes = ['1VII'] # DEBUG: just use one
input_pdb_filename = pdblist.retrieve_pdb_file(pdbcode, pdir='.')
output_pdb_filename = 'output.pdb' # Set up PDB retrieval.
pdblist = PDBList(server=PDBList.alternative_download_url)
pH = 7.0
ionic = 50.0 * unit.millimolar success = True
box = 10.0 * unit.angstrom
positiveIon = 'Na+' for pdbcode in pdbcodes:
negativeIon = 'Cl-' print pdbcode
print "Running PDBFixer..." try:
infile = open(input_pdb_filename) print "Attempting to retrieve PDB code '%s' from %s..." % (pdbcode, PDBList.alternative_download_url)
outfile = open(output_pdb_filename, 'w') input_pdb_filename = pdblist.retrieve_pdb_file(pdbcode, pdir='.')
except Exception as e:
try: print str(e)
fixer = PDBFixer(PdbStructure(infile)) print "Could not download PDB code '%s'" % pdbcode
fixer.findMissingResidues() continue
fixer.findNonstandardResidues()
fixer.replaceNonstandardResidues() output_pdb_filename = 'output.pdb'
fixer.findMissingAtoms()
fixer.addMissingAtoms() # PDB setup parameters.
fixer.removeHeterogens(False) # TODO: Try several combinations?
fixer.addMissingHydrogens(pH) pH = 7.0
#fixer.addSolvent(box*unit.nanometer, positiveIon, negativeIon, ionic*unit.molar) ionic = 50.0 * unit.millimolar
app.PDBFile.writeFile(fixer.topology, fixer.positions, outfile) box = 10.0 * unit.angstrom
infile.close() positiveIon = 'Na+'
outfile.close() negativeIon = 'Cl-'
# Delete input file. infile = open(input_pdb_filename)
os.remove(input_pdb_filename) outfile = open(output_pdb_filename, 'w')
os.remove(output_pdb_filename)
try:
except Exception as e: fixer = PDBFixer(PdbStructure(infile))
print str(e) fixer.findMissingResidues()
sys.exit(1) fixer.findNonstandardResidues()
fixer.replaceNonstandardResidues()
fixer.findMissingAtoms()
# Signal success. fixer.addMissingAtoms()
sys.exit(0) fixer.removeHeterogens(False)
fixer.addMissingHydrogens(pH)
#fixer.addSolvent(box*unit.nanometer, positiveIon, negativeIon, ionic*unit.molar)
app.PDBFile.writeFile(fixer.topology, fixer.positions, outfile)
infile.close()
outfile.close()
# Delete input file.
os.remove(input_pdb_filename)
os.remove(output_pdb_filename)
except Exception as e:
print str(e)
success = False
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