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
d1c0f578
Commit
d1c0f578
authored
Sep 06, 2013
by
Peter Eastman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further UI improvements
parent
3515f0da
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
107 additions
and
68 deletions
+107
-68
html/addHeavyAtoms.html
+3
-3
html/addHydrogens.html
+4
-4
html/addResidues.html
+3
-12
html/convertResidues.html
+4
-12
html/header.html
+37
-0
html/quit.html
+10
-0
html/removeChains.html
+4
-12
html/saveFile.html
+3
-3
html/start.html
+3
-3
ui.py
+18
-9
uiserver.py
+18
-10
No files found.
html/addHeavyAtoms.html
View file @
d1c0f578
<html>
<head><title>
PDB Fixer
</title></head>
<body>
The following residues are missing heavy atoms, which will be added.
The following residues are missing heavy atoms, which will be added.
<p>
<p>
<form
method=
"post"
action=
"/"
>
<form
method=
"post"
action=
"/"
>
...
@@ -11,5 +8,8 @@ The following residues are missing heavy atoms, which will be added.
...
@@ -11,5 +8,8 @@ The following residues are missing heavy atoms, which will be added.
<p>
<p>
<input
type=
"submit"
value=
"Continue"
/>
<input
type=
"submit"
value=
"Continue"
/>
</form>
</form>
<script>
setCurrentStep
(
5
)
</script>
</body>
</body>
<html>
<html>
html/addHydrogens.html
View file @
d1c0f578
<html>
<head><title>
PDB Fixer
</title>
<script>
<script>
function
validateForm
()
{
function
validateForm
()
{
if
(
document
.
getElementById
(
"addCheckbox"
).
checked
)
{
if
(
document
.
getElementById
(
"addCheckbox"
).
checked
)
{
...
@@ -11,8 +9,6 @@ function validateForm() {
...
@@ -11,8 +9,6 @@ function validateForm() {
}
}
}
}
</script>
</script>
</head>
<body>
Add missing hydrogen atoms?
Add missing hydrogen atoms?
<p>
<p>
<form
method=
"post"
action=
"/"
onsubmit=
"return validateForm()"
>
<form
method=
"post"
action=
"/"
onsubmit=
"return validateForm()"
>
...
@@ -20,5 +16,8 @@ Add missing hydrogen atoms?
...
@@ -20,5 +16,8 @@ Add missing hydrogen atoms?
<p>
<p>
<input
type=
"submit"
value=
"Continue"
/>
<input
type=
"submit"
value=
"Continue"
/>
</form>
</form>
<script>
setCurrentStep
(
6
)
</script>
</body>
</body>
<html>
<html>
\ No newline at end of file
html/addResidues.html
View file @
d1c0f578
<html>
<head>
<title>
PDB Fixer
</title>
<script>
function
setCheckboxes
(
selected
)
{
checkboxes
=
document
.
getElementById
(
"table"
).
getElementsByTagName
(
"input"
);
for
(
var
i
=
0
;
i
<
checkboxes
.
length
;
i
++
)
checkboxes
[
i
].
checked
=
selected
}
</script>
</head>
<body>
The SEQRES records in this PDB file include residues that are missing from the atom data section. Do you want to add the missing residues?
The SEQRES records in this PDB file include residues that are missing from the atom data section. Do you want to add the missing residues?
<p>
<p>
<form
method=
"post"
action=
"/"
>
<form
method=
"post"
action=
"/"
>
...
@@ -21,5 +9,8 @@ The SEQRES records in this PDB file include residues that are missing from the a
...
@@ -21,5 +9,8 @@ The SEQRES records in this PDB file include residues that are missing from the a
<p>
<p>
<input
type=
"submit"
value=
"Continue"
/>
<input
type=
"submit"
value=
"Continue"
/>
</form>
</form>
<script>
setCurrentStep
(
3
)
</script>
</body>
</body>
<html>
<html>
html/convertResidues.html
View file @
d1c0f578
<html>
<head>
<title>
PDB Fixer
</title>
<script>
function
setCheckboxes
(
selected
)
{
checkboxes
=
document
.
getElementById
(
"table"
).
getElementsByTagName
(
"input"
);
for
(
var
i
=
0
;
i
<
checkboxes
.
length
;
i
++
)
checkboxes
[
i
].
checked
=
selected
}
</script>
</head>
<body>
This PDB file contains non-standard residues. Do you want to convert them to the corresponding standard residues?
This PDB file contains non-standard residues. Do you want to convert them to the corresponding standard residues?
<p>
<p>
<form
method=
"post"
action=
"/"
>
<form
method=
"post"
action=
"/"
>
...
@@ -21,5 +9,8 @@ This PDB file contains non-standard residues. Do you want to convert them to th
...
@@ -21,5 +9,8 @@ This PDB file contains non-standard residues. Do you want to convert them to th
<p>
<p>
<input
type=
"submit"
value=
"Continue"
/>
<input
type=
"submit"
value=
"Continue"
/>
</form>
</form>
<script>
setCurrentStep
(
4
)
</script>
</body>
</body>
<html>
<html>
\ No newline at end of file
html/header.html
0 → 100644
View file @
d1c0f578
<html>
<head>
<title>
PDBFixer
</title>
<script>
function
setCurrentStep
(
step
)
{
for
(
var
i
=
1
;
i
<
step
;
i
++
)
document
.
getElementById
(
"step"
+
i
).
style
.
color
=
"black"
document
.
getElementById
(
"step"
+
step
).
style
.
color
=
"red"
for
(
var
i
=
step
+
1
;
i
<
8
;
i
++
)
document
.
getElementById
(
"step"
+
i
).
style
.
color
=
"gray"
if
(
step
==
1
)
document
.
getElementById
(
"newfile"
).
disabled
=
true
}
function
setCheckboxes
(
selected
)
{
checkboxes
=
document
.
getElementById
(
"table"
).
getElementsByTagName
(
"input"
);
for
(
var
i
=
0
;
i
<
checkboxes
.
length
;
i
++
)
checkboxes
[
i
].
checked
=
selected
}
</script>
</head>
<body>
<div
style=
"background-color:LightSkyBlue;font-style:italic;font-size:xx-large;text-align:center"
>
PDBFixer
</div>
<span
style=
"background-color:LightSkyBlue;font-style:italic;font-size:large;float:right;height:100%;padding:0px 10px"
>
<form
method=
"post"
action=
"/controls"
>
<input
type=
"submit"
name=
"newfile"
value=
"New File"
id=
"newfile"
/>
<input
type=
"submit"
name=
"quit"
value=
"Quit"
style=
"float:right"
/>
</form>
<p
id=
"step1"
>
Load File
</p>
<p
id=
"step2"
>
Select Chains
</p>
<p
id=
"step3"
>
Add Residues
</p>
<p
id=
"step4"
>
Convert Residues
</p>
<p
id=
"step5"
>
Add Heavy Atoms
</p>
<p
id=
"step6"
>
Add Hydrogens
</p>
<p
id=
"step7"
>
Save File
</p>
</span>
<p/>
\ No newline at end of file
html/quit.html
0 → 100644
View file @
d1c0f578
<html>
<head>
<title>
PDBFixer
</title>
</head>
<body>
<h1
style=
"text-align:center"
>
See You Again Soon!
</h1>
PDBFixer has exited. You can close your browser window.
</body>
</html>
\ No newline at end of file
html/removeChains.html
View file @
d1c0f578
<html>
<head>
<title>
PDB Fixer
</title>
<script>
function
setCheckboxes
(
selected
)
{
checkboxes
=
document
.
getElementById
(
"table"
).
getElementsByTagName
(
"input"
);
for
(
var
i
=
0
;
i
<
checkboxes
.
length
;
i
++
)
checkboxes
[
i
].
checked
=
selected
}
</script>
</head>
<body>
This PDB file contains %d chains. Select which ones to include.
This PDB file contains %d chains. Select which ones to include.
<p>
<p>
<form
method=
"post"
action=
"/"
>
<form
method=
"post"
action=
"/"
>
...
@@ -21,5 +9,8 @@ This PDB file contains %d chains. Select which ones to include.
...
@@ -21,5 +9,8 @@ This PDB file contains %d chains. Select which ones to include.
<p>
<p>
<input
type=
"submit"
value=
"Continue"
/>
<input
type=
"submit"
value=
"Continue"
/>
</form>
</form>
<script>
setCurrentStep
(
2
)
</script>
</body>
</body>
<html>
<html>
\ No newline at end of file
html/saveFile.html
View file @
d1c0f578
<html>
<head><title>
PDB Fixer
</title></head>
<body>
The fixed PDB file is ready to save.
The fixed PDB file is ready to save.
<p>
<p>
<form
method=
"post"
action=
"/"
>
<form
method=
"post"
action=
"/"
>
<input
type=
"submit"
name=
"save"
value=
"Save File"
/>
<input
type=
"submit"
name=
"save"
value=
"Save File"
/>
<input
type=
"submit"
name=
"newfile"
value=
"Process Another File"
/>
<input
type=
"submit"
name=
"newfile"
value=
"Process Another File"
/>
</form>
</form>
<script>
setCurrentStep
(
7
)
</script>
</body>
</body>
<html>
<html>
html/start.html
View file @
d1c0f578
<html>
<head><title>
PDBFixer
</title></head>
<body>
<h1>
Welcome To PDBFixer!
</h1>
<h1>
Welcome To PDBFixer!
</h1>
Select a PDB file to load. It will be analyzed for problems.
Select a PDB file to load. It will be analyzed for problems.
<p>
<p>
...
@@ -9,5 +6,8 @@ PDB File: <input type="file" name="pdbfile" onchange="document.getElementById('s
...
@@ -9,5 +6,8 @@ PDB File: <input type="file" name="pdbfile" onchange="document.getElementById('s
<p>
<p>
<input
type=
"submit"
id=
"submit"
value=
"Analyze File"
disabled
/>
<input
type=
"submit"
id=
"submit"
value=
"Analyze File"
disabled
/>
</form>
</form>
<script>
setCurrentStep
(
1
)
</script>
</body>
</body>
</html>
</html>
ui.py
View file @
d1c0f578
...
@@ -11,6 +11,13 @@ def loadHtmlFile(name):
...
@@ -11,6 +11,13 @@ def loadHtmlFile(name):
file
=
os
.
path
.
join
(
htmlPath
,
name
)
file
=
os
.
path
.
join
(
htmlPath
,
name
)
return
open
(
file
)
.
read
()
return
open
(
file
)
.
read
()
def
controlsCallback
(
parameters
,
handler
):
if
'newfile'
in
parameters
:
displayStartPage
()
if
'quit'
in
parameters
:
handler
.
sendResponse
(
loadHtmlFile
(
"quit.html"
))
uiserver
.
server
.
shutdown
()
def
startPageCallback
(
parameters
,
handler
):
def
startPageCallback
(
parameters
,
handler
):
if
'pdbfile'
in
parameters
:
if
'pdbfile'
in
parameters
:
global
fixer
global
fixer
...
@@ -56,7 +63,7 @@ def saveFilePageCallback(parameters, handler):
...
@@ -56,7 +63,7 @@ def saveFilePageCallback(parameters, handler):
def
displayStartPage
():
def
displayStartPage
():
uiserver
.
setCallback
(
startPageCallback
)
uiserver
.
setCallback
(
startPageCallback
)
uiserver
.
setContent
(
loadHtmlFile
(
"start.html"
))
uiserver
.
setContent
(
header
+
loadHtmlFile
(
"start.html"
))
def
displayDeleteChainsPage
():
def
displayDeleteChainsPage
():
uiserver
.
setCallback
(
deleteChainsPageCallback
)
uiserver
.
setCallback
(
deleteChainsPageCallback
)
...
@@ -79,7 +86,7 @@ def displayDeleteChainsPage():
...
@@ -79,7 +86,7 @@ def displayDeleteChainsPage():
else
:
else
:
content
=
', '
.
join
(
set
(
residues
))
content
=
', '
.
join
(
set
(
residues
))
table
+=
' <tr><td>
%
d</td><td>
%
d</td><td>
%
s</td><td><input type="checkbox" name="include
%
d" checked></td></tr>
\n
'
%
(
chain
.
index
+
1
,
len
(
residues
),
content
,
i
)
table
+=
' <tr><td>
%
d</td><td>
%
d</td><td>
%
s</td><td><input type="checkbox" name="include
%
d" checked></td></tr>
\n
'
%
(
chain
.
index
+
1
,
len
(
residues
),
content
,
i
)
uiserver
.
setContent
(
loadHtmlFile
(
"removeChains.html"
)
%
(
numChains
,
table
))
uiserver
.
setContent
(
header
+
loadHtmlFile
(
"removeChains.html"
)
%
(
numChains
,
table
))
def
displayAddResiduesPage
():
def
displayAddResiduesPage
():
uiserver
.
setCallback
(
addResiduesPageCallback
)
uiserver
.
setCallback
(
addResiduesPageCallback
)
...
@@ -91,7 +98,7 @@ def displayAddResiduesPage():
...
@@ -91,7 +98,7 @@ def displayAddResiduesPage():
for
i
,
key
in
enumerate
(
sorted
(
fixer
.
missingResidues
)):
for
i
,
key
in
enumerate
(
sorted
(
fixer
.
missingResidues
)):
residues
=
fixer
.
missingResidues
[
key
]
residues
=
fixer
.
missingResidues
[
key
]
table
+=
' <tr><td>
%
d</td><td>
%
d to
%
d</td><td>
%
s</td><td><input type="checkbox" name="add
%
d" checked></td></tr>
\n
'
%
(
key
[
0
]
+
1
,
key
[
1
]
+
1
,
key
[
1
]
+
len
(
residues
),
', '
.
join
(
residues
),
i
)
table
+=
' <tr><td>
%
d</td><td>
%
d to
%
d</td><td>
%
s</td><td><input type="checkbox" name="add
%
d" checked></td></tr>
\n
'
%
(
key
[
0
]
+
1
,
key
[
1
]
+
1
,
key
[
1
]
+
len
(
residues
),
', '
.
join
(
residues
),
i
)
uiserver
.
setContent
(
loadHtmlFile
(
"addResidues.html"
)
%
table
)
uiserver
.
setContent
(
header
+
loadHtmlFile
(
"addResidues.html"
)
%
table
)
def
displayConvertResiduesPage
():
def
displayConvertResiduesPage
():
uiserver
.
setCallback
(
convertResiduesPageCallback
)
uiserver
.
setCallback
(
convertResiduesPageCallback
)
...
@@ -106,7 +113,7 @@ def displayConvertResiduesPage():
...
@@ -106,7 +113,7 @@ def displayConvertResiduesPage():
table
=
""
table
=
""
for
i
,
residue
in
enumerate
(
fixer
.
nonstandardResidues
):
for
i
,
residue
in
enumerate
(
fixer
.
nonstandardResidues
):
table
+=
' <tr><td>
%
d</td><td>
%
s
%
d</td><td>
%
s</td><td><input type="checkbox" name="convert
%
d" checked></td></tr>
\n
'
%
(
residue
.
chain
.
index
+
1
,
residue
.
name
,
indexInChain
[
residue
],
substitutions
[
residue
.
name
],
i
)
table
+=
' <tr><td>
%
d</td><td>
%
s
%
d</td><td>
%
s</td><td><input type="checkbox" name="convert
%
d" checked></td></tr>
\n
'
%
(
residue
.
chain
.
index
+
1
,
residue
.
name
,
indexInChain
[
residue
],
substitutions
[
residue
.
name
],
i
)
uiserver
.
setContent
(
loadHtmlFile
(
"convertResidues.html"
)
%
table
)
uiserver
.
setContent
(
header
+
loadHtmlFile
(
"convertResidues.html"
)
%
table
)
def
displayMissingAtomsPage
():
def
displayMissingAtomsPage
():
uiserver
.
setCallback
(
missingAtomsPageCallback
)
uiserver
.
setCallback
(
missingAtomsPageCallback
)
...
@@ -128,17 +135,20 @@ def displayMissingAtomsPage():
...
@@ -128,17 +135,20 @@ def displayMissingAtomsPage():
if
residue
in
fixer
.
missingTerminals
:
if
residue
in
fixer
.
missingTerminals
:
atoms
.
extend
(
atom
for
atom
in
fixer
.
missingTerminals
[
residue
])
atoms
.
extend
(
atom
for
atom
in
fixer
.
missingTerminals
[
residue
])
table
+=
' <tr><td>
%
d</td><td>
%
s
%
d</td><td>
%
s</td></tr>
\n
'
%
(
residue
.
chain
.
index
+
1
,
residue
.
name
,
indexInChain
[
residue
],
', '
.
join
(
atoms
))
table
+=
' <tr><td>
%
d</td><td>
%
s
%
d</td><td>
%
s</td></tr>
\n
'
%
(
residue
.
chain
.
index
+
1
,
residue
.
name
,
indexInChain
[
residue
],
', '
.
join
(
atoms
))
uiserver
.
setContent
(
loadHtmlFile
(
"addHeavyAtoms.html"
)
%
table
)
uiserver
.
setContent
(
header
+
loadHtmlFile
(
"addHeavyAtoms.html"
)
%
table
)
def
displayAddHydrogensPage
():
def
displayAddHydrogensPage
():
uiserver
.
setCallback
(
addHydrogensPageCallback
)
uiserver
.
setCallback
(
addHydrogensPageCallback
)
uiserver
.
setContent
(
loadHtmlFile
(
"addHydrogens.html"
))
uiserver
.
setContent
(
header
+
loadHtmlFile
(
"addHydrogens.html"
))
def
displaySaveFilePage
():
def
displaySaveFilePage
():
uiserver
.
setCallback
(
saveFilePageCallback
)
uiserver
.
setCallback
(
saveFilePageCallback
)
uiserver
.
setContent
(
loadHtmlFile
(
"saveFile.html"
))
uiserver
.
setContent
(
header
+
loadHtmlFile
(
"saveFile.html"
))
def
launchUI
():
def
launchUI
():
global
header
header
=
loadHtmlFile
(
"header.html"
)
uiserver
.
beginServing
()
uiserver
.
beginServing
()
uiserver
.
setCallback
(
controlsCallback
,
"/controls"
)
displayStartPage
()
displayStartPage
()
webbrowser
.
open
(
'http://localhost:'
+
str
(
uiserver
.
server
.
server_address
[
1
]))
webbrowser
.
open
(
'http://localhost:'
+
str
(
uiserver
.
server
.
server_address
[
1
]))
\ No newline at end of file
uiserver.py
View file @
d1c0f578
...
@@ -13,25 +13,34 @@ class _Handler(BaseHTTPRequestHandler):
...
@@ -13,25 +13,34 @@ class _Handler(BaseHTTPRequestHandler):
parameters
=
parse_qs
(
self
.
path
[
queryStart
+
1
:])
parameters
=
parse_qs
(
self
.
path
[
queryStart
+
1
:])
else
:
else
:
parameters
=
{}
parameters
=
{}
result
=
callback
(
parameters
,
self
)
self
.
invokeCallback
(
parameters
)
if
not
self
.
hasSentResponse
:
if
not
self
.
hasSentResponse
:
self
.
sendResponse
(
content
)
self
.
sendResponse
(
content
)
def
do_POST
(
self
):
def
do_POST
(
self
):
self
.
hasSentResponse
=
False
self
.
hasSentResponse
=
False
if
callback
is
not
None
:
parameters
=
cgi
.
FieldStorage
(
fp
=
self
.
rfile
,
headers
=
self
.
headers
,
environ
=
{
'REQUEST_METHOD'
:
'POST'
,
'CONTENT_TYPE'
:
self
.
headers
[
'Content-Type'
]})
parameters
=
cgi
.
FieldStorage
(
fp
=
self
.
rfile
,
headers
=
self
.
headers
,
environ
=
{
'REQUEST_METHOD'
:
'POST'
,
'CONTENT_TYPE'
:
self
.
headers
[
'Content-Type'
]})
self
.
invokeCallback
(
parameters
)
callback
(
parameters
,
self
)
if
not
self
.
hasSentResponse
:
if
not
self
.
hasSentResponse
:
self
.
sendResponse
(
content
)
self
.
sendResponse
(
content
)
def
log_message
(
self
,
format
,
*
args
):
return
def
invokeCallback
(
self
,
parameters
):
path
=
self
.
path
if
'?'
in
path
:
path
=
path
[:
path
.
find
(
'?'
)]
if
path
in
callback
:
callback
[
path
](
parameters
,
self
)
def
sendResponse
(
self
,
response
):
def
sendResponse
(
self
,
response
):
self
.
hasSentResponse
=
True
self
.
hasSentResponse
=
True
self
.
send_response
(
200
)
self
.
send_response
(
200
)
self
.
send_header
(
"Content-type"
,
"text/html"
)
self
.
send_header
(
"Content-type"
,
"text/html"
)
self
.
send_header
(
"Content-length"
,
str
(
len
(
content
)))
self
.
send_header
(
"Content-length"
,
str
(
len
(
response
)))
self
.
end_headers
()
self
.
end_headers
()
self
.
wfile
.
write
(
content
)
self
.
wfile
.
write
(
response
)
def
sendDownload
(
self
,
download
,
filename
):
def
sendDownload
(
self
,
download
,
filename
):
self
.
hasSentResponse
=
True
self
.
hasSentResponse
=
True
...
@@ -46,7 +55,7 @@ class _ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
...
@@ -46,7 +55,7 @@ class _ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
pass
pass
content
=
""
content
=
""
callback
=
None
callback
=
{}
server
=
_ThreadingHTTPServer
((
"localhost"
,
8000
),
_Handler
)
server
=
_ThreadingHTTPServer
((
"localhost"
,
8000
),
_Handler
)
def
beginServing
():
def
beginServing
():
...
@@ -56,7 +65,6 @@ def setContent(newContent):
...
@@ -56,7 +65,6 @@ def setContent(newContent):
global
content
global
content
content
=
newContent
content
=
newContent
def
setCallback
(
newCallback
):
def
setCallback
(
newCallback
,
path
=
"/"
):
global
callback
global
callback
callback
=
newCallback
callback
[
path
]
=
newCallback
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