Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
5719a05d
Commit
5719a05d
authored
Sep 05, 2013
by
peastman
Browse files
PdbStructure records SEQRES records
parent
30b4cf1c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
wrappers/python/simtk/openmm/app/internal/pdbstructure.py
wrappers/python/simtk/openmm/app/internal/pdbstructure.py
+13
-0
wrappers/python/simtk/openmm/app/pdbfile.py
wrappers/python/simtk/openmm/app/pdbfile.py
+7
-4
No files found.
wrappers/python/simtk/openmm/app/internal/pdbstructure.py
View file @
5719a05d
...
@@ -138,6 +138,7 @@ class PdbStructure(object):
...
@@ -138,6 +138,7 @@ class PdbStructure(object):
self
.
default_model
=
None
self
.
default_model
=
None
self
.
models_by_number
=
{}
self
.
models_by_number
=
{}
self
.
_unit_cell_dimensions
=
None
self
.
_unit_cell_dimensions
=
None
self
.
sequences
=
[]
# read file
# read file
self
.
_load
(
input_stream
)
self
.
_load
(
input_stream
)
...
@@ -172,6 +173,11 @@ class PdbStructure(object):
...
@@ -172,6 +173,11 @@ class PdbStructure(object):
except
:
except
:
pass
pass
self
.
_current_model
.
connects
.
append
(
atoms
)
self
.
_current_model
.
connects
.
append
(
atoms
)
elif
(
pdb_line
.
find
(
"SEQRES"
)
==
0
):
chain_id
=
pdb_line
[
11
]
if
len
(
self
.
sequences
)
==
0
or
chain_id
!=
self
.
sequences
[
-
1
].
chain_id
:
self
.
sequences
.
append
(
Sequence
(
chain_id
))
self
.
sequences
[
-
1
].
residues
.
extend
(
pdb_line
[
19
:].
split
())
self
.
_finalize
()
self
.
_finalize
()
def
write
(
self
,
output_stream
=
sys
.
stdout
):
def
write
(
self
,
output_stream
=
sys
.
stdout
):
...
@@ -266,6 +272,13 @@ class PdbStructure(object):
...
@@ -266,6 +272,13 @@ class PdbStructure(object):
return
self
.
_unit_cell_dimensions
return
self
.
_unit_cell_dimensions
class
Sequence
(
object
):
"""Sequence holds the sequence of a chain, as specified by SEQRES records."""
def
__init__
(
self
,
chain_id
):
self
.
chain_id
=
chain_id
self
.
residues
=
[]
class
Model
(
object
):
class
Model
(
object
):
"""Model holds one model of a PDB structure.
"""Model holds one model of a PDB structure.
...
...
wrappers/python/simtk/openmm/app/pdbfile.py
View file @
5719a05d
...
@@ -70,10 +70,13 @@ class PDBFile(object):
...
@@ -70,10 +70,13 @@ class PDBFile(object):
# Load the PDB file
# Load the PDB file
inputfile
=
file
if
isinstance
(
file
,
PdbStructure
):
if
isinstance
(
file
,
str
):
pdb
=
file
inputfile
=
open
(
file
)
else
:
pdb
=
PdbStructure
(
inputfile
,
load_all_models
=
True
)
inputfile
=
file
if
isinstance
(
file
,
str
):
inputfile
=
open
(
file
)
pdb
=
PdbStructure
(
inputfile
,
load_all_models
=
True
)
PDBFile
.
_loadNameReplacementTables
()
PDBFile
.
_loadNameReplacementTables
()
# Build the topology
# Build the topology
...
...
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