Hi Hernando,

  The ChimeraX "volume zone" command or the Chimera "vop zone" command has an option minimalBounds that may do exactly what you want.  It crops the rectangular bounds of a map to fit an atomic model.

https://www.cgl.ucsf.edu/chimerax/docs/user/commands/volume.html#zone

https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/vop.html#zone

For example in ChimeraX

open 1a0m
open 1a0m from eds
volume zone #2 near #1/A range 3 minimalBounds true
save croppedmap.mrc model #2

The volume zone command also hides the part of the map contour surface far from the atoms, but you can save the cropped map to an MRC file and it has all the density in the full subbox containing the atoms.

  To answer your original question though, there are different origins for maps as Elaine mentioned (in grid index units or physical coordinates), and there are different coordinate systems for your fit atomic model and map.  So if you want to see the actual Python code that does what the volume zone minimalBounds option does which involves converting the atom coordinates into the volume grid index coordinate system I can provide that.  But we really need to work with specific code, not ambiguous terms like "origin" and "coordinates" which have various possible meanings.  So show me some Python code of what you are doing, or I can provide some simple Python code example if the above minimalBounds option doesn't already do what you want.

Tom

volzone.png

On Jan 2, 2024, at 1:41 PM, Hernando J Sosa via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:

Dear Chimera,


I want to extract a submap around some parts of an atomic model that is aligned to the main map. For this I am using the volume region command, but I am running into a problem converting the atomic coordinates to voxel coordinates when the pixel size of the map is different from 1 and the map origin is not at 0,0,0.  

What should be the right formula to go from one set the coordinates to the other and  be able to get a submap in the right place?

i.e. 
If a sub-volume were to be extracted at coordinates x1,y1,z1 and x2,y2,z2   of the atomic model

what would be the volume coordinates to use in the command
 
volume #mainmap region VX1, VY1, VZ1,  VX2, VY2, VZ2 assuming the map voxel size is Mapvsize and the map orig Orig is at cx,cy,cz.

To  go from one set of coordinates to the other I have tried:

MapCoord = (ModelCoord - Orig) / Mapvsize

and 

MapCoord = (ModelCoord /Mapvsize) -  Orig

None seems to extract the volume at the right place. The first one seems closer (??)


Thanks

Hernando



_______________________________________________
ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu
To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu
Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/