How can I get a list of neighboring Hydrogen atoms of an alpha-carbon?
0
0
Entering edit mode
2.5 years ago
user366312 ▴ 20

Suppose, I want to find the neighboring Hydrogen atoms of a specific C-alpha atom.

from typing import List
from Bio.PDB import Chain, Atom


def get_hydrogen_atoms(c_alpha_atom: Atom.Atom):
    ns = NeighborSearch(c_alpha_atom)
    return ns.search_all(10.0, "H")

p = PDBParser()
structure = p.get_structure('16pk', '16pk.pdb')

c_alpha_list = [atom for atom in structure.get_atoms() if atom.name == 'CA']
hydrogen_list = get_hydrogen_atoms(c_alpha_list[0])

print(hydrogen_list)

Error Output

C:\ProgramData\Miniconda3\python.exe C:/Users/pc/source/repos/_3_extended_features/_dataset_generation.py
Traceback (most recent call last):
  File "C:\Users\pc\source\repos\_3_extended_features\_dataset_generation.py", line 35, in <module>
    hydrogen_list = get_hydrogen_atoms(c_alpha_list[0])
  File "C:\Users\pc\source\repos\_3_extended_features\_dataset_generation.py", line 28, in get_hydrogen_atoms
    ns = NeighborSearch(c_alpha_atom)
  File "C:\ProgramData\Miniconda3\lib\site-packages\Bio\PDB\NeighborSearch.py", line 45, in __init__
    coord_list = [a.get_coord() for a in atom_list]
TypeError: 'Atom' object is not iterable

Process finished with exit code 1

How can I correct this?

Edit:

Passing a list to NeighborSearch() gives out a different error:

def get_hydrogen_atoms(c_alpha_atom: Atom.Atom):
    ns = NeighborSearch([c_alpha_atom])
    return ns.search_all(10.0, "H")

Error Output

C:\ProgramData\Miniconda3\python.exe C:/Users/pc/source/repos/_3_extended_features/_dataset_generation.py
Traceback (most recent call last):
  File "C:\Users\pc\source\repos\_3_extended_features\_dataset_generation.py", line 35, in <module>
    hydrogen_list = get_hydrogen_atoms(c_alpha_list[0])
  File "C:\Users\pc\source\repos\_3_extended_features\_dataset_generation.py", line 29, in get_hydrogen_atoms
    return ns.search_all(10.0, "H")
  File "C:\ProgramData\Miniconda3\lib\site-packages\Bio\PDB\NeighborSearch.py", line 113, in search_all
    raise PDBException("%s: Unknown level" % level)
Bio.PDB.PDBExceptions.PDBException: H: Unknown level

Process finished with exit code 1
python biopython protein • 633 views
ADD COMMENT
0
Entering edit mode

Most PDB structures - the exception being NMR models and possibly some computational models - do not have hydrogens, as they do not scatter x-rays and are thus "invisible." You may want to add them first.

https://github.com/rlabduke/reduce

ADD REPLY

Login before adding your answer.

Traffic: 2937 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6