Skip to content

Instantly share code, notes, and snippets.

@physicshinzui
Created February 7, 2023 02:32
Show Gist options
  • Save physicshinzui/1f1950ae10ab3bc545dd24d66b6bff66 to your computer and use it in GitHub Desktop.
Save physicshinzui/1f1950ae10ab3bc545dd24d66b6bff66 to your computer and use it in GitHub Desktop.
get_interacting_residues by PyMOL.md

#pymol-script #pymol

from pymol import cmd

import sys

  

print("""

Description:

This script is used to print interacting residues between two molecules in two PDB files.

Usage:

pymol -c get_interacting_residues.py -- protein.pdb ligand.pdb

""")

  

cmd.load(sys.argv[1], "protein")

cmd.load(sys.argv[2], "ligand")

cmd.do("sele polymer and name ca within 6.0 of ligand")

cmd.show("spheres", "sele")

residues = []

cmd.iterate("sele", "residues.append((resi, resn))")

  

# Print the residues

ri = []

for residue in residues:

print("Residue:", residue[0], "Residue Name:", residue[1])

ri.append(residue[0])

print("---Gromacs selection---")

print("Copy and paste the following command in the Gromacs shell (gmx make_ndx):")

print("ri", *ri)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment