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@igbmc.u-strasbg.fr
Hi Gabor, I am pretty sure the capabilities are still there, but maybe the dialog has been rearranged - In the Volume Viewer dialog, choose Features... Atom box - is that what you had in mind? <http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/volumeviewer/volume...
Another possibility is to use Features... Zone to get everything within some distance of your markers (not necessarily a rectangular box): <http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/volumeviewer/volume...
For both of those, you would first need to select all the markers of interest. To get the (untransformed) coordinates of the markers, you could save them to a file from the Volume Tracer tool, or select them and use the command: getcrd sel which sends the coordinates to the Reply Log (under Favorites). Best, Elaine ----- Elaine C. Meng, Ph.D. meng@cgl.ucsf.edu UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco http://www.cgl.ucsf.edu/home/meng/index.html On Jan 26, 2009, at 4: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
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@igbmc.u-strasbg.fr
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
Hi Gabor, Not sure what you are talking about in the subregion selection panel that has disappeared. Sounds like what you want is the "atom box" panel as Elaine mentioned. Once you use Atom Box, then use volume dialog File / Save Map As.... If you are refering to the subregion panel Resample button. That is now down by the "Crop" button if you have the "Rotate selection box" checkbutton enabled. Tom 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
Hi Giovanni, The call to save your individual maps would be like gv.write_file('/tmp/volume%d.mrc' % (i+1), format = 'mrc') Allowed formats are mrc, dsn6 (O brix format), cmap (Chimera map format uses HDF5), or netcdf (Chimera only). Tom Giovanni Cardone wrote:
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@igbmc.u-strasbg.fr
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
Hi Tom, I was talking about this: "Resample map commands newmap 100 100 100 2.4 2.4 2.4 -120 -120 -120 This command creates a new map containing zero values of size 100^3 grid points with grid plane spacing equal to 2.4 and origin (i.e. physical xyz position of grid value at index 0,0,0) equal to (-120,-120,-120). An outline box is shown for the new map." Here I could create a new map at a specified position with specified size but the Atom Box feature will be fine and the "getcrd sel" command also. Thank you, Elaine and Giovanni! At last, a feature request: it would be convenient if I could open IMAGIC files directly in Chimera. Bye, 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@igbmc.u-strasbg.fr
Hi Gabor, The "newmap" command is part of a plug-in "Resample map commands" still available on the following web page. http://www.cgl.ucsf.edu/chimera/experimental/experimental.html It has never been included in the Chimera distributions. In cases where the new map is part of an existing map the volume dialog subregion panel can be used. Also the "vop #0 resample onGrid #1" command can resample one map on the grid of another map. If there are interesting cases where newmap is needed please explain them to me. Reading IMAGIC maps is item #100 on the feature request list. http://www.cgl.ucsf.edu/chimera/plans.html I'm not sure when it will be implemented, there are at least a dozen higher priority requests. Tom Gabor Papai wrote:
Hi Tom,
I was talking about this:
"Resample map commands
newmap 100 100 100 2.4 2.4 2.4 -120 -120 -120 This command creates a new map containing zero values of size 100^3 grid points with grid plane spacing equal to 2.4 and origin (i.e. physical xyz position of grid value at index 0,0,0) equal to (-120,-120,-120). An outline box is shown for the new map."
Here I could create a new map at a specified position with specified size but the Atom Box feature will be fine and the "getcrd sel" command also. Thank you, Elaine and Giovanni!
At last, a feature request: it would be convenient if I could open IMAGIC files directly in Chimera.
Bye,
Gabor
participants (5)
-
Elaine Meng
-
Gabor Papai
-
Giovanni Cardone
-
Thomas Goddard
-
Tom Goddard