Skip to content

Instantly share code, notes, and snippets.

@myociss
Created June 5, 2025 20:39
Show Gist options
  • Save myociss/c575eea0bba5ef40121a1b4cbe21e26b to your computer and use it in GitHub Desktop.
Save myociss/c575eea0bba5ef40121a1b4cbe21e26b to your computer and use it in GitHub Desktop.
Protein Docking: extract interface
# determine if each amino acid is part of the interface of the complex
interface_max_dist = 10.0
for res_key_l in keys(all_residues_dict["l_b"])
atom_l_coords = all_residues_dict["l_b"][res_key_l]["coords"]
for res_key_r in keys(all_residues_dict["r_b"])
atom_r_coords = all_residues_dict["r_b"][res_key_r]["coords"]
is_interface = any([norm(coord2 - coord1) <= interface_max_dist for coord2 in atom_r_coords for coord1 in atom_l_coords])
if is_interface
all_residues_dict["r_b"][res_key_r]["is_interface"] = true
haskey(all_residues_dict["r_u"], res_key_r) && (all_residues_dict["r_u"][res_key_r]["is_interface"] = true)
all_residues_dict["l_b"][res_key_l]["is_interface"] = true
haskey(all_residues_dict["l_u"], res_key_l) && (all_residues_dict["l_u"][res_key_l]["is_interface"] = true)
end
end
end
# plot interaface atoms of bound and unbound proteins together and plot the bound complex
interface_l, interface_r, complex = get_plot_data(all_residues_dict)
plot_3d(interface_l, string("ligand_compare_", protein_complex_pdb_id), figures_path)
plot_3d(interface_r, string("receptor_compare_", protein_complex_pdb_id), figures_path)
plot_3d(complex, string("complex_", protein_complex_pdb_id), figures_path)
# calculate interface rmsd
irmsd = calc_interface_rmsd(all_residues_dict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment