IMP  2.4.0
The Integrative Modeling Platform
profile.py
1 ## \example saxs/profile.py
2 # In this example, we read a protein from a PDB file and experimental profile file. Next we compute the theoretical profile from the PDB file and fit it to the experimental one.
3 #
4 # This application is available as a web service at salilab.org/foxs. It is also available as C++ code in IMP/applications.
5 #
6 # The experimental data for lysozyme is taken from crysol program (www.embl-hamburg.de/ExternalInfo/Research/Sax/crysol.html)
7 #
8 
9 from __future__ import print_function
10 import IMP
11 import IMP.atom
12 import IMP.core
13 import IMP.saxs
14 import os
15 
16 
17 m = IMP.kernel.Model()
18 
19 #! read PDB
22 
23 #! read experimental profile
24 exp_profile = IMP.saxs.Profile(IMP.saxs.get_example_path('lyzexp.dat'))
25 
26 print('min_q = ' + str(exp_profile.get_min_q()))
27 print('max_q = ' + str(exp_profile.get_max_q()))
28 print('delta_q = ' + str(exp_profile.get_delta_q()))
29 
30 #! select particles from the model
31 particles = IMP.atom.get_by_type(mp, IMP.atom.ATOM_TYPE)
32 
33 #! calculate SAXS profile
34 model_profile = IMP.saxs.Profile()
35 model_profile.calculate_profile(particles)
36 model_profile.write_SAXS_file('6lyz.dat')
37 
38 #! calculate chi score (should be ~0.5 for this example)
39 saxs_score = IMP.saxs.ProfileFitterChi(exp_profile)
40 chi = saxs_score.compute_score(model_profile)
41 print('Chi = ' + str(chi))
42 
43 
44 #! convert to p(r)
46 model_profile.profile_2_distribution(pr, 48.0)
47 pr.normalize()
48 pr.show()
Select non water and non hydrogen atoms.
Definition: pdb.h:197
Hierarchies get_by_type(Hierarchy mhd, GetByType t)
std::string get_example_path(std::string file_name)
Return the path to installed example data for this module.
Basic functionality that is expected to be used by a wide variety of IMP users.
Functionality for loading, creating, manipulating and scoring atomic structures.
void read_pdb(base::TextInput input, int model, Hierarchy h)
Support for small angle X-ray scattering (SAXS) data.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73