How to read a volume in python script

Hello, I am trying to use UCSF Chimera to analysis cry-EM density maps. I would like to read a density map (for example: a .mrc file) in python script and get the array (or a three dimensional matrix) of all voxels of this density map. How could I realize this? By the way, I tried to learn some basic chimera functions which can be used in python on this website: https://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html <https://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html> However, it seems this website can’t be opened and it shows me a blank page. Best, Huiya

Hi Huiya, Our volume data expert is away this week, so it may be several days before you can get a more helpful answer, but maybe I can give a few preliminary tips. Programmer guide examples: I don’t know why the link is broken on our website, but you should be able to see the copy that is included with your download by using menu: Help… User Guide, then in that page clicking the “Chimera documentation” link, then in the resulting documentation index, clicking “Chimera Programmer’s Guide” and then in that page, clicking the “Examples” link in the fourth paragragh. However, I don’t think any of the examples relate to volume data anyway. You may need to look in the Chimera code directly. I believe the relevant parts are in the downloaded application under […]/share/VolumeData/ … i.e. on Mac it’s under [wherever you put it]/Chimera.app/Contents/Resources/share/VolumeData/ but the first part of the path may be different on other platforms. I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Aug 21, 2019, at 9:38 AM, Huiya Zhou <huiya@tamu.edu> wrote:
Hello, I am trying to use UCSF Chimera to analysis cry-EM density maps. I would like to read a density map (for example: a .mrc file) in python script and get the array (or a three dimensional matrix) of all voxels of this density map. How could I realize this?
By the way, I tried to learn some basic chimera functions which can be used in python on this website: https://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html However, it seems this website can’t be opened and it shows me a blank page. Best, Huiya

Hi Huiya, There is a list of Chimera Python scripts, many that read volume data here http://plato.cgl.ucsf.edu/trac/chimera/wiki/Scripts <http://plato.cgl.ucsf.edu/trac/chimera/wiki/Scripts> and this readvol.py one shows how to get the 3d matrix as a numpy array, basic m = v.matrix() or m = v.full_matrix(), full_matrix() gives the full 3d data even if it is being shown subsampled, e.g. at step 2, http://plato.cgl.ucsf.edu/trac/chimera/attachment/wiki/Scripts/readvol.py <http://plato.cgl.ucsf.edu/trac/chimera/attachment/wiki/Scripts/readvol.py> Tom
On Aug 21, 2019, at 9:38 AM, Huiya Zhou <huiya@tamu.edu> wrote:
Hello,
I am trying to use UCSF Chimera to analysis cry-EM density maps. I would like to read a density map (for example: a .mrc file) in python script and get the array (or a three dimensional matrix) of all voxels of this density map. How could I realize this?
By the way, I tried to learn some basic chimera functions which can be used in python on this website: https://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html <https://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html> However, it seems this website can’t be opened and it shows me a blank page.
Best, Huiya _______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
participants (3)
-
Elaine Meng
-
Huiya Zhou
-
Tom Goddard