Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pdbfixer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pdbfixer
Commits
920bea10
Commit
920bea10
authored
Mar 28, 2014
by
John Chodera (MSKCC)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempted to add timeout to tests.
parent
53a29217
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
11 deletions
+41
-11
tests/test_build_and_simulate.py
+41
-11
No files found.
tests/test_build_and_simulate.py
View file @
920bea10
...
@@ -65,8 +65,7 @@ def simulate(pdbcode, pdb_filename):
...
@@ -65,8 +65,7 @@ def simulate(pdbcode, pdb_filename):
def
test_build_and_simulate
():
def
test_build_and_simulate
():
# 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_to_build
=
[
'1AS5'
,
'1CBN'
,
'1DPO'
,
'1IGY'
,
'1HAG'
,
'1IAO'
,
'4CPA'
,
'1QCQ'
]
pdbcodes_to_build
=
[
'1AS5'
,
'1CBN'
,
'1DPO'
,
'1IGY'
,
'1HAG'
,
'1IAO'
,
'4CPA'
,
'1QCQ'
]
pdbcodes_to_build
=
[
'1VII'
]
# DEBUG
pdbcodes_to_simulate
=
[
'1AS5'
,
'1CBN'
,
'1DPO'
,
'1IGY'
,
'1HAG'
,
'1IAO'
,
'4CPA'
,
'1QCQ'
]
pdbcodes_to_simulate
=
[
'1VII'
]
# should be a subset of pdbcodes_to_build
# Set up PDB retrieval.
# Set up PDB retrieval.
from
Bio.PDB
import
PDBList
from
Bio.PDB
import
PDBList
...
@@ -99,34 +98,65 @@ def test_build_and_simulate():
...
@@ -99,34 +98,65 @@ def test_build_and_simulate():
infile
=
open
(
input_pdb_filename
)
infile
=
open
(
input_pdb_filename
)
outfile
=
open
(
output_pdb_filename
,
'w'
)
outfile
=
open
(
output_pdb_filename
,
'w'
)
try
:
from
eventlet.timeout
import
Timeout
timeout_seconds
=
30.0
timeout
=
Timeout
(
timeout_seconds
)
try
:
from
pdbfixer.pdbfixer
import
PDBFixer
,
PdbStructure
from
pdbfixer.pdbfixer
import
PDBFixer
,
PdbStructure
from
simtk.openmm
import
app
from
simtk.openmm
import
app
stage
=
"Creating PDBFixer..."
fixer
=
PDBFixer
(
PdbStructure
(
infile
))
fixer
=
PDBFixer
(
PdbStructure
(
infile
))
stage
=
"Finding missing residues..."
fixer
.
findMissingResidues
()
fixer
.
findMissingResidues
()
stage
=
"Finding nonstandard residues..."
fixer
.
findNonstandardResidues
()
fixer
.
findNonstandardResidues
()
stage
=
"Replacing nonstandard residues..."
fixer
.
replaceNonstandardResidues
()
fixer
.
replaceNonstandardResidues
()
stage
=
"Finding missing atoms..."
fixer
.
findMissingAtoms
()
fixer
.
findMissingAtoms
()
stage
=
"Adding missing atoms..."
fixer
.
addMissingAtoms
()
fixer
.
addMissingAtoms
()
stage
=
"Removing heterogens..."
fixer
.
removeHeterogens
(
False
)
fixer
.
removeHeterogens
(
False
)
stage
=
"Adding missing hydrogens..."
fixer
.
addMissingHydrogens
(
pH
)
fixer
.
addMissingHydrogens
(
pH
)
#fixer.addSolvent(box*unit.nanometer, positiveIon, negativeIon, ionic*unit.molar)
stage
=
"Writing PDB file..."
app
.
PDBFile
.
writeFile
(
fixer
.
topology
,
fixer
.
positions
,
outfile
)
app
.
PDBFile
.
writeFile
(
fixer
.
topology
,
fixer
.
positions
,
outfile
)
stage
=
"Done."
infile
.
close
()
infile
.
close
()
outfile
.
close
()
outfile
.
close
()
# Test simulating this with OpenMM.
if
pdbcode
in
pdbcodes_to_simulate
:
simulate
(
pdbcode
,
output_pdb_filename
)
# Delete input file.
except
Timeout
as
e
:
os
.
remove
(
input_pdb_filename
)
print
str
(
e
)
os
.
remove
(
output_pdb_filename
)
timeout
.
cancel
()
print
"PDB code
%
s timed out in stage '
%
s'."
%
(
pdbcode
,
stage
)
except
Exception
as
e
:
except
Exception
as
e
:
print
str
(
e
)
print
str
(
e
)
timeout
.
cancel
()
success
=
False
success
=
False
# Test simulating this with OpenMM.
if
pdbcode
in
pdbcodes_to_simulate
:
timeout_seconds
=
30.0
timeout
=
Timeout
(
timeout_seconds
)
try
:
simulate
(
pdbcode
,
output_pdb_filename
)
except
Timeout
as
e
:
print
str
(
e
)
timeout
.
cancel
()
print
"PDB code
%
s timed out in stage '
%
s'."
%
(
pdbcode
,
stage
)
except
Exception
as
e
:
print
str
(
e
)
timeout
.
cancel
()
success
=
False
# Clean up.
os
.
remove
(
input_pdb_filename
)
os
.
remove
(
output_pdb_filename
)
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."
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment