You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Residues with missing atoms necessary for HSE calculation should be ignored. This is accomplished by Line 70 of HSExposure.py that catches 'None' returned by _get_cb (which could be due to missing atoms, e.g., see lines 183 or 271) and skips over the residue. However, when the residue is GLY and has atoms missing (making the vector impossible to calculate), then _get_cb function in HSExposureCB (line 265) (and possibly HSExposureCA) will return the tuple (None, 0.0) with only the vector component as None and angle as 0.0. This will not be caught at line 70 and cause an exception later when trying to use the angle value (e.g., on Line 89 d.angle(pcb) where pcb is the angle None).
Actual behaviour
Uncaught exception: AttributeError: 'NoneType' object has no attribute 'norm' from calling angle() in Bio/PDB/vectors.py
Steps to reproduce
This occurs with structure PDB ID 7QYA, where chain U residue 7 is GLY with a missing N atom.
import requests
from Bio.PDB.MMCIFParser import FastMMCIFParser
from Bio.PDB.HSExposure import HSExposureCB
response = requests.get("https://files.rcsb.org/download/7QYA-assembly1.cif")
filename = "7QYA.cif"
with open(filename, "w") as outfile:
outfile.write(response.text)
parser = FastMMCIFParser(QUIET=True)
structure = parser.get_structure("7QYA", filename)
HSExposureCB(structure[0])
An additional conditional statement in _get_cb that returns only None (instead of a tuple) if the vector is None should solve this issue. I can make the change and submit a PR if you think that's a reasonable approach.
The text was updated successfully, but these errors were encountered:
Setup
I am reporting a problem with Biopython version, Python version, and operating
system as follows:
Python 3.12.2
CPython
macOS-14.2.1-arm64-arm-64bit
Biopython 1.83
Expected behaviour
Residues with missing atoms necessary for HSE calculation should be ignored. This is accomplished by Line 70 of HSExposure.py that catches 'None' returned by
_get_cb
(which could be due to missing atoms, e.g., see lines 183 or 271) and skips over the residue. However, when the residue is GLY and has atoms missing (making the vector impossible to calculate), then_get_cb
function in HSExposureCB (line 265) (and possibly HSExposureCA) will return the tuple(None, 0.0)
with only the vector component asNone
and angle as0.0
. This will not be caught at line 70 and cause an exception later when trying to use the angle value (e.g., on Line 89d.angle(pcb)
wherepcb
is the angleNone
).Actual behaviour
Uncaught exception:
AttributeError: 'NoneType' object has no attribute 'norm'
from callingangle()
in Bio/PDB/vectors.pySteps to reproduce
This occurs with structure PDB ID 7QYA, where chain U residue 7 is GLY with a missing N atom.
An additional conditional statement in
_get_cb
that returns onlyNone
(instead of a tuple) if the vector isNone
should solve this issue. I can make the change and submit a PR if you think that's a reasonable approach.The text was updated successfully, but these errors were encountered: