IMP  2.2.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 import IMP.atom
6 
8 IMP.base.set_check_level(IMP.base.NONE)
9 protein = IMP.atom.read_pdb(IMP.atom.get_example_path('1d3d-protein.pdb'), m)
10 protein_atoms = IMP.atom.get_by_type(protein, IMP.atom.ATOM_TYPE)
11 ligands = IMP.atom.read_mol2(IMP.atom.get_example_path('1d3d-ligands.mol2'), m)
12 # create the score which applies to a pair of atoms
14 ps.set_was_used(True)
15 # label each atom of the protein with the type needed for scoring
17 for l in ligands.get_children():
18  # compute the atom type for each ligand atom
20  score = 0
21  ligand_atoms = IMP.atom.get_by_type(l, IMP.atom.ATOM_TYPE)
22  for pa in protein_atoms:
23  for la in ligand_atoms:
24  # check if the atoms are close enough together
26  # score one pair of atoms
27  score += ps.evaluate((pa, la), None)
28  print "score for ", l.get_name(), "is", score