<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>

CC BY-SA 4.0
2020-07-08T16:07:34.247Z
Wow, impressive response - thanks
M__
CC BY-SA 4.0
2020-07-11T13:58:43.070Z
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!
user8338
CC BY-SA 4.0
2020-07-11T16:01:53.347Z
The selection algebra is listed in https://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')`
Matteo Ferla
CC BY-SA 4.0
2020-07-11T21:07:58.160Z
Typo: `cmd.remove('resn 3WL and not chain A')`
Matteo Ferla
CC BY-SA 4.0
2020-07-08T15:24:31.907Z
2020-07-08T15:35:45.033Z
2020-07-08T15:35:45.033Z
Matteo Ferla
<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>

CC BY-SA 4.0
2020-07-08T15:58:24.670Z
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!
M__
<covid-19><sars-cov-2><pymol>
Selecting part of an extracted ligand
# Selecting part of an extracted ligand

(Asked by: username_0 on 2020-07-08)

I have the PDB [6LU7](https://www.rcsb.org/structure/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.

**Tags:** covid-19, sars-cov-2, pymol
> **Comments:**
> **username_1**: 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!  

---

## 1 answers

### Answer by username_2 on 2020-07-08. Score: 1

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 ', 'name="") followed by a cmd.alter('resn PJE', 'resn="GLN"') and lastly cmd.sort() to commit the changes. Not pretty, but is all in PyMOL.

> **Comments:**
> **username_1**: Wow, impressive response - thanks  
> **username_0**: 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!  
> **username_2**: The selection algebra is listed in https://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')`  
> **username_2**: Typo: `cmd.remove('resn 3WL and not chain A')`  

---

