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
160c1cda
Commit
160c1cda
authored
Nov 06, 2014
by
peastman
Browse files
Bug fixes and improvements to PDBxFile
parent
0d829062
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
wrappers/python/simtk/openmm/app/pdbxfile.py
wrappers/python/simtk/openmm/app/pdbxfile.py
+10
-5
No files found.
wrappers/python/simtk/openmm/app/pdbxfile.py
View file @
160c1cda
...
...
@@ -79,6 +79,7 @@ class PDBxFile(object):
asymIdCol
=
atomData
.
getAttributeIndex
(
'label_asym_id'
)
chainIdCol
=
atomData
.
getAttributeIndex
(
'label_entity_id'
)
elementCol
=
atomData
.
getAttributeIndex
(
'type_symbol'
)
altIdCol
=
atomData
.
getAttributeIndex
(
'label_alt_id'
)
modelCol
=
atomData
.
getAttributeIndex
(
'pdbx_PDB_model_num'
)
xCol
=
atomData
.
getAttributeIndex
(
'Cartn_x'
)
yCol
=
atomData
.
getAttributeIndex
(
'Cartn_y'
)
...
...
@@ -89,13 +90,16 @@ class PDBxFile(object):
atomTable
=
{}
models
=
[]
for
row
in
atomData
.
getRowList
():
asymId
=
(
'A'
if
asymIdCol
==
-
1
else
row
[
asymIdCol
])
atomKey
=
((
row
[
resIdCol
],
asymId
,
row
[
atomNameCol
]))
atomKey
=
((
row
[
resIdCol
],
row
[
asymIdCol
],
row
[
atomNameCol
]))
model
=
(
'1'
if
modelCol
==
-
1
else
row
[
modelCol
])
if
model
not
in
models
:
models
.
append
(
model
)
self
.
_positions
.
append
([])
modelIndex
=
models
.
index
(
model
)
if
row
[
altIdCol
]
!=
'.'
and
atomKey
in
atomTable
and
len
(
self
.
_positions
[
modelIndex
])
>
atomTable
[
atomKey
].
index
:
# This row is an alternate position for an existing atom, so ignore it.
continue
if
modelIndex
==
0
:
# This row defines a new atom.
...
...
@@ -105,11 +109,13 @@ class PDBxFile(object):
lastChainId
=
row
[
chainIdCol
]
lastResId
=
None
lastAsymId
=
None
if
lastResId
!=
row
[
resIdCol
]
or
lastAsymId
!=
asymId
:
if
lastResId
!=
row
[
resIdCol
]
or
lastAsymId
!=
row
[
asymId
Col
]
:
# The start of a new residue.
res
=
top
.
addResidue
(
row
[
resNameCol
],
chain
)
lastResId
=
row
[
resIdCol
]
lastAsymId
=
asymId
if
lastResId
==
'.'
:
lastResId
=
None
lastAsymId
=
row
[
asymIdCol
]
element
=
None
try
:
element
=
elem
.
get_by_symbol
(
row
[
elementCol
])
...
...
@@ -132,7 +138,6 @@ class PDBxFile(object):
## The atom positions read from the PDBx/mmCIF file. If the file contains multiple frames, these are the positions in the first frame.
self
.
positions
=
self
.
_positions
[
0
]
self
.
topology
.
createStandardBonds
()
self
.
topology
.
createDisulfideBonds
(
self
.
positions
)
self
.
_numpyPositions
=
None
# Record unit cell information, if present.
...
...
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