neighbor_search

Function neighbor_search 

Source
pub fn neighbor_search(
    pdb: PDB,
    target_residues_numbers: Vec<&Residue>,
    radius: f64,
) -> Vec<isize>
Expand description

Performs a neighbor search for residues within a specified radius of target residues.

This function uses a K-d tree to efficiently find residues that are within a given radius of any atom in the target residues.

§Arguments

  • pdb - A pdbtbx::PDB structure representing the entire protein.
  • target_residues_numbers - A vector of references to pdbtbx::Residue objects representing the target residues.
  • radius - A f64 value specifying the search radius in Angstroms.

§Returns

A Vec<isize> containing the sorted serial numbers of residues that are within the specified radius of any atom in the target residues, excluding the target residues themselves.

§Algorithm

  1. Constructs a K-d tree from all atom coordinates in the PDB structure.
  2. For each atom in the target residues: a. Performs a radius search in the K-d tree. b. Identifies the residues corresponding to the atoms found in the search.
  3. Removes the target residues from the result set.
  4. Sorts the resulting residue serial numbers.

§Notes

  • The function uses the KdTree data structure for efficient spatial searching.
  • The current implementation may have performance bottlenecks in the atom-to-residue mapping step.
  • The function assumes that atom coordinates are unique for identification purposes.

§TODO

  • Optimize the atom-to-residue mapping step for better performance.