Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix filterInteractions to be more general #2014

Merged
merged 3 commits into from
Dec 13, 2024

Conversation

jamesmkrieger
Copy link
Contributor

So far, I just have a fix to the single selection mode, which didn't include chain, but I'm close to making the whole thing more general too.

@jamesmkrieger
Copy link
Contributor Author

Originally, we have filterInteractions and getInteractions using either kwargs selection alone, which is just based on residue numbers and names without chain ID, or both kwargs selection and selection2 that must both have chain IDs and don't take any other information. As such, the standard way to analyse interactions between two regions at present is to make them have separate chain IDs.

With the old code, this is the procedure and the results we get for mGluR1 closed chain (1ewkA modified for comparison to 1ewkB in http://www.bahargroup.org/prody/tutorials/clustenmd_tutorial/clustenmd_tutorial_files.zip):

from prody import *

PDBfile = addMissingAtoms('1ewkA_protein_trim.pdb', method='openbabel')
ag3 = parsePDB(PDBfile)

selstr_x='resnum 36 to 206 346 to 472'
selstr_y='resnum 214 to 341 478 to 511'

ag3.setChids('H')
ag3.select(selstr_x).setChids('U')
ag3.select(selstr_y).setChids('L')

interactions_closed = Interactions()
all_interactions = interactions_closed.calcProteinInteractions(ag3)
lobe_interactions_closed = interactions_closed.getInteractions(selection='chain U', 
                                                               selection2='chain L', replace=True)
lobe_interactions_closed

[[['ASN235', 'ND2_1342', 'L', 'ASP191', 'OD2_979', 'U', 2.6414, 29.5225],
  ['ASN235', 'N_1336', 'L', 'SER166', 'OG_785', 'U', 2.7779, 25.7723],
  ['ARG71', 'NH2_278', 'U', 'GLU325', 'OE2_2040', 'L', 3.0711, 22.601],
  ['LYS409', 'NZ_2742', 'U', 'ASP318', 'OD2_1981', 'L', 3.2217, 29.1795]],
 [['LYS409', 'NZ_2742', 'U', 'ASP318', 'OD1_1980_1981', 'L', 4.2535],
  ['ARG71', 'NH1_277_278', 'U', 'GLU325', 'OE1_2039_2040', 'L', 4.434]],
 [],
 [],
 [['TYR74',
   '302_303_304_305_306_307',
   'U',
   'ARG323',
   'NH1_2022_2023',
   'L',
   4.2377]],
 [['ILE190', 'CD1_971', 'U', 'ALA243', 'CB_1399', 'L', 3.6713, 9.0492]],
 []]

With the updated code, we can still reproduce these results:

[[['ASN235', 'ND2_1342', 'L', 'ASP191', 'OD2_979', 'U', 2.6414, 29.5225],
  ['ASN235', 'N_1336', 'L', 'SER166', 'OG_785', 'U', 2.7779, 25.7723],
  ['ARG71', 'NH2_278', 'U', 'GLU325', 'OE2_2040', 'L', 3.0711, 22.601],
  ['LYS409', 'NZ_2742', 'U', 'ASP318', 'OD2_1981', 'L', 3.2217, 29.1795]],
 [['ASP318', 'OD1_1980_1981', 'L', 'LYS409', 'NZ_2742', 'U', 4.2535],
  ['GLU325', 'OE1_2039_2040', 'L', 'ARG71', 'NH1_277_278', 'U', 4.434]],
 [],
 [],
 [['TYR74',
   '302_303_304_305_306_307',
   'U',
   'ARG323',
   'NH1_2022_2023',
   'L',
   4.2377]],
 [['ALA243', 'CB_1399', 'L', 'ILE190', 'CD1_971', 'U', 3.6713, 9.0492]],
 []]

We can also get them more easily as follows:

In [1]: from prody import *

In [2]: PDBfile = addMissingAtoms('1ewkA_protein_trim.pdb', method='openbabel')
   ...: ag3 = parsePDB(PDBfile)
   ...: ag3
Out[2]: <AtomGroup: addH_1ewkA_protein_trim (7059 atoms)>

In [3]: selstr_x='resnum 36 to 206 346 to 472'
   ...: selstr_y='resnum 214 to 341 478 to 511'

In [4]: interactions_closed = Interactions()

In [5]: all_interactions = interactions_closed.calcProteinInteractions(ag3)

In [6]: lobe_interactions_closed = interactions_closed.getInteractions(selection=selstr_x,
   ...:                                                                selection2=selstr_y, replace=True)
   ...: lobe_interactions_closed
Out[6]: 
[[['ASN235', 'ND2_1342', 'A', 'ASP191', 'OD2_979', 'A', 2.6414, 29.5225],
  ['ASN235', 'N_1336', 'A', 'SER166', 'OG_785', 'A', 2.7779, 25.7723],
  ['ARG71', 'NH2_278', 'A', 'GLU325', 'OE2_2040', 'A', 3.0711, 22.601],
  ['LYS409', 'NZ_2742', 'A', 'ASP318', 'OD2_1981', 'A', 3.2217, 29.1795]],
 [['ASP318', 'OD1_1980_1981', 'A', 'LYS409', 'NZ_2742', 'A', 4.2535],
  ['GLU325', 'OE1_2039_2040', 'A', 'ARG71', 'NH1_277_278', 'A', 4.434]],
 [],
 [],
 [['TYR74',
   '302_303_304_305_306_307',
   'A',
   'ARG323',
   'NH1_2022_2023',
   'A',
   4.2377]],
 [['ILE190', 'CD1_971', 'A', 'ALA243', 'CB_1399', 'A', 3.6713, 9.0492]],
 []]

Copy link
Contributor

@karolamik13 karolamik13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested. Works fine. Thank you, James.

@jamesmkrieger jamesmkrieger merged commit 259a5a5 into prody:main Dec 13, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants