[Chimera-users] marker coordinates

Giovanni Cardone cardoneg at mail.nih.gov
Mon Jan 26 11:38:39 PST 2009


Hi Gabor,

here attached is a python script that I adapted from a pug-in that I  
am writing.
You need to adjust the box size to your needs, then you can save it as  
a file and open it in Chimera.
The script extracts subregions from the active volume, around only the  
selected markers.
The subregions are visualized as separate maps, but they are not saved  
to file (can anyone contribute with that?).
Since it uses a function (region_matrix) that has been recently  
modified, I can only guarantee that it works with the latest nightly  
builds (however, in the script there is a commented line that should  
work with version 1.2552).

I hope it helps,
Giovanni




#  
-----------------------------------------------------------------------------
# Script to extract subregions around selected markers from the active  
volume
#
from chimera import selection
from VolumeData import Array_Grid_Data
from VolumeViewer import volume_from_grid_data, active_volume

# box size around markers (pixels)
boxSize = 10

region = active_volume()
data = region.data

for i,atom in enumerate(selection.currentAtoms()):
  coord = atom.coord()
# calculate limits and extract subregions
  ijkcoord = map(lambda a: int(round(a)), data.xyz_to_ijk(coord))
  ijk_size = [boxSize]*len(ijkcoord)
  ijk_min = map(lambda a,b: max(0,a-b/2), ijkcoord, ijk_size)
  ijk_size = map(lambda a,b,c,d: min(a-1,b+c/2)-d, data.size,  
ijkcoord, ijk_size, ijk_min)
  ijk_max = map(lambda a,b: a+b-1, ijk_min, ijk_size)
  new_origin = data.ijk_to_xyz(ijk_min)

  step = (1,1,1)
  r = (ijk_min, ijk_max, step)
  mtx = region.region_matrix(r)
# version 1.2552
#  mtx = region.region_matrix(origin = ijk_min, size = ijk_size,  
subsampling = (1,1,1), step = (1,1,1), read_matrix = True)

# show selection
  name = region.name + (' (subregion %d) '%(i+1))
  gg = Array_Grid_Data(mtx, new_origin, data.step, data.cell_angles,  
data.rotation, name = name)

  gv = volume_from_grid_data(gg, show_data = False)
  gv.copy_settings_from(region, copy_region = False)
  gv.show()



On Jan 26, 2009, at 7:43 AM, Gabor Papai wrote:

> Hi,
>
> I would like to do the following: I placed markers on density spots. I
> want to get their coordinates and excise a box around the marked  
> density
> and save it as a separate file. For this I would like to know how I  
> can
> retrieve the coordinates of a marker set and possibly how to position
> exactly a box around a  marker to set a subregion (and of course how  
> to
> set the dimensions of that box). This second feature existed before,  
> but
> disappeared in the latest releases with the subregion selection tool  
> in
> the Volume Viewer.
> Thanks in advance,
> Gabor
>
> -- 
> Gabor Papai
> IGBMC
> Department of Structural Biology and Genomics
> 1, rue Laurent Fries, BP 10142
> 67404 Illkirch, France
> phone  +33-3-88655748
> Fax +33-3-88653201
> E-mail: papai at igbmc.u-strasbg.fr
>
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users




More information about the Chimera-users mailing list