Hi Thu,

  It sounds like you are trying to automate some processing.  If you want to write out the region bounds with Python you could put this code in bounds.py and open it in ChimeraX after opening your map data.

from chimerax.map import Volume
with open('bounds.txt', 'w') as output:
  for v in session.models:
    if isinstance(v, Volume):
      (i0,j0,k0), (i1,j1,k1) =  v.region[:2]
      output.write(f'{v.name.replace(" ","_")} {i0} {j0} {k0} {i1} {j1} {k1}\n')

There are many examples of ChimeraX Python scripts at the ChimeraX Recipes web site

https://rbvi.github.io/chimerax-recipes/

  Tom

On Nov 7, 2022, at 8:40 AM, Thu Nguyen via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:

Good morning,
Thank you very much for your explanation. It is truly helpful.
For my second question, is there a way to write the region of a map to a text file? For example, when I open the map of emdb 12554, I have the region of 0 0 0 to 449 449 449. Is there any way we can write these numbers into a text file (for example: id_12554 0 0 0 449 449 449)?
Thank you very much.

Best regards,
Thu


On Mon, Nov 7, 2022 at 11:26 AM Elaine Meng <meng@cgl.ucsf.edu> wrote:
Hi Thu,
The pad value units are angstroms (not voxels) but it sounds like you understand that, since your math is correct: if you want 1.4 angstroms, then enter 1.4.  If you want 23.8 angstroms then enter 23.8.  If the voxel size (grid spacing) is 1.4 then those are equal to 1 grid unit and 17 grid units respectively, like you said.

To calculate the XYZ location of grid indices, like (0,0,0) and (103,95,143) you have to figure it out from the voxel size and origin coordinates, as reported by "volume settings" command.  Say for example that this command gives me 

voxel size = 1.4 1.4 1.4
origin = 2.525 -2.214 7.929

Then the coordinates of grid (0,0,0) are xyz (2.525,-2.214,7.929).  The coordinates of grid (1,3,1) are x = 2.525 + 1(1.4) = 3.925, y = -2.214 + 3(1.4) = 1.986, z = 7.929 + 1(1.4) = 9.329.   

For saving part of a map, you can enter grid indices with the "save" command "region" option, for example if your map is #2:

save ~meng/Desktop/mymap.mrc model #2 region 0,0,0,103,95,143

<https://rbvi.ucsf.edu/chimerax/docs/user/commands/save.html#map>

I hope this helps,
Elaine
-----
Elaine C. Meng, Ph.D.                       
UCSF Chimera(X) team
Department of Pharmaceutical Chemistry
University of California, San Francisco


> On Nov 7, 2022, at 7:44 AM, Thu Nguyen via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
> 
> Thank you very much for your help.
> 
> You mean that if the voxel size of my map is 1.4 (for example), then the pad value in the command will have the unit of the voxel size, which is 1.4 in this case? And if I want to add 17 extra voxels on each side, the pad value will be 1.4*17 = 23.8?
> 
> I do have another question about how to extract a region of a chain. For example, if a chain has its region of 0 0 0 to 103 95 143, how do we extract its location and save it in a text file?
> Thank you so much.
> 
> Best regards,
> Thu

<Screen Shot 2022-11-07 at 11.33.31 AM.png>_______________________________________________
ChimeraX-users mailing list
ChimeraX-users@cgl.ucsf.edu
Manage subscription:
https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users