Implement KDTree in PDB Coordinates
Post
Cancel

# Implement KDTree in PDB Coordinates

## Concept

### K-D Tree

In computer science, a k-d tree (short for k-dimensional tree) is a space-partitioning data structure for organizing points in a k-dimensional space. k-d trees are a useful data structure for several applications, such as searches involving a multidimensional search key (e.g. range searches and nearest neighbor searches). k-d trees are a special case of binary space partitioning trees.[1]

### Reference

1. Wikipedia contributors. (2020, September 9). K-d tree. In Wikipedia, The Free Encyclopedia. Retrieved 13:47, September 18, 2020, from https://en.wikipedia.org/w/index.php?title=K-d_tree&oldid=977572387

## Demo

### 2A01.A v.s 2LEM.A (via FATCAT)

 Full SuperImposed Structure

Get all residues within the given radius from the source residue:

1 2 3 4 5 6 7 8 9 query_sites = ["141","142"] res_index_1 = tree1.query_radius( df_model['1'].query(f'atom_name == "CA" & residue_site in {query_sites}')[['x_coord','y_coord','z_coord']].to_numpy(), r=10) res_index_2 = tree2.query_radius( df_model['2'].query(f'atom_name == "CA" & residue_site in {query_sites}')[['x_coord','y_coord','z_coord']].to_numpy(), r=10) res_indexes = [np.intersect1d(*i) for i in zip(res_index_1,res_index_2)] 
 Focus on Particular Subset of SuperImposed Structure