text: user9161: 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.
  
  user6322: I know that structure way too well —SARS-COV-2 MPro.
  In PyMOL command line
   remove resn 02J or 010
  
  or
   cmd.remove('resn 02J or 010')
  
  In python
   import pymol2
   with pymol2.PyMOL() as pymol:
        pymol.cmd.fetch('6LU7')
        pymol.cmd.remove('resn 02J or 010')
        pymol.cmd.save('6LU7.mod.pdb') 
        #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.
  
original_text: 9161: <p>I have the PDB <a href="https://www.rcsb.org/structure/6LU7" rel="nofollow noreferrer">6LU7</a>.</p>
  <ul>
  <li><p>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.</p>
  </li>
  <li><p>I want to select the 02J and 010 IN A SCRIPT and delete them.</p>
  </li>
  </ul>
  <p>I know how to do it by simply clicking, but want to incluse this in a script.</p>
   6322: <p>I know that structure way too well —SARS-COV-2 MPro.</p>
  <p>In PyMOL command line</p>
  <pre><code> remove resn 02J or 010
  </code></pre>
  <p>or</p>
  <pre><code> cmd.remove('resn 02J or 010')
  </code></pre>
  <p>In python</p>
  <pre><code> import pymol2
   with pymol2.PyMOL() as pymol:
        pymol.cmd.fetch('6LU7')
        pymol.cmd.remove('resn 02J or 010')
        pymol.cmd.save('6LU7.mod.pdb') 
        #or pdbblock = pymol.cmd.get_pdbstr()
  </code></pre>
  <p>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 <code>cmd.alter('resn PJE and name &lt;atomname&gt;', 'name=&quot;&lt;newname&gt;&quot;)</code> followed by a <code>cmd.alter('resn PJE', 'resn=&quot;GLN&quot;')</code> and lastly <code>cmd.sort()</code> to commit the changes. Not pretty, but is all in PyMOL.</p>
  