Skip to content

A python script for PyMol to make protein-ligand interaction images.

Notifications You must be signed in to change notification settings

quantaosun/Pymol_Script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 

Repository files navigation

Pymol_Script

STEP 1 Open PyMOL, load/fetch your protein-ligand structure use your mouse, File > Run Script > lig.py

STEP 2 Check what your ligand name is Confirm your ligand name, for example, is ABC
Go to the PyMOL command line type exactly lig ABC , and that's it, the pymol should have done the hard work for you.

    ####################################################################
    # This script also suport automatic H-bond detection, here is the
    # part of lig.py responsible for H-bond dection and visulisation.
    ####################################################################
    # Define polar donors in the protein and ligand
    cmd.select("polar_donors_res", "(res and elem n,o and (neighbor hydro))")
    cmd.select("polar_donors_lig", "(lig and elem n,o and (neighbor hydro))")
    
    # Define polar acceptors in the protein and ligand
    cmd.select("polar_acceptors_res", "(res and (elem o or (elem n and not (neighbor hydro))))")
    cmd.select("polar_acceptors_lig", "(lig and (elem o or (elem n and not (neighbor hydro))))")
    
    # Select hydrogen atoms bonded to polar donors
    cmd.select("don_hydrogens_res", "hydro and (neighbor polar_donors_res)")
    cmd.select("don_hydrogens_lig", "hydro and (neighbor polar_donors_lig)")
    
    # Show hydrogen bonds between protein donors and ligand acceptors
    cmd.distance("hbonds_res_to_lig", "don_hydrogens_res", "polar_acceptors_lig", 3.2)
    
    # Show hydrogen bonds between ligand donors and protein acceptors
    cmd.distance("hbonds_lig_to_res", "don_hydrogens_lig", "polar_acceptors_res", 3.2)

image

(CRYSTAL STRUCTURE OF THE SARS-COV-2 (2019-NCOV) MAIN PROTEASE IN COMPLEX WITH COMPOUND 4, published by Jorgensen, W.L. et al.)

The surface generation was not included in lig.py

    # Create a new object for the pocket residues
    cmd.create("pocket_surface", "res")

    # Hide the original surface to avoid confusion
    cmd.hide("surface", "all")

    # Show the surface of the new pocket object
    cmd.show("surface", "pocket_surface")

    # Color the surface: red for oxygen (polar), blue for nitrogen (polar), and white for carbon (non-polar)
    cmd.color("red", "pocket_surface and elem O")
    cmd.color("blue", "pocket_surface and elem N")
    cmd.color("white", "pocket_surface and elem C")

    # Adjust the transparency of the pocket surface
    cmd.set("transparency", 0.5, "pocket_surface")

    # Zoom in on the pocket for a better view
    cmd.zoom("pocket_surface")

About

A python script for PyMol to make protein-ligand interaction images.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages