IMP logo
IMP Reference Guide  2.15.0
The Integrative Modeling Platform
atom/score_protein_with_ligand.py

Show how to score a number of ligand conformations loaded from a file against a protein loaded from a pdb.

1 ## \example atom/score_protein_with_ligand.py
2 # Show how to score a number of ligand conformations loaded from a file
3 # against a protein loaded from a pdb.
4 
5 from __future__ import print_function
6 import IMP.atom
7 import sys
8 
9 IMP.setup_from_argv(sys.argv, "score protein with ligand")
10 
11 m = IMP.Model()
12 IMP.set_check_level(IMP.NONE)
13 protein = IMP.atom.read_pdb(IMP.atom.get_example_path('1d3d-protein.pdb'), m)
14 protein_atoms = IMP.atom.get_by_type(protein, IMP.atom.ATOM_TYPE)
15 ligands = IMP.atom.read_mol2(IMP.atom.get_example_path('1d3d-ligands.mol2'), m)
16 # create the score which applies to a pair of atoms
18 ps.set_was_used(True)
19 # label each atom of the protein with the type needed for scoring
21 for l in ligands.get_children():
22  # compute the atom type for each ligand atom
24  score = 0
25  ligand_atoms = IMP.atom.get_by_type(l, IMP.atom.ATOM_TYPE)
26  for pa in protein_atoms:
27  for la in ligand_atoms:
28  # check if the atoms are close enough together
30  # score one pair of atoms
31  score += ps.evaluate_index(m,
32  (pa.get_particle_index(),
33  la.get_particle_index()), None)
34  print("score for ", l.get_name(), "is", score)