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
e05aa4a2
Commit
e05aa4a2
authored
Oct 24, 2014
by
Lee-Ping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PDBFixer writes a remark containing the original source
parent
233d3fc5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
pdbfixer/pdbfixer.py
+9
-2
pdbfixer/ui.py
+2
-0
No files found.
pdbfixer/pdbfixer.py
View file @
e05aa4a2
...
@@ -166,12 +166,14 @@ class PDBFixer(object):
...
@@ -166,12 +166,14 @@ class PDBFixer(object):
>>> fixer = PDBFixer(pdbid=pdbid)
>>> fixer = PDBFixer(pdbid=pdbid)
"""
"""
# Check to make sure only one option has been specified.
# Check to make sure only one option has been specified.
if
bool
(
filename
)
+
bool
(
file
)
+
bool
(
url
)
+
bool
(
pdbid
)
!=
1
:
if
bool
(
filename
)
+
bool
(
file
)
+
bool
(
url
)
+
bool
(
pdbid
)
!=
1
:
raise
Exception
(
"Exactly one option [filename, file, url, pdbid] must be specified."
)
raise
Exception
(
"Exactly one option [filename, file, url, pdbid] must be specified."
)
self
.
source
=
None
if
filename
:
if
filename
:
self
.
source
=
filename
# A local file has been specified.
# A local file has been specified.
file
=
open
(
filename
,
'r'
)
file
=
open
(
filename
,
'r'
)
structure
=
PdbStructure
(
file
)
structure
=
PdbStructure
(
file
)
...
@@ -180,6 +182,7 @@ class PDBFixer(object):
...
@@ -180,6 +182,7 @@ class PDBFixer(object):
# A file-like object has been specified.
# A file-like object has been specified.
structure
=
PdbStructure
(
file
)
structure
=
PdbStructure
(
file
)
elif
url
:
elif
url
:
self
.
source
=
url
# A URL has been specified.
# A URL has been specified.
file
=
urlopen
(
url
)
file
=
urlopen
(
url
)
structure
=
PdbStructure
(
file
)
structure
=
PdbStructure
(
file
)
...
@@ -187,6 +190,7 @@ class PDBFixer(object):
...
@@ -187,6 +190,7 @@ class PDBFixer(object):
elif
pdbid
:
elif
pdbid
:
# A PDB id has been specified.
# A PDB id has been specified.
url
=
'http://www.rcsb.org/pdb/files/
%
s.pdb'
%
pdbid
url
=
'http://www.rcsb.org/pdb/files/
%
s.pdb'
%
pdbid
self
.
source
=
url
file
=
urlopen
(
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.
# 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
()
...
@@ -1035,7 +1039,10 @@ def main():
...
@@ -1035,7 +1039,10 @@ def main():
if
options
.
box
is
not
None
:
if
options
.
box
is
not
None
:
fixer
.
addSolvent
(
boxSize
=
options
.
box
*
unit
.
nanometer
,
positiveIon
=
options
.
positiveIon
,
fixer
.
addSolvent
(
boxSize
=
options
.
box
*
unit
.
nanometer
,
positiveIon
=
options
.
positiveIon
,
negativeIon
=
options
.
negativeIon
,
ionicStrength
=
options
.
ionic
*
unit
.
molar
)
negativeIon
=
options
.
negativeIon
,
ionicStrength
=
options
.
ionic
*
unit
.
molar
)
app
.
PDBFile
.
writeFile
(
fixer
.
topology
,
fixer
.
positions
,
open
(
options
.
output
,
'w'
))
with
open
(
options
.
output
,
'w'
)
as
f
:
if
fixer
.
source
is
not
None
:
f
.
write
(
"REMARK 1 PDBFIXER FROM:
%
s
\n
"
%
fixer
.
source
)
app
.
PDBFile
.
writeFile
(
fixer
.
topology
,
fixer
.
positions
,
f
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
main
()
main
()
pdbfixer/ui.py
View file @
e05aa4a2
...
@@ -106,6 +106,8 @@ def addHydrogensPageCallback(parameters, handler):
...
@@ -106,6 +106,8 @@ def addHydrogensPageCallback(parameters, handler):
def
saveFilePageCallback
(
parameters
,
handler
):
def
saveFilePageCallback
(
parameters
,
handler
):
if
'save'
in
parameters
:
if
'save'
in
parameters
:
output
=
StringIO
()
output
=
StringIO
()
if
fixer
.
source
is
not
None
:
output
.
write
(
"REMARK 1 PDBFIXER FROM:
%
s
\n
"
%
fixer
.
source
)
app
.
PDBFile
.
writeFile
(
fixer
.
topology
,
fixer
.
positions
,
output
)
app
.
PDBFile
.
writeFile
(
fixer
.
topology
,
fixer
.
positions
,
output
)
handler
.
sendDownload
(
output
.
getvalue
(),
'output.pdb'
)
handler
.
sendDownload
(
output
.
getvalue
(),
'output.pdb'
)
else
:
else
:
...
...
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