Unverified Commit dd80fb3f authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

PDBxFile replaces nonstandard names with standard ones (#3659)

parent e9534c15
......@@ -129,7 +129,7 @@
<Atom name="HE1" alt1="HE"/>
<Atom name="HE2" alt1="HNE" alt2="HNE2"/>
</Residue>
<Residue name="ASP" type="Protein">
<Residue name="ASP" type="Protein" alt1="ASH">
<Atom name="HB2" alt1="2HB"/>
<Atom name="HB3" alt1="HB1" alt2="1HB" alt3="3HB"/>
</Residue>
......@@ -141,7 +141,7 @@
<Atom name="HD21" alt1="1HD2" alt2="HND1"/>
<Atom name="HD22" alt1="2HD2" alt2="HND2"/>
</Residue>
<Residue name="GLU" type="Protein">
<Residue name="GLU" type="Protein" alt1="GLH">
<Atom name="HB2" alt1="2HB"/>
<Atom name="HB3" alt1="HB1" alt2="1HB" alt3="3HB"/>
<Atom name="HG2" alt1="2HG"/>
......
......@@ -66,6 +66,7 @@ class PDBxFile(object):
## The Topology read from the PDBx/mmCIF file
self.topology = top
self._positions = []
PDBFile._loadNameReplacementTables()
# Load the file.
......@@ -152,7 +153,14 @@ class PDBxFile(object):
# The start of a new residue.
resId = (None if resNumCol == -1 else row[resNumCol])
resIC = insertionCode
res = top.addResidue(row[resNameCol], chain, resId, resIC)
resName = row[resNameCol]
if resName in PDBFile._residueNameReplacements:
resName = PDBFile._residueNameReplacements[resName]
res = top.addResidue(resName, chain, resId, resIC)
if resName in PDBFile._atomNameReplacements:
atomReplacements = PDBFile._atomNameReplacements[resName]
else:
atomReplacements = {}
lastResId = row[resNumCol]
lastInsertionCode = insertionCode
atomsInResidue.clear()
......@@ -161,9 +169,12 @@ class PDBxFile(object):
element = elem.get_by_symbol(row[elementCol])
except KeyError:
pass
atom = top.addAtom(row[atomNameCol], element, res, row[atomIdCol])
atomName = row[atomNameCol]
if atomName in atomReplacements:
atomName = atomReplacements[atomName]
atom = top.addAtom(atomName, element, res, row[atomIdCol])
atomTable[atomKey] = atom
atomsInResidue.add(row[atomNameCol])
atomsInResidue.add(atomName)
else:
# This row defines coordinates for an existing atom in one of the later models.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment