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
6d75bb33
Commit
6d75bb33
authored
Oct 24, 2014
by
peastman
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #58 from leeping/master
PDBFixer writes a remark containing the original source
parents
233d3fc5
e05aa4a2
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 @
6d75bb33
...
...
@@ -166,12 +166,14 @@ class PDBFixer(object):
>>> fixer = PDBFixer(pdbid=pdbid)
"""
# Check to make sure only one option has been specified.
if
bool
(
filename
)
+
bool
(
file
)
+
bool
(
url
)
+
bool
(
pdbid
)
!=
1
:
raise
Exception
(
"Exactly one option [filename, file, url, pdbid] must be specified."
)
self
.
source
=
None
if
filename
:
self
.
source
=
filename
# A local file has been specified.
file
=
open
(
filename
,
'r'
)
structure
=
PdbStructure
(
file
)
...
...
@@ -180,6 +182,7 @@ class PDBFixer(object):
# A file-like object has been specified.
structure
=
PdbStructure
(
file
)
elif
url
:
self
.
source
=
url
# A URL has been specified.
file
=
urlopen
(
url
)
structure
=
PdbStructure
(
file
)
...
...
@@ -187,6 +190,7 @@ class PDBFixer(object):
elif
pdbid
:
# A PDB id has been specified.
url
=
'http://www.rcsb.org/pdb/files/
%
s.pdb'
%
pdbid
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
()
...
...
@@ -1035,7 +1039,10 @@ def main():
if
options
.
box
is
not
None
:
fixer
.
addSolvent
(
boxSize
=
options
.
box
*
unit
.
nanometer
,
positiveIon
=
options
.
positiveIon
,
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__'
:
main
()
pdbfixer/ui.py
View file @
6d75bb33
...
...
@@ -106,6 +106,8 @@ def addHydrogensPageCallback(parameters, handler):
def
saveFilePageCallback
(
parameters
,
handler
):
if
'save'
in
parameters
:
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
)
handler
.
sendDownload
(
output
.
getvalue
(),
'output.pdb'
)
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