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
9e10769a
Commit
9e10769a
authored
Nov 06, 2014
by
peastman
Browse files
Merge pull request #706 from peastman/pdbx
Bug fixes and improvements to PDBxFile
parents
51fc7a1e
160c1cda
Changes
1
Hide 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 @
9e10769a
...
@@ -79,6 +79,7 @@ class PDBxFile(object):
...
@@ -79,6 +79,7 @@ class PDBxFile(object):
asymIdCol
=
atomData
.
getAttributeIndex
(
'label_asym_id'
)
asymIdCol
=
atomData
.
getAttributeIndex
(
'label_asym_id'
)
chainIdCol
=
atomData
.
getAttributeIndex
(
'label_entity_id'
)
chainIdCol
=
atomData
.
getAttributeIndex
(
'label_entity_id'
)
elementCol
=
atomData
.
getAttributeIndex
(
'type_symbol'
)
elementCol
=
atomData
.
getAttributeIndex
(
'type_symbol'
)
altIdCol
=
atomData
.
getAttributeIndex
(
'label_alt_id'
)
modelCol
=
atomData
.
getAttributeIndex
(
'pdbx_PDB_model_num'
)
modelCol
=
atomData
.
getAttributeIndex
(
'pdbx_PDB_model_num'
)
xCol
=
atomData
.
getAttributeIndex
(
'Cartn_x'
)
xCol
=
atomData
.
getAttributeIndex
(
'Cartn_x'
)
yCol
=
atomData
.
getAttributeIndex
(
'Cartn_y'
)
yCol
=
atomData
.
getAttributeIndex
(
'Cartn_y'
)
...
@@ -89,13 +90,16 @@ class PDBxFile(object):
...
@@ -89,13 +90,16 @@ class PDBxFile(object):
atomTable
=
{}
atomTable
=
{}
models
=
[]
models
=
[]
for
row
in
atomData
.
getRowList
():
for
row
in
atomData
.
getRowList
():
asymId
=
(
'A'
if
asymIdCol
==
-
1
else
row
[
asymIdCol
])
atomKey
=
((
row
[
resIdCol
],
row
[
asymIdCol
],
row
[
atomNameCol
]))
atomKey
=
((
row
[
resIdCol
],
asymId
,
row
[
atomNameCol
]))
model
=
(
'1'
if
modelCol
==
-
1
else
row
[
modelCol
])
model
=
(
'1'
if
modelCol
==
-
1
else
row
[
modelCol
])
if
model
not
in
models
:
if
model
not
in
models
:
models
.
append
(
model
)
models
.
append
(
model
)
self
.
_positions
.
append
([])
self
.
_positions
.
append
([])
modelIndex
=
models
.
index
(
model
)
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
:
if
modelIndex
==
0
:
# This row defines a new atom.
# This row defines a new atom.
...
@@ -105,11 +109,13 @@ class PDBxFile(object):
...
@@ -105,11 +109,13 @@ class PDBxFile(object):
lastChainId
=
row
[
chainIdCol
]
lastChainId
=
row
[
chainIdCol
]
lastResId
=
None
lastResId
=
None
lastAsymId
=
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.
# The start of a new residue.
res
=
top
.
addResidue
(
row
[
resNameCol
],
chain
)
res
=
top
.
addResidue
(
row
[
resNameCol
],
chain
)
lastResId
=
row
[
resIdCol
]
lastResId
=
row
[
resIdCol
]
lastAsymId
=
asymId
if
lastResId
==
'.'
:
lastResId
=
None
lastAsymId
=
row
[
asymIdCol
]
element
=
None
element
=
None
try
:
try
:
element
=
elem
.
get_by_symbol
(
row
[
elementCol
])
element
=
elem
.
get_by_symbol
(
row
[
elementCol
])
...
@@ -132,7 +138,6 @@ class PDBxFile(object):
...
@@ -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.
## 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
.
positions
=
self
.
_positions
[
0
]
self
.
topology
.
createStandardBonds
()
self
.
topology
.
createStandardBonds
()
self
.
topology
.
createDisulfideBonds
(
self
.
positions
)
self
.
_numpyPositions
=
None
self
.
_numpyPositions
=
None
# Record unit cell information, if present.
# 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