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- Apdbtbx::PDBstructure representing the entire protein.target_residues_numbers- A vector of references topdbtbx::Residueobjects representing the target residues.radius- Af64value 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
- Constructs a K-d tree from all atom coordinates in the PDB structure.
- 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.
- Removes the target residues from the result set.
- Sorts the resulting residue serial numbers.
§Notes
- The function uses the
KdTreedata 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.