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

bug fix chainsHB no ligand #1991

Merged
merged 1 commit into from
Nov 15, 2024
Merged

Conversation

jamesmkrieger
Copy link
Contributor

When there are no hydrogen bonds between chains with the current parameters, we can get this error if there's no ligand either, but it works if we loosen the criteria.

In [1]: from prody import *

In [2]: PDBfile = 'addH_9asd.pdb'

In [3]: atomsRL = parsePDB(PDBfile).select('protein and chain R L')

In [4]: chHB_RL = calcChHydrogenBonds(atomsRL)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[4], line 1
----> 1 chHB_RL = calcChHydrogenBonds(atomsRL)

File ~/software/scipion3/software/em/prody-github/ProDy/prody/proteins/interactions.py:713, in calcChHydrogenBonds(atoms, **kwargs)
    711 ChainsHBs = [ i for i in HBS_calculations if str(i[2]) != str(i[5]) ]
    712 if not ChainsHBs:
--> 713     ligand_name = list(set(atoms.select('all not protein and not ion').getResnames()))[0]
    714     ChainsHBs = [ ii for ii in HBS_calculations if ii[0][:3] == ligand_name or ii[3][:3] == ligand_name ]
    716 return ChainsHBs

AttributeError: 'NoneType' object has no attribute 'getResnames'

In [5]: chHB_RL = calcChHydrogenBonds(atomsRL, angle=90, distA=4)

In [6]: chHB_RL
Out[6]: 
[['ASN417', 'N_4667', 'R', 'TYR34', 'OH_2300', 'L', 2.7602, 49.0483],
 ['TYR93', 'OH_3186', 'L', 'THR415', 'OG1_4658', 'R', 3.0228, 69.6565],
 ['TYR34', 'OH_2300', 'L', 'GLN409', 'NE2_4576', 'R', 3.3524, 52.5221],
 ['GLN409', 'NE2_4576', 'R', 'TYR34', 'OH_2300', 'L', 3.3524, 63.639],
 ['ASN33', 'ND2_2278', 'L', 'ASN405', 'ND2_4517', 'R', 3.5242, 60.8902],
 ['ASN405', 'ND2_4517', 'R', 'ASN33', 'ND2_2278', 'L', 3.5242, 74.5393],
 ['LYS460', 'NZ_5388', 'R', 'TYR97', 'OH_3235', 'L', 3.5589, 52.5927],
 ['ASN33', 'ND2_2278', 'L', 'ASN405', 'OD1_4516', 'R', 3.83, 69.8678]]

With the fix, it will still try for a ligand if there is one but otherwise we just get an empty list without an error:

In [4]: chHB_RL = calcChHydrogenBonds(atomsRL)

In [5]: chHB_RL
Out[5]: []

In [6]: chHB_RL = calcChHydrogenBonds(atomsRL, angle=90, distA=4)

In [7]: chHB_RL
Out[7]: 
[['ASN417', 'N_4667', 'R', 'TYR34', 'OH_2300', 'L', 2.7602, 49.0483],
 ['TYR93', 'OH_3186', 'L', 'THR415', 'OG1_4658', 'R', 3.0228, 69.6565],
 ['TYR34', 'OH_2300', 'L', 'GLN409', 'NE2_4576', 'R', 3.3524, 52.5221],
 ['GLN409', 'NE2_4576', 'R', 'TYR34', 'OH_2300', 'L', 3.3524, 63.639],
 ['ASN33', 'ND2_2278', 'L', 'ASN405', 'ND2_4517', 'R', 3.5242, 60.8902],
 ['ASN405', 'ND2_4517', 'R', 'ASN33', 'ND2_2278', 'L', 3.5242, 74.5393],
 ['LYS460', 'NZ_5388', 'R', 'TYR97', 'OH_3235', 'L', 3.5589, 52.5927],
 ['ASN33', 'ND2_2278', 'L', 'ASN405', 'OD1_4516', 'R', 3.83, 69.8678]]

@jamesmkrieger jamesmkrieger merged commit e20a87c into prody:main Nov 15, 2024
6 checks passed
@jamesmkrieger jamesmkrieger deleted the chHB_no_lig branch November 19, 2024 10:03
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

Successfully merging this pull request may close these issues.

2 participants