IMP logo
IMP Reference Guide  2.20.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
3 # file. Next we compute the theoretical profile from the PDB file and fit it
4 # to the experimental one.
5 #
6 # This application is available as a web service at salilab.org/foxs. It is
7 # also available as C++ code in IMP at modules/foxs/bin/foxs.cpp.
8 #
9 # The experimental data for lysozyme is taken from crysol program
10 # (www.embl-hamburg.de/ExternalInfo/Research/Sax/crysol.html)
11 #
12 
13 from __future__ import print_function
14 import IMP
15 import IMP.atom
16 import IMP.core
17 import IMP.saxs
18 import sys
19 
20 IMP.setup_from_argv(sys.argv, "profile")
21 
22 m = IMP.Model()
23 
24 # read PDB
27 
28 # read experimental profile
29 exp_profile = IMP.saxs.Profile(IMP.saxs.get_example_path('lyzexp.dat'))
30 
31 print('min_q = ' + str(exp_profile.get_min_q()))
32 print('max_q = ' + str(exp_profile.get_max_q()))
33 print('delta_q = ' + str(exp_profile.get_delta_q()))
34 
35 # select particles from the model
36 particles = IMP.atom.get_by_type(mp, IMP.atom.ATOM_TYPE)
37 
38 # calculate SAXS profile
39 model_profile = IMP.saxs.Profile()
40 model_profile.calculate_profile(particles)
41 model_profile.write_SAXS_file('6lyz.dat')
42 
43 # calculate chi score (should be ~0.5 for this example)
44 saxs_score = IMP.saxs.ProfileFitterChi(exp_profile)
45 chi = saxs_score.compute_score(model_profile)
46 print('Chi = ' + str(chi))
47 
48 
49 # convert to p(r)
51 model_profile.profile_2_distribution(pr, 48.0)
52 pr.normalize()
53 pr.show()
Select non water and non hydrogen atoms.
Definition: pdb.h:331
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
void read_pdb(TextInput input, int model, Hierarchy h)
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
std::string get_example_path(std::string file_name)
Return the full path to one of this module's example files.
Basic functionality that is expected to be used by a wide variety of IMP users.
Functionality for loading, creating, manipulating and scoring atomic structures.
Support for small angle X-ray scattering (SAXS) data.