Bio.PDB.NeighborSearch module

Fast atom neighbor lookup using a KD tree (implemented in C).

class Bio.PDB.NeighborSearch.NeighborSearch(atom_list, bucket_size=10)

Bases: object

Class for neighbor searching.

This class can be used for two related purposes:

  1. To find all atoms/residues/chains/models/structures within radius of a given query position.

  2. To find all atoms/residues/chains/models/structures that are within a fixed radius of each other.

NeighborSearch makes use of the KDTree class implemented in C for speed.

__init__(self, atom_list, bucket_size=10)

Create the object.

Arguments:
  • atom_list - list of atoms. This list is used in the queries. It can contain atoms from different structures.

  • bucket_size - bucket size of KD tree. You can play around with this to optimize speed if you feel like it.

search(self, center, radius, level='A')

Neighbor search.

Return all atoms/residues/chains/models/structures that have at least one atom within radius of center. What entity level is returned (e.g. atoms or residues) is determined by level (A=atoms, R=residues, C=chains, M=models, S=structures).

Arguments:
  • center - Numeric array

  • radius - float

  • level - char (A, R, C, M, S)

search_all(self, radius, level='A')

All neighbor search.

Search all entities that have atoms pairs within radius.

Arguments:
  • radius - float

  • level - char (A, R, C, M, S)