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 @@ ...@@ -129,7 +129,7 @@
<Atom name="HE1" alt1="HE"/> <Atom name="HE1" alt1="HE"/>
<Atom name="HE2" alt1="HNE" alt2="HNE2"/> <Atom name="HE2" alt1="HNE" alt2="HNE2"/>
</Residue> </Residue>
<Residue name="ASP" type="Protein"> <Residue name="ASP" type="Protein" alt1="ASH">
<Atom name="HB2" alt1="2HB"/> <Atom name="HB2" alt1="2HB"/>
<Atom name="HB3" alt1="HB1" alt2="1HB" alt3="3HB"/> <Atom name="HB3" alt1="HB1" alt2="1HB" alt3="3HB"/>
</Residue> </Residue>
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
<Atom name="HD21" alt1="1HD2" alt2="HND1"/> <Atom name="HD21" alt1="1HD2" alt2="HND1"/>
<Atom name="HD22" alt1="2HD2" alt2="HND2"/> <Atom name="HD22" alt1="2HD2" alt2="HND2"/>
</Residue> </Residue>
<Residue name="GLU" type="Protein"> <Residue name="GLU" type="Protein" alt1="GLH">
<Atom name="HB2" alt1="2HB"/> <Atom name="HB2" alt1="2HB"/>
<Atom name="HB3" alt1="HB1" alt2="1HB" alt3="3HB"/> <Atom name="HB3" alt1="HB1" alt2="1HB" alt3="3HB"/>
<Atom name="HG2" alt1="2HG"/> <Atom name="HG2" alt1="2HG"/>
......
...@@ -66,6 +66,7 @@ class PDBxFile(object): ...@@ -66,6 +66,7 @@ class PDBxFile(object):
## The Topology read from the PDBx/mmCIF file ## The Topology read from the PDBx/mmCIF file
self.topology = top self.topology = top
self._positions = [] self._positions = []
PDBFile._loadNameReplacementTables()
# Load the file. # Load the file.
...@@ -152,7 +153,14 @@ class PDBxFile(object): ...@@ -152,7 +153,14 @@ class PDBxFile(object):
# 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])
resIC = insertionCode 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] lastResId = row[resNumCol]
lastInsertionCode = insertionCode lastInsertionCode = insertionCode
atomsInResidue.clear() atomsInResidue.clear()
...@@ -161,9 +169,12 @@ class PDBxFile(object): ...@@ -161,9 +169,12 @@ class PDBxFile(object):
element = elem.get_by_symbol(row[elementCol]) element = elem.get_by_symbol(row[elementCol])
except KeyError: except KeyError:
pass 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 atomTable[atomKey] = atom
atomsInResidue.add(row[atomNameCol]) atomsInResidue.add(atomName)
else: else:
# This row defines coordinates for an existing atom in one of the later models. # 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