IMP logo
IMP Reference Guide  develop.549d75e6f4,2024/11/20
The Integrative Modeling Platform
saxs/profile.py

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.

This application is available as a web service at salilab.org/foxs. It is also available as C++ code in IMP at modules/foxs/bin/foxs.cpp.

The experimental data for lysozyme is taken from crysol program (www.embl-hamburg.de/ExternalInfo/Research/Sax/crysol.html)

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 import IMP
14 import IMP.atom
15 import IMP.core
16 import IMP.saxs
17 import sys
18 
19 IMP.setup_from_argv(sys.argv, "profile")
20 
21 m = IMP.Model()
22 
23 # read PDB
26 
27 # read experimental profile
28 exp_profile = IMP.saxs.Profile(IMP.saxs.get_example_path('lyzexp.dat'))
29 
30 print('min_q = ' + str(exp_profile.get_min_q()))
31 print('max_q = ' + str(exp_profile.get_max_q()))
32 print('delta_q = ' + str(exp_profile.get_delta_q()))
33 
34 # select particles from the model
35 particles = IMP.atom.get_by_type(mp, IMP.atom.ATOM_TYPE)
36 
37 # calculate SAXS profile
38 model_profile = IMP.saxs.Profile()
39 model_profile.calculate_profile(particles)
40 model_profile.write_SAXS_file('6lyz.dat')
41 
42 # calculate chi score (should be ~0.5 for this example)
43 saxs_score = IMP.saxs.ProfileFitterChi(exp_profile)
44 chi = saxs_score.compute_score(model_profile)
45 print('Chi = ' + str(chi))
46 
47 
48 # convert to p(r)
50 model_profile.profile_2_distribution(pr, 48.0)
51 pr.normalize()
52 pr.show()