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
39f81e3b
Commit
39f81e3b
authored
Feb 17, 2015
by
peastman
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/SimTk/pdbfixer
Conflicts: pdbfixer/ui.py
parents
4ea8b0bf
06591a81
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
30 deletions
+50
-30
.travis.yml
+7
-0
pdbfixer/__init__.py
+3
-1
pdbfixer/pdbfixer.py
+3
-3
pdbfixer/ui.py
+19
-9
pdbfixer/uiserver.py
+1
-1
tests/test_build_and_simulate.py
+17
-16
No files found.
.travis.yml
View file @
39f81e3b
language
:
c
env
:
matrix
:
-
CONDA_PY=2.7
-
CONDA_PY=3.3
-
CONDA_PY=3.4
install
:
-
sudo apt-get update -qq
-
sudo apt-get install -qq python-dev python-pip python-yaml g++ ftp
...
...
pdbfixer/__init__.py
View file @
39f81e3b
from
pdbfixer
import
PDBFixer
from
__future__
import
absolute_import
from
.pdbfixer
import
PDBFixer
pdbfixer/pdbfixer.py
View file @
39f81e3b
...
...
@@ -28,6 +28,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from
__future__
import
absolute_import
__author__
=
"Peter Eastman"
__version__
=
"1.1"
...
...
@@ -207,7 +208,7 @@ class PDBFixer(object):
self
.
source
=
url
file
=
urlopen
(
url
)
# Read contents all at once and split into lines, since urlopen doesn't like it when we read one line at a time over the network.
contents
=
file
.
read
()
contents
=
file
.
read
()
.
decode
(
'utf-8'
)
lines
=
contents
.
split
(
'
\n
'
)
file
.
close
()
structure
=
PdbStructure
(
lines
)
...
...
@@ -1025,8 +1026,7 @@ class PDBFixer(object):
def
main
():
if
len
(
sys
.
argv
)
<
2
:
# Display the UI.
import
ui
from
.
import
ui
ui
.
launchUI
()
else
:
# Run in command line mode.
...
...
pdbfixer/ui.py
View file @
39f81e3b
import
simtk.openmm.app
as
app
import
simtk.unit
as
unit
from
pdbfixer
import
PDBFixer
,
substitutions
,
proteinResidues
,
dnaResidues
,
rnaResidues
import
uiserver
from
__future__
import
absolute_import
import
webbrowser
import
os.path
import
gzip
import
time
from
io
import
BytesIO
import
simtk.openmm.app
as
app
import
simtk.unit
as
unit
from
.pdbfixer
import
PDBFixer
,
proteinResidues
,
dnaResidues
,
rnaResidues
from
.
import
uiserver
try
:
from
urllib.request
import
urlopen
from
io
import
StringIO
...
...
@@ -26,7 +29,7 @@ def loadImageFile(name):
if
name
not
in
cachedImages
:
imagePath
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'images'
)
file
=
os
.
path
.
join
(
imagePath
,
name
)
cachedImages
[
name
]
=
open
(
file
)
.
read
()
cachedImages
[
name
]
=
open
(
file
,
'rb'
)
.
read
()
return
cachedImages
[
name
]
def
controlsCallback
(
parameters
,
handler
):
...
...
@@ -58,8 +61,15 @@ def startPageCallback(parameters, handler):
id
=
parameters
.
getfirst
(
'pdbid'
)
try
:
fixer
=
PDBFixer
(
pdbid
=
id
)
except
:
handler
.
sendResponse
(
header
+
"Unable to download the PDB file. This may indicate an invalid PDB identifier, or an error in network connectivity."
+
loadHtmlFile
(
"error.html"
))
except
Exception
as
e
:
import
traceback
print
(
traceback
.
format_exc
())
handler
.
sendResponse
(
header
+
"<p>Unable to download the PDB file. "
+
"This may indicate an invalid PDB identifier, "
+
"or an error in network connectivity.</p>"
+
"<p>{}</p>"
.
format
(
e
)
+
loadHtmlFile
(
"error.html"
))
displayDeleteChainsPage
()
def
deleteChainsPageCallback
(
parameters
,
handler
):
...
...
pdbfixer/uiserver.py
View file @
39f81e3b
...
...
@@ -46,7 +46,7 @@ class _Handler(BaseHTTPRequestHandler):
self
.
send_header
(
"Content-type"
,
type
)
self
.
send_header
(
"Content-length"
,
str
(
len
(
response
)))
self
.
end_headers
()
if
sys
.
version_info
.
major
>
2
:
if
sys
.
version_info
.
major
>
2
and
isinstance
(
response
,
str
)
:
response
=
bytes
(
response
,
'UTF-8'
)
self
.
wfile
.
write
(
response
)
...
...
tests/test_build_and_simulate.py
View file @
39f81e3b
from
__future__
import
print_function
import
pdbfixer
import
simtk.openmm
...
...
@@ -79,7 +80,7 @@ def simulate(pdbcode, pdb_filename):
del
context
,
integrator
print
"Simulation completed: potential =
%.3
f kcal/mol"
%
potential
print
(
"Simulation completed: potential =
%.3
f kcal/mol"
%
potential
)
return
...
...
@@ -105,8 +106,8 @@ def test_build_and_simulate():
failures
=
list
()
for
pdbcode
in
pdbcodes_to_build
:
print
"------------------------------------------------"
print
pdbcode
print
(
"------------------------------------------------"
)
print
(
pdbcode
)
output_pdb_filename
=
'output.pdb'
...
...
@@ -152,14 +153,14 @@ def test_build_and_simulate():
except
Watchdog
:
message
=
"timed out in stage
%
s"
%
stage
print
message
print
(
message
)
failures
.
append
((
pdbcode
,
Exception
(
message
)))
except
Exception
as
e
:
print
"EXCEPTION DURING BUILD"
print
(
"EXCEPTION DURING BUILD"
)
#import traceback
#print traceback.print_exc()
print
str
(
e
)
print
(
str
(
e
)
)
failures
.
append
((
pdbcode
,
e
))
watchdog
.
stop
()
...
...
@@ -173,14 +174,14 @@ def test_build_and_simulate():
except
Watchdog
:
message
=
"timed out in simulation"
print
message
print
(
message
)
failures
.
append
((
pdbcode
,
Exception
(
message
)))
except
Exception
as
e
:
print
"EXCEPTION DURING SIMULATE"
print
(
"EXCEPTION DURING SIMULATE"
)
#import traceback
#print traceback.print_exc()
print
str
(
e
)
print
(
str
(
e
)
)
failures
.
append
((
pdbcode
,
e
))
watchdog
.
stop
()
...
...
@@ -189,21 +190,21 @@ def test_build_and_simulate():
# Clean up.
os
.
remove
(
output_pdb_filename
)
print
"------------------------------------------------"
print
(
"------------------------------------------------"
)
if
len
(
failures
)
!=
0
:
print
""
print
"SUMMARY OF FAILURES:"
print
""
print
(
""
)
print
(
"SUMMARY OF FAILURES:"
)
print
(
""
)
for
failure
in
failures
:
(
pdbcode
,
exception
)
=
failure
print
"
%6
s :
%
s"
%
(
pdbcode
,
str
(
exception
))
print
""
print
(
"
%6
s :
%
s"
%
(
pdbcode
,
str
(
exception
)
))
print
(
""
)
raise
Exception
(
"Build test failed on one or more PDB files."
)
else
:
print
"All tests succeeded."
print
(
"All tests succeeded."
)
if
__name__
==
'__main__'
:
test_build_and_simulate
()
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