_______________________________________________On Aug 1, 2010, at 10:07 PM, Keren Lasker wrote:hi Ben -You can initiate a SampledDensityMap from a DensityHeader, which you can set to any dimension you want.Does that make sense ?What fields of the density header must be set in order for construction to work right?set_number_of_voxels()set_resolution()set_{x,y,z}origin()Objectpixelsize_ (there doesn't seem to be a set function, right?)Anything else?Our Ben - I am still for some reason not getting these messages, only after forwarding from Daniel :)This message was old, I just revived it._______________________________________________On Aug 1, 2010, at 12:31 PM, Daniel Russel wrote:Keren? I have comments below._______________________________________________On Jul 22, 2010, at 6:51 AM, Benjamin SCHWARZ wrote:Hi list,I could not find how to Generate a density map from a structure with a *fixed* dimension :When using IMP.em.SampledDensityMap(ps,resolution,apix) with a fixed size for apix, the grid size depends on the resolution. I would like to write a function that would allow me to generate maps with the same number of vertices (and the same space coverage) for different resolutions. I thus tried :def pdbFile2dmap (pdbStream,densityFile,resolution,apix,sel,bboxCoverage=1.2):'''pdbStream : where to read the structuredensityFile : name of the file where to drop the density mapresolution : resolution of the density mapapix : voxel sizesel : selector for reading structurebboxCoverage : approximate bbox coverage of the density map'''m= IMP.Model()# read proteinmh = IMP.atom.read_pdb(pdbStream,m,sel)# add radius info to each atomIMP.atom.add_radii(mh)# compute bbox, and map size in voxelsbbox = IMP.atom.get_bounding_box(mh)diag = bbox.get_corner(0) - bbox.get_corner(1)nx = int(bboxCoverage * diag[0] / apix)ny = int(bboxCoverage * diag[1] / apix)nz = int(bboxCoverage * diag[2] / apix)# compute originorigin = bbox.get_corner(0) + (1-bboxCoverage)/2 * diagdmap = IMP.em.SampledDensityMap()# dmap.CreateVoidMap(nx,ny,nz)ps = IMP.Particles(IMP.core.get_leaves(mh))dmap.set_particles(ps)dmap.set_origin(origin)dmap.get_header_writable().set_number_of_voxels(nx,ny,nz)dmap.get_header_writable().set_resolution(resolution)dmap.update_voxel_size(apix)dmap.resample()dmap.calcRMS() # computes statistic stuff about the map and insert it in the headerprint dmap.get_header().show(),"\n"IMP.em.write_map(dmap,densityFile,IMP.em.MRCReaderWriter())that resulted in :python(10802) malloc: *** mmap(size=18446744073709314048) failed (error code=12)*** error: can't allocate region*** set a breakpoint in malloc_error_break to debugTraceback (most recent call last):File "./pdb2density.py", line 181, in <module>pdbFile2dmap(pdbStream,densityFile,resolution,apix,sel,1.2)File "./pdb2density.py", line 75, in pdbFile2dmapdmap.update_voxel_size(apix)File "/usr/local/lib/python2.6/site-packages/IMP/em/__init__.py", line 428, in update_voxel_sizedef update_voxel_size(self, *args): return _IMP_em.DensityMap_update_voxel_size(self, *args)MemoryError: std::bad_allocCan you tell me if my approach is OK, and how to solve my allocation problem ?There DenistyMap/DensityHeader is still a bit finicky (that is, there are protocols which have to be followed, and, even worse, they don't tend to be documented). Keren is working on a cleaner version. My guess it the problem is due to not setting the "upper right" value or the length of the edge of each voxel. I don't see the function to do that offhand. Keren?I would also like to know if there are easy means in IMP to1.) Strip a density map : out of an existing map, create a new map or restrict the existing one, so as to conserve only a central subset of voxelsThere is get_transformed_into() which could be used. This may be a post 1.0 addition.2.) Re-sample a map : Conserve the density map "box" size, and change the number of voxels that cover itThere is get_resampled(). Also may be a post 1.0 addition._______________________________________________--Ben
IMP-users mailing list
IMP-users@salilab.org
https://salilab.org/mailman/listinfo/imp-users
IMP-users mailing list
IMP-users@salilab.org
https://salilab.org/mailman/listinfo/imp-users
IMP-users mailing list
IMP-users@salilab.org
https://salilab.org/mailman/listinfo/imp-users
IMP-users mailing list
IMP-users@salilab.org
https://salilab.org/mailman/listinfo/imp-users