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
532d7279
Commit
532d7279
authored
Mar 28, 2014
by
John Chodera (MSKCC)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Exception handling back.
parent
509dcb40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
10 deletions
+26
-10
tests/test_build_and_simulate.py
+26
-10
No files found.
tests/test_build_and_simulate.py
View file @
532d7279
...
@@ -4,6 +4,7 @@ import simtk.openmm
...
@@ -4,6 +4,7 @@ import simtk.openmm
import
Bio.PDB
import
Bio.PDB
import
os
import
os
import
os.path
import
sys
import
sys
import
numpy
import
numpy
...
@@ -26,13 +27,6 @@ class Watchdog:
...
@@ -26,13 +27,6 @@ class Watchdog:
def
defaultHandler
(
self
):
def
defaultHandler
(
self
):
raise
self
raise
self
def
simulate
(
pdbcode
,
pdb_filename
):
def
simulate
(
pdbcode
,
pdb_filename
):
from
simtk.openmm
import
app
from
simtk.openmm
import
app
import
simtk.openmm
as
mm
import
simtk.openmm
as
mm
...
@@ -103,8 +97,14 @@ def test_build_and_simulate():
...
@@ -103,8 +97,14 @@ def test_build_and_simulate():
print
pdbcode
print
pdbcode
try
:
try
:
# Remove file if it exists already.
input_pdb_filename
=
'pdb'
+
pdbcode
+
'.ent'
if
os
.
path
.
exists
(
input_pdb_filename
):
os
.
remove
(
input_pdb_filename
)
print
"Attempting to retrieve PDB code '
%
s' from
%
s..."
%
(
pdbcode
,
PDBList
.
alternative_download_url
)
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
:
except
Exception
as
e
:
print
str
(
e
)
print
str
(
e
)
print
"Could not download PDB code '
%
s'"
%
pdbcode
print
"Could not download PDB code '
%
s'"
%
pdbcode
...
@@ -123,9 +123,10 @@ def test_build_and_simulate():
...
@@ -123,9 +123,10 @@ 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'
)
timeout_seconds
=
30.0
success
=
True
timeout_seconds
=
0.1
watchdog
=
Watchdog
(
timeout_seconds
)
watchdog
=
Watchdog
(
timeout_seconds
)
try
:
try
:
from
pdbfixer.pdbfixer
import
PDBFixer
,
PdbStructure
from
pdbfixer.pdbfixer
import
PDBFixer
,
PdbStructure
...
@@ -151,11 +152,19 @@ def test_build_and_simulate():
...
@@ -151,11 +152,19 @@ def test_build_and_simulate():
stage
=
"Done."
stage
=
"Done."
infile
.
close
()
infile
.
close
()
outfile
.
close
()
outfile
.
close
()
except
Watchdog
:
except
Watchdog
:
print
"timed out fixing PDB
%
s"
%
pdbcode
print
"timed out fixing PDB
%
s"
%
pdbcode
# Test simulating this with OpenMM.
success
=
False
except
Exception
as
e
:
print
str
(
e
)
success
=
False
watchdog
.
stop
()
watchdog
.
stop
()
del
watchdog
del
watchdog
# Test simulating this with OpenMM.
if
pdbcode
in
pdbcodes_to_simulate
:
if
pdbcode
in
pdbcodes_to_simulate
:
watchdog
=
Watchdog
(
timeout_seconds
)
watchdog
=
Watchdog
(
timeout_seconds
)
try
:
try
:
...
@@ -164,7 +173,14 @@ def test_build_and_simulate():
...
@@ -164,7 +173,14 @@ def test_build_and_simulate():
except
Watchdog
:
except
Watchdog
:
print
"PDB code
%
s timed out in stage '
%
s'."
%
(
pdbcode
,
stage
)
print
"PDB code
%
s timed out in stage '
%
s'."
%
(
pdbcode
,
stage
)
success
=
False
success
=
False
except
Exception
as
e
:
print
str
(
e
)
success
=
False
watchdog
.
stop
()
watchdog
.
stop
()
del
watchdog
# Clean up.
# Clean up.
os
.
remove
(
input_pdb_filename
)
os
.
remove
(
input_pdb_filename
)
os
.
remove
(
output_pdb_filename
)
os
.
remove
(
output_pdb_filename
)
...
...
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