Unverified Commit f9b6cd5a authored by peastman's avatar peastman Committed by GitHub
Browse files

Merge pull request #2575 from peastman/chain

Improved identification of chain IDs in PDBx/mmCIF files
parents 6786cc75 7db5140a
...@@ -101,6 +101,13 @@ class PDBxFile(object): ...@@ -101,6 +101,13 @@ class PDBxFile(object):
altChainIdCol = -1 altChainIdCol = -1
else: else:
altChainIdCol = atomData.getAttributeIndex('label_asym_id') altChainIdCol = atomData.getAttributeIndex('label_asym_id')
if altChainIdCol != -1:
# Figure out which column is best to use for chain IDs.
idSet = set(row[chainIdCol] for row in atomData.getRowList())
altIdSet = set(row[altChainIdCol] for row in atomData.getRowList())
if len(altIdSet) > len(idSet):
chainIdCol, altChainIdCol = (altChainIdCol, chainIdCol)
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')
......
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