pdbfixer icon indicating copy to clipboard operation
pdbfixer copied to clipboard

fix add missing unknown (UNK) residues error

Open ndonyapour opened this issue 1 year ago • 3 comments

Hello, I am trying to run pdbfixer with these arguments pdbfixer --pdbid=6fs0 --add-atoms=all --replace-nonstandard --add-residues --replace-nonstandard but I ran into the error below. It seems that pdbfixer tries to add a missing unknown residue to the structure.

Traceback (most recent call last):
  File "/home/donyapourn2/actions-runner/_work/workflow-inference-compiler/workflow-inference-compiler/3/envs/tests/bin/pdbfixer", line 33, in <module>
    sys.exit(load_entry_point('pdbfixer', 'console_scripts', 'pdbfixer')())
  File "/home/donyapourn2/projects/wic/pdbfixer/pdbfixer/pdbfixer.py", line 1283, in main
    fixer.addMissingAtoms()
  File "/home/donyapourn2/projects/wic/pdbfixer/pdbfixer/pdbfixer.py", line 902, in addMissingAtoms
    (newTopology, newPositions, newAtoms, existingAtomMap) = self._addAtomsToTopology(True, True)
  File "/home/donyapourn2/projects/wic/pdbfixer/pdbfixer/pdbfixer.py", line 400, in _addAtomsToTopology
    self._addMissingResiduesToChain(newChain, insertHere, startPosition, endPosition, loopDirection, residue, newAtoms, newPositions, firstIndex)
  File "/home/donyapourn2/projects/wic/pdbfixer/pdbfixer/pdbfixer.py", line 511, in _addMissingResiduesToChain
    template = self.templates[residueName]
KeyError: 'UNK'

This PR fixes this error by checking the residue before adding it.

Best, Nazanin

ndonyapour avatar Dec 26 '23 18:12 ndonyapour