I have the PDB 6LU7.

  • I extracted the ligand using extract lig, org and then the protein using extract prot, poly. The ligand has three parts: 02J, PJE, and 010.

  • I want to select the 02J and 010 IN A SCRIPT and delete them.

I know how to do it by simply clicking, but want to incluse this in a script.

  • $\begingroup$ Hi @user8338 and welcome. I think what you are asking is PyMol scripting, I suspect Modeller will do something similar. Do you use PyMol/Modeller? If so could you please update and clarify your post accordingly. Thanks! $\endgroup$
    – M__
    Commented Jul 8, 2020 at 15:58

1 Answer 1


I know that structure way too well —SARS-COV-2 MPro.

In PyMOL command line

 remove resn 02J or 010


 cmd.remove('resn 02J or 010')

In python

 import pymol2
 with pymol2.PyMOL() as pymol:
      pymol.cmd.remove('resn 02J or 010')
      #or pdbblock = pymol.cmd.get_pdbstr()

From the sounds of it you'd like to make the peptidomimetic a peptide. If you wanted to do the horrid thing of making PJE, the capped side chain glutamine ketamide, into glutamine, the command to rename atoms is a multitude of cmd.alter('resn PJE and name <atomname>', 'name="<newname>") followed by a cmd.alter('resn PJE', 'resn="GLN"') and lastly cmd.sort() to commit the changes. Not pretty, but is all in PyMOL.

  • $\begingroup$ Wow, impressive response - thanks $\endgroup$
    – M__
    Commented Jul 8, 2020 at 16:07
  • $\begingroup$ And, related, for the structure 6M2N, there are four 3WL ligands, one in each of the four protein chains. I'd like to remove 3WL in chains B, C, and D, retain chain A ligand, also scripted (not select and remove). Thanks! $\endgroup$
    – user8338
    Commented Jul 11, 2020 at 13:58
  • $\begingroup$ The selection algebra is listed in pymolwiki.org/index.php/Selection_Algebra But basically you want to select based on meeting two criteria so it's an and. Namely, cmd.remove('3WL and not chain A') $\endgroup$ Commented Jul 11, 2020 at 16:01
  • $\begingroup$ Typo: cmd.remove('resn 3WL and not chain A') $\endgroup$ Commented Jul 11, 2020 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.