"platforms/vscode:/vscode.git/clone" did not exist on "6ed5bc4ee2f01e69de99dbd5def56698ce9fe344"
Commit db637054 authored by João Rodrigues's avatar João Rodrigues
Browse files

Changed all 'label_*' calls to 'auth_*' calls to match PDB format specifications.

parent 9a5004bf
...@@ -80,10 +80,9 @@ class PDBxFile(object): ...@@ -80,10 +80,9 @@ class PDBxFile(object):
# Build the topology. # Build the topology.
atomData = block.getObj('atom_site') atomData = block.getObj('atom_site')
atomNameCol = atomData.getAttributeIndex('label_atom_id') atomNameCol = atomData.getAttributeIndex('auth_atom_id')
atomIdCol = atomData.getAttributeIndex('id') atomIdCol = atomData.getAttributeIndex('id')
resNameCol = atomData.getAttributeIndex('label_comp_id') resNameCol = atomData.getAttributeIndex('auth_comp_id')
resIdCol = atomData.getAttributeIndex('label_seq_id')
resNumCol = atomData.getAttributeIndex('auth_seq_id') resNumCol = atomData.getAttributeIndex('auth_seq_id')
chainIdCol = atomData.getAttributeIndex('auth_asym_id') chainIdCol = atomData.getAttributeIndex('auth_asym_id')
elementCol = atomData.getAttributeIndex('type_symbol') elementCol = atomData.getAttributeIndex('type_symbol')
...@@ -98,7 +97,7 @@ class PDBxFile(object): ...@@ -98,7 +97,7 @@ class PDBxFile(object):
atomsInResidue = set() atomsInResidue = set()
models = [] models = []
for row in atomData.getRowList(): for row in atomData.getRowList():
atomKey = ((row[resIdCol], row[chainIdCol], row[atomNameCol])) atomKey = ((row[resNumCol], row[chainIdCol], 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)
...@@ -116,10 +115,10 @@ class PDBxFile(object): ...@@ -116,10 +115,10 @@ class PDBxFile(object):
chain = top.addChain(row[chainIdCol]) chain = top.addChain(row[chainIdCol])
lastChainId = row[chainIdCol] lastChainId = row[chainIdCol]
lastResId = None lastResId = None
if lastResId != row[resIdCol] or lastChainId != row[chainIdCol] or (lastResId == '.' and row[atomNameCol] in atomsInResidue): if lastResId != row[resNumCol] or lastChainId != row[chainIdCol] or (lastResId == '.' and row[atomNameCol] in atomsInResidue):
# The start of a new residue. # The start of a new residue.
res = top.addResidue(row[resNameCol], chain, None if resNumCol == -1 else row[resNumCol]) res = top.addResidue(row[resNameCol], chain, None if resNumCol == -1 else row[resNumCol])
lastResId = row[resIdCol] lastResId = row[resNumCol]
atomsInResidue.clear() atomsInResidue.clear()
element = None element = None
try: try:
...@@ -135,7 +134,7 @@ class PDBxFile(object): ...@@ -135,7 +134,7 @@ class PDBxFile(object):
try: try:
atom = atomTable[atomKey] atom = atomTable[atomKey]
except KeyError: except KeyError:
raise ValueError('Unknown atom %s in residue %s %s for model %s' % (row[atomNameCol], row[resNameCol], row[resIdCol], model)) raise ValueError('Unknown atom %s in residue %s %s for model %s' % (row[atomNameCol], row[resNameCol], row[resNumCol], model))
if atom.index != len(self._positions[modelIndex]): if atom.index != len(self._positions[modelIndex]):
raise ValueError('Atom %s for model %s does not match the order of atoms for model %s' % (row[atomIdCol], model, models[0])) raise ValueError('Atom %s for model %s does not match the order of atoms for model %s' % (row[atomIdCol], model, models[0]))
self._positions[modelIndex].append(Vec3(float(row[xCol]), float(row[yCol]), float(row[zCol]))*0.1) self._positions[modelIndex].append(Vec3(float(row[xCol]), float(row[yCol]), float(row[zCol]))*0.1)
......
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