Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculating HSE with missing atoms on Gly #4708

Open
kacperskakuj opened this issue Apr 24, 2024 · 0 comments
Open

Calculating HSE with missing atoms on Gly #4708

kacperskakuj opened this issue Apr 24, 2024 · 0 comments

Comments

@kacperskakuj
Copy link

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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant