IMP
2.0.0
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
score_protein_with_ligand.py
1
## \example atom/score_protein_with_ligand.py
2
## Show how to score a number of ligand conformations loaded from a file against a protein loaded from a pdb.
3
4
import
IMP.atom
5
6
m =
IMP.Model
()
7
IMP.base.set_check_level
(IMP.base.NONE)
8
protein=
IMP.atom.read_pdb
(
IMP.atom.get_example_path
(
'1d3d-protein.pdb'
), m)
9
protein_atoms=
IMP.atom.get_by_type
(protein, IMP.atom.ATOM_TYPE)
10
ligands=
IMP.atom.read_mol2
(
IMP.atom.get_example_path
(
'1d3d-ligands.mol2'
), m)
11
# create the score which applies to a pair of atoms
12
ps=
IMP.atom.ProteinLigandAtomPairScore
()
13
ps.set_was_used(
True
)
14
# label each atom of the protein with the type needed for scoring
15
IMP.atom.add_protein_ligand_score_data
(protein)
16
for
l
in
ligands.get_children():
17
# compute the atom type for each ligand atom
18
IMP.atom.add_protein_ligand_score_data
(l)
19
score=0
20
ligand_atoms=
IMP.atom.get_by_type
(l, IMP.atom.ATOM_TYPE)
21
for
pa
in
protein_atoms:
22
for
la
in
ligand_atoms:
23
# check if the atoms are close enough together
24
if
IMP.core.get_distance
(
IMP.core.XYZ
(pa),
IMP.core.XYZ
(la)) < 15:
25
# score one pair of atoms
26
score+= ps.evaluate((pa, la),
None
)
27
print
"score for "
, l.get_name(),
"is"
, score