IMP  2.0.1
The Integrative Modeling Platform
saxs/profile_fit.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. Unlike in profile.py example, here we fit the profile with adjustment of the excluded volume and hydration layer density of the molecule.

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

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

1 ## \example saxs/profile_fit.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. Unlike in profile.py example, here we fit the profile with adjustment of the excluded volume and hydration layer density of the molecule.
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 import IMP
10 import IMP.atom
11 import IMP.core
12 import IMP.saxs
13 import os
14 
15 
16 m = IMP.Model()
17 
18 #! read PDB
21 
22 #! read experimental profile
23 exp_profile = IMP.saxs.Profile(IMP.saxs.get_example_path('lyzexp.dat'))
24 
25 print 'min_q = ' + str(exp_profile.get_min_q())
26 print 'max_q = ' + str(exp_profile.get_max_q())
27 print 'delta_q = ' + str(exp_profile.get_delta_q())
28 
29 #! select particles from the model
30 particles = IMP.atom.get_by_type(mp, IMP.atom.ATOM_TYPE)
31 
32 #! add radius for water layer computation
34 for i in range(0, len(particles)):
35  radius = ft.get_radius(particles[i])
36  IMP.core.XYZR.setup_particle(particles[i], radius)
37 # compute surface accessibility
39 surface_area = s.get_solvent_accessibility(IMP.core.XYZRs(particles))
40 
41 #! calculate SAXS profile
42 delta_q = 0.5 / 500
43 model_profile = IMP.saxs.Profile(0.0, 0.5, delta_q)
44 model_profile.calculate_profile_partial(particles, surface_area)
45 #model_profile.write_SAXS_file('6lyz.dat')
46 
47 #! calculate chi score (should be ~0.5 for this example)
48 saxs_score = IMP.saxs.ProfileFitterChi(exp_profile)
49 chi = saxs_score.compute_score(model_profile)
50 print 'Chi without parameter fitting = ' + str(chi)
51 
52 chi = (saxs_score.fit_profile(model_profile)).get_chi()
53 print 'Chi after adjustment of excluded volume and water layer parameters = ' + str(chi)