IMP  2.4.0
The Integrative Modeling Platform
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
3 # against a protein loaded from a pdb.
4 
5 from __future__ import print_function
6 import IMP.atom
7 
9 IMP.base.set_check_level(IMP.base.NONE)
10 protein = IMP.atom.read_pdb(IMP.atom.get_example_path('1d3d-protein.pdb'), m)
11 protein_atoms = IMP.atom.get_by_type(protein, IMP.atom.ATOM_TYPE)
12 ligands = IMP.atom.read_mol2(IMP.atom.get_example_path('1d3d-ligands.mol2'), m)
13 # create the score which applies to a pair of atoms
15 ps.set_was_used(True)
16 # label each atom of the protein with the type needed for scoring
18 for l in ligands.get_children():
19  # compute the atom type for each ligand atom
21  score = 0
22  ligand_atoms = IMP.atom.get_by_type(l, IMP.atom.ATOM_TYPE)
23  for pa in protein_atoms:
24  for la in ligand_atoms:
25  # check if the atoms are close enough together
27  # score one pair of atoms
28  score += ps.evaluate((pa, la), None)
29  print("score for ", l.get_name(), "is", score)
void set_check_level(CheckLevel tf)
Control runtime checks in the code.
Definition: exception.h:73
std::string get_example_path(std::string file_name)
Return the path to installed example data for this module.
double get_distance(XYZR a, XYZR b)
Compute the sphere distance between a and b.
Definition: XYZR.h:87
Hierarchies get_by_type(Hierarchy mhd, GetByType t)
Hierarchy read_mol2(base::TextInput mol2_file, kernel::Model *model, Mol2Selector *mol2sel=nullptr)
Create a hierarchy from a Mol2 file.
A decorator for a particle with x,y,z coordinates.
Definition: XYZ.h:30
void add_protein_ligand_score_data(Hierarchy h)
Functionality for loading, creating, manipulating and scoring atomic structures.
void read_pdb(base::TextInput input, int model, Hierarchy h)
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73