Re: [PyMOL] Help with selecting interface residues between two structures

2023-06-29 Thread Zhou, Yingyao via PyMOL-users
Hi, Jarrett

This is more than helpful! I just need to fix my own mistake in the selection

cmd.select(base_interface, "byres((not (/base//H+L) & base) within 10 of 
/base//H+L)")

Maybe one more question:

Selection: “not (/base//H+L)” returns all residues in pred, as well as the P 
chain of base. I understand this.
However, why “not /base//H+L” returns an empty selection?

Thanks!

From: Jarrett Johnson 
Sent: Thursday, June 29, 2023 6:31 AM
To: Zhou, Yingyao 
Cc: pymol-users@lists.sourceforge.net
Subject: Re: [PyMOL] Help with selecting interface residues between two 
structures


This Message is from an External Sender. Do not click links or open attachments 
unless you trust the sender.
Hi,

There might be a cleaner way to do this, but I propose creating a mapping of 
your chains from base to pred and use the `iterate` command to get the relevant 
identifiers and map them back to the prediction. Here is a full script that 
pulls from the PDB that attempts this idea.

from pymol
import cmd



# our reference

cmd.fetch('3hfm',
'base')

# dummy prediction

cmd.copy('pred',
'base')



# Heavy & Light chains in 3hfm are named L and H

# Antigen is Y so lets rename to A to simulate your case

cmd.alter('base & chain Y',
'chain="A"')



# change chain to emulate same residues different chain names

cmd.alter('pred & chain L',
'chain="A"')

cmd.alter('pred & chain H',
'chain="B"')

cmd.alter('pred & chain Y',
'chain="C"')



base_interface
= 'int_base'

cmd.select(base_interface,
'byres(base & (/base//H+L around 5))')



# After preparation:

# create a mapping of chains from base to pred

base_to_pred_chains
= {'L':
'A', 'H':
'B', 'A':
'C'}



# Create a list of identifiers in the interface from the selection

myspace
= {'int_set':
set()}

cmd.iterate(base_interface,
'int_set.add((chain, resi, resn))', space=myspace)



# Map them to a new selection onto the prediction

pred_interface
= 'int_pred'

cmd.select(pred_interface,
'none')

for
chain, resi,
resn in
myspace['int_set']:

new_chain
= base_to_pred_chains[chain]

# Add each pred residue to the selection

cmd.select(pred_interface,

   f'pred & chain
{new_chain} & resi
{resi} & resn
{resn}',

   merge=1)


Hope that helps,
Jarrett J

On Thu, Jun 29, 2023 at 12:59 AM Zhou, Yingyao via PyMOL-users 
mailto:pymol-users@lists.sourceforge.net>> 
wrote:
I am a relatively new PyMOL user and would like to get some helps from the 
community.

I have two structures for the same antibody-antigen complex (with three chains: 
light chain L, heavy chain H, and an antigen chain A) .
Structure “base” is the experimental true structure, structure “pred” is the 
predicted structure. My goal is to determine how close the predicted interface 
is w.r.t. the experimental truth.

I first select the interface residues as defined by “base”

load base.pdb
load pred.pdb
select int_base, byres(base & (/base//H+L around 5))

How do I select the same corresponding residues in object “pred”?

In addition, what if in the pred structure, chains are named A, B, and C, 
corresponding to base structure L, H, A, respectively, how will I handle that?
(I was planning to rename the chains, if there is no nice trick to transfer the 
selections from base to pred)

Thanks!


___
PyMOL-users mailing list
Archives: 
http://www.mail-archive.com/pymol-users@lists.sourceforge.net<https://urldefense.com/v3/__http:/www.mail-archive.com/pymol-users@lists.sourceforge.net__;!!N3hqHg43uw!uwuPjMkMmShRv1H1Jo8JrmQlENOxFP1gKBxnxcRRsC88x9H66HcFQraBUdeu6fLNY9VT93bLYvg85UTGJumvXasRnMHv7MUuixo$>
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe<https://urldefense.com/v3/__https:/sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe__;!!N3hqHg43uw!uwuPjMkMmShRv1H1Jo8JrmQlENOxFP1gKBxnxcRRsC88x9H66HcFQraBUdeu6fLNY9VT93bLYvg85UTGJumvXasRnMHvo8xE8pg$>


--

Jarrett Johnson | Senior Developer, PyMOL
[https://drive.google.com/uc?id=1zOlB9fluGZyuInRUQgKsdjtjpR5L9z6R=download]

___
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Re: [PyMOL] Help with selecting interface residues between two structures

2023-06-29 Thread Jarrett Johnson
Hi,

There might be a cleaner way to do this, but I propose creating a mapping
of your chains from base to pred and use the `iterate` command to get the
relevant identifiers and map them back to the prediction. Here is a full
script that pulls from the PDB that attempts this idea.

from pymol import cmd

# our reference
cmd.fetch('3hfm', 'base')
# dummy prediction
cmd.copy('pred', 'base')

# Heavy & Light chains in 3hfm are named L and H
# Antigen is Y so lets rename to A to simulate your case
cmd.alter('base & chain Y', 'chain="A"')

# change chain to emulate same residues different chain names
cmd.alter('pred & chain L', 'chain="A"')
cmd.alter('pred & chain H', 'chain="B"')
cmd.alter('pred & chain Y', 'chain="C"')

base_interface = 'int_base'
cmd.select(base_interface, 'byres(base & (/base//H+L around 5))')

# After preparation:
# create a mapping of chains from base to pred
base_to_pred_chains = {'L': 'A', 'H': 'B', 'A': 'C'}

# Create a list of identifiers in the interface from the selection
myspace = {'int_set': set()}
cmd.iterate(base_interface, 'int_set.add((chain, resi, resn))', space=
myspace)

# Map them to a new selection onto the prediction
pred_interface = 'int_pred'
cmd.select(pred_interface, 'none')
for chain, resi, resn in myspace['int_set']:
new_chain = base_to_pred_chains[chain]
# Add each pred residue to the selection
cmd.select(pred_interface,
   f'pred & chain {new_chain} & resi {resi} & resn {resn}',
   merge=1)

Hope that helps,
Jarrett J

On Thu, Jun 29, 2023 at 12:59 AM Zhou, Yingyao via PyMOL-users <
pymol-users@lists.sourceforge.net> wrote:

> I am a relatively new PyMOL user and would like to get some helps from the
> community.
>
>
>
> I have two structures for the same antibody-antigen complex (with three
> chains: light chain L, heavy chain H, and an antigen chain A) .
>
> Structure “base” is the experimental true structure, structure “pred” is
> the predicted structure. My goal is to determine how close the predicted
> interface is w.r.t. the experimental truth.
>
>
>
> I first select the interface residues as defined by “base”
>
>
>
> load base.pdb
>
> load pred.pdb
>
> select int_base, byres(base & (/base//H+L around 5))
>
>
>
> How do I select the same corresponding residues in object “pred”?
>
>
>
> In addition, what if in the pred structure, chains are named A, B, and C,
> corresponding to base structure L, H, A, respectively, how will I handle
> that?
>
> (I was planning to rename the chains, if there is no nice trick to
> transfer the selections from base to pred)
>
>
>
> Thanks!
>
>
>
>
> ___
> PyMOL-users mailing list
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
> Unsubscribe:
> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
>


-- 

*Jarrett Johnson* | Senior Developer, PyMOL
___
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

[PyMOL] Help with selecting interface residues between two structures

2023-06-28 Thread Zhou, Yingyao via PyMOL-users
I am a relatively new PyMOL user and would like to get some helps from the 
community.

I have two structures for the same antibody-antigen complex (with three chains: 
light chain L, heavy chain H, and an antigen chain A) .
Structure "base" is the experimental true structure, structure "pred" is the 
predicted structure. My goal is to determine how close the predicted interface 
is w.r.t. the experimental truth.

I first select the interface residues as defined by "base"

load base.pdb
load pred.pdb
select int_base, byres(base & (/base//H+L around 5))

How do I select the same corresponding residues in object "pred"?

In addition, what if in the pred structure, chains are named A, B, and C, 
corresponding to base structure L, H, A, respectively, how will I handle that?
(I was planning to rename the chains, if there is no nice trick to transfer the 
selections from base to pred)

Thanks!


___
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe