IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
em/pdb2density.py

A simple example showing how to simulate density from a protein. IMP uses a Gaussian smoothing kernel. see SampledDensityMap::resample for documentation.

1 ## \example em/pdb2density.py
2 # A simple example showing how to simulate density from a protein.
3 # IMP uses a Gaussian smoothing kernel. see SampledDensityMap::resample
4 # for documentation.
5 #
6 
7 import IMP.em
8 import IMP.core
9 import IMP.atom
10 import sys
11 
12 IMP.setup_from_argv(sys.argv, "pdb2density")
13 
14 m = IMP.Model()
15 # read protein
17 mh = IMP.atom.read_pdb(IMP.em.get_example_path("input.pdb"), m, sel)
18 # add radius info to each atom, otherwise the resampling would fail.
20 ps = IMP.core.get_leaves(mh)
21 # decide on resolution and spacing you would like to simulate to
22 resolution = 10.
23 apix = 1.5
24 dmap = IMP.em.particles2density(ps, resolution, apix)
25 # write out the map in the favorite format (xplor, mrc, em and spider are
26 # supported)
27 IMP.em.write_map(dmap, "example.mrc", IMP.em.MRCReaderWriter())