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
c8bc7593
Commit
c8bc7593
authored
Feb 18, 2020
by
peastman
Browse files
Add chain break when either auth_asym_id or label_asym_id changes
parent
484e6b99
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
wrappers/python/simtk/openmm/app/pdbxfile.py
wrappers/python/simtk/openmm/app/pdbxfile.py
+8
-2
No files found.
wrappers/python/simtk/openmm/app/pdbxfile.py
View file @
c8bc7593
...
@@ -6,7 +6,7 @@ Simbios, the NIH National Center for Physics-Based Simulation of
...
@@ -6,7 +6,7 @@ Simbios, the NIH National Center for Physics-Based Simulation of
Biological Structures at Stanford, funded under the NIH Roadmap for
Biological Structures at Stanford, funded under the NIH Roadmap for
Medical Research, grant U54 GM072970. See https://simtk.org.
Medical Research, grant U54 GM072970. See https://simtk.org.
Portions copyright (c) 2015-20
19
Stanford University and the Authors.
Portions copyright (c) 2015-20
20
Stanford University and the Authors.
Authors: Peter Eastman
Authors: Peter Eastman
Contributors: Jason Swails
Contributors: Jason Swails
...
@@ -98,6 +98,9 @@ class PDBxFile(object):
...
@@ -98,6 +98,9 @@ class PDBxFile(object):
chainIdCol
=
atomData
.
getAttributeIndex
(
'auth_asym_id'
)
chainIdCol
=
atomData
.
getAttributeIndex
(
'auth_asym_id'
)
if
chainIdCol
==
-
1
:
if
chainIdCol
==
-
1
:
chainIdCol
=
atomData
.
getAttributeIndex
(
'label_asym_id'
)
chainIdCol
=
atomData
.
getAttributeIndex
(
'label_asym_id'
)
altChainIdCol
=
-
1
else
:
altChainIdCol
=
atomData
.
getAttributeIndex
(
'label_asym_id'
)
elementCol
=
atomData
.
getAttributeIndex
(
'type_symbol'
)
elementCol
=
atomData
.
getAttributeIndex
(
'type_symbol'
)
altIdCol
=
atomData
.
getAttributeIndex
(
'label_alt_id'
)
altIdCol
=
atomData
.
getAttributeIndex
(
'label_alt_id'
)
modelCol
=
atomData
.
getAttributeIndex
(
'pdbx_PDB_model_num'
)
modelCol
=
atomData
.
getAttributeIndex
(
'pdbx_PDB_model_num'
)
...
@@ -105,6 +108,7 @@ class PDBxFile(object):
...
@@ -105,6 +108,7 @@ class PDBxFile(object):
yCol
=
atomData
.
getAttributeIndex
(
'Cartn_y'
)
yCol
=
atomData
.
getAttributeIndex
(
'Cartn_y'
)
zCol
=
atomData
.
getAttributeIndex
(
'Cartn_z'
)
zCol
=
atomData
.
getAttributeIndex
(
'Cartn_z'
)
lastChainId
=
None
lastChainId
=
None
lastAltChainId
=
None
lastResId
=
None
lastResId
=
None
lastInsertionCode
=
''
lastInsertionCode
=
''
atomTable
=
{}
atomTable
=
{}
...
@@ -130,11 +134,13 @@ class PDBxFile(object):
...
@@ -130,11 +134,13 @@ class PDBxFile(object):
insertionCode
=
row
[
resInsertionCol
]
insertionCode
=
row
[
resInsertionCol
]
if
insertionCode
in
(
'.'
,
'?'
):
if
insertionCode
in
(
'.'
,
'?'
):
insertionCode
=
''
insertionCode
=
''
if
lastChainId
!=
row
[
chainIdCol
]:
if
lastChainId
!=
row
[
chainIdCol
]
or
(
altChainIdCol
!=
-
1
and
lastAltChainId
!=
row
[
altChainIdCol
])
:
# The start of a new chain.
# The start of a new chain.
chain
=
top
.
addChain
(
row
[
chainIdCol
])
chain
=
top
.
addChain
(
row
[
chainIdCol
])
lastChainId
=
row
[
chainIdCol
]
lastChainId
=
row
[
chainIdCol
]
lastResId
=
None
lastResId
=
None
if
altChainIdCol
!=
-
1
:
lastAltChainId
=
row
[
altChainIdCol
]
if
lastResId
!=
row
[
resNumCol
]
or
lastChainId
!=
row
[
chainIdCol
]
or
lastInsertionCode
!=
insertionCode
or
(
lastResId
==
'.'
and
row
[
atomNameCol
]
in
atomsInResidue
):
if
lastResId
!=
row
[
resNumCol
]
or
lastChainId
!=
row
[
chainIdCol
]
or
lastInsertionCode
!=
insertionCode
or
(
lastResId
==
'.'
and
row
[
atomNameCol
]
in
atomsInResidue
):
# The start of a new residue.
# The start of a new residue.
resId
=
(
None
if
resNumCol
==
-
1
else
row
[
resNumCol
])
resId
=
(
None
if
resNumCol
==
-
1
else
row
[
resNumCol
])
...
...
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